Index: test/mjsunit/undeletable-functions.js |
diff --git a/test/mjsunit/undeletable-functions.js b/test/mjsunit/undeletable-functions.js |
index bbb798f3516e7f2a96f85540e9443271246e65ed..635ea6fa9aca8752c280559ed193e9216766a2b3 100644 |
--- a/test/mjsunit/undeletable-functions.js |
+++ b/test/mjsunit/undeletable-functions.js |
@@ -25,11 +25,8 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Test that we match JSC in making some functions undeletable. |
-// See http://code.google.com/p/chromium/issues/detail?id=1717 |
-// The functions on these prototypes are not just undeletable. It is |
-// possible to override them with new definitions, then get the old |
-// version back by deleting the new definition. |
+// Test that we match ECMAScript in making most builtin functions |
+// deletable and only specific ones undeletable or read-only. |
var array; |
@@ -37,7 +34,7 @@ array = [ |
"toString", "toLocaleString", "join", "pop", "push", "concat", "reverse", |
"shift", "unshift", "slice", "splice", "sort", "filter", "forEach", "some", |
"every", "map", "indexOf", "lastIndexOf", "reduce", "reduceRight"]; |
-CheckJSCSemantics(Array.prototype, array, "Array prototype"); |
+CheckEcmaSemantics(Array.prototype, array, "Array prototype"); |
var old_Array_prototype = Array.prototype; |
var new_Array_prototype = {}; |
@@ -57,12 +54,12 @@ array = [ |
"setUTCMinutes", "setHours", "setUTCHours", "setDate", "setUTCDate", |
"setMonth", "setUTCMonth", "setFullYear", "setUTCFullYear", "toGMTString", |
"toUTCString", "getYear", "setYear", "toISOString", "toJSON"]; |
-CheckJSCSemantics(Date.prototype, array, "Date prototype"); |
+CheckEcmaSemantics(Date.prototype, array, "Date prototype"); |
array = [ |
"random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", "floor", "log", |
"round", "sin", "sqrt", "tan", "atan2", "pow", "max", "min"]; |
-CheckJSCSemantics(Math, array, "Math1"); |
+CheckEcmaSemantics(Math, array, "Math1"); |
CheckEcmaSemantics(Date, ["UTC", "parse", "now"], "Date"); |
@@ -114,7 +111,7 @@ array = [ |
"toUpperCase", "toLocaleUpperCase", "link", "anchor", "fontcolor", "fontsize", |
"big", "blink", "bold", "fixed", "italics", "small", "strike", "sub", "sup", |
"toJSON", "toString", "valueOf"]; |
-CheckJSCSemantics(String.prototype, array, "String prototype"); |
+CheckEcmaSemantics(String.prototype, array, "String prototype"); |
CheckEcmaSemantics(String, ["fromCharCode"], "String"); |
@@ -126,14 +123,6 @@ function CheckEcmaSemantics(type, props, name) { |
} |
-function CheckJSCSemantics(type, props, name) { |
- print(name); |
- for (var i = 0; i < props.length; i++) { |
- CheckNotDeletable(type, props[i]); |
- } |
-} |
- |
- |
function CheckDontDelete(type, props, name) { |
print(name); |
for (var i = 0; i < props.length; i++) { |
@@ -156,21 +145,6 @@ function CheckDeletable(type, prop) { |
} |
-function CheckNotDeletable(type, prop) { |
- var old = type[prop]; |
- if (!type[prop]) return; |
- assertTrue(type.hasOwnProperty(prop), "inherited: " + prop); |
- var deleted = delete type[prop]; |
- assertTrue(deleted, "delete operator returned false: " + prop); |
- assertTrue(type.hasOwnProperty(prop), "not there after delete: " + prop); |
- type[prop] = "foo"; |
- assertEquals("foo", type[prop], "not overwritable: " + prop); |
- deleted = delete type[prop]; |
- assertTrue(deleted, "delete operator returned false 2nd time: " + prop); |
- assertEquals(old.toString(), type[prop].toString(), "delete didn't restore the old value: " + prop); |
-} |
- |
- |
function CheckDontDeleteAttr(type, prop) { |
var old = type[prop]; |
if (!type[prop]) return; |