Skip to content
  • barraclough@apple.com's avatar
    Bug 56041 - RexExp constructor should only accept flags "gim" · 745949b0
    barraclough@apple.com authored
    Fix for issues introduced in r80667.
    
    Reviewed by Sam Weinig.
    
    Source/JavaScriptCore: 
    
    Invalid flags to a RegExp literal are a late syntax error!
    
    * bytecode/CodeBlock.h:
    (JSC::CodeBlock::addRegExp):
        - Pass a PassRefPtr<RegExp>
    * bytecompiler/BytecodeGenerator.cpp:
    (JSC::BytecodeGenerator::addRegExp):
    (JSC::BytecodeGenerator::emitNewRegExp):
    * bytecompiler/BytecodeGenerator.h:
        - Pass a PassRefPtr<RegExp>
    * bytecompiler/NodesCodegen.cpp:
    (JSC::RegExpNode::emitBytecode):
        - Should not be ASSERTing that the flags are valid - this is a late(er) error.
    * interpreter/Interpreter.cpp:
    (JSC::Interpreter::privateExecute):
        - Need to check for error from RegExp constructor.
    * jit/JITStubs.cpp:
    (JSC::DEFINE_STUB_FUNCTION):
        - Need to check for error from RegExp constructor.
    * runtime/RegExp.h:
    (JSC::RegExp::isValid):
        - Make isValid check that the regexp was created with valid flags.
    * runtime/RegExpKey.h:
        - Since we'll not create RegExp objects with invalid flags, separate out the deleted value.
    
    LayoutTests: 
    
    * fast/regex/script-tests/parentheses.js:
    * fast/regex/script-tests/pcre-test-1.js:
        - Providing invalid flags to RegExp literals is an error in ES5.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    745949b0