OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // 1. Redistributions of source code must retain the above copyright | 7 // 1. Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // 2. Redistributions in binary form must reproduce the above copyright | 9 // 2. Redistributions in binary form must reproduce the above copyright |
10 // notice, this list of conditions and the following disclaimer in the | 10 // notice, this list of conditions and the following disclaimer in the |
(...skipping 25 matching lines...) Expand all Loading... |
36 shouldBe("Array.prototype.__proto__", "Object.prototype"); | 36 shouldBe("Array.prototype.__proto__", "Object.prototype"); |
37 shouldBe("Date.prototype.__proto__", "Object.prototype"); | 37 shouldBe("Date.prototype.__proto__", "Object.prototype"); |
38 shouldBe("Number.prototype.__proto__", "Object.prototype"); | 38 shouldBe("Number.prototype.__proto__", "Object.prototype"); |
39 shouldBe("Object.prototype.__proto__", "null"); | 39 shouldBe("Object.prototype.__proto__", "null"); |
40 shouldBe("String.prototype.__proto__", "Object.prototype"); | 40 shouldBe("String.prototype.__proto__", "Object.prototype"); |
41 shouldBe("Array.__proto__", "Object.__proto__"); | 41 shouldBe("Array.__proto__", "Object.__proto__"); |
42 shouldBe("Date.__proto__", "Object.__proto__"); | 42 shouldBe("Date.__proto__", "Object.__proto__"); |
43 shouldBe("Number.__proto__", "Object.__proto__"); | 43 shouldBe("Number.__proto__", "Object.__proto__"); |
44 shouldBe("String.__proto__", "Object.__proto__"); | 44 shouldBe("String.__proto__", "Object.__proto__"); |
45 | 45 |
46 shouldThrow("Object.getPrototypeOf('')"); | 46 shouldBe("Object.getPrototypeOf('')", "String.prototype"); |
47 shouldThrow("Object.getPrototypeOf(0)"); | 47 shouldBe("Object.getPrototypeOf(0)", "Number.prototype"); |
48 shouldBe("Object.getPrototypeOf([])", "Array.prototype"); | 48 shouldBe("Object.getPrototypeOf([])", "Array.prototype"); |
49 shouldBe("Object.getPrototypeOf({})", "Object.prototype"); | 49 shouldBe("Object.getPrototypeOf({})", "Object.prototype"); |
50 shouldBe("Object.getPrototypeOf(new Date)", "Date.prototype"); | 50 shouldBe("Object.getPrototypeOf(new Date)", "Date.prototype"); |
51 shouldBe("Object.getPrototypeOf(new Number)", "Number.prototype"); | 51 shouldBe("Object.getPrototypeOf(new Number)", "Number.prototype"); |
52 shouldBe("Object.getPrototypeOf(new Object)", "Object.prototype"); | 52 shouldBe("Object.getPrototypeOf(new Object)", "Object.prototype"); |
53 shouldBe("Object.getPrototypeOf(new String)", "String.prototype"); | 53 shouldBe("Object.getPrototypeOf(new String)", "String.prototype"); |
54 shouldBe("Object.getPrototypeOf(Array.prototype)", "Object.prototype"); | 54 shouldBe("Object.getPrototypeOf(Array.prototype)", "Object.prototype"); |
55 shouldBe("Object.getPrototypeOf(Date.prototype)", "Object.prototype"); | 55 shouldBe("Object.getPrototypeOf(Date.prototype)", "Object.prototype"); |
56 shouldBe("Object.getPrototypeOf(Number.prototype)", "Object.prototype"); | 56 shouldBe("Object.getPrototypeOf(Number.prototype)", "Object.prototype"); |
57 shouldBe("Object.getPrototypeOf(Object.prototype)", "null"); | 57 shouldBe("Object.getPrototypeOf(Object.prototype)", "null"); |
(...skipping 24 matching lines...) Expand all Loading... |
82 shouldBeTrue("var wasSet = false; var o = { }; o.__defineSetter__(\"__proto__\",
function() { wasSet = true }); o.__proto__ = {}; wasSet;"); | 82 shouldBeTrue("var wasSet = false; var o = { }; o.__defineSetter__(\"__proto__\",
function() { wasSet = true }); o.__proto__ = {}; wasSet;"); |
83 shouldBeTrue("var wasSet = false; var o = { }; Object.defineProperty(o, \"__prot
o__\", { \"get\": function() { wasSet = true } }); o.__proto__; wasSet;"); | 83 shouldBeTrue("var wasSet = false; var o = { }; Object.defineProperty(o, \"__prot
o__\", { \"get\": function() { wasSet = true } }); o.__proto__; wasSet;"); |
84 shouldBeFalse("var wasSet = false; var o = { }; Object.defineProperty(o, \"__pro
to__\", { \"__proto__\": function(x) { wasSet = true } }); o.__proto__ = {}; was
Set;"); | 84 shouldBeFalse("var wasSet = false; var o = { }; Object.defineProperty(o, \"__pro
to__\", { \"__proto__\": function(x) { wasSet = true } }); o.__proto__ = {}; was
Set;"); |
85 | 85 |
86 // Deleting Object.prototype.__proto__ removes the ability to set the object's p
rototype. | 86 // Deleting Object.prototype.__proto__ removes the ability to set the object's p
rototype. |
87 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.x"); | 87 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.x"); |
88 shouldBeFalse("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__
')"); | 88 shouldBeFalse("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__
')"); |
89 delete Object.prototype.__proto__; | 89 delete Object.prototype.__proto__; |
90 shouldBeUndefined("var o = {}; o.__proto__ = { x:true }; o.x"); | 90 shouldBeUndefined("var o = {}; o.__proto__ = { x:true }; o.x"); |
91 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__'
)"); | 91 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__'
)"); |
OLD | NEW |