Title: [207334] trunk
Revision
207334
Author
commit-qu...@webkit.org
Date
2016-10-14 03:04:42 -0700 (Fri, 14 Oct 2016)

Log Message

test262: Failure with RegExp.prototype.compile when pattern is undefined
https://bugs.webkit.org/show_bug.cgi?id=163431

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-10-14
Reviewed by Yusuke Suzuki.

JSTests:

* test262.yaml:

Source/_javascript_Core:

If pattern is undefined let P be the empty String.
https://tc39.github.io/ecma262/#sec-regexpinitialize

* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncCompile):

LayoutTests:

* js/regexp-compile-expected.txt:
* js/script-tests/regexp-compile.js:

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (207333 => 207334)


--- trunk/JSTests/ChangeLog	2016-10-14 09:49:47 UTC (rev 207333)
+++ trunk/JSTests/ChangeLog	2016-10-14 10:04:42 UTC (rev 207334)
@@ -1,3 +1,12 @@
+2016-10-14  Joseph Pecoraro  <pecor...@apple.com>
+
+        test262: Failure with RegExp.prototype.compile when pattern is undefined
+        https://bugs.webkit.org/show_bug.cgi?id=163431
+
+        Reviewed by Yusuke Suzuki.
+
+        * test262.yaml:
+
 2016-10-13  Joseph Pecoraro  <pecor...@apple.com>
 
         Exception message for expressions with multiple bracket accesses is inconsistent / incorrect

Modified: trunk/JSTests/test262.yaml (207333 => 207334)


--- trunk/JSTests/test262.yaml	2016-10-14 09:49:47 UTC (rev 207333)
+++ trunk/JSTests/test262.yaml	2016-10-14 10:04:42 UTC (rev 207334)
@@ -448,9 +448,9 @@
 - path: test262/test/annexB/built-ins/RegExp/prototype/compile/pattern-to-string-err.js
   cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js
-  cmd: runTest262 :fail, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js
-  cmd: runTest262 :fail, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
 - path: test262/test/annexB/built-ins/RegExp/prototype/compile/this-not-object.js
   cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
 - path: test262/test/annexB/built-ins/RegExp/prototype/compile/this-not-object.js

Modified: trunk/LayoutTests/ChangeLog (207333 => 207334)


--- trunk/LayoutTests/ChangeLog	2016-10-14 09:49:47 UTC (rev 207333)
+++ trunk/LayoutTests/ChangeLog	2016-10-14 10:04:42 UTC (rev 207334)
@@ -1,3 +1,13 @@
+2016-10-14  Joseph Pecoraro  <pecor...@apple.com>
+
+        test262: Failure with RegExp.prototype.compile when pattern is undefined
+        https://bugs.webkit.org/show_bug.cgi?id=163431
+
+        Reviewed by Yusuke Suzuki.
+
+        * js/regexp-compile-expected.txt:
+        * js/script-tests/regexp-compile.js:
+
 2016-10-14  Antoine Quint  <grao...@apple.com>
 
         REGRESSION (r207299): media/modern-media-controls/pip-button/pip-button.html and media/modern-media-controls/skip-back-button/skip-back-button.html are flaky

Modified: trunk/LayoutTests/js/regexp-compile-expected.txt (207333 => 207334)


--- trunk/LayoutTests/js/regexp-compile-expected.txt	2016-10-14 09:49:47 UTC (rev 207333)
+++ trunk/LayoutTests/js/regexp-compile-expected.txt	2016-10-14 10:04:42 UTC (rev 207334)
@@ -17,9 +17,10 @@
 PASS re.compile(new RegExp('c'), 'i'); threw exception TypeError: Cannot supply flags when constructing one RegExp from another..
 PASS re.toString() is '/c/i'
 PASS re.compile(new RegExp('+')); threw exception SyntaxError: Invalid regular _expression_: nothing to repeat.
-PASS re.toString() is '/undefined/'
+PASS re.toString() is '/(?:)/'
+PASS re.toString() is '/(?:)/'
+PASS re.toString() is '/(?:)/'
 PASS re.toString() is '/null/'
-PASS re.toString() is '/(?:)/'
 PASS re.toString() is '/z/'
 PASS re.lastIndex is 0
 PASS re.lastIndex is 1

Modified: trunk/LayoutTests/js/script-tests/regexp-compile.js (207333 => 207334)


--- trunk/LayoutTests/js/script-tests/regexp-compile.js	2016-10-14 09:49:47 UTC (rev 207333)
+++ trunk/LayoutTests/js/script-tests/regexp-compile.js	2016-10-14 10:04:42 UTC (rev 207334)
@@ -31,15 +31,16 @@
 
 shouldThrow("re.compile(new RegExp('+'));");
 
+re.compile();
+shouldBe("re.toString()", "'/(?:)/'");
 re.compile(undefined);
-shouldBe("re.toString()", "'/undefined/'");
+shouldBe("re.toString()", "'/(?:)/'");
+re.compile("");
+shouldBe("re.toString()", "'/(?:)/'");
 
 re.compile(null);
 shouldBe("re.toString()", "'/null/'");
 
-re.compile();
-shouldBe("re.toString()", "'/(?:)/'");
-
 re.compile("z", undefined);
 shouldBe("re.toString()", "'/z/'");
 

Modified: trunk/Source/_javascript_Core/ChangeLog (207333 => 207334)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-14 09:49:47 UTC (rev 207333)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-14 10:04:42 UTC (rev 207334)
@@ -1,3 +1,16 @@
+2016-10-14  Joseph Pecoraro  <pecor...@apple.com>
+
+        test262: Failure with RegExp.prototype.compile when pattern is undefined
+        https://bugs.webkit.org/show_bug.cgi?id=163431
+
+        Reviewed by Yusuke Suzuki.
+
+        If pattern is undefined let P be the empty String.
+        https://tc39.github.io/ecma262/#sec-regexpinitialize
+
+        * runtime/RegExpPrototype.cpp:
+        (JSC::regExpProtoFuncCompile):
+
 2016-10-13  Joseph Pecoraro  <pecor...@apple.com>
 
         Exception message for expressions with multiple bracket accesses is inconsistent / incorrect

Modified: trunk/Source/_javascript_Core/runtime/RegExpPrototype.cpp (207333 => 207334)


--- trunk/Source/_javascript_Core/runtime/RegExpPrototype.cpp	2016-10-14 09:49:47 UTC (rev 207333)
+++ trunk/Source/_javascript_Core/runtime/RegExpPrototype.cpp	2016-10-14 10:04:42 UTC (rev 207334)
@@ -158,7 +158,7 @@
             return throwVMTypeError(exec, scope, ASCIILiteral("Cannot supply flags when constructing one RegExp from another."));
         regExp = asRegExpObject(arg0)->regExp();
     } else {
-        String pattern = !exec->argumentCount() ? emptyString() : arg0.toString(exec)->value(exec);
+        String pattern = arg0.isUndefined() ? emptyString() : arg0.toString(exec)->value(exec);
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
         RegExpFlags flags = NoFlags;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to