Diff
Modified: trunk/LayoutTests/ChangeLog (184641 => 184642)
--- trunk/LayoutTests/ChangeLog 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/LayoutTests/ChangeLog 2015-05-20 17:23:03 UTC (rev 184642)
@@ -1,3 +1,39 @@
+2015-05-20 Joseph Pecoraro <[email protected]>
+
+ ES6: Implement Object.setPrototypeOf
+ https://bugs.webkit.org/show_bug.cgi?id=145202
+
+ Reviewed by Darin Adler.
+
+ * http/tests/security/cross-frame-access-object-setPrototypeOf-expected.txt: Added.
+ * http/tests/security/cross-frame-access-object-setPrototypeOf.html: Added.
+ * http/tests/security/resources/cross-frame-iframe-for-object-setPrototypeOf-test.html: Added.
+ Test covering cross origin restriction behavior.
+
+ * js/Object-getOwnPropertyNames-expected.txt:
+ * js/script-tests/Object-getOwnPropertyNames.js:
+ Updated for the new exposed property.
+
+ * js/cyclic-prototypes-expected.txt:
+ * js/script-tests/cyclic-prototypes.js:
+ Extend this test to include setPrototypeOf cyclic checks.
+ Note that setPrototypeOf can still change the prototype
+ where __proto__ cannot.
+
+ * js/prototypes-expected.txt:
+ * js/script-tests/prototypes.js:
+ Extend this test to cover more types previously overlooked.
+
+ * js/script-tests/setPrototypeOf.js: Added.
+ (debugEval):
+ (getObjectDescriptions.myFunction):
+ (getObjectDescriptions):
+ * js/setPrototypeOf-expected.txt: Added.
+ * js/setPrototypeOf.html: Added.
+ Test coverage for all the different object / prototype combinations.
+ This is modeled after the other browser tests with coverage of a
+ few more basic functionality tests and object types.
+
2015-05-20 Youenn Fablet <[email protected]>
AudioContext suspend/resume/close should resolve promises immediately when state is already suspended/active/closed
Added: trunk/LayoutTests/http/tests/security/cross-frame-access-object-setPrototypeOf-expected.txt (0 => 184642)
--- trunk/LayoutTests/http/tests/security/cross-frame-access-object-setPrototypeOf-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/cross-frame-access-object-setPrototypeOf-expected.txt 2015-05-20 17:23:03 UTC (rev 184642)
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 23: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 24: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
+This tests that you can't set the prototype of the window or history objects cross-origin using Object.setPrototypeOf().
+
+PASS: targetWindow instanceof Array should be 'false' and is.
+PASS: targetWindow.history instanceof Array should be 'false' and is.
+PASS: Object.setPrototypeOf(targetWindow, Array.prototype) should be '[object Window]' and is.
+PASS: Object.setPrototypeOf(targetWindow.history, Array.prototype) should be '[object History]' and is.
+PASS: targetWindow instanceof Array should be 'false' and is.
+PASS: targetWindow.history instanceof Array should be 'false' and is.
+
Added: trunk/LayoutTests/http/tests/security/cross-frame-access-object-setPrototypeOf.html (0 => 184642)
--- trunk/LayoutTests/http/tests/security/cross-frame-access-object-setPrototypeOf.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/cross-frame-access-object-setPrototypeOf.html 2015-05-20 17:23:03 UTC (rev 184642)
@@ -0,0 +1,39 @@
+<html>
+<head>
+ <script src=""
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ // Set up listener for message from iframe
+ addEventListener('message', function(event) {
+ if (event.data == "finishedLoad")
+ doTest();
+ }, false);
+
+ doTest = function()
+ {
+ targetWindow = document.getElementById("target").contentWindow;
+
+ shouldBeFalse("targetWindow instanceof Array");
+ shouldBeFalse("targetWindow.history instanceof Array");
+
+ shouldBe("Object.setPrototypeOf(targetWindow, Array.prototype)", "targetWindow");
+ shouldBe("Object.setPrototypeOf(targetWindow.history, Array.prototype)", "targetWindow.history");
+
+ shouldBeFalse("targetWindow instanceof Array");
+ shouldBeFalse("targetWindow.history instanceof Array");
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ </script>
+</head>
+<body>
+ <div>This tests that you can't set the prototype of the window or history objects cross-origin using Object.setPrototypeOf().</div>
+ <iframe id="target" src=""
+ <pre id="console"></pre>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-object-setPrototypeOf-test.html (0 => 184642)
--- trunk/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-object-setPrototypeOf-test.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-object-setPrototypeOf-test.html 2015-05-20 17:23:03 UTC (rev 184642)
@@ -0,0 +1,13 @@
+<html>
+<head>
+ <script>
+ _onload_ = function()
+ {
+ parent.postMessage("finishedLoad", "*");
+ }
+ </script>
+</head>
+<body>
+ Body
+</body>
+</html>
Modified: trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt (184641 => 184642)
--- trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt 2015-05-20 17:23:03 UTC (rev 184642)
@@ -41,7 +41,7 @@
PASS getSortedOwnPropertyNames(decodeURIComponent) is ['length', 'name']
PASS getSortedOwnPropertyNames(encodeURI) is ['length', 'name']
PASS getSortedOwnPropertyNames(encodeURIComponent) is ['length', 'name']
-PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']
+PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']
PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']
PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype']
PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']
Modified: trunk/LayoutTests/js/cyclic-prototypes-expected.txt (184641 => 184642)
--- trunk/LayoutTests/js/cyclic-prototypes-expected.txt 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/LayoutTests/js/cyclic-prototypes-expected.txt 2015-05-20 17:23:03 UTC (rev 184642)
@@ -4,9 +4,11 @@
PASS o1.__proto__ = o3; threw exception Error: cyclic __proto__ value.
+PASS Object.setPrototypeOf(o1, o3) threw exception Error: cyclic __proto__ value.
PASS ({}).hasOwnProperty.call(o1, '__proto__') is false
PASS ({}).hasOwnProperty.call(o1, '__proto__') is true
PASS Object.getPrototypeOf(o1) is null
+PASS Object.setPrototypeOf(o1, o3) threw exception Error: cyclic __proto__ value.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/js/prototypes-expected.txt (184641 => 184642)
--- trunk/LayoutTests/js/prototypes-expected.txt 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/LayoutTests/js/prototypes-expected.txt 2015-05-20 17:23:03 UTC (rev 184642)
@@ -5,9 +5,12 @@
PASS ('').__proto__ is String.prototype
PASS (0).__proto__ is Number.prototype
+PASS (true).__proto__ is Boolean.prototype
+PASS (Symbol()).__proto__ is Symbol.prototype
PASS ([]).__proto__ is Array.prototype
PASS ({}).__proto__ is Object.prototype
PASS (new Date).__proto__ is Date.prototype
+PASS (new Error).__proto__ is Error.prototype
PASS (new Number).__proto__ is Number.prototype
PASS (new Object).__proto__ is Object.prototype
PASS (new String).__proto__ is String.prototype
@@ -22,9 +25,12 @@
PASS String.__proto__ is Object.__proto__
PASS Object.getPrototypeOf('') is String.prototype
PASS Object.getPrototypeOf(0) is Number.prototype
+PASS Object.getPrototypeOf(true) is Boolean.prototype
+PASS Object.getPrototypeOf(Symbol()) is Symbol.prototype
PASS Object.getPrototypeOf([]) is Array.prototype
PASS Object.getPrototypeOf({}) is Object.prototype
PASS Object.getPrototypeOf(new Date) is Date.prototype
+PASS Object.getPrototypeOf(new Error) is Error.prototype
PASS Object.getPrototypeOf(new Number) is Number.prototype
PASS Object.getPrototypeOf(new Object) is Object.prototype
PASS Object.getPrototypeOf(new String) is String.prototype
@@ -39,9 +45,12 @@
PASS Object.getPrototypeOf(String) is Object.__proto__
PASS String.prototype.isPrototypeOf('') is false
PASS Number.prototype.isPrototypeOf(0) is false
+PASS Boolean.prototype.isPrototypeOf(true) is false
+PASS Symbol.prototype.isPrototypeOf(Symbol()) is false
PASS Array.prototype.isPrototypeOf([]) is true
PASS Object.prototype.isPrototypeOf({}) is true
PASS Date.prototype.isPrototypeOf(new Date) is true
+PASS Error.prototype.isPrototypeOf(new Error) is true
PASS Number.prototype.isPrototypeOf(new Number) is true
PASS Object.prototype.isPrototypeOf(new Object) is true
PASS String.prototype.isPrototypeOf(new String) is true
Modified: trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (184641 => 184642)
--- trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js 2015-05-20 17:23:03 UTC (rev 184642)
@@ -50,7 +50,7 @@
"encodeURI": "['length', 'name']",
"encodeURIComponent": "['length', 'name']",
// Built-in ECMA objects
- "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']",
+ "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']",
"Object.prototype": "['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']",
"Function": "['length', 'name', 'prototype']",
"Function.prototype": "['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']",
Modified: trunk/LayoutTests/js/script-tests/cyclic-prototypes.js (184641 => 184642)
--- trunk/LayoutTests/js/script-tests/cyclic-prototypes.js 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/LayoutTests/js/script-tests/cyclic-prototypes.js 2015-05-20 17:23:03 UTC (rev 184642)
@@ -8,11 +8,14 @@
// Try to create a cyclical prototype chain.
shouldThrow("o1.__proto__ = o3;");
+shouldThrow("Object.setPrototypeOf(o1, o3)");
-// This changes behaviour, since __proto__ is an accessor on Object.prototype.
+// This changes __proto__ setter behaviour, since __proto__ is an accessor on Object.prototype.
o1.__proto__ = null;
-
shouldBeFalse("({}).hasOwnProperty.call(o1, '__proto__')");
o1.__proto__ = o3;
shouldBeTrue("({}).hasOwnProperty.call(o1, '__proto__')");
shouldBe("Object.getPrototypeOf(o1)", "null");
+
+// But setPrototypeOf will still work, and will still detect the cycle.
+shouldThrow("Object.setPrototypeOf(o1, o3)");
Modified: trunk/LayoutTests/js/script-tests/prototypes.js (184641 => 184642)
--- trunk/LayoutTests/js/script-tests/prototypes.js 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/LayoutTests/js/script-tests/prototypes.js 2015-05-20 17:23:03 UTC (rev 184642)
@@ -4,9 +4,12 @@
shouldBe("('').__proto__", "String.prototype");
shouldBe("(0).__proto__", "Number.prototype");
+shouldBe("(true).__proto__", "Boolean.prototype");
+shouldBe("(Symbol()).__proto__", "Symbol.prototype");
shouldBe("([]).__proto__", "Array.prototype");
shouldBe("({}).__proto__", "Object.prototype");
shouldBe("(new Date).__proto__", "Date.prototype");
+shouldBe("(new Error).__proto__", "Error.prototype");
shouldBe("(new Number).__proto__", "Number.prototype");
shouldBe("(new Object).__proto__", "Object.prototype");
shouldBe("(new String).__proto__", "String.prototype");
@@ -22,9 +25,12 @@
shouldBe("Object.getPrototypeOf('')", "String.prototype");
shouldBe("Object.getPrototypeOf(0)", "Number.prototype");
+shouldBe("Object.getPrototypeOf(true)", "Boolean.prototype");
+shouldBe("Object.getPrototypeOf(Symbol())", "Symbol.prototype");
shouldBe("Object.getPrototypeOf([])", "Array.prototype");
shouldBe("Object.getPrototypeOf({})", "Object.prototype");
shouldBe("Object.getPrototypeOf(new Date)", "Date.prototype");
+shouldBe("Object.getPrototypeOf(new Error)", "Error.prototype");
shouldBe("Object.getPrototypeOf(new Number)", "Number.prototype");
shouldBe("Object.getPrototypeOf(new Object)", "Object.prototype");
shouldBe("Object.getPrototypeOf(new String)", "String.prototype");
@@ -40,9 +46,12 @@
shouldBeFalse("String.prototype.isPrototypeOf('')");
shouldBeFalse("Number.prototype.isPrototypeOf(0)");
+shouldBeFalse("Boolean.prototype.isPrototypeOf(true)");
+shouldBeFalse("Symbol.prototype.isPrototypeOf(Symbol())");
shouldBeTrue("Array.prototype.isPrototypeOf([])");
shouldBeTrue("Object.prototype.isPrototypeOf({})");
shouldBeTrue("Date.prototype.isPrototypeOf(new Date)");
+shouldBeTrue("Error.prototype.isPrototypeOf(new Error)");
shouldBeTrue("Number.prototype.isPrototypeOf(new Number)");
shouldBeTrue("Object.prototype.isPrototypeOf(new Object)");
shouldBeTrue("String.prototype.isPrototypeOf(new String)");
Added: trunk/LayoutTests/js/script-tests/setPrototypeOf.js (0 => 184642)
--- trunk/LayoutTests/js/script-tests/setPrototypeOf.js (rev 0)
+++ trunk/LayoutTests/js/script-tests/setPrototypeOf.js 2015-05-20 17:23:03 UTC (rev 184642)
@@ -0,0 +1,104 @@
+description('Test Object.setPrototypeOf.');
+
+function debugEval(str) {
+ debug(str);
+ eval(str);
+}
+
+var value, object, proto, description, protoDescription, oldProto;
+var coercibleValueStrings = ["0", "true", "false", "'string'", "Symbol()"];
+var nonCoercibleValueStrings = ["undefined", "null"];
+var nonNullValueStrings = coercibleValueStrings.concat(["undefined"]);
+
+function getObjectDescriptions() {
+ function myFunction() {};
+ return [
+ { object: myFunction, description: "Function" },
+ { object: new myFunction(), description: "Function2" },
+ { object: {x: 5}, description: "Object" },
+ { object: Object.create(null), description: "Object2" },
+ { object: /regexp/, description: "RegExp" },
+ { object: [1, 2, 3], description: "Array" },
+ { object: new Error("test error"), description: "Error" },
+ { object: new Date(), description: "Date" },
+ { object: new Number(1), description: "Number" },
+ { object: new Boolean(true), description: "Boolean" },
+ { object: new String('str'), description: "String" },
+ ];
+}
+
+debug("Basics");
+shouldBe("Object.setPrototypeOf.name", "'setPrototypeOf'");
+shouldBe("Object.setPrototypeOf.length", "2");
+
+// Coercible objects get coerced.
+debug(""); debug("Coercible value");
+for (value of coercibleValueStrings) {
+ debugEval("value = " + value);
+ shouldNotThrow("Object.getPrototypeOf(value)");
+ shouldBe("Object.setPrototypeOf(value, {})", "value");
+ shouldBe("Object.getPrototypeOf(value)", "(value).__proto__");
+}
+
+// Non-coercible object throws a TypeError.
+debug(""); debug("Non-Coercible value");
+for (value of nonCoercibleValueStrings)
+ shouldThrow("Object.setPrototypeOf(" + value + ", {})");
+
+// Non-object/null proto throws a TypeError.
+debug(""); debug("Non-Object/Null proto");
+for ({object, description} of getObjectDescriptions()) {
+ debug("object (" + description + ")");
+ for (proto of nonNullValueStrings)
+ shouldThrow("Object.setPrototypeOf(object, " + proto + ")");
+}
+
+// Object and object proto, more like normal behavior.
+debug(""); debug("Object and object proto");
+for ({object, description} of getObjectDescriptions()) {
+ for ({object: proto, description: protoDescription} of getObjectDescriptions()) {
+ debug("object (" + description + ") proto (" + protoDescription + ")");
+ shouldBe("Object.setPrototypeOf(object, proto)", "object");
+ shouldBe("Object.getPrototypeOf(object)", "proto");
+ }
+}
+
+// Normal behavior with null proto.
+debug(""); debug("Object and null proto");
+for ({object, description} of getObjectDescriptions()) {
+ debug("object (" + description + ")");
+ shouldBe("Object.setPrototypeOf(object, null)", "object");
+ shouldBe("Object.getPrototypeOf(object)", "null");
+}
+
+// Non-extensible object throws TypeError.
+debug(""); debug("Non-extensible object");
+for ({object, description} of getObjectDescriptions()) {
+ debug("object (" + description + ") with extensions prevented");
+ Object.preventExtensions(object);
+ oldProto = Object.getPrototypeOf(object);
+ shouldThrow("Object.setPrototypeOf(object, {})");
+ shouldBe("Object.getPrototypeOf(object)", "oldProto");
+}
+
+// Ensure prototype change affects lookup.
+debug(""); debug("Test prototype lookup");
+object = {};
+shouldBeFalse("'x' in object");
+shouldBeFalse("'y' in object");
+
+var oldProto = { x: 'old x', y: 'old y', };
+shouldBe("Object.setPrototypeOf(object, oldProto)", "object");
+shouldBe("object.x", "'old x'");
+shouldBe("object.y", "'old y'");
+
+var newProto = { x: 'new x' };
+shouldBe("Object.setPrototypeOf(object, newProto)", "object");
+shouldBe("object.x", "'new x'");
+shouldBeFalse("'y' in object");
+
+// Other prototype behavior, like instanceof and compare to __proto__.
+debug(""); debug("Test other behavior");
+shouldBeTrue("object = {}; Object.setPrototypeOf(object, Array.prototype); object instanceof Array");
+shouldBeTrue("object = {}; Object.setPrototypeOf(object, Array.prototype); object.__proto__ === Array.prototype");
+shouldBeTrue("object = {}; Object.setPrototypeOf(object, Array.prototype); Array.prototype.isPrototypeOf(object)");
Added: trunk/LayoutTests/js/setPrototypeOf-expected.txt (0 => 184642)
--- trunk/LayoutTests/js/setPrototypeOf-expected.txt (rev 0)
+++ trunk/LayoutTests/js/setPrototypeOf-expected.txt 2015-05-20 17:23:03 UTC (rev 184642)
@@ -0,0 +1,567 @@
+Test Object.setPrototypeOf.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Basics
+PASS Object.setPrototypeOf.name is 'setPrototypeOf'
+PASS Object.setPrototypeOf.length is 2
+
+Coercible value
+value = 0
+PASS Object.getPrototypeOf(value) did not throw exception.
+PASS Object.setPrototypeOf(value, {}) is value
+PASS Object.getPrototypeOf(value) is (value).__proto__
+value = true
+PASS Object.getPrototypeOf(value) did not throw exception.
+PASS Object.setPrototypeOf(value, {}) is value
+PASS Object.getPrototypeOf(value) is (value).__proto__
+value = false
+PASS Object.getPrototypeOf(value) did not throw exception.
+PASS Object.setPrototypeOf(value, {}) is value
+PASS Object.getPrototypeOf(value) is (value).__proto__
+value = 'string'
+PASS Object.getPrototypeOf(value) did not throw exception.
+PASS Object.setPrototypeOf(value, {}) is value
+PASS Object.getPrototypeOf(value) is (value).__proto__
+value = Symbol()
+PASS Object.getPrototypeOf(value) did not throw exception.
+PASS Object.setPrototypeOf(value, {}) is value
+PASS Object.getPrototypeOf(value) is (value).__proto__
+
+Non-Coercible value
+PASS Object.setPrototypeOf(undefined, {}) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(null, {}) threw exception TypeError: Type error.
+
+Non-Object/Null proto
+object (Function)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Function2)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Object)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Object2)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (RegExp)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Array)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Error)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Date)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Number)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (Boolean)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+object (String)
+PASS Object.setPrototypeOf(object, 0) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, true) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, false) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, 'string') threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, Symbol()) threw exception TypeError: Type error.
+PASS Object.setPrototypeOf(object, undefined) threw exception TypeError: Type error.
+
+Object and object proto
+object (Function) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Function2) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Object2) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (RegExp) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Array) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Error) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Date) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Number) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (Boolean) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Function)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Function2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Object)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Object2)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (RegExp)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Array)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Error)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Date)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Number)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (Boolean)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+object (String) proto (String)
+PASS Object.setPrototypeOf(object, proto) is object
+PASS Object.getPrototypeOf(object) is proto
+
+Object and null proto
+object (Function)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Function2)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Object)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Object2)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (RegExp)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Array)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Error)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Date)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Number)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (Boolean)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+object (String)
+PASS Object.setPrototypeOf(object, null) is object
+PASS Object.getPrototypeOf(object) is null
+
+Non-extensible object
+object (Function) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Function2) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Object) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Object2) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (RegExp) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Array) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Error) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Date) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Number) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (Boolean) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+object (String) with extensions prevented
+PASS Object.setPrototypeOf(object, {}) threw exception TypeError: Attempted to assign to readonly property..
+PASS Object.getPrototypeOf(object) is oldProto
+
+Test prototype lookup
+PASS 'x' in object is false
+PASS 'y' in object is false
+PASS Object.setPrototypeOf(object, oldProto) is object
+PASS object.x is 'old x'
+PASS object.y is 'old y'
+PASS Object.setPrototypeOf(object, newProto) is object
+PASS object.x is 'new x'
+PASS 'y' in object is false
+
+Test other behavior
+PASS object = {}; Object.setPrototypeOf(object, Array.prototype); object instanceof Array is true
+PASS object = {}; Object.setPrototypeOf(object, Array.prototype); object.__proto__ === Array.prototype is true
+PASS object = {}; Object.setPrototypeOf(object, Array.prototype); Array.prototype.isPrototypeOf(object) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/js/setPrototypeOf.html (0 => 184642)
--- trunk/LayoutTests/js/setPrototypeOf.html (rev 0)
+++ trunk/LayoutTests/js/setPrototypeOf.html 2015-05-20 17:23:03 UTC (rev 184642)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Modified: trunk/Source/_javascript_Core/ChangeLog (184641 => 184642)
--- trunk/Source/_javascript_Core/ChangeLog 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-05-20 17:23:03 UTC (rev 184642)
@@ -1,5 +1,22 @@
2015-05-20 Joseph Pecoraro <[email protected]>
+ ES6: Implement Object.setPrototypeOf
+ https://bugs.webkit.org/show_bug.cgi?id=145202
+
+ Reviewed by Darin Adler.
+
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncProtoSetter):
+ (JSC::checkProtoSetterAccessAllowed):
+ Extract a helper to share this code between __proto__ setter and setPrototypeOf.
+
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorSetPrototypeOf):
+ Implementation is very similiar to __proto__ setter.
+
+2015-05-20 Joseph Pecoraro <[email protected]>
+
ES6: Should not allow duplicate basic __proto__ properties in Object Literals
https://bugs.webkit.org/show_bug.cgi?id=145138
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (184641 => 184642)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2015-05-20 17:23:03 UTC (rev 184642)
@@ -846,6 +846,13 @@
JSObject* m_thisObject;
};
+bool checkProtoSetterAccessAllowed(ExecState* exec, JSObject* object)
+{
+ GlobalFuncProtoSetterFunctor functor(object);
+ exec->iterate(functor);
+ return functor.allowsAccess();
+}
+
EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState* exec)
{
if (exec->thisValue().isUndefinedOrNull())
@@ -859,9 +866,7 @@
if (!thisObject)
return JSValue::encode(jsUndefined());
- GlobalFuncProtoSetterFunctor functor(thisObject);
- exec->iterate(functor);
- if (!functor.allowsAccess())
+ if (!checkProtoSetterAccessAllowed(exec, thisObject))
return JSValue::encode(jsUndefined());
// Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla.
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h (184641 => 184642)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h 2015-05-20 17:23:03 UTC (rev 184642)
@@ -53,6 +53,8 @@
EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncBuiltinLog(ExecState*);
+bool checkProtoSetterAccessAllowed(ExecState*, JSObject*);
+
static const double mantissaOverflowLowerBound = 9007199254740992.0;
double parseIntOverflow(const LChar*, unsigned length, int radix);
bool isStrWhiteSpace(UChar);
Modified: trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp (184641 => 184642)
--- trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2015-05-20 17:02:24 UTC (rev 184641)
+++ trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2015-05-20 17:23:03 UTC (rev 184642)
@@ -25,12 +25,13 @@
#include "CopiedSpaceInlines.h"
#include "Error.h"
#include "ExceptionHelpers.h"
+#include "JSArray.h"
+#include "JSCInlines.h"
#include "JSFunction.h"
-#include "JSArray.h"
#include "JSGlobalObject.h"
+#include "JSGlobalObjectFunctions.h"
#include "Lookup.h"
#include "ObjectPrototype.h"
-#include "JSCInlines.h"
#include "PropertyDescriptor.h"
#include "PropertyNameArray.h"
#include "StackVisitor.h"
@@ -39,6 +40,7 @@
namespace JSC {
EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
+EncodedJSValue JSC_HOST_CALL objectConstructorSetPrototypeOf(ExecState*);
EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
@@ -64,6 +66,7 @@
/* Source for ObjectConstructor.lut.h
@begin objectConstructorTable
getPrototypeOf objectConstructorGetPrototypeOf DontEnum|Function 1
+ setPrototypeOf objectConstructorSetPrototypeOf DontEnum|Function 2
getOwnPropertyDescriptor objectConstructorGetOwnPropertyDescriptor DontEnum|Function 2
getOwnPropertyNames objectConstructorGetOwnPropertyNames DontEnum|Function 1
keys objectConstructorKeys DontEnum|Function 1
@@ -185,6 +188,34 @@
return functor.result();
}
+EncodedJSValue JSC_HOST_CALL objectConstructorSetPrototypeOf(ExecState* exec)
+{
+ JSValue objectValue = exec->argument(0);
+ if (objectValue.isUndefinedOrNull())
+ return throwVMTypeError(exec);
+
+ JSValue protoValue = exec->argument(1);
+ if (!protoValue.isObject() && !protoValue.isNull())
+ return throwVMTypeError(exec);
+
+ JSObject* object = objectValue.toObject(exec);
+ if (exec->hadException())
+ return JSValue::encode(objectValue);
+
+ if (!checkProtoSetterAccessAllowed(exec, object))
+ return JSValue::encode(objectValue);
+
+ if (!object->isExtensible())
+ return throwVMError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
+
+ if (!object->setPrototypeWithCycleCheck(exec, protoValue)) {
+ exec->vm().throwException(exec, createError(exec, ASCIILiteral("cyclic __proto__ value")));
+ return JSValue::encode(jsUndefined());
+ }
+
+ return JSValue::encode(objectValue);
+}
+
EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
{
JSObject* object = exec->argument(0).toObject(exec);