Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / constructor-attributes.js
bloba2590f489aa840631831d226b433a647c27a3271
1 description(
2 "This test checks that constructor properties are not enumeratable, but are writable deletable."
3 );
5 function canEnum(object, propertyName)
7 for (prop in object)
8 if (prop == propertyName)
9 return true;
10 return false;
13 function checkConstructor(expression)
15 shouldBe(expression + ".hasOwnProperty('constructor')", "true");
16 shouldBe("canEnum(" + expression + ", 'constructor')", "false");
17 shouldBe("x = " + expression + "; x.constructor = 4; x.constructor", "4");
18 shouldBe("x = " + expression + "; delete x.constructor; x.hasOwnProperty('constructor')", "false");
21 checkConstructor("(function () { }).prototype");
22 function declaredFunction() { }
23 checkConstructor("declaredFunction.prototype");
24 checkConstructor("(new Function).prototype");
26 checkConstructor("Array.prototype");
27 checkConstructor("Boolean.prototype");
28 checkConstructor("Date.prototype");
29 checkConstructor("Error.prototype");
30 checkConstructor("EvalError.prototype");
31 checkConstructor("Function.prototype");
32 checkConstructor("Number.prototype");
33 checkConstructor("Object.prototype");
34 checkConstructor("RangeError.prototype");
35 checkConstructor("ReferenceError.prototype");
36 checkConstructor("RegExp.prototype");
37 checkConstructor("String.prototype");
38 checkConstructor("SyntaxError.prototype");
39 checkConstructor("TypeError.prototype");
40 checkConstructor("URIError.prototype");
42 checkConstructor("document.createTextNode('')");