Changeset 207334 in webkit


Ignore:
Timestamp:
Oct 14, 2016 3:04:42 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-10-14
Reviewed by Yusuke Suzuki.

JSTests:

  • test262.yaml:

Source/JavaScriptCore:

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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r207326 r207334  
     12016-10-14  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        test262: Failure with RegExp.prototype.compile when pattern is undefined
     4        https://bugs.webkit.org/show_bug.cgi?id=163431
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * test262.yaml:
     9
    1102016-10-13  Joseph Pecoraro  <pecoraro@apple.com>
    211
  • trunk/JSTests/test262.yaml

    r206738 r207334  
    449449  cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
    450450- path: test262/test/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js
    451   cmd: runTest262 :fail, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
     451  cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
    452452- path: test262/test/annexB/built-ins/RegExp/prototype/compile/pattern-undefined.js
    453   cmd: runTest262 :fail, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
     453  cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], [:strict]
    454454- path: test262/test/annexB/built-ins/RegExp/prototype/compile/this-not-object.js
    455455  cmd: runTest262 :normal, "NoException", ["../../../../../../harness/assert.js", "../../../../../../harness/sta.js"], []
  • trunk/LayoutTests/ChangeLog

    r207333 r207334  
     12016-10-14  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        test262: Failure with RegExp.prototype.compile when pattern is undefined
     4        https://bugs.webkit.org/show_bug.cgi?id=163431
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * js/regexp-compile-expected.txt:
     9        * js/script-tests/regexp-compile.js:
     10
    1112016-10-14  Antoine Quint  <graouts@apple.com>
    212
  • trunk/LayoutTests/js/regexp-compile-expected.txt

    r202770 r207334  
    1818PASS re.toString() is '/c/i'
    1919PASS re.compile(new RegExp('+')); threw exception SyntaxError: Invalid regular expression: nothing to repeat.
    20 PASS re.toString() is '/undefined/'
     20PASS re.toString() is '/(?:)/'
     21PASS re.toString() is '/(?:)/'
     22PASS re.toString() is '/(?:)/'
    2123PASS re.toString() is '/null/'
    22 PASS re.toString() is '/(?:)/'
    2324PASS re.toString() is '/z/'
    2425PASS re.lastIndex is 0
  • trunk/LayoutTests/js/script-tests/regexp-compile.js

    r202770 r207334  
    3232shouldThrow("re.compile(new RegExp('+'));");
    3333
     34re.compile();
     35shouldBe("re.toString()", "'/(?:)/'");
    3436re.compile(undefined);
    35 shouldBe("re.toString()", "'/undefined/'");
     37shouldBe("re.toString()", "'/(?:)/'");
     38re.compile("");
     39shouldBe("re.toString()", "'/(?:)/'");
    3640
    3741re.compile(null);
    3842shouldBe("re.toString()", "'/null/'");
    39 
    40 re.compile();
    41 shouldBe("re.toString()", "'/(?:)/'");
    4243
    4344re.compile("z", undefined);
  • trunk/Source/JavaScriptCore/ChangeLog

    r207326 r207334  
     12016-10-14  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        test262: Failure with RegExp.prototype.compile when pattern is undefined
     4        https://bugs.webkit.org/show_bug.cgi?id=163431
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        If pattern is undefined let P be the empty String.
     9        https://tc39.github.io/ecma262/#sec-regexpinitialize
     10
     11        * runtime/RegExpPrototype.cpp:
     12        (JSC::regExpProtoFuncCompile):
     13
    1142016-10-13  Joseph Pecoraro  <pecoraro@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r206386 r207334  
    159159        regExp = asRegExpObject(arg0)->regExp();
    160160    } else {
    161         String pattern = !exec->argumentCount() ? emptyString() : arg0.toString(exec)->value(exec);
     161        String pattern = arg0.isUndefined() ? emptyString() : arg0.toString(exec)->value(exec);
    162162        RETURN_IF_EXCEPTION(scope, encodedJSValue());
    163163
Note: See TracChangeset for help on using the changeset viewer.