Diff
Modified: trunk/LayoutTests/ChangeLog (198446 => 198447)
--- trunk/LayoutTests/ChangeLog 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ChangeLog 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,3 +1,38 @@
+2016-03-18 Mark Lam <[email protected]>
+
+ ES6 spec requires that RegExpPrototype not be a RegExp object.
+ https://bugs.webkit.org/show_bug.cgi?id=155654
+
+ Reviewed by Filip Pizlo.
+
+ Rebase all the test results.
+
+ * fast/regex/script-tests/toString.js:
+ * fast/regex/toString-expected.txt:
+ * ietestcenter/_javascript_/15.10.6-expected.txt:
+ * ietestcenter/_javascript_/15.10.7.1-1-expected.txt:
+ * ietestcenter/_javascript_/15.10.7.2-1-expected.txt:
+ * ietestcenter/_javascript_/15.10.7.3-1-expected.txt:
+ * ietestcenter/_javascript_/15.10.7.4-1-expected.txt:
+ * ietestcenter/_javascript_/15.10.7.5-1-expected.txt:
+ * ietestcenter/_javascript_/TestCases/15.10.6.js:
+ (ES5Harness.registerTest.test):
+ * ietestcenter/_javascript_/TestCases/15.10.7.1-1.js:
+ (ES5Harness.registerTest.test):
+ * ietestcenter/_javascript_/TestCases/15.10.7.2-1.js:
+ (ES5Harness.registerTest.test):
+ * ietestcenter/_javascript_/TestCases/15.10.7.3-1.js:
+ (ES5Harness.registerTest.test):
+ * ietestcenter/_javascript_/TestCases/15.10.7.4-1.js:
+ (ES5Harness.registerTest.test):
+ * ietestcenter/_javascript_/TestCases/15.10.7.5-1.js:
+ (ES5Harness.registerTest.test):
+ * js/Object-getOwnPropertyNames-expected.txt:
+ * js/kde/RegExp-expected.txt:
+ * js/kde/script-tests/RegExp.js:
+ * js/script-tests/Object-getOwnPropertyNames.js:
+ * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.6/S15.10.6_A2-expected.txt:
+
2016-03-18 Brent Fulgham <[email protected]>
Local file restrictions should not block sessionStorage access
Modified: trunk/LayoutTests/fast/regex/script-tests/toString.js (198446 => 198447)
--- trunk/LayoutTests/fast/regex/script-tests/toString.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/fast/regex/script-tests/toString.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -19,11 +19,11 @@
shouldBe("RegExp('/').source", '"\\\\/"');
shouldBe("RegExp('').source", '"(?:)"');
-shouldBe("RegExp.prototype.source", '"(?:)"');
+shouldThrow("RegExp.prototype.source", '"TypeError: Type error"');
shouldBe("RegExp('/').toString()", '"/\\\\//"');
shouldBe("RegExp('').toString()", '"/(?:)/"');
-shouldBe("RegExp.prototype.toString()", '"/(?:)/"');
+shouldThrow("RegExp.prototype.toString()", '"TypeError: Type error"');
// These strings are equivalent, since the '\' is identity escaping the '/' at the string level.
shouldBeTrue('testForwardSlash("^/$", "/");');
Modified: trunk/LayoutTests/fast/regex/toString-expected.txt (198446 => 198447)
--- trunk/LayoutTests/fast/regex/toString-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/fast/regex/toString-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -5,10 +5,10 @@
PASS RegExp('/').source is "\\/"
PASS RegExp('').source is "(?:)"
-PASS RegExp.prototype.source is "(?:)"
+PASS RegExp.prototype.source threw exception TypeError: Type error.
PASS RegExp('/').toString() is "/\\//"
PASS RegExp('').toString() is "/(?:)/"
-PASS RegExp.prototype.toString() is "/(?:)/"
+PASS RegExp.prototype.toString() threw exception TypeError: Type error.
PASS testForwardSlash("^/$", "/"); is true
PASS testForwardSlash("^/$", "/"); is true
PASS testForwardSlash("^\/$", "/"); is true
Modified: trunk/LayoutTests/ietestcenter/_javascript_/15.10.6-expected.txt (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/15.10.6-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/15.10.6-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,4 +1,4 @@
-15.10.6 (TestCases/chapter15/15.10/15.10.6/15.10.6.js) RegExp.prototype is itself a RegExp
+15.10.6 (TestCases/chapter15/15.10/15.10.6/15.10.6.js) RegExp.prototype is not a RegExp
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.1-1-expected.txt (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.1-1-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.1-1-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,4 +1,4 @@
-15.10.7.1-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.1/15.10.7.1-1.js) RegExp.prototype.source is of type String
+15.10.7.1-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.1/15.10.7.1-1.js) RegExp.prototype.source should throw because RegExp.prototype is not a RegExp
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.2-1-expected.txt (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.2-1-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.2-1-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,4 +1,4 @@
-15.10.7.2-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.2/15.10.7.2-1.js) RegExp.prototype.global is of type Boolean
+15.10.7.2-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.2/15.10.7.2-1.js) RegExp.prototype.global should throw because RegExp.prototype is not a RegExp
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.3-1-expected.txt (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.3-1-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.3-1-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,4 +1,4 @@
-15.10.7.3-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.3/15.10.7.3-1.js) RegExp.prototype.ignoreCase is of type Boolean
+15.10.7.3-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.3/15.10.7.3-1.js) RegExp.prototype.ignoreCase should throw because RegExp.prototype is not a RegExp
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.4-1-expected.txt (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.4-1-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.4-1-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,4 +1,4 @@
-15.10.7.4-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.4/15.10.7.4-1.js) RegExp.prototype.multiline is of type Boolean
+15.10.7.4-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.4/15.10.7.4-1.js) RegExp.prototype.multiline should throw because RegExp.prototype is not a RegExp
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.5-1-expected.txt (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.5-1-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/15.10.7.5-1-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,4 +1,4 @@
-15.10.7.5-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.5/15.10.7.5-1.js) RegExp.prototype.lastIndex is of type Number
+15.10.7.5-1 (TestCases/chapter15/15.10/15.10.7/15.10.7.5/15.10.7.5-1.js) RegExp.prototype.lastIndex is undefined because RegExp.prototype is not a RegExp
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.6.js (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.6.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.6.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -24,11 +24,11 @@
path: "TestCases/chapter15/15.10/15.10.6/15.10.6.js",
-description: "RegExp.prototype is itself a RegExp",
+description: "RegExp.prototype is not a RegExp",
test: function testcase() {
var s = Object.prototype.toString.call(RegExp.prototype);
- if (s === '[object RegExp]') {
+ if (s === '[object Object]') {
return true;
}
}
Modified: trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.1-1.js (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.1-1.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.1-1.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -24,10 +24,14 @@
path: "TestCases/chapter15/15.10/15.10.7/15.10.7.1/15.10.7.1-1.js",
-description: "RegExp.prototype.source is of type String",
+description: "RegExp.prototype.source should throw because RegExp.prototype is not a RegExp",
test: function testcase() {
- if((typeof(RegExp.prototype.source)) === 'string')
- return true;
+ try {
+ RegExp.prototype.source;
+ return false;
+ } catch (e) {
+ return true;
+ }
}
});
Modified: trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.2-1.js (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.2-1.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.2-1.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -24,10 +24,14 @@
path: "TestCases/chapter15/15.10/15.10.7/15.10.7.2/15.10.7.2-1.js",
-description: "RegExp.prototype.global is of type Boolean",
+description: "RegExp.prototype.global should throw because RegExp.prototype is not a RegExp",
test: function testcase() {
- if((typeof(RegExp.prototype.global)) === 'boolean')
- return true;
+ try {
+ RegExp.prototype.global;
+ return false;
+ } catch (e) {
+ return true;
+ }
}
});
Modified: trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.3-1.js (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.3-1.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.3-1.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -24,10 +24,14 @@
path: "TestCases/chapter15/15.10/15.10.7/15.10.7.3/15.10.7.3-1.js",
-description: "RegExp.prototype.ignoreCase is of type Boolean",
+description: "RegExp.prototype.ignoreCase should throw because RegExp.prototype is not a RegExp",
test: function testcase() {
- if((typeof(RegExp.prototype.ignoreCase)) === 'boolean')
- return true;
+ try {
+ RegExp.prototype.ignoreCase;
+ return false;
+ } catch (e) {
+ return true;
+ }
}
});
Modified: trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.4-1.js (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.4-1.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.4-1.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -24,10 +24,14 @@
path: "TestCases/chapter15/15.10/15.10.7/15.10.7.4/15.10.7.4-1.js",
-description: "RegExp.prototype.multiline is of type Boolean",
+description: "RegExp.prototype.multiline should throw because RegExp.prototype is not a RegExp",
test: function testcase() {
- if((typeof(RegExp.prototype.multiline)) === 'boolean')
- return true;
+ try {
+ RegExp.prototype.multiline;
+ return false;
+ } catch (e) {
+ return true;
+ }
}
});
Modified: trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.5-1.js (198446 => 198447)
--- trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.5-1.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.5-1.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -24,10 +24,10 @@
path: "TestCases/chapter15/15.10/15.10.7/15.10.7.5/15.10.7.5-1.js",
-description: "RegExp.prototype.lastIndex is of type Number",
+description: "RegExp.prototype.lastIndex is undefined because RegExp.prototype is not a RegExp",
test: function testcase() {
- if((typeof(RegExp.prototype.lastIndex)) === 'number')
+ if((typeof(RegExp.prototype.lastIndex)) === 'undefined')
return true;
}
});
Modified: trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt (198446 => 198447)
--- trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -56,7 +56,7 @@
PASS getSortedOwnPropertyNames(Date) is ['UTC', 'length', 'name', 'now', 'parse', 'prototype']
PASS getSortedOwnPropertyNames(Date.prototype) is ['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf']
PASS getSortedOwnPropertyNames(RegExp) is ['$&', "$'", '$*', '$+', '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9', '$_', '$`', 'input', 'lastMatch', 'lastParen', 'leftContext', 'length', 'multiline', 'name', 'prototype', 'rightContext']
-PASS getSortedOwnPropertyNames(RegExp.prototype) is ['compile', 'constructor', 'exec', 'flags', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'sticky', 'test', 'toString', 'unicode']
+PASS getSortedOwnPropertyNames(RegExp.prototype) is ['compile', 'constructor', 'exec', 'flags', 'global', 'ignoreCase', 'multiline', 'source', 'sticky', 'test', 'toString', 'unicode']
PASS getSortedOwnPropertyNames(Error) is ['length', 'name', 'prototype']
PASS getSortedOwnPropertyNames(Error.prototype) is ['constructor', 'message', 'name', 'toString']
PASS getSortedOwnPropertyNames(Math) is ['E','LN10','LN2','LOG10E','LOG2E','PI','SQRT1_2','SQRT2','abs','acos','acosh','asin','asinh','atan','atan2','atanh','cbrt','ceil','clz32','cos','cosh','exp','expm1','floor','fround','hypot','imul','log','log10','log1p','log2','max','min','pow','random','round','sign','sin','sinh','sqrt','tan','tanh','trunc']
Modified: trunk/LayoutTests/js/kde/RegExp-expected.txt (198446 => 198447)
--- trunk/LayoutTests/js/kde/RegExp-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/js/kde/RegExp-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -90,8 +90,8 @@
PASS str.match(/d/gi).toString() is 'D,d'
PASS /\u0061/.source is '\\u0061'
PASS 'abc'.match(/\u0062/).toString() is 'b'
-PASS Object.prototype.toString.apply(RegExp.prototype) is '[object RegExp]'
-PASS typeof RegExp.prototype.toString() is 'string'
+PASS Object.prototype.toString.apply(RegExp.prototype) is '[object Object]'
+PASS RegExp.prototype.toString() threw exception TypeError: Type error.
PASS new RegExp().toString() is '/(?:)/'
PASS (new RegExp('(?:)')).source is '(?:)'
PASS /(?:)/.toString() is '/(?:)/'
Modified: trunk/LayoutTests/js/kde/script-tests/RegExp.js (198446 => 198447)
--- trunk/LayoutTests/js/kde/script-tests/RegExp.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/js/kde/script-tests/RegExp.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -143,11 +143,11 @@
shouldBe("'abc'.match(/\\u0062/).toString()", "'b'");
shouldBe("Object.prototype.toString.apply(RegExp.prototype)",
- "'[object RegExp]'");
+ "'[object Object]'");
// not sure what this should return. most importantly
// it doesn't throw an exception
-shouldBe("typeof RegExp.prototype.toString()", "'string'");
+shouldThrow("RegExp.prototype.toString()", "'TypeError: Type error'");
// Empty regular expressions have string representation /(?:)/
shouldBe("new RegExp().toString()", "'/(?:)/'");
Modified: trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (198446 => 198447)
--- trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -65,7 +65,7 @@
"Date": "['UTC', 'length', 'name', 'now', 'parse', 'prototype']",
"Date.prototype": "['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf']",
"RegExp": "['$&', \"$'\", '$*', '$+', '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9', '$_', '$`', 'input', 'lastMatch', 'lastParen', 'leftContext', 'length', 'multiline', 'name', 'prototype', 'rightContext']",
- "RegExp.prototype": "['compile', 'constructor', 'exec', 'flags', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'sticky', 'test', 'toString', 'unicode']",
+ "RegExp.prototype": "['compile', 'constructor', 'exec', 'flags', 'global', 'ignoreCase', 'multiline', 'source', 'sticky', 'test', 'toString', 'unicode']",
"Error": "['length', 'name', 'prototype']",
"Error.prototype": "['constructor', 'message', 'name', 'toString']",
"Math": "['E','LN10','LN2','LOG10E','LOG2E','PI','SQRT1_2','SQRT2','abs','acos','acosh','asin','asinh','atan','atan2','atanh','cbrt','ceil','clz32','cos','cosh','exp','expm1','floor','fround','hypot','imul','log','log10','log1p','log2','max','min','pow','random','round','sign','sin','sinh','sqrt','tan','tanh','trunc']",
Modified: trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.6/S15.10.6_A2-expected.txt (198446 => 198447)
--- trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.6/S15.10.6_A2-expected.txt 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.6/S15.10.6_A2-expected.txt 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,6 +1,6 @@
S15.10.6_A2
-FAIL SputnikError: #1: RegExp.prototype.toString = Object.prototype.toString; RegExp.prototype.toString() === "[object " + "Object" + "]". Actual: [object RegExp]
+PASS
TEST COMPLETE
Modified: trunk/Source/_javascript_Core/ChangeLog (198446 => 198447)
--- trunk/Source/_javascript_Core/ChangeLog 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,3 +1,48 @@
+2016-03-18 Mark Lam <[email protected]>
+
+ ES6 spec requires that RegExpPrototype not be a RegExp object.
+ https://bugs.webkit.org/show_bug.cgi?id=155654
+
+ Reviewed by Filip Pizlo.
+
+ The ES6 spec states that RegExp.prototype should not be an instance of RegExp:
+ https://tc39.github.io/ecma262/#sec-properties-of-the-regexp-prototype-object
+
+ "The RegExp prototype object is an ordinary object. It is not a RegExp instance
+ and does not have a [[RegExpMatcher]] internal slot or any of the other internal
+ slots of RegExp instance objects."
+
+ This patch changes RegExpPrototype to conform to the above specifications.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ (JSC::RegExpConstructor::finishCreation):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ (JSC::RegExpPrototype::finishCreation):
+ (JSC::RegExpPrototype::getOwnPropertySlot):
+ (JSC::RegExpPrototype::visitChildren):
+ (JSC::regExpProtoFuncTest):
+ * runtime/RegExpPrototype.h:
+ (JSC::RegExpPrototype::create):
+ (JSC::RegExpPrototype::createStructure):
+ (JSC::RegExpPrototype::emptyRegExp):
+
+ * tests/es6.yaml:
+ - This patch makes the es6/miscellaneous_built-in_prototypes_are_not_instances.js
+ test now pass. However, the kangax version of this test still fails because
+ it also checks Error objects (which will be fixed in a subsequent patch).
+
+ * tests/mozilla/ecma_2/shell.js:
+ (stringify):
+ (test):
+ (getFailedCases):
+ (err):
+ * tests/stress/static-getter-in-names.js:
+ (shouldBe):
+
2016-03-18 Keith Miller <[email protected]>
DataView should use an accessor for its length and buffer properties
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (198446 => 198447)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2016-03-18 23:14:34 UTC (rev 198447)
@@ -361,9 +361,7 @@
for (unsigned i = 0; i < NumberOfIndexingShapes; ++i)
m_arrayStructureForIndexingShapeDuringAllocation[i] = m_originalArrayStructureForIndexingShape[i];
- RegExp* emptyRegex = RegExp::create(vm, "", NoFlags);
-
- m_regExpPrototype.set(vm, this, RegExpPrototype::create(vm, this, RegExpPrototype::createStructure(vm, this, m_objectPrototype.get()), emptyRegex));
+ m_regExpPrototype.set(vm, this, RegExpPrototype::create(vm, this, RegExpPrototype::createStructure(vm, this, m_objectPrototype.get())));
m_regExpStructure.set(vm, this, RegExpObject::createStructure(vm, this, m_regExpPrototype.get()));
m_regExpMatchesArrayStructure.set(vm, this, createRegExpMatchesArrayStructure(vm, this));
m_regExpMatchesArraySlowPutStructure.set(vm, this, createRegExpMatchesArraySlowPutStructure(vm, this));
Modified: trunk/Source/_javascript_Core/runtime/RegExpConstructor.cpp (198446 => 198447)
--- trunk/Source/_javascript_Core/runtime/RegExpConstructor.cpp 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/runtime/RegExpConstructor.cpp 2016-03-18 23:14:34 UTC (rev 198447)
@@ -86,14 +86,14 @@
RegExpConstructor::RegExpConstructor(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype)
: InternalFunction(vm, structure)
- , m_cachedResult(vm, this, regExpPrototype->regExp())
+ , m_cachedResult(vm, this, regExpPrototype->emptyRegExp())
, m_multiline(false)
{
}
void RegExpConstructor::finishCreation(VM& vm, RegExpPrototype* regExpPrototype, GetterSetter* speciesSymbol)
{
- Base::finishCreation(vm, regExpPrototype->classInfo()->className);
+ Base::finishCreation(vm, ASCIILiteral("RegExp"));
ASSERT(inherits(info()));
// ECMA 15.10.5.1 RegExp.prototype
Modified: trunk/Source/_javascript_Core/runtime/RegExpPrototype.cpp (198446 => 198447)
--- trunk/Source/_javascript_Core/runtime/RegExpPrototype.cpp 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/runtime/RegExpPrototype.cpp 2016-03-18 23:14:34 UTC (rev 198447)
@@ -59,7 +59,7 @@
namespace JSC {
-const ClassInfo RegExpPrototype::s_info = { "RegExp", &RegExpObject::s_info, ®ExpPrototypeTable, CREATE_METHOD_TABLE(RegExpPrototype) };
+const ClassInfo RegExpPrototype::s_info = { "Object", &Base::s_info, ®ExpPrototypeTable, CREATE_METHOD_TABLE(RegExpPrototype) };
/* Source for RegExpPrototype.lut.h
@begin regExpPrototypeTable
@@ -77,8 +77,8 @@
@end
*/
-RegExpPrototype::RegExpPrototype(VM& vm, Structure* structure, RegExp* regExp)
- : RegExpObject(vm, structure, regExp)
+RegExpPrototype::RegExpPrototype(VM& vm, Structure* structure)
+ : JSNonFinalObject(vm, structure)
{
}
@@ -87,6 +87,8 @@
Base::finishCreation(vm);
ASSERT(inherits(info()));
JSC_NATIVE_FUNCTION(vm.propertyNames->searchSymbol, regExpProtoFuncSearch, DontEnum, 1);
+
+ m_emptyRegExp.set(vm, this, RegExp::create(vm, "", NoFlags));
}
bool RegExpPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
@@ -94,6 +96,15 @@
return getStaticFunctionSlot<Base>(exec, regExpPrototypeTable, jsCast<RegExpPrototype*>(object), propertyName, slot);
}
+void RegExpPrototype::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ RegExpPrototype* thisObject = jsCast<RegExpPrototype*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ Base::visitChildren(thisObject, visitor);
+
+ visitor.append(&thisObject->m_emptyRegExp);
+}
+
// ------------------------------ Functions ---------------------------
EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec)
Modified: trunk/Source/_javascript_Core/runtime/RegExpPrototype.h (198446 => 198447)
--- trunk/Source/_javascript_Core/runtime/RegExpPrototype.h 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/runtime/RegExpPrototype.h 2016-03-18 23:14:34 UTC (rev 198447)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2000 Harri Porten ([email protected])
- * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2003, 2007-2008, 2016 Apple Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,19 +21,19 @@
#ifndef RegExpPrototype_h
#define RegExpPrototype_h
-#include "RegExpObject.h"
#include "JSObject.h"
+#include "RegExp.h"
namespace JSC {
-class RegExpPrototype : public RegExpObject {
+class RegExpPrototype : public JSNonFinalObject {
public:
- typedef RegExpObject Base;
+ typedef JSNonFinalObject Base;
static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;
- static RegExpPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp)
+ static RegExpPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
- RegExpPrototype* prototype = new (NotNull, allocateCell<RegExpPrototype>(vm.heap)) RegExpPrototype(vm, structure, regExp);
+ RegExpPrototype* prototype = new (NotNull, allocateCell<RegExpPrototype>(vm.heap)) RegExpPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
@@ -45,12 +45,18 @@
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
+ JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
+
+ RegExp* emptyRegExp() const { return m_emptyRegExp.get(); }
+
protected:
- RegExpPrototype(VM&, Structure*, RegExp*);
+ RegExpPrototype(VM&, Structure*);
private:
void finishCreation(VM&, JSGlobalObject*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+
+ WriteBarrier<RegExp> m_emptyRegExp;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/tests/es6.yaml (198446 => 198447)
--- trunk/Source/_javascript_Core/tests/es6.yaml 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/tests/es6.yaml 2016-03-18 23:14:34 UTC (rev 198447)
@@ -867,7 +867,7 @@
- path: es6/Map_Map[Symbol.species].js
cmd: runES6 :normal
- path: es6/miscellaneous_built-in_prototypes_are_not_instances.js
- cmd: runES6 :fail
+ cmd: runES6 :normal
- path: es6/miscellaneous_function_length_is_configurable.js
cmd: runES6 :normal
- path: es6/miscellaneous_no_assignments_allowed_in_for-in_head.js
Modified: trunk/Source/_javascript_Core/tests/mozilla/ecma_2/shell.js (198446 => 198447)
--- trunk/Source/_javascript_Core/tests/mozilla/ecma_2/shell.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/tests/mozilla/ecma_2/shell.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -42,13 +42,23 @@
var PASSED = " PASSED!"
var FAILED = " FAILED! expected: ";
+function stringify(x) {
+ let str;
+ try {
+ str = "" + x;
+ } catch (e) {
+ str = Object.prototype.toString.call(x);
+ }
+ return str;
+}
+
function test() {
for ( tc=0; tc < testcases.length; tc++ ) {
testcases[tc].passed = writeTestCaseResult(
testcases[tc].expect,
testcases[tc].actual,
testcases[tc].description +" = "+
- testcases[tc].actual );
+ stringify(testcases[tc].actual));
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
}
@@ -167,7 +177,7 @@
function getFailedCases() {
for ( var i = 0; i < testcases.length; i++ ) {
if ( ! testcases[i].passed ) {
- print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ print( testcases[i].description +" = " +stringify(testcases[i].actual) +" expected: "+ stringify(testcases[i].expect));
}
}
}
@@ -177,7 +187,7 @@
testcases[tc].reason = msg;
writeTestCaseResult( testcases[tc].expect,
testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual +
+ testcases[tc].description +" = "+ stringify(testcases[tc].actual) +
": " + testcases[tc].reason );
stopTest();
return true;
@@ -194,8 +204,8 @@
function getFailedCases() {
for ( var i = 0; i < testcases.length; i++ ) {
if ( ! testcases[i].passed ) {
- writeLineToLog( testcases[i].description +" = " +testcases[i].actual +
- " expected: "+ testcases[i].expect );
+ writeLineToLog( testcases[i].description +" = " + stringify(testcases[i].actual) +
+ " expected: "+ stringify(testcases[i].expect));
}
}
}
Modified: trunk/Source/_javascript_Core/tests/stress/static-getter-in-names.js (198446 => 198447)
--- trunk/Source/_javascript_Core/tests/stress/static-getter-in-names.js 2016-03-18 22:35:33 UTC (rev 198446)
+++ trunk/Source/_javascript_Core/tests/stress/static-getter-in-names.js 2016-03-18 23:14:34 UTC (rev 198447)
@@ -3,5 +3,5 @@
throw new Error('bad value: ' + actual);
}
-shouldBe(JSON.stringify(Object.getOwnPropertyNames(RegExp.prototype).sort()), '["compile","constructor","exec","flags","global","ignoreCase","lastIndex","multiline","source","sticky","test","toString","unicode"]');
+shouldBe(JSON.stringify(Object.getOwnPropertyNames(RegExp.prototype).sort()), '["compile","constructor","exec","flags","global","ignoreCase","multiline","source","sticky","test","toString","unicode"]');
shouldBe(JSON.stringify(Object.getOwnPropertyNames(/Cocoa/).sort()), '["lastIndex"]');