Changeset 202770 in webkit


Ignore:
Timestamp:
Jul 1, 2016 7:20:39 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

[JSC] RegExp.compile is not returning the regexp when it succeed
https://bugs.webkit.org/show_bug.cgi?id=159381

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-07-01
Reviewed by Mark Lam.

Source/JavaScriptCore:

Spec:
-https://tc39.github.io/ecma262/#sec-regexp.prototype.compile
-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:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202769 r202770  
     12016-07-01  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] RegExp.compile is not returning the regexp when it succeed
     4        https://bugs.webkit.org/show_bug.cgi?id=159381
     5
     6        Reviewed by Mark Lam.
     7
     8        * js/regexp-compile-expected.txt:
     9        * js/script-tests/regexp-compile.js:
     10
    1112016-07-01  Zalan Bujtas  <zalan@apple.com>
    212
  • trunk/LayoutTests/js/regexp-compile-expected.txt

    r53062 r202770  
    2424PASS re.lastIndex is 0
    2525PASS re.lastIndex is 1
     26PASS regexpWithUndefinedCompiledToValid = new RegExp(undefined), regexpWithUndefinedCompiledToValid.compile('abc') is regexpWithUndefinedCompiledToValid
     27PASS regexpValidPatternCompiledToValid = new RegExp('zyx'), regexpValidPatternCompiledToValid.compile('abc') is regexpValidPatternCompiledToValid
     28PASS regexpWithValidCompiledToUndefined = new RegExp('abc'), regexpWithValidCompiledToUndefined.compile(undefined) is regexpWithValidCompiledToUndefined
    2629PASS successfullyParsed is true
    2730
  • trunk/LayoutTests/js/script-tests/regexp-compile.js

    r98407 r202770  
    5050re.exec("aaa");
    5151shouldBe("re.lastIndex", "1");
     52
     53// Compile returns the regexp itself.
     54shouldBe("regexpWithUndefinedCompiledToValid = new RegExp(undefined), regexpWithUndefinedCompiledToValid.compile('abc')", "regexpWithUndefinedCompiledToValid");
     55shouldBe("regexpValidPatternCompiledToValid = new RegExp('zyx'), regexpValidPatternCompiledToValid.compile('abc')", "regexpValidPatternCompiledToValid");
     56shouldBe("regexpWithValidCompiledToUndefined = new RegExp('abc'), regexpWithValidCompiledToUndefined.compile(undefined)", "regexpWithValidCompiledToUndefined");
  • trunk/Source/JavaScriptCore/ChangeLog

    r202768 r202770  
     12016-07-01  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] RegExp.compile is not returning the regexp when it succeed
     4        https://bugs.webkit.org/show_bug.cgi?id=159381
     5
     6        Reviewed by Mark Lam.
     7
     8        Spec:
     9        -https://tc39.github.io/ecma262/#sec-regexp.prototype.compile
     10        -https://tc39.github.io/ecma262/#sec-regexpinitialize
     11
     12        * runtime/RegExpPrototype.cpp:
     13        (JSC::regExpProtoFuncCompile):
     14
    1152016-07-01  Saam Barati  <sbarati@apple.com>
    216
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r201787 r202770  
    167167    asRegExpObject(thisValue)->setRegExp(exec->vm(), regExp);
    168168    asRegExpObject(thisValue)->setLastIndex(exec, 0);
    169     return JSValue::encode(jsUndefined());
     169    return JSValue::encode(thisValue);
    170170}
    171171
Note: See TracChangeset for help on using the changeset viewer.