return;
}
- if ($Object.isSealed(this)) {
+ if (ObjectIsSealed(this)) {
throw MakeTypeError("array_functions_change_sealed",
["Array.prototype.pop"]);
}
var n = TO_UINT32(this.length);
var m = %_ArgumentsLength();
- if (m > 0 && $Object.isSealed(this)) {
+ if (m > 0 && ObjectIsSealed(this)) {
throw MakeTypeError("array_functions_change_sealed",
["Array.prototype.push"]);
}
return;
}
- if ($Object.isSealed(this)) {
+ if (ObjectIsSealed(this)) {
throw MakeTypeError("array_functions_change_sealed",
["Array.prototype.shift"]);
}
var len = TO_UINT32(this.length);
var num_arguments = %_ArgumentsLength();
- var is_sealed = $Object.isSealed(this);
+ var is_sealed = ObjectIsSealed(this);
if (num_arguments > 0 && is_sealed) {
throw MakeTypeError("array_functions_change_sealed",
if (IS_ARRAY(this) && !is_sealed) {
SmartMove(this, 0, 0, len, num_arguments);
} else {
- if (num_arguments == 0 && $Object.isFrozen(this)) {
+ if (num_arguments == 0 && ObjectIsFrozen(this)) {
// In the zero argument case, values from the prototype come into the
// object. This can't be allowed on frozen arrays.
for (var i = 0; i < len; i++) {
deleted_elements.length = del_count;
var num_elements_to_add = num_arguments > 2 ? num_arguments - 2 : 0;
- if (del_count != num_elements_to_add && $Object.isSealed(this)) {
+ if (del_count != num_elements_to_add && ObjectIsSealed(this)) {
throw MakeTypeError("array_functions_change_sealed",
["Array.prototype.splice"]);
- } else if (del_count > 0 && $Object.isFrozen(this)) {
+ } else if (del_count > 0 && ObjectIsFrozen(this)) {
throw MakeTypeError("array_functions_on_frozen",
["Array.prototype.splice"]);
}
--- /dev/null
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function nope() { return false; }
+var a = [ 1, 2, 3 ];
+Object.seal(a);
+Object.isSealed = nope;
+
+assertThrows(function() { a.pop(); }, TypeError);
+assertThrows(function() { a.push(5); }, TypeError);
+assertThrows(function() { a.shift(); }, TypeError);
+assertThrows(function() { a.unshift(5); }, TypeError);
+assertThrows(function() { a.splice(0, 1); }, TypeError);