Diff
Modified: trunk/LayoutTests/ChangeLog (202831 => 202832)
--- trunk/LayoutTests/ChangeLog 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/LayoutTests/ChangeLog 2016-07-05 21:08:38 UTC (rev 202832)
@@ -1,3 +1,14 @@
+2016-07-05 Benjamin Poulain <bpoul...@apple.com>
+
+ [JSC] The prototype cycle checks throws the wrong error type
+ https://bugs.webkit.org/show_bug.cgi?id=159393
+
+ Reviewed by Geoffrey Garen.
+
+ * js/cyclic-prototypes-expected.txt:
+ * js/script-tests/cyclic-prototypes.js:
+ (catch):
+
2016-07-05 Jer Noble <jer.no...@apple.com>
REGRESSION (r202641): Netflix playback stalls after a few seconds
Modified: trunk/LayoutTests/fast/dom/Window/script-tests/window-custom-prototype.js (202831 => 202832)
--- trunk/LayoutTests/fast/dom/Window/script-tests/window-custom-prototype.js 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/LayoutTests/fast/dom/Window/script-tests/window-custom-prototype.js 2016-07-05 21:08:38 UTC (rev 202832)
@@ -4,12 +4,12 @@
var chainPointingBackToWindow = { __proto__: window };
var anotherObject = { };
-shouldThrow("__proto__ = window; __proto", "'Error: cyclic __proto__ value'");
-shouldThrow("__proto__ = chainPointingBackToWindow; __proto__", "'Error: cyclic __proto__ value'");
+shouldThrow("__proto__ = window; __proto", "'TypeError: cyclic __proto__ value'");
+shouldThrow("__proto__ = chainPointingBackToWindow; __proto__", "'TypeError: cyclic __proto__ value'");
shouldBe("__proto__ = 1; __proto__", "originalWindowPrototype");
shouldBe("__proto__ = 'a string'; __proto__", "originalWindowPrototype");
shouldBe("__proto__ = anotherObject; __proto__", "anotherObject");
-shouldThrow("anotherObject.__proto__ = window; __proto__", "'Error: cyclic __proto__ value'");
+shouldThrow("anotherObject.__proto__ = window; __proto__", "'TypeError: cyclic __proto__ value'");
shouldBe("__proto__ = 1; __proto__", "anotherObject");
shouldBe("__proto__ = 'a string'; __proto__", "anotherObject");
shouldBe("__proto__ = anotherObject; __proto__", "anotherObject");
Modified: trunk/LayoutTests/fast/dom/Window/window-custom-prototype-expected.txt (202831 => 202832)
--- trunk/LayoutTests/fast/dom/Window/window-custom-prototype-expected.txt 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/LayoutTests/fast/dom/Window/window-custom-prototype-expected.txt 2016-07-05 21:08:38 UTC (rev 202832)
@@ -3,12 +3,12 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS __proto__ = window; __proto threw exception Error: cyclic __proto__ value.
-PASS __proto__ = chainPointingBackToWindow; __proto__ threw exception Error: cyclic __proto__ value.
+PASS __proto__ = window; __proto threw exception TypeError: cyclic __proto__ value.
+PASS __proto__ = chainPointingBackToWindow; __proto__ threw exception TypeError: cyclic __proto__ value.
PASS __proto__ = 1; __proto__ is originalWindowPrototype
PASS __proto__ = 'a string'; __proto__ is originalWindowPrototype
PASS __proto__ = anotherObject; __proto__ is anotherObject
-PASS anotherObject.__proto__ = window; __proto__ threw exception Error: cyclic __proto__ value.
+PASS anotherObject.__proto__ = window; __proto__ threw exception TypeError: cyclic __proto__ value.
PASS __proto__ = 1; __proto__ is anotherObject
PASS __proto__ = 'a string'; __proto__ is anotherObject
PASS __proto__ = anotherObject; __proto__ is anotherObject
Modified: trunk/LayoutTests/js/cyclic-prototypes-expected.txt (202831 => 202832)
--- trunk/LayoutTests/js/cyclic-prototypes-expected.txt 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/LayoutTests/js/cyclic-prototypes-expected.txt 2016-07-05 21:08:38 UTC (rev 202832)
@@ -3,12 +3,14 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS o1.__proto__ = o3; threw exception Error: cyclic __proto__ value.
-PASS Object.setPrototypeOf(o1, o3) threw exception Error: cyclic __proto__ value.
+PASS o1.__proto__ = o3; threw exception TypeError: cyclic __proto__ value.
+PASS Object.setPrototypeOf(o1, o3) threw exception TypeError: cyclic __proto__ value.
+PASS globalException.constructor is TypeError
+PASS globalException.constructor is TypeError
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 Object.setPrototypeOf(o1, o3) threw exception TypeError: cyclic __proto__ value.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/js/dom/cyclic-proto-expected.txt (202831 => 202832)
--- trunk/LayoutTests/js/dom/cyclic-proto-expected.txt 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/LayoutTests/js/dom/cyclic-proto-expected.txt 2016-07-05 21:08:38 UTC (rev 202832)
@@ -3,7 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS x.__proto__ = x; threw exception Error: cyclic __proto__ value.
+PASS x.__proto__ = x; threw exception TypeError: cyclic __proto__ value.
PASS x.__proto__ is originalProto
PASS successfullyParsed is true
Modified: trunk/LayoutTests/js/script-tests/cyclic-prototypes.js (202831 => 202832)
--- trunk/LayoutTests/js/script-tests/cyclic-prototypes.js 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/LayoutTests/js/script-tests/cyclic-prototypes.js 2016-07-05 21:08:38 UTC (rev 202832)
@@ -7,9 +7,24 @@
o3.__proto__ = o2;
// Try to create a cyclical prototype chain.
-shouldThrow("o1.__proto__ = o3;");
-shouldThrow("Object.setPrototypeOf(o1, o3)");
+shouldThrow("o1.__proto__ = o3;", "'TypeError: cyclic __proto__ value'");
+shouldThrow("Object.setPrototypeOf(o1, o3)", "'TypeError: cyclic __proto__ value'");
+var globalException;
+try {
+ o1.__proto__ = o3;
+} catch (e) {
+ globalException = e;
+}
+shouldBe("globalException.constructor", "TypeError");
+globalException = undefined;
+try {
+ Object.setPrototypeOf(o1, o3);
+} catch (e) {
+ globalException = e;
+}
+shouldBe("globalException.constructor", "TypeError");
+
// This changes __proto__ setter behaviour, since __proto__ is an accessor on Object.prototype.
o1.__proto__ = null;
shouldBeFalse("({}).hasOwnProperty.call(o1, '__proto__')");
Modified: trunk/Source/_javascript_Core/ChangeLog (202831 => 202832)
--- trunk/Source/_javascript_Core/ChangeLog 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-07-05 21:08:38 UTC (rev 202832)
@@ -1,3 +1,16 @@
+2016-07-05 Benjamin Poulain <bpoul...@apple.com>
+
+ [JSC] The prototype cycle checks throws the wrong error type
+ https://bugs.webkit.org/show_bug.cgi?id=159393
+
+ Reviewed by Geoffrey Garen.
+
+ We were supposed to throw the TypeError:
+ -https://tc39.github.io/ecma262/#sec-set-object.prototype.__proto__
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::setPrototypeWithCycleCheck):
+
2016-07-05 Saam Barati <sbar...@apple.com>
our parsing for "use strict" is wrong when we first parse other directives that are not "use strict" but are located in a place where "use strict" would be valid
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (202831 => 202832)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2016-07-05 20:38:22 UTC (rev 202831)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2016-07-05 21:08:38 UTC (rev 202832)
@@ -1366,7 +1366,7 @@
while (nextPrototype && nextPrototype.isObject()) {
if (nextPrototype == this) {
if (shouldThrowIfCantSet)
- vm.throwException(exec, createError(exec, ASCIILiteral("cyclic __proto__ value")));
+ throwTypeError(exec, ASCIILiteral("cyclic __proto__ value"));
return false;
}
if (UNLIKELY(asObject(nextPrototype)->methodTable(vm)->getPrototype != defaultGetPrototype))