[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

barraclough at apple.com barraclough at apple.com
Fri Jan 21 15:16:58 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 7e6bd6d6f5aa95a45eafea5112c2d96cb2373a57
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 10 20:20:15 2011 +0000

    Bug 52079 - Syntax errors should be early errors.
    
    Reviewed by Oliver Hunt.
    
    Source/JavaScriptCore:
    
    From chapter 16 the spec:
        An implementation must report most errors at the time the relevant ECMAScript language construct is
        evaluated. An early error is an error that can be detected and reported prior to the evaluation of
        any construct in the Program containing the error. An implementation must report early errors in a
        Program prior to the first evaluation of that Program. Early errors in eval code are reported at
        the time eval is called but prior to evaluation of any construct within the eval code. All errors
        that are not early errors are runtime errors.
    
        An implementation must treat any instance of the following kinds of errors as an early error:
            * Any syntax error."
    
    * JavaScriptCore.xcodeproj/project.pbxproj:
        Added new files.
    * bytecode/CodeBlock.cpp:
        Removed op_throw_syntax_error.
    * bytecode/Opcode.h:
        Removed op_throw_syntax_error.
    * bytecompiler/BytecodeGenerator.cpp:
    (JSC::BytecodeGenerator::generate):
        If m_expressionTooDeep then throw a runtime error.
    (JSC::BytecodeGenerator::BytecodeGenerator):
        Initialize m_expressionTooDeep.
    (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):
        Sets m_expressionTooDeep.
    * bytecompiler/BytecodeGenerator.h:
        Added m_expressionTooDeep, removed emitThrowSyntaxError.
    * bytecompiler/NodesCodegen.cpp:
    (JSC::RegExpNode::emitBytecode):
    (JSC::ContinueNode::emitBytecode):
    (JSC::BreakNode::emitBytecode):
    (JSC::ReturnNode::emitBytecode):
    (JSC::LabelNode::emitBytecode):
        Conditions that threw syntax error are now handled during parsing;
        during bytecompilation these are now just ASSERTs.
    * interpreter/Interpreter.cpp:
    (JSC::Interpreter::privateExecute):
    * jit/JIT.cpp:
    (JSC::JIT::privateCompileMainPass):
    * jit/JIT.h:
    * jit/JITOpcodes.cpp:
    * jit/JITOpcodes32_64.cpp:
    * jit/JITStubs.cpp:
    * jit/JITStubs.h:
        Removed op_throw_syntax_error.
    * parser/ASTBuilder.h:
    (JSC::ASTBuilder::createRegExp):
        Renamed; added syntax check.
    * parser/JSParser.cpp:
    (JSC::JSParser::breakIsValid):
    (JSC::JSParser::hasLabel):
    (JSC::JSParser::Scope::Scope):
    (JSC::JSParser::Scope::setIsFunction):
    (JSC::JSParser::Scope::isFunctionBoundary):
    (JSC::JSParser::ScopeRef::hasContainingScope):
    (JSC::JSParser::ScopeRef::containingScope):
    (JSC::JSParser::AutoPopScopeRef::AutoPopScopeRef):
    (JSC::JSParser::AutoPopScopeRef::~AutoPopScopeRef):
    (JSC::JSParser::AutoPopScopeRef::setPopped):
    (JSC::JSParser::popScopeInternal):
    (JSC::JSParser::popScope):
    (JSC::jsParse):
    (JSC::JSParser::JSParser):
    (JSC::JSParser::parseProgram):
    (JSC::JSParser::parseBreakStatement):
    (JSC::JSParser::parseContinueStatement):
    (JSC::JSParser::parseReturnStatement):
    (JSC::JSParser::parseTryStatement):
    (JSC::JSParser::parseFunctionInfo):
    (JSC::JSParser::parseExpressionOrLabelStatement):
    (JSC::JSParser::parsePrimaryExpression):
    * parser/JSParser.h:
    * parser/Nodes.h:
    * parser/Parser.cpp:
    (JSC::Parser::parse):
    * parser/SyntaxChecker.h:
    (JSC::SyntaxChecker::createRegExp):
        Renamed; added syntax check.
    * runtime/ExceptionHelpers.cpp:
    (JSC::createOutOfMemoryError):
    (JSC::throwOutOfMemoryError):
    * runtime/ExceptionHelpers.h:
        Broke out createOutOfMemoryError.
    * runtime/Executable.cpp:
    (JSC::EvalExecutable::compileInternal):
    (JSC::ProgramExecutable::compileInternal):
    (JSC::FunctionExecutable::compileForCallInternal):
    (JSC::FunctionExecutable::compileForConstructInternal):
        Add check for exception after bytecode generation.
    * runtime/RegExpConstructor.cpp:
    (JSC::constructRegExp):
    * runtime/RegExpPrototype.cpp:
    (JSC::regExpProtoFuncCompile):
        RegExp error prefixes not included in error string.
    * yarr/RegexParser.h:
    (JSC::Yarr::Parser::parse):
        Removed regexBegin/regexEnd/regexError.
    * yarr/RegexPattern.cpp:
    (JSC::Yarr::RegexPatternConstructor::regexBegin):
        Removed regexEnd/regexError.
    (JSC::Yarr::compileRegex):
        Add call to regexBegin (no longer called from the parser).
    * yarr/YarrSyntaxChecker.cpp: Added.
    (JSC::Yarr::SyntaxChecker::assertionBOL):
    (JSC::Yarr::SyntaxChecker::assertionEOL):
    (JSC::Yarr::SyntaxChecker::assertionWordBoundary):
    (JSC::Yarr::SyntaxChecker::atomPatternCharacter):
    (JSC::Yarr::SyntaxChecker::atomBuiltInCharacterClass):
    (JSC::Yarr::SyntaxChecker::atomCharacterClassBegin):
    (JSC::Yarr::SyntaxChecker::atomCharacterClassAtom):
    (JSC::Yarr::SyntaxChecker::atomCharacterClassRange):
    (JSC::Yarr::SyntaxChecker::atomCharacterClassBuiltIn):
    (JSC::Yarr::SyntaxChecker::atomCharacterClassEnd):
    (JSC::Yarr::SyntaxChecker::atomParenthesesSubpatternBegin):
    (JSC::Yarr::SyntaxChecker::atomParentheticalAssertionBegin):
    (JSC::Yarr::SyntaxChecker::atomParenthesesEnd):
    (JSC::Yarr::SyntaxChecker::atomBackReference):
    (JSC::Yarr::SyntaxChecker::quantifyAtom):
    (JSC::Yarr::SyntaxChecker::disjunction):
    (JSC::Yarr::checkSyntax):
    * yarr/YarrSyntaxChecker.h: Added.
        Check RegExp syntax.
    
    LayoutTests:
    
    Fix syntax errors in layout tests, and update expected results.
    
    * editing/selection/select-crash-001.html:
    * editing/selection/select-crash-002.html:
    * fast/canvas/webgl/renderbuffer-initialization.html:
    * fast/forms/25153.html:
    * fast/forms/textfield-drag-into-disabled.html:
    * fast/js/exception-codegen-crash-expected.txt:
    * fast/js/exception-codegen-crash.html:
    * fast/js/kde/parse-expected.txt:
    * fast/js/kde/script-tests/parse.js:
    * fast/js/large-expressions-expected.txt:
    * fast/js/named-function-expression-expected.txt:
    * fast/js/parser-syntax-check-expected.txt:
    * fast/js/script-tests/large-expressions.js:
    * fast/js/script-tests/named-function-expression.js:
    * fast/js/script-tests/parser-syntax-check.js:
    * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8-expected.txt:
    * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9-expected.txt:
    * http/tests/security/isolatedWorld/events.html:
    * http/tests/security/isolatedWorld/userGestureEvents.html:
    * svg/custom/resources/use-instanceRoot-event-listeners.js:
    * svg/custom/rgbcolor-syntax.svg:
    * svg/custom/use-instanceRoot-modifications.svg:
    * svg/custom/use-property-changes-through-svg-dom.svg:
    * webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive:
    * webarchive/resources/adopt-attribute-styled-body-iframe.html:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75408 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1caacc6..d52aa34 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,69 @@
+2011-01-10  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Bug 52079 - Syntax errors should be early errors.
+
+        Fix syntax errors in layout tests, and update expected results.
+
+        * editing/selection/select-crash-001.html:
+        * editing/selection/select-crash-002.html:
+        * fast/canvas/webgl/renderbuffer-initialization.html:
+        * fast/forms/25153.html:
+        * fast/forms/textfield-drag-into-disabled.html:
+        * fast/js/exception-codegen-crash-expected.txt:
+        * fast/js/exception-codegen-crash.html:
+        * fast/js/kde/parse-expected.txt:
+        * fast/js/kde/script-tests/parse.js:
+        * fast/js/large-expressions-expected.txt:
+        * fast/js/named-function-expression-expected.txt:
+        * fast/js/parser-syntax-check-expected.txt:
+        * fast/js/script-tests/large-expressions.js:
+        * fast/js/script-tests/named-function-expression.js:
+        * fast/js/script-tests/parser-syntax-check.js:
+        * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8-expected.txt:
+        * fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9-expected.txt:
+        * http/tests/security/isolatedWorld/events.html:
+        * http/tests/security/isolatedWorld/userGestureEvents.html:
+        * svg/custom/resources/use-instanceRoot-event-listeners.js:
+        * svg/custom/rgbcolor-syntax.svg:
+        * svg/custom/use-instanceRoot-modifications.svg:
+        * svg/custom/use-property-changes-through-svg-dom.svg:
+        * webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive:
+        * webarchive/resources/adopt-attribute-styled-body-iframe.html:
+
 2011-01-10  Tony Chang  <tony at chromium.org>
 
         Unreviewed, remove duplicate test expectation for gif-loop-count.
diff --git a/LayoutTests/editing/selection/select-crash-001.html b/LayoutTests/editing/selection/select-crash-001.html
index cc96978..1601957 100644
--- a/LayoutTests/editing/selection/select-crash-001.html
+++ b/LayoutTests/editing/selection/select-crash-001.html
@@ -10,14 +10,14 @@ html,body,h1{font-size:100%;font-style:inherit;font-weight:inherit;margin:0;padd
 <body>
 <h1 id="test">The Longest German Word?</h1>
 <script type="text/javascript" language="javascript">
-    if (!window.layoutTestController)
-        return;
-    layoutTestController.dumpAsText();
-    var element = document.getElementById("test");
-    var selection = window.getSelection();
-    selection.setPosition(element.firstChild, 2);
-    extendSelectionForwardByCharacterCommand();
-    copyCommand();
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        var element = document.getElementById("test");
+        var selection = window.getSelection();
+        selection.setPosition(element.firstChild, 2);
+        extendSelectionForwardByCharacterCommand();
+        copyCommand();
+    }
 </script>
 </body>
 </html>
diff --git a/LayoutTests/editing/selection/select-crash-002.html b/LayoutTests/editing/selection/select-crash-002.html
index 1b4597b..c3ae342 100644
--- a/LayoutTests/editing/selection/select-crash-002.html
+++ b/LayoutTests/editing/selection/select-crash-002.html
@@ -10,11 +10,11 @@ html,body,h1{font-size:100%;font-style:inherit;font-weight:inherit;margin:0;padd
 <body>
 <h1>The Longest German Word?</h1>
 <script type="text/javascript" language="javascript">
-    if (!window.layoutTestController)
-        return;
-    layoutTestController.dumpAsText();
-    selectAllCommand();
-    copyCommand();
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        selectAllCommand();
+        copyCommand();
+    }
 </script>
 </body>
 </html>
diff --git a/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html b/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html
index 8dd58f6..d2d317c 100644
--- a/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html
+++ b/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html
@@ -66,24 +66,22 @@ description('Verify renderbuffers are initialized to 0 before being read in WebG
 
 var canvas = document.getElementById("testbed");
 var gl = canvas.getContext("experimental-webgl");
-if (!gl) {
-    testFailed('canvas.getContext() failed');
-    return false;
-}
+if (gl) {
+    runTest(gl, canvas.width, canvas.height);
 
-runTest(gl, canvas.width, canvas.height);
+    // Testing that canvas resizing will clear the buffers with 0 instead of the current clear values.
+    gl.clearColor(1, 0, 0, 1);
+    canvas.width += 1;
+    canvas.height += 1;
+    runTest(gl, canvas.width, canvas.height);
 
-// Testing that canvas resizing will clear the buffers with 0 instead of the current clear values.
-gl.clearColor(1, 0, 0, 1);
-canvas.width += 1;
-canvas.height += 1;
-runTest(gl, canvas.width, canvas.height);
+    // Testing buffer clearing won't change the clear values.
+    var clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE);
+    shouldBe("clearColor", "[1, 0, 0, 1]");
 
-// Testing buffer clearing won't change the clear values.
-var clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE);
-shouldBe("clearColor", "[1, 0, 0, 1]");
-
-successfullyParsed = true;
+    successfullyParsed = true;
+} else
+    testFailed('canvas.getContext() failed');
 </script>
 <script src="../../js/resources/js-test-post.js"></script>
 </body>
diff --git a/LayoutTests/fast/forms/25153.html b/LayoutTests/fast/forms/25153.html
index 8a61232..a3c471a 100644
--- a/LayoutTests/fast/forms/25153.html
+++ b/LayoutTests/fast/forms/25153.html
@@ -2,18 +2,18 @@ This tests to make sure that clicking inside a text field places the caret in it
 <input id="textfield" onFocus="window.scrollBy(0, 40)" value="click in me"><br>
 <div style="height: 1500px;">
 <script>
-if (!window.layoutTestController)
-    return;
-window.layoutTestController.dumpAsText();
-textfield = document.getElementById("textfield");
-// Click near the end of the field so that the caret after all of the text inside it.
-x = textfield.offsetParent.offsetLeft + textfield.offsetLeft + textfield.offsetWidth - 5;
-y = textfield.offsetParent.offsetTop + textfield.offsetTop + textfield.offsetHeight / 2;
-eventSender.mouseMoveTo(x, y);
-eventSender.mouseDown();
-eventSender.mouseUp();
-if (textfield.selectionStart == textfield.value.length && textfield.selectionEnd == textfield.value.length)
-    document.body.innerText = "Success"
-else
-    document.body.innerText = "Failure.  Expected selection to be after all of the text in the text field."
+if (window.layoutTestController) {
+    window.layoutTestController.dumpAsText();
+    textfield = document.getElementById("textfield");
+    // Click near the end of the field so that the caret after all of the text inside it.
+    x = textfield.offsetParent.offsetLeft + textfield.offsetLeft + textfield.offsetWidth - 5;
+    y = textfield.offsetParent.offsetTop + textfield.offsetTop + textfield.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    if (textfield.selectionStart == textfield.value.length && textfield.selectionEnd == textfield.value.length)
+        document.body.innerText = "Success"
+    else
+        document.body.innerText = "Failure.  Expected selection to be after all of the text in the text field."
+}
 </script>
diff --git a/LayoutTests/fast/forms/textfield-drag-into-disabled.html b/LayoutTests/fast/forms/textfield-drag-into-disabled.html
index 8240e52..5e73744 100644
--- a/LayoutTests/fast/forms/textfield-drag-into-disabled.html
+++ b/LayoutTests/fast/forms/textfield-drag-into-disabled.html
@@ -17,21 +17,20 @@ var fieldY = field.offsetTop + field.offsetHeight / 2;
 
 window.getSelection().setBaseAndExtent(text, 0, text, 1);
 
-if (!window.layoutTestController)
-    return;
+if (window.layoutTestController) {
+    eventSender.mouseMoveTo(textX, textY);
+    eventSender.mouseDown();
+    // leap forward so mouseDown will kick off a drag instead of starting a new selection.
+    eventSender.leapForward(1000);
 
-eventSender.mouseMoveTo(textX, textY);
-eventSender.mouseDown();
-// leap forward so mouseDown will kick off a drag instead of starting a new selection.
-eventSender.leapForward(1000);
+    eventSender.mouseMoveTo(fieldX, fieldY);
+    eventSender.mouseUp();
 
-eventSender.mouseMoveTo(fieldX, fieldY);
-eventSender.mouseUp();
-
-layoutTestController.dumpAsText();
-var resultText = "FAIL"
-if (!field.value)
-    resultText = "PASS -- http://bugs.webkit.org/show_bug.cgi?id=10177";
-document.body.innerText = resultText;
+    layoutTestController.dumpAsText();
+    var resultText = "FAIL"
+    if (!field.value)
+        resultText = "PASS -- http://bugs.webkit.org/show_bug.cgi?id=10177";
+    document.body.innerText = resultText;
+}
 </script>
 </body>
diff --git a/LayoutTests/fast/js/exception-codegen-crash-expected.txt b/LayoutTests/fast/js/exception-codegen-crash-expected.txt
index 90ae472..c43bbef 100644
--- a/LayoutTests/fast/js/exception-codegen-crash-expected.txt
+++ b/LayoutTests/fast/js/exception-codegen-crash-expected.txt
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: line 1: ReferenceError: Postfix ++ operator applied to value that is not a reference.
 This page tests some conditions that used to cause crashes during codegen.
 
 If you don't crash, you pass.
diff --git a/LayoutTests/fast/js/exception-codegen-crash.html b/LayoutTests/fast/js/exception-codegen-crash.html
index e09d19a..71f03e1 100644
--- a/LayoutTests/fast/js/exception-codegen-crash.html
+++ b/LayoutTests/fast/js/exception-codegen-crash.html
@@ -14,5 +14,8 @@ var scripts = [
     "(1 = 1).x;"
 ];
 
-eval(scripts.join("\n"));
+try {
+    eval(scripts.join("\n"));
+} catch (e) {
+}
 </script>
diff --git a/LayoutTests/fast/js/kde/parse-expected.txt b/LayoutTests/fast/js/kde/parse-expected.txt
index 9f36555..ecfef73 100644
--- a/LayoutTests/fast/js/kde/parse-expected.txt
+++ b/LayoutTests/fast/js/kde/parse-expected.txt
@@ -3,6 +3,18 @@ KDE JS Test
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS function test() { return;}; lab: 1 is 1
+PASS function test() { while(0) break; } lab: 1 is 1
+PASS function test() { while(0) continue; } lab: 1 is 1
+PASS function test() { return lab;} lab: 1 is 1
+PASS function test() { while(0) break lab; } lab: 1 threw exception SyntaxError: Parse error.
+PASS function test() { while(0) continue lab; } lab: 1 threw exception SyntaxError: Parse error.
+PASS function test() { return } lab: 1 is 1
+PASS function test() { while(0) break } lab: 1 is 1
+PASS function test() { while(0) continue } lab: 1 is 1
+PASS function test() { return 0 } lab: 1 is 1
+PASS function test() { while(0) break lab } lab: 1 threw exception SyntaxError: Parse error.
+PASS function test() { while(0) continue lab } lab: 1 threw exception SyntaxError: Parse error.
 PASS var éĀʯΈᢨ = 101; éĀʯΈᢨ; is 101
 PASS var f÷; threw exception SyntaxError: Parse error.
 PASS var \u0061 = 102; a is 102
diff --git a/LayoutTests/fast/js/kde/script-tests/parse.js b/LayoutTests/fast/js/kde/script-tests/parse.js
index ed42dac..dd9bf10 100644
--- a/LayoutTests/fast/js/kde/script-tests/parse.js
+++ b/LayoutTests/fast/js/kde/script-tests/parse.js
@@ -1,20 +1,19 @@
-function test() { return;}
-function test() { while(0) break; }
-function test() { while(0) continue; }
-
-function test() { return lab;}
-function test() { while(0) break lab; }
-function test() { while(0) continue lab; }
-
-function test() { return }
-function test() { while(0) break }
-function test() { while(0) continue }
-
-function test() { return 0 }
-function test() { while(0) break lab }
-function test() { while(0) continue lab }
-
-lab:
+// Check parsing of nested scopes; a couple of the break/continue to label cases are invalid.
+shouldBe("function test() { return;}; lab: 1", "1");
+shouldBe("function test() { while(0) break; } lab: 1", "1");
+shouldBe("function test() { while(0) continue; } lab: 1", "1");
+
+shouldBe("function test() { return lab;} lab: 1", "1");
+shouldThrow("function test() { while(0) break lab; } lab: 1");
+shouldThrow("function test() { while(0) continue lab; } lab: 1");
+
+shouldBe("function test() { return } lab: 1", "1");
+shouldBe("function test() { while(0) break } lab: 1", "1");
+shouldBe("function test() { while(0) continue } lab: 1", "1");
+
+shouldBe("function test() { return 0 } lab: 1", "1");
+shouldThrow("function test() { while(0) break lab } lab: 1");
+shouldThrow("function test() { while(0) continue lab } lab: 1");
 
 a = 1
 b = 123 // comment
diff --git a/LayoutTests/fast/js/large-expressions-expected.txt b/LayoutTests/fast/js/large-expressions-expected.txt
index 743964f..879e264 100644
--- a/LayoutTests/fast/js/large-expressions-expected.txt
+++ b/LayoutTests/fast/js/large-expressions-expected.txt
@@ -6,7 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 PASS eval(repeatedExpression("letterA", "+", 100)) is repeatedString("a", 100)
 PASS eval(repeatedExpression("letterA", "+", 1000)) is repeatedString("a", 1000)
 PASS eval(repeatedExpression("letterA", "+", 10000)) is repeatedString("a", 10000)
-PASS eval(repeatedExpression("letterA", "+", 100000)) threw exception SyntaxError: Expression too deep.
+PASS eval(repeatedExpression("letterA", "+", 100000)) threw exception Error: Out of memory.
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/js/named-function-expression-expected.txt b/LayoutTests/fast/js/named-function-expression-expected.txt
index c487707..7b8ecb2 100644
--- a/LayoutTests/fast/js/named-function-expression-expected.txt
+++ b/LayoutTests/fast/js/named-function-expression-expected.txt
@@ -16,7 +16,7 @@ PASS (function Foo(){ return 1; }); try { Foo(); throw "FuncExpr was stored"; }
 recursion is possible, though
 PASS var ctr = 3; var x = (function Named(a,b){ if(--ctr) return 2 * Named(a,b); else return a + b; }); x(5,6) is 44
 regression test where kjs regarded an anonymous function declaration (which is illegal) as a FunctionExpr
-PASS try { eval("function(){ return 2; };"); return 0; } catch(e) { 1; } is 1
+PASS var hadError = 0; try { eval("function(){ return 2; };"); } catch(e) { hadError = 1; }; hadError; is 1
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/js/parser-syntax-check-expected.txt b/LayoutTests/fast/js/parser-syntax-check-expected.txt
index 1879bc1..cf085e4 100644
--- a/LayoutTests/fast/js/parser-syntax-check-expected.txt
+++ b/LayoutTests/fast/js/parser-syntax-check-expected.txt
@@ -265,8 +265,8 @@ PASS Valid:   "do while (0) if (a) {} else y; while(0)"
 PASS Valid:   "function f() { do while (0) if (a) {} else y; while(0) }"
 PASS Valid:   "if (a) while (b) if (c) with(d) {} else e; else f"
 PASS Valid:   "function f() { if (a) while (b) if (c) with(d) {} else e; else f }"
-PASS Valid:   "break ; break your_limits ; continue ; continue living ; debugger"
-PASS Valid:   "function f() { break ; break your_limits ; continue ; continue living ; debugger }"
+PASS Invalid: "break ; break your_limits ; continue ; continue living ; debugger"
+PASS Invalid: "function f() { break ; break your_limits ; continue ; continue living ; debugger }"
 PASS Invalid: "debugger X"
 PASS Invalid: "function f() { debugger X }"
 PASS Invalid: "break 0.2"
@@ -452,8 +452,8 @@ PASS Invalid: "function f() { for (var (a) in b) { } }"
 PASS Valid:   "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}"
 PASS Valid:   "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }"
 try statement
-PASS Valid:   "try { break } catch(e) {}"
-PASS Valid:   "function f() { try { break } catch(e) {} }"
+PASS Invalid: "try { break } catch(e) {}"
+PASS Invalid: "function f() { try { break } catch(e) {} }"
 PASS Valid:   "try {} finally { c++ }"
 PASS Valid:   "function f() { try {} finally { c++ } }"
 PASS Valid:   "try { with (x) { } } catch(e) {} finally { if (a) ; }"
diff --git a/LayoutTests/fast/js/script-tests/large-expressions.js b/LayoutTests/fast/js/script-tests/large-expressions.js
index c019cc8..8ce095e 100644
--- a/LayoutTests/fast/js/script-tests/large-expressions.js
+++ b/LayoutTests/fast/js/script-tests/large-expressions.js
@@ -27,6 +27,6 @@ function repeatedString(value, count)
 shouldBe('eval(repeatedExpression("letterA", "+", 100))', 'repeatedString("a", 100)');
 shouldBe('eval(repeatedExpression("letterA", "+", 1000))', 'repeatedString("a", 1000)');
 shouldBe('eval(repeatedExpression("letterA", "+", 10000))', 'repeatedString("a", 10000)');
-shouldThrow('eval(repeatedExpression("letterA", "+", 100000))', '"SyntaxError: Expression too deep"');
+shouldThrow('eval(repeatedExpression("letterA", "+", 100000))');
 
 var successfullyParsed = true;
diff --git a/LayoutTests/fast/js/script-tests/named-function-expression.js b/LayoutTests/fast/js/script-tests/named-function-expression.js
index d3e623f..7d06e63 100644
--- a/LayoutTests/fast/js/script-tests/named-function-expression.js
+++ b/LayoutTests/fast/js/script-tests/named-function-expression.js
@@ -23,6 +23,6 @@ debug("recursion is possible, though");
 shouldBe("var ctr = 3; var x = (function Named(a,b){ if(--ctr) return 2 * Named(a,b); else return a + b; }); x(5,6)", "44");
 
 debug("regression test where kjs regarded an anonymous function declaration (which is illegal) as a FunctionExpr");
-shouldBe('try { eval("function(){ return 2; };"); return 0; } catch(e) { 1; }', "1");
+shouldBe('var hadError = 0; try { eval("function(){ return 2; };"); } catch(e) { hadError = 1; }; hadError;', "1");
 
 var successfullyParsed = true;
diff --git a/LayoutTests/fast/js/script-tests/parser-syntax-check.js b/LayoutTests/fast/js/script-tests/parser-syntax-check.js
index 1c1316a..135abf8 100644
--- a/LayoutTests/fast/js/script-tests/parser-syntax-check.js
+++ b/LayoutTests/fast/js/script-tests/parser-syntax-check.js
@@ -195,7 +195,7 @@ invalid("do g; while ((4)");
 valid  ("{ { do do do ; while(0) while(0) while(0) } }");
 valid  ("do while (0) if (a) {} else y; while(0)");
 valid  ("if (a) while (b) if (c) with(d) {} else e; else f");
-valid  ("break ; break your_limits ; continue ; continue living ; debugger");
+invalid("break ; break your_limits ; continue ; continue living ; debugger");
 invalid("debugger X");
 invalid("break 0.2");
 invalid("continue a++");
@@ -296,7 +296,7 @@ valid  ("for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}");
 
 debug  ("try statement");
 
-valid  ("try { break } catch(e) {}");
+invalid("try { break } catch(e) {}");
 valid  ("try {} finally { c++ }");
 valid  ("try { with (x) { } } catch(e) {} finally { if (a) ; }");
 invalid("try {}");
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3-expected.txt
index 2fba18a..a7a4edf 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11.1_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.6.3_A11.1_T3
 
-PASS SyntaxError: Undefined label: 'nonexist'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3-expected.txt
index 651e789..ffdca35 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A11_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.6.3_A11_T3
 
-PASS SyntaxError: Undefined label: 'nonexist'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3-expected.txt
index 8cc701a..11f2236 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12.1_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.6.3_A12.1_T3
 
-PASS SyntaxError: Undefined label: 'nonexist'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3-expected.txt
index 07a6879..e80deba 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.3_The_for_Statement/S12.6.3_A12_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.6.3_A12_T3
 
-PASS SyntaxError: Undefined label: 'nonexist'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1-expected.txt
index bc87bdc..d418c16 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T1-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.7_A1_T1
 
-PASS SyntaxError: Invalid continue statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2-expected.txt
index 7dea5c2..4523f7f 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T2-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 81: SyntaxError: Parse error
 S12.7_A1_T2
 
-PASS SyntaxError: Undefined label: 'LABEL'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3-expected.txt
index a2f7bc6..23fe75d 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.7_A1_T3
 
-PASS SyntaxError: Undefined label: 'LABEL'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4-expected.txt
index 46c6008..9d1e6c0 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A1_T4-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 81: SyntaxError: Parse error
 S12.7_A1_T4
 
-PASS SyntaxError: Invalid continue statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1-expected.txt
index 509ed6c..4c221e3 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T1-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.7_A5_T1
 
-PASS SyntaxError: Undefined label: 'LABEL_ANOTHER_LOOP'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2-expected.txt
index 25f840f..3bcf4f9 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T2-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.7_A5_T2
 
-PASS SyntaxError: Undefined label: 'IN_DO_FUNC'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3-expected.txt
index b01b8cc..5dfe9b1 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A5_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 81: SyntaxError: Parse error
 S12.7_A5_T3
 
-PASS SyntaxError: Undefined label: 'LABEL_IN'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6-expected.txt
index 99508f1..9a1f6af 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A6-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.7_A6
 
-PASS SyntaxError: Undefined label: 'LABEL1'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1-expected.txt
index 471e207..b37ddc6 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T1-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 86: SyntaxError: Parse error
 S12.7_A8_T1
 
-PASS SyntaxError: Undefined label: 'LABEL2'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2-expected.txt
index d670f18..4d16c5a 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.7_The_continue_Statement/S12.7_A8_T2-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 87: SyntaxError: Parse error
 S12.7_A8_T2
 
-PASS SyntaxError: Invalid continue statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1-expected.txt
index 3c96b9b..34631b2 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T1-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.8_A1_T1
 
-PASS SyntaxError: Invalid break statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2-expected.txt
index 0853aa6..60b22f7 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T2-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 81: SyntaxError: Parse error
 S12.8_A1_T2
 
-PASS SyntaxError: Undefined label: 'LABEL'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3-expected.txt
index 040d055..826f026 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 81: SyntaxError: Parse error
 S12.8_A1_T3
 
-PASS SyntaxError: Invalid break statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4-expected.txt
index 0569260..132f8b9 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A1_T4-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.8_A1_T4
 
-PASS SyntaxError: Undefined label: 'LABEL'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1-expected.txt
index d4d192d..01edce5 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T1-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.8_A5_T1
 
-PASS SyntaxError: Undefined label: 'LABEL_ANOTHER_LOOP'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2-expected.txt
index 2cff4b5..2bc52eb 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T2-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.8_A5_T2
 
-PASS SyntaxError: Undefined label: 'IN_DO_FUNC'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3-expected.txt
index c10e6b6..486a801 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A5_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 82: SyntaxError: Parse error
 S12.8_A5_T3
 
-PASS SyntaxError: Undefined label: 'LABEL_IN'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6-expected.txt
index 1731dfd..bfe542a 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A6-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.8_A6
 
-PASS SyntaxError: Undefined label: 'LABEL1'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1-expected.txt
index aeaa459..a35c646 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T1-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 86: SyntaxError: Parse error
 S12.8_A8_T1
 
-PASS SyntaxError: Undefined label: 'LABEL2'.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2-expected.txt
index 2d17fd8..d7ba63d 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.8_The_break_Statement/S12.8_A8_T2-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 87: SyntaxError: Parse error
 S12.8_A8_T2
 
-PASS SyntaxError: Invalid break statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1-expected.txt
index 31f1afc..f4caedc 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T1-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 79: SyntaxError: Parse error
 S12.9_A1_T1
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10-expected.txt
index 0072b4d..bbdfac5 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T10-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 78: SyntaxError: Parse error
 S12.9_A1_T10
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2-expected.txt
index 31889a4..d913999 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T2-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 79: SyntaxError: Parse error
 S12.9_A1_T2
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3-expected.txt
index 6abf6cc..cdfc75d 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T3-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 79: SyntaxError: Parse error
 S12.9_A1_T3
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4-expected.txt
index 097b0a1..8510ffd 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T4-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 78: SyntaxError: Parse error
 S12.9_A1_T4
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5-expected.txt
index 5ac0fe6..3588327 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T5-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.9_A1_T5
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6-expected.txt
index 74cf051..393a42d 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T6-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.9_A1_T6
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7-expected.txt
index 3c4810d..e178a31 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T7-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.9_A1_T7
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8-expected.txt
index 0a728af..90dd345 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T8-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 80: SyntaxError: Parse error
 S12.9_A1_T8
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9-expected.txt
index f22f75f..16dcb71 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/12_Statement/12.9_The_return_Statement/S12.9_A1_T9-expected.txt
@@ -1,6 +1,7 @@
+CONSOLE MESSAGE: line 81: SyntaxError: Parse error
 S12.9_A1_T9
 
-PASS SyntaxError: Invalid return statement.
+PASS Expected parsing failure
 
 TEST COMPLETE
 
diff --git a/LayoutTests/http/tests/security/isolatedWorld/events.html b/LayoutTests/http/tests/security/isolatedWorld/events.html
index 0742f9d..adf92c8 100644
--- a/LayoutTests/http/tests/security/isolatedWorld/events.html
+++ b/LayoutTests/http/tests/security/isolatedWorld/events.html
@@ -4,101 +4,100 @@
 <script>
 
 // This test is meaningless without layoutTestController.
-if (!window.layoutTestController && !window.eventSender)
-    return;
+if (window.layoutTestController && window.eventSender) {
 
-layoutTestController.dumpAsText();
-layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
 
-window.textAttributeEventsCount = 0;
-window.xhrEventsCount = 0;
-window.functionAttributeEventsCount = 0;
-window.addEventListener("message", function(message)
-{
-    layoutTestController.notifyDone();
-}, false);
-
-window.textAttributeEventsCallback = function()
-{
-    if (textAttributeEventsCount++)
-        document.getElementById("log").innerHTML += "PASS";
-}
-
-function newTest(title)
-{
-    document.getElementById("log").innerHTML += "<br>" + title + ": ";
-}
+    window.textAttributeEventsCount = 0;
+    window.xhrEventsCount = 0;
+    window.functionAttributeEventsCount = 0;
+    window.addEventListener("message", function(message)
+    {
+        layoutTestController.notifyDone();
+    }, false);
 
-function textAttributeEventListener()
-{
     window.textAttributeEventsCallback = function()
     {
-        if (window.alreadyFailed)
-            return;
-         document.getElementById("log").innerHTML += "FAIL";
-         window.alreadyFailed = true;
+        if (textAttributeEventsCount++)
+            document.getElementById("log").innerHTML += "PASS";
     }
 
-    var test = document.getElementById("test");
-    test.innerHTML = "<button id='button1' onclick='textAttributeEventsCallback()'></button>";
-    document.getElementById("button1").click();
-}
+    function newTest(title)
+    {
+        document.getElementById("log").innerHTML += "<br>" + title + ": ";
+    }
 
-function functionAttributeEventListener()
-{
-    var test = document.getElementById("test");
-    var button = test.appendChild(document.createElement("button"));
-    window.functionAttributeEventsCount = 0;
-    button.onclick = function()
+    function textAttributeEventListener()
     {
-        if (window.functionAttributeEventsCount++)
-            document.getElementById("log").innerHTML += "PASS";
+        window.textAttributeEventsCallback = function()
+        {
+            if (window.alreadyFailed)
+                return;
+             document.getElementById("log").innerHTML += "FAIL";
+             window.alreadyFailed = true;
+        }
+
+        var test = document.getElementById("test");
+        test.innerHTML = "<button id='button1' onclick='textAttributeEventsCallback()'></button>";
+        document.getElementById("button1").click();
     }
-    button.style.cssText = "width: 30px;height:30px";
-    button.click();
-}
 
-function xhrEventListener()
-{
-    window.xhrWorld = 1;
-    var done;
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", "anyfile", true);
-    xhr.onreadystatechange = function() {
-        if (done)
-            return;
-        done = true;
-        document.getElementById("log").innerHTML += window.xhrWorld  ? "PASS" : "FAIL";
-        window.postMessage("done", "*");
-    };
-    xhr.send(null);
-}
+    function functionAttributeEventListener()
+    {
+        var test = document.getElementById("test");
+        var button = test.appendChild(document.createElement("button"));
+        window.functionAttributeEventsCount = 0;
+        button.onclick = function()
+        {
+            if (window.functionAttributeEventsCount++)
+                document.getElementById("log").innerHTML += "PASS";
+        }
+        button.style.cssText = "width: 30px;height:30px";
+        button.click();
+    }
 
-function runTestInWorld(worldId, funcName)
-{
-    layoutTestController.evaluateScriptInIsolatedWorld(worldId, String(eval(funcName)) + "\n" + funcName + "();");
-}
+    function xhrEventListener()
+    {
+        window.xhrWorld = 1;
+        var done;
+        var xhr = new XMLHttpRequest();
+        xhr.open("GET", "anyfile", true);
+        xhr.onreadystatechange = function() {
+            if (done)
+                return;
+            done = true;
+            document.getElementById("log").innerHTML += window.xhrWorld  ? "PASS" : "FAIL";
+            window.postMessage("done", "*");
+        };
+        xhr.send(null);
+    }
 
-function runTest() 
-{
-    newTest("Text attribute event listeners should always fire in main world");
-    runTestInWorld(1, "textAttributeEventListener");
-    var button1 = document.getElementById("button1");
-    button1.click();
-    button1.parentElement.removeChild(button1);
-    
-    newTest("Function attribute event listeners should fire in the world where they were created");
-    runTestInWorld(1, "functionAttributeEventListener");
-    var testDiv = document.getElementById("test");
-    // Land somewhere on the button.
-    eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
-    eventSender.mouseDown();
-    eventSender.mouseUp();
+    function runTestInWorld(worldId, funcName)
+    {
+        layoutTestController.evaluateScriptInIsolatedWorld(worldId, String(eval(funcName)) + "\n" + funcName + "();");
+    }
 
-    newTest("XHR attribute event listeners should fire in the world where they were created");
-    runTestInWorld(1, "xhrEventListener");
-}
+    function runTest() 
+    {
+        newTest("Text attribute event listeners should always fire in main world");
+        runTestInWorld(1, "textAttributeEventListener");
+        var button1 = document.getElementById("button1");
+        button1.click();
+        button1.parentElement.removeChild(button1);
+        
+        newTest("Function attribute event listeners should fire in the world where they were created");
+        runTestInWorld(1, "functionAttributeEventListener");
+        var testDiv = document.getElementById("test");
+        // Land somewhere on the button.
+        eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
 
+        newTest("XHR attribute event listeners should fire in the world where they were created");
+        runTestInWorld(1, "xhrEventListener");
+    }
+}
 </script>
 <body onload="runTest()">
     <div id="test"></div>
diff --git a/LayoutTests/http/tests/security/isolatedWorld/userGestureEvents.html b/LayoutTests/http/tests/security/isolatedWorld/userGestureEvents.html
index 910aceb..8fcb401 100644
--- a/LayoutTests/http/tests/security/isolatedWorld/userGestureEvents.html
+++ b/LayoutTests/http/tests/security/isolatedWorld/userGestureEvents.html
@@ -4,53 +4,52 @@
 <script>
 
 // This test is meaningless without a layoutTestController.
-if (!window.layoutTestController && !window.eventSender) {
-    document.getElementById("log").innerHTML += "FAIL\n";
-    return;
-}
-
-layoutTestController.setCanOpenWindows(true);
-layoutTestController.waitUntilDone();
-layoutTestController.dumpAsText();
-
-function newTest(title)
-{
-    document.getElementById("log").innerHTML += "<br>" + title + ": ";
-}
-
-function pass()
-{
-    document.getElementById("log").innerHTML += "PASS\n";
-    layoutTestController.notifyDone();
-}
-
-// (This function is run within an isolated world)
-function userGestureEventListener()
-{
-    // Register an event handler that will try to perform an action that can only be initiated by a user gesture (opening a window).
-    document.getElementById("button1").onclick = function()
+if (window.layoutTestController && window.eventSender) {
+
+    layoutTestController.setCanOpenWindows(true);
+    layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+
+    function newTest(title)
     {
-        window.open("resources/userGestureEvents-second-window.html", "resources/userGestureEvents-second-window.html");
+        document.getElementById("log").innerHTML += "<br>" + title + ": ";
     }
-}
 
-function runTestInWorld(worldId, funcName)
-{
-    layoutTestController.evaluateScriptInIsolatedWorld(worldId, String(eval(funcName)) + "\n" + funcName + "();");
-}
+    function pass()
+    {
+        document.getElementById("log").innerHTML += "PASS\n";
+        layoutTestController.notifyDone();
+    }
 
-function runTest() 
-{
-    newTest("Event handlers in isolated worlds for user gesture generated events should should the same permissions as handlers within the page.");
-    runTestInWorld(1, "userGestureEventListener");
+    // (This function is run within an isolated world)
+    function userGestureEventListener()
+    {
+        // Register an event handler that will try to perform an action that can only be initiated by a user gesture (opening a window).
+        document.getElementById("button1").onclick = function()
+        {
+            window.open("resources/userGestureEvents-second-window.html", "resources/userGestureEvents-second-window.html");
+        }
+    }
 
-    // Click somewhere on the button!
-    var testDiv = document.getElementById("test");
-    eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
-    eventSender.mouseDown();
-    eventSender.mouseUp();
-}
+    function runTestInWorld(worldId, funcName)
+    {
+        layoutTestController.evaluateScriptInIsolatedWorld(worldId, String(eval(funcName)) + "\n" + funcName + "();");
+    }
+
+    function runTest() 
+    {
+        newTest("Event handlers in isolated worlds for user gesture generated events should should the same permissions as handlers within the page.");
+        runTestInWorld(1, "userGestureEventListener");
+
+        // Click somewhere on the button!
+        var testDiv = document.getElementById("test");
+        eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }
 
+} else
+    document.getElementById("log").innerHTML += "FAIL\n";
 </script>
 <body onload="runTest()">
     <div id="test"><button id='button1'></button></div>
diff --git a/LayoutTests/svg/custom/resources/use-instanceRoot-event-listeners.js b/LayoutTests/svg/custom/resources/use-instanceRoot-event-listeners.js
index 9dc1cc1..08b204a 100644
--- a/LayoutTests/svg/custom/resources/use-instanceRoot-event-listeners.js
+++ b/LayoutTests/svg/custom/resources/use-instanceRoot-event-listeners.js
@@ -169,11 +169,9 @@ function driveTests()
     }
 }
 
-if (!window.eventSender) {
-    alert("This test must be run via DRT!");
-    return;
-}
-
 // Start tests
-eventSender.mouseMoveTo(115, 55);
-driveTests();
+if (window.eventSender) {
+    eventSender.mouseMoveTo(115, 55);
+    driveTests();
+} else
+    alert("This test must be run via DRT!");
diff --git a/LayoutTests/svg/custom/rgbcolor-syntax.svg b/LayoutTests/svg/custom/rgbcolor-syntax.svg
index b4756db..97863fb 100644
--- a/LayoutTests/svg/custom/rgbcolor-syntax.svg
+++ b/LayoutTests/svg/custom/rgbcolor-syntax.svg
@@ -27,28 +27,31 @@
     }
 
     /* test that incorrect color strings throw an exception */
-    var col = document.styleSheets[0].cssRules[0].style.getPropertyCSSValue("fill");
-    if (!expectsException(col, "rgb(100%,100%,0%")) return;
-    if (!expectsException(col, "rgba(100%,100%,0%")) return;
-    if (!expectsException(col, "rgb(100%,100%,r)")) return;
-    if (!expectsException(col, "rgb (100%,100%,r)")) return;
-    if (!expectsException(col, "rgb(100%, 1, 1)")) return;
-    if (!expectsException(col, "hsl(100%,100%,100%)")) return;
-    if (!expectsException(col, "yello")) return;
-    if (!expectsException(col, "!#fff")) return;
-    if (!expectsException(col, "#sdf")) return;
-    if (!expectsException(col, "#")) return;
-    if (!expectsException(col, "#f")) return;
-    if (!expectsException(col, "#ff")) return;
-    if (!expectsException(col, "#ffff")) return;
-    if (!expectsException(col, "#fffff")) return;
-    if (!expectsException(col, "#fffffff")) return;
-    if (!expectsException(col, "green,")) return;
-    if (!expectsValid(col, "rgb(0, 10, 20)", "#000A14")) return;
-    if (!expectsValid(col, "#FFF", "#FFFFFF")) return;
-    if (!expectsValid(col, "#FFFFFF", "#FFFFFF")) return;
-    if (!expectsValid(col, " green", "#008000")) return;
-    if (!expectsValid(col, "green ", "#008000")) return;
-    if (!expectsValid(col, "green", "#008000")) return;
+    function testIncorrectColor() {
+        var col = document.styleSheets[0].cssRules[0].style.getPropertyCSSValue("fill");
+        if (!expectsException(col, "rgb(100%,100%,0%")) return;
+        if (!expectsException(col, "rgba(100%,100%,0%")) return;
+        if (!expectsException(col, "rgb(100%,100%,r)")) return;
+        if (!expectsException(col, "rgb (100%,100%,r)")) return;
+        if (!expectsException(col, "rgb(100%, 1, 1)")) return;
+        if (!expectsException(col, "hsl(100%,100%,100%)")) return;
+        if (!expectsException(col, "yello")) return;
+        if (!expectsException(col, "!#fff")) return;
+        if (!expectsException(col, "#sdf")) return;
+        if (!expectsException(col, "#")) return;
+        if (!expectsException(col, "#f")) return;
+        if (!expectsException(col, "#ff")) return;
+        if (!expectsException(col, "#ffff")) return;
+        if (!expectsException(col, "#fffff")) return;
+        if (!expectsException(col, "#fffffff")) return;
+        if (!expectsException(col, "green,")) return;
+        if (!expectsValid(col, "rgb(0, 10, 20)", "#000A14")) return;
+        if (!expectsValid(col, "#FFF", "#FFFFFF")) return;
+        if (!expectsValid(col, "#FFFFFF", "#FFFFFF")) return;
+        if (!expectsValid(col, " green", "#008000")) return;
+        if (!expectsValid(col, "green ", "#008000")) return;
+        if (!expectsValid(col, "green", "#008000")) return;
+    }
+    testIncorrectColor();
 </script>   
 </svg>
diff --git a/LayoutTests/svg/custom/use-instanceRoot-modifications.svg b/LayoutTests/svg/custom/use-instanceRoot-modifications.svg
index 7aea17b..137328b 100644
--- a/LayoutTests/svg/custom/use-instanceRoot-modifications.svg
+++ b/LayoutTests/svg/custom/use-instanceRoot-modifications.svg
@@ -14,27 +14,30 @@
 <text id="text" x="70" y="70">Test failed.</text>
 
 <script>
-var useElement = document.getElementsByTagName("use")[1];
-if (useElement != useElement.instanceRoot.correspondingUseElement)
-    return;
-
-var element = useElement.instanceRoot.correspondingElement;
-if (element != document.getElementById("g"))
-    return;
-
-// element.firstChild is a #text node! the next sibling gives the rect
-var rect = element.firstChild.nextSibling;
-if (rect != document.getElementById("rect"))
-    return;
-
-// rect.nextSibling is a #text node! the next sibling gives the circle
-var circle = rect.nextSibling.nextSibling;
-if (circle != document.getElementById("circle"))
-    return;
-
-rect.setAttribute("fill", "green");
-circle.setAttribute("opacity", "0.8");
-
-document.getElementById("text").firstChild.nodeValue = "Test passed.";
+function runInstanceRootTest() {
+    var useElement = document.getElementsByTagName("use")[1];
+    if (useElement != useElement.instanceRoot.correspondingUseElement)
+        return;
+
+    var element = useElement.instanceRoot.correspondingElement;
+    if (element != document.getElementById("g"))
+        return;
+
+    // element.firstChild is a #text node! the next sibling gives the rect
+    var rect = element.firstChild.nextSibling;
+    if (rect != document.getElementById("rect"))
+        return;
+
+    // rect.nextSibling is a #text node! the next sibling gives the circle
+    var circle = rect.nextSibling.nextSibling;
+    if (circle != document.getElementById("circle"))
+        return;
+
+    rect.setAttribute("fill", "green");
+    circle.setAttribute("opacity", "0.8");
+
+    document.getElementById("text").firstChild.nodeValue = "Test passed.";
+}
+runInstanceRootTest();
 </script>
 </svg>
diff --git a/LayoutTests/svg/custom/use-property-changes-through-svg-dom.svg b/LayoutTests/svg/custom/use-property-changes-through-svg-dom.svg
index 34d023b..c76cf4c 100644
--- a/LayoutTests/svg/custom/use-property-changes-through-svg-dom.svg
+++ b/LayoutTests/svg/custom/use-property-changes-through-svg-dom.svg
@@ -19,13 +19,11 @@
      var use1 = document.getElementById("use1");
      var use2 = document.getElementById("use2");
 
-     if (!use1 || !use2)
-         return;
-
-     use1.href.baseVal = "#rect";
-
-     use2.x.baseVal.value = 200;
-     use2.y.baseVal.value = -50;
+     if (use1 && use2) {
+         use1.href.baseVal = "#rect";
+         use2.x.baseVal.value = 200;
+         use2.y.baseVal.value = -50;
+     }
     ]]>
   </script>
 </svg>
diff --git a/LayoutTests/webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive b/LayoutTests/webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive
index 16a0672..8e6f029 100644
--- a/LayoutTests/webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive
+++ b/LayoutTests/webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive
@@ -89,12 +89,11 @@ way of fulling testing the bug.  One should wait "awhile" before making the WebA
 			<dict>
 				<key>WebResourceData</key>
 				<string>&lt;html&gt;&lt;head&gt;&lt;script&gt;
-if (!window.parent.bodyToAdopt) {
+if (window.parent.bodyToAdopt) {
+    document.getElementsByTagName("html")[0].appendChild(document.adoptNode(window.parent.bodyToAdopt));
+    window.parent.bodyToAdopt = null;
+} else
     alert("window.parent.bodyToAdopt is not set - Are you viewing this page as part of the adopt-attribute-styled-body test?");
-    return;
-}
-document.getElementsByTagName("html")[0].appendChild(document.adoptNode(window.parent.bodyToAdopt));
-window.parent.bodyToAdopt = null;
 &lt;/script&gt;
 &lt;/head&gt;&lt;body id="otherBody" vlink="green" alink="green"&gt;
 &lt;a href="SomeUnvisitedPage.html"&gt;Spaceballs: The Unvisited Link&lt;/a&gt;&lt;br&gt;
diff --git a/LayoutTests/webarchive/resources/adopt-attribute-styled-body-iframe.html b/LayoutTests/webarchive/resources/adopt-attribute-styled-body-iframe.html
index ef47dbd..e057a63 100644
--- a/LayoutTests/webarchive/resources/adopt-attribute-styled-body-iframe.html
+++ b/LayoutTests/webarchive/resources/adopt-attribute-styled-body-iframe.html
@@ -1,8 +1,7 @@
 <script>
-if (!window.parent.bodyToAdopt) {
+if (window.parent.bodyToAdopt) {
+    document.getElementsByTagName("html")[0].appendChild(document.adoptNode(window.parent.bodyToAdopt));
+    window.parent.bodyToAdopt = null;
+} else
     alert("window.parent.bodyToAdopt is not set - Are you viewing this page as part of the adopt-attribute-styled-body test?");
-    return;
-}
-document.getElementsByTagName("html")[0].appendChild(document.adoptNode(window.parent.bodyToAdopt));
-window.parent.bodyToAdopt = null;
 </script>
diff --git a/Source/JavaScriptCore/Android.mk b/Source/JavaScriptCore/Android.mk
index 490989a..be8a9b4 100644
--- a/Source/JavaScriptCore/Android.mk
+++ b/Source/JavaScriptCore/Android.mk
@@ -192,7 +192,8 @@ LOCAL_SRC_FILES := \
 	\
 	yarr/RegexPattern.cpp \
 	yarr/RegexInterpreter.cpp \
-	yarr/RegexJIT.cpp
+	yarr/RegexJIT.cpp \
+    yarr/YarrSyntaxChecker.cpp
 
 # generated headers
 JSC_OBJECTS := $(addprefix $(intermediates)/runtime/, \
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
index fd26d77..31dc4e1 100644
--- a/Source/JavaScriptCore/CMakeLists.txt
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -170,6 +170,7 @@ SET(JavaScriptCore_SOURCES
     yarr/RegexPattern.cpp
     yarr/RegexInterpreter.cpp
     yarr/RegexJIT.cpp
+    yarr/YarrSyntaxChecker.cpp
 
     wtf/DateMath.cpp
     wtf/PageAllocationAligned.cpp
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index fddc05b..11897ba 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,131 @@
+2011-01-10  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Bug 52079 - Syntax errors should be early errors.
+
+        From chapter 16 the spec:
+            An implementation must report most errors at the time the relevant ECMAScript language construct is
+            evaluated. An early error is an error that can be detected and reported prior to the evaluation of
+            any construct in the Program containing the error. An implementation must report early errors in a
+            Program prior to the first evaluation of that Program. Early errors in eval code are reported at
+            the time eval is called but prior to evaluation of any construct within the eval code. All errors
+            that are not early errors are runtime errors.
+
+            An implementation must treat any instance of the following kinds of errors as an early error:
+                * Any syntax error."
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+            Added new files.
+        * bytecode/CodeBlock.cpp:
+            Removed op_throw_syntax_error.
+        * bytecode/Opcode.h:
+            Removed op_throw_syntax_error.
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::generate):
+            If m_expressionTooDeep then throw a runtime error.
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+            Initialize m_expressionTooDeep.
+        (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):
+            Sets m_expressionTooDeep.
+        * bytecompiler/BytecodeGenerator.h:
+            Added m_expressionTooDeep, removed emitThrowSyntaxError.
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::RegExpNode::emitBytecode):
+        (JSC::ContinueNode::emitBytecode):
+        (JSC::BreakNode::emitBytecode):
+        (JSC::ReturnNode::emitBytecode):
+        (JSC::LabelNode::emitBytecode):
+            Conditions that threw syntax error are now handled during parsing;
+            during bytecompilation these are now just ASSERTs.
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::privateExecute):
+        * jit/JIT.cpp:
+        (JSC::JIT::privateCompileMainPass):
+        * jit/JIT.h:
+        * jit/JITOpcodes.cpp:
+        * jit/JITOpcodes32_64.cpp:
+        * jit/JITStubs.cpp:
+        * jit/JITStubs.h:
+            Removed op_throw_syntax_error.
+        * parser/ASTBuilder.h:
+        (JSC::ASTBuilder::createRegExp):
+            Renamed; added syntax check.
+        * parser/JSParser.cpp:
+        (JSC::JSParser::breakIsValid):
+        (JSC::JSParser::hasLabel):
+        (JSC::JSParser::Scope::Scope):
+        (JSC::JSParser::Scope::setIsFunction):
+        (JSC::JSParser::Scope::isFunctionBoundary):
+        (JSC::JSParser::ScopeRef::hasContainingScope):
+        (JSC::JSParser::ScopeRef::containingScope):
+        (JSC::JSParser::AutoPopScopeRef::AutoPopScopeRef):
+        (JSC::JSParser::AutoPopScopeRef::~AutoPopScopeRef):
+        (JSC::JSParser::AutoPopScopeRef::setPopped):
+        (JSC::JSParser::popScopeInternal):
+        (JSC::JSParser::popScope):
+        (JSC::jsParse):
+        (JSC::JSParser::JSParser):
+        (JSC::JSParser::parseProgram):
+        (JSC::JSParser::parseBreakStatement):
+        (JSC::JSParser::parseContinueStatement):
+        (JSC::JSParser::parseReturnStatement):
+        (JSC::JSParser::parseTryStatement):
+        (JSC::JSParser::parseFunctionInfo):
+        (JSC::JSParser::parseExpressionOrLabelStatement):
+        (JSC::JSParser::parsePrimaryExpression):
+        * parser/JSParser.h:
+        * parser/Nodes.h:
+        * parser/Parser.cpp:
+        (JSC::Parser::parse):
+        * parser/SyntaxChecker.h:
+        (JSC::SyntaxChecker::createRegExp):
+            Renamed; added syntax check.
+        * runtime/ExceptionHelpers.cpp:
+        (JSC::createOutOfMemoryError):
+        (JSC::throwOutOfMemoryError):
+        * runtime/ExceptionHelpers.h:
+            Broke out createOutOfMemoryError.
+        * runtime/Executable.cpp:
+        (JSC::EvalExecutable::compileInternal):
+        (JSC::ProgramExecutable::compileInternal):
+        (JSC::FunctionExecutable::compileForCallInternal):
+        (JSC::FunctionExecutable::compileForConstructInternal):
+            Add check for exception after bytecode generation.
+        * runtime/RegExpConstructor.cpp:
+        (JSC::constructRegExp):
+        * runtime/RegExpPrototype.cpp:
+        (JSC::regExpProtoFuncCompile):
+            RegExp error prefixes not included in error string.
+        * yarr/RegexParser.h:
+        (JSC::Yarr::Parser::parse):
+            Removed regexBegin/regexEnd/regexError.
+        * yarr/RegexPattern.cpp:
+        (JSC::Yarr::RegexPatternConstructor::regexBegin):
+            Removed regexEnd/regexError.
+        (JSC::Yarr::compileRegex):
+            Add call to regexBegin (no longer called from the parser).
+        * yarr/YarrSyntaxChecker.cpp: Added.
+        (JSC::Yarr::SyntaxChecker::assertionBOL):
+        (JSC::Yarr::SyntaxChecker::assertionEOL):
+        (JSC::Yarr::SyntaxChecker::assertionWordBoundary):
+        (JSC::Yarr::SyntaxChecker::atomPatternCharacter):
+        (JSC::Yarr::SyntaxChecker::atomBuiltInCharacterClass):
+        (JSC::Yarr::SyntaxChecker::atomCharacterClassBegin):
+        (JSC::Yarr::SyntaxChecker::atomCharacterClassAtom):
+        (JSC::Yarr::SyntaxChecker::atomCharacterClassRange):
+        (JSC::Yarr::SyntaxChecker::atomCharacterClassBuiltIn):
+        (JSC::Yarr::SyntaxChecker::atomCharacterClassEnd):
+        (JSC::Yarr::SyntaxChecker::atomParenthesesSubpatternBegin):
+        (JSC::Yarr::SyntaxChecker::atomParentheticalAssertionBegin):
+        (JSC::Yarr::SyntaxChecker::atomParenthesesEnd):
+        (JSC::Yarr::SyntaxChecker::atomBackReference):
+        (JSC::Yarr::SyntaxChecker::quantifyAtom):
+        (JSC::Yarr::SyntaxChecker::disjunction):
+        (JSC::Yarr::checkSyntax):
+        * yarr/YarrSyntaxChecker.h: Added.
+            Check RegExp syntax.
+
 2011-01-10  Adam Roben  <aroben at apple.com>
 
         Roll out r75289
diff --git a/Source/JavaScriptCore/GNUmakefile.am b/Source/JavaScriptCore/GNUmakefile.am
index 30e3f09..62ae602 100644
--- a/Source/JavaScriptCore/GNUmakefile.am
+++ b/Source/JavaScriptCore/GNUmakefile.am
@@ -558,7 +558,9 @@ javascriptcore_sources += \
 	Source/JavaScriptCore/yarr/RegexJIT.h \
 	Source/JavaScriptCore/yarr/RegexParser.h \
 	Source/JavaScriptCore/yarr/RegexPattern.cpp \
-	Source/JavaScriptCore/yarr/RegexPattern.h
+	Source/JavaScriptCore/yarr/RegexPattern.h \
+	Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp \
+	Source/JavaScriptCore/yarr/YarrSyntaxChecker.h
 
 if TARGET_WIN32
 javascriptcore_sources += \
diff --git a/Source/JavaScriptCore/JavaScriptCore.gypi b/Source/JavaScriptCore/JavaScriptCore.gypi
index 4f4da73..3d8ae87 100644
--- a/Source/JavaScriptCore/JavaScriptCore.gypi
+++ b/Source/JavaScriptCore/JavaScriptCore.gypi
@@ -501,6 +501,8 @@
             'yarr/RegexParser.h',
             'yarr/RegexPattern.cpp',
             'yarr/RegexPattern.h',
+            'yarr/YarrSyntaxChecker.cpp',
+            'yarr/YarrSyntaxChecker.h',
         ]
     }
 }
diff --git a/Source/JavaScriptCore/JavaScriptCore.pro b/Source/JavaScriptCore/JavaScriptCore.pro
index fa4ebfb..bf24bea 100644
--- a/Source/JavaScriptCore/JavaScriptCore.pro
+++ b/Source/JavaScriptCore/JavaScriptCore.pro
@@ -210,7 +210,8 @@ SOURCES += \
     runtime/UString.cpp \
     yarr/RegexPattern.cpp \
     yarr/RegexInterpreter.cpp \
-    yarr/RegexJIT.cpp
+    yarr/RegexJIT.cpp \
+    yarr/ YarrSyntaxChecker.cpp
 
 # Generated files, simply list them for JavaScriptCore
 
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index 328363e..2478ea5 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -1685,6 +1685,14 @@
 				RelativePath="..\..\yarr\RegexPattern.h"
 				>
 			</File>
+			<File
+				RelativePath="..\..\yarr\YarrSyntaxChecker.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\yarr\YarrSyntaxChecker.h"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="jit"
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index e08d0b7..7a96e45 100644
--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -221,6 +221,8 @@
 		86565743115BE3DA00291F40 /* CString.h in Headers */ = {isa = PBXBuildFile; fileRef = 86565741115BE3DA00291F40 /* CString.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		865F408810E7D56300947361 /* APIShims.h in Headers */ = {isa = PBXBuildFile; fileRef = 865F408710E7D56300947361 /* APIShims.h */; };
 		86676D5211FED9BC004B6863 /* BumpPointerAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86704B4012DB8A8100A9FE7B /* YarrSyntaxChecker.cpp */; };
+		86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 86704B4112DB8A8100A9FE7B /* YarrSyntaxChecker.h */; };
 		868BFA08117CEFD100B908B1 /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 868BFA00117CEFD100B908B1 /* AtomicString.cpp */; };
 		868BFA09117CEFD100B908B1 /* AtomicString.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA01117CEFD100B908B1 /* AtomicString.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		868BFA0A117CEFD100B908B1 /* AtomicStringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA02117CEFD100B908B1 /* AtomicStringImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -841,6 +843,8 @@
 		86565741115BE3DA00291F40 /* CString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CString.h; path = text/CString.h; sourceTree = "<group>"; };
 		865F408710E7D56300947361 /* APIShims.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIShims.h; sourceTree = "<group>"; };
 		86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpPointerAllocator.h; sourceTree = "<group>"; };
+		86704B4012DB8A8100A9FE7B /* YarrSyntaxChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YarrSyntaxChecker.cpp; path = yarr/YarrSyntaxChecker.cpp; sourceTree = "<group>"; };
+		86704B4112DB8A8100A9FE7B /* YarrSyntaxChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YarrSyntaxChecker.h; path = yarr/YarrSyntaxChecker.h; sourceTree = "<group>"; };
 		867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32_64only.exp; sourceTree = "<group>"; };
 		867FC36011B763950025105E /* JavaScriptCore.JSVALUE32only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32only.exp; sourceTree = "<group>"; };
 		867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE64only.exp; sourceTree = "<group>"; };
@@ -1905,6 +1909,8 @@
 		86EAC48C0F93E8B9008EC948 /* yarr */ = {
 			isa = PBXGroup;
 			children = (
+				86704B4012DB8A8100A9FE7B /* YarrSyntaxChecker.cpp */,
+				86704B4112DB8A8100A9FE7B /* YarrSyntaxChecker.h */,
 				86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */,
 				86EAC4900F93E8D1008EC948 /* RegexInterpreter.h */,
 				86EAC4910F93E8D1008EC948 /* RegexJIT.cpp */,
@@ -2390,6 +2396,7 @@
 				14FFF98D12BFFF7500795BB8 /* PageAllocationAligned.h in Headers */,
 				5135FAF212D26ACE003C083B /* Decoder.h in Headers */,
 				5135FAF312D26AD1003C083B /* Encoder.h in Headers */,
+				86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2853,6 +2860,7 @@
 				E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
 				868BFA17117CF19900B908B1 /* WTFString.cpp in Sources */,
 				86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */,
+				86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
index cbae990..f3f5f27 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -1197,11 +1197,6 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             printf("[%4d] throw_reference_error\t %s\n", location, constantName(exec, k0, getConstant(k0)).data());
             break;
         }
-        case op_throw_syntax_error: {
-            int k0 = (++it)->u.operand;
-            printf("[%4d] throw_syntax_error\t %s\n", location, constantName(exec, k0, getConstant(k0)).data());
-            break;
-        }
         case op_jsr: {
             int retAddrDst = (++it)->u.operand;
             int offset = (++it)->u.operand;
diff --git a/Source/JavaScriptCore/bytecode/Opcode.h b/Source/JavaScriptCore/bytecode/Opcode.h
index 6c1c6b2..8082ae0 100644
--- a/Source/JavaScriptCore/bytecode/Opcode.h
+++ b/Source/JavaScriptCore/bytecode/Opcode.h
@@ -185,7 +185,6 @@ namespace JSC {
         macro(op_catch, 2) \
         macro(op_throw, 2) \
         macro(op_throw_reference_error, 2) \
-        macro(op_throw_syntax_error, 2) \
         \
         macro(op_jsr, 3) \
         macro(op_sret, 2) \
diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index 3a99957..34afb52 100644
--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -137,7 +137,7 @@ bool BytecodeGenerator::dumpsGeneratedCode()
 #endif
 }
 
-void BytecodeGenerator::generate()
+JSObject* BytecodeGenerator::generate()
 {
     m_codeBlock->setThisRegister(m_thisRegister.index());
 
@@ -154,6 +154,10 @@ void BytecodeGenerator::generate()
         symbolTable().clear();
 
     m_codeBlock->shrinkToFit();
+
+    if (m_expressionTooDeep)
+        return createOutOfMemoryError(m_scopeChain->globalObject());
+    return 0;
 }
 
 bool BytecodeGenerator::addVar(const Identifier& ident, bool isConstant, RegisterID*& r0)
@@ -222,6 +226,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const ScopeChain&
     , m_usesExceptions(false)
     , m_regeneratingForExceptionInfo(false)
     , m_codeBlockBeingRegeneratedFrom(0)
+    , m_expressionTooDeep(false)
 {
     if (m_shouldEmitDebugHooks)
         m_codeBlock->setNeedsFullScopeChain(true);
@@ -316,6 +321,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Scope
     , m_usesExceptions(false)
     , m_regeneratingForExceptionInfo(false)
     , m_codeBlockBeingRegeneratedFrom(0)
+    , m_expressionTooDeep(false)
 {
     if (m_shouldEmitDebugHooks)
         m_codeBlock->setNeedsFullScopeChain(true);
@@ -481,6 +487,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const ScopeChain& scope
     , m_usesExceptions(false)
     , m_regeneratingForExceptionInfo(false)
     , m_codeBlockBeingRegeneratedFrom(0)
+    , m_expressionTooDeep(false)
 {
     if (m_shouldEmitDebugHooks || m_baseScopeDepth)
         m_codeBlock->setNeedsFullScopeChain(true);
@@ -2053,12 +2060,6 @@ void BytecodeGenerator::emitThrowReferenceError(const UString& message)
     instructions().append(addConstantValue(jsString(globalData(), message))->index());
 }
 
-void BytecodeGenerator::emitThrowSyntaxError(const UString& message)
-{
-    emitOpcode(op_throw_syntax_error);
-    instructions().append(addConstantValue(jsString(globalData(), message))->index());
-}
-
 PassRefPtr<Label> BytecodeGenerator::emitJumpSubroutine(RegisterID* retAddrDst, Label* finally)
 {
     size_t begin = instructions().size();
@@ -2210,8 +2211,7 @@ RegisterID* BytecodeGenerator::emitThrowExpressionTooDeepException()
     // And we could make the caller pass the node pointer in, if there was some way of getting
     // that from an arbitrary node. However, calling emitExpressionInfo without any useful data
     // is still good enough to get us an accurate line number.
-    emitExpressionInfo(0, 0, 0);
-    emitThrowSyntaxError("Expression too deep");
+    m_expressionTooDeep = true;
     return newTemporary();
 }
 
diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
index 37756fa..8b0cc40 100644
--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -102,7 +102,7 @@ namespace JSC {
 
         bool isConstructor() { return m_codeBlock->m_isConstructor; }
 
-        void generate();
+        JSObject* generate();
 
         // Returns the register corresponding to a local variable, or 0 if no
         // such register exists. Registers returned by registerFor do not
@@ -364,7 +364,6 @@ namespace JSC {
         }
 
         void emitThrowReferenceError(const UString& message);
-        void emitThrowSyntaxError(const UString& message);
 
         void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value);
 
@@ -581,6 +580,7 @@ namespace JSC {
         bool m_usesExceptions;
         bool m_regeneratingForExceptionInfo;
         CodeBlock* m_codeBlockBeingRegeneratedFrom;
+        bool m_expressionTooDeep;
     };
 
 }
diff --git a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
index a850c96..2875434 100644
--- a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
+++ b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
@@ -83,13 +83,6 @@ RegisterID* ThrowableExpressionData::emitThrowReferenceError(BytecodeGenerator&
     return generator.newTemporary();
 }
 
-RegisterID* ThrowableExpressionData::emitThrowSyntaxError(BytecodeGenerator& generator, const UString& message)
-{
-    generator.emitExpressionInfo(divot(), startOffset(), endOffset());
-    generator.emitThrowSyntaxError(message);
-    return generator.newTemporary();
-}
-
 // ------------------------------ NullNode -------------------------------------
 
 RegisterID* NullNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
@@ -130,11 +123,10 @@ RegisterID* StringNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d
 
 RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
 {
-    RefPtr<RegExp> regExp = generator.globalData()->regExpCache()->lookupOrCreate(m_pattern.ustring(), m_flags.ustring());
-    if (!regExp->isValid())
-        return emitThrowSyntaxError(generator, makeUString("Invalid regular expression: ", regExp->errorMessage()));
     if (dst == generator.ignoredResult())
         return 0;
+    RefPtr<RegExp> regExp = generator.globalData()->regExpCache()->lookupOrCreate(m_pattern.ustring(), m_flags.ustring());
+    ASSERT(regExp->isValid());
     return generator.emitNewRegExp(generator.finalDestination(dst), regExp.get());
 }
 
@@ -1641,12 +1633,7 @@ RegisterID* ContinueNode::emitBytecode(BytecodeGenerator& generator, RegisterID*
     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
     
     LabelScope* scope = generator.continueTarget(m_ident);
-
-    if (!scope) {
-        if (m_ident.isEmpty())
-            return emitThrowSyntaxError(generator, "Invalid continue statement.");
-        return emitThrowSyntaxError(generator, makeUString("Undefined label: '", m_ident.ustring(), "'."));
-    }
+    ASSERT(scope);
 
     generator.emitJumpScopes(scope->continueTarget(), scope->scopeDepth());
     return dst;
@@ -1660,12 +1647,7 @@ RegisterID* BreakNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds
     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
     
     LabelScope* scope = generator.breakTarget(m_ident);
-    
-    if (!scope) {
-        if (m_ident.isEmpty())
-            return emitThrowSyntaxError(generator, "Invalid break statement.");
-        return emitThrowSyntaxError(generator, makeUString("Undefined label: '", m_ident.ustring(), "'."));
-    }
+    ASSERT(scope);
 
     generator.emitJumpScopes(scope->breakTarget(), scope->scopeDepth());
     return dst;
@@ -1676,8 +1658,7 @@ RegisterID* BreakNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds
 RegisterID* ReturnNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
 {
     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
-    if (generator.codeType() != FunctionCode)
-        return emitThrowSyntaxError(generator, "Invalid return statement.");
+    ASSERT(generator.codeType() == FunctionCode);
 
     if (dst == generator.ignoredResult())
         dst = 0;
@@ -1882,8 +1863,7 @@ RegisterID* LabelNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds
 {
     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
 
-    if (generator.breakTarget(m_name))
-        return emitThrowSyntaxError(generator, makeUString("Duplicate label: ", m_name.ustring(), "."));
+    ASSERT(!generator.breakTarget(m_name));
 
     RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::NamedLabel, &m_name);
     RegisterID* r0 = generator.emitNode(dst, m_statement);
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp
index 57c068a..99bc81a 100644
--- a/Source/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp
@@ -4632,17 +4632,6 @@ skip_id_custom_self:
         exceptionValue = JSValue(createReferenceError(callFrame, message));
         goto vm_throw;
     }
-    DEFINE_OPCODE(op_throw_syntax_error) {
-        /* op_throw_syntax_error message(k)
-
-           Constructs a new syntax Error instance using the
-           original constructor, using constant message as the
-           message string. The result is thrown.
-        */
-        UString message = callFrame->r(vPC[1].u.operand).jsValue().toString(callFrame);
-        exceptionValue = JSValue(createSyntaxError(callFrame, message));
-        goto vm_throw;
-    }
     DEFINE_OPCODE(op_end) {
         /* end result(r)
            
diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp
index 01401a7..e66b65e 100644
--- a/Source/JavaScriptCore/jit/JIT.cpp
+++ b/Source/JavaScriptCore/jit/JIT.cpp
@@ -318,7 +318,6 @@ void JIT::privateCompileMainPass()
         DEFINE_OP(op_tear_off_arguments)
         DEFINE_OP(op_throw)
         DEFINE_OP(op_throw_reference_error)
-        DEFINE_OP(op_throw_syntax_error)
         DEFINE_OP(op_to_jsnumber)
         DEFINE_OP(op_to_primitive)
 
diff --git a/Source/JavaScriptCore/jit/JIT.h b/Source/JavaScriptCore/jit/JIT.h
index 907a774..45ed436 100644
--- a/Source/JavaScriptCore/jit/JIT.h
+++ b/Source/JavaScriptCore/jit/JIT.h
@@ -829,7 +829,6 @@ namespace JSC {
         void emit_op_tear_off_arguments(Instruction*);
         void emit_op_throw(Instruction*);
         void emit_op_throw_reference_error(Instruction*);
-        void emit_op_throw_syntax_error(Instruction*);
         void emit_op_to_jsnumber(Instruction*);
         void emit_op_to_primitive(Instruction*);
         void emit_op_unexpected_load(Instruction*);
diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp
index 972b879..98cb2f3 100644
--- a/Source/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp
@@ -1147,13 +1147,6 @@ void JIT::emit_op_throw_reference_error(Instruction* currentInstruction)
     stubCall.call();
 }
 
-void JIT::emit_op_throw_syntax_error(Instruction* currentInstruction)
-{
-    JITStubCall stubCall(this, cti_op_throw_syntax_error);
-    stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->getConstant(currentInstruction[1].u.operand))));
-    stubCall.call();
-}
-
 void JIT::emit_op_debug(Instruction* currentInstruction)
 {
 #if ENABLE(DEBUG_WITH_BREAKPOINT)
diff --git a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
index 5a0aae5..dda74c8 100644
--- a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
+++ b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
@@ -1494,15 +1494,6 @@ void JIT::emit_op_throw_reference_error(Instruction* currentInstruction)
     stubCall.call();
 }
 
-void JIT::emit_op_throw_syntax_error(Instruction* currentInstruction)
-{
-    unsigned message = currentInstruction[1].u.operand;
-
-    JITStubCall stubCall(this, cti_op_throw_syntax_error);
-    stubCall.addArgument(m_codeBlock->getConstant(message));
-    stubCall.call();
-}
-
 void JIT::emit_op_debug(Instruction* currentInstruction)
 {
 #if ENABLE(DEBUG_WITH_BREAKPOINT)
diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp
index 0959a6e..201f322 100644
--- a/Source/JavaScriptCore/jit/JITStubs.cpp
+++ b/Source/JavaScriptCore/jit/JITStubs.cpp
@@ -3567,16 +3567,6 @@ DEFINE_STUB_FUNCTION(void, op_throw_reference_error)
     VM_THROW_EXCEPTION_AT_END();
 }
 
-DEFINE_STUB_FUNCTION(void, op_throw_syntax_error)
-{
-    STUB_INIT_STACK_FRAME(stackFrame);
-
-    CallFrame* callFrame = stackFrame.callFrame;
-    UString message = stackFrame.args[0].jsValue().toString(callFrame);
-    stackFrame.globalData->exception = createSyntaxError(callFrame, message);
-    VM_THROW_EXCEPTION_AT_END();
-}
-
 DEFINE_STUB_FUNCTION(void, op_debug)
 {
     STUB_INIT_STACK_FRAME(stackFrame);
diff --git a/Source/JavaScriptCore/jit/JITStubs.h b/Source/JavaScriptCore/jit/JITStubs.h
index 937134b..66edf45 100644
--- a/Source/JavaScriptCore/jit/JITStubs.h
+++ b/Source/JavaScriptCore/jit/JITStubs.h
@@ -394,7 +394,6 @@ extern "C" {
     void JIT_STUB cti_op_tear_off_activation(STUB_ARGS_DECLARATION);
     void JIT_STUB cti_op_tear_off_arguments(STUB_ARGS_DECLARATION);
     void JIT_STUB cti_op_throw_reference_error(STUB_ARGS_DECLARATION);
-    void JIT_STUB cti_op_throw_syntax_error(STUB_ARGS_DECLARATION);
     void* JIT_STUB cti_op_call_arityCheck(STUB_ARGS_DECLARATION);
     void* JIT_STUB cti_op_construct_arityCheck(STUB_ARGS_DECLARATION);
     void* JIT_STUB cti_op_call_jitCompile(STUB_ARGS_DECLARATION);
diff --git a/Source/JavaScriptCore/parser/ASTBuilder.h b/Source/JavaScriptCore/parser/ASTBuilder.h
index 04cf272..409c6ab 100644
--- a/Source/JavaScriptCore/parser/ASTBuilder.h
+++ b/Source/JavaScriptCore/parser/ASTBuilder.h
@@ -208,8 +208,10 @@ public:
         return node;
     }
 
-    ExpressionNode* createRegex(const Identifier& pattern, const Identifier& flags, int start)
+    ExpressionNode* createRegExp(const Identifier& pattern, const Identifier& flags, int start)
     {
+        if (Yarr::checkSyntax(pattern.ustring()))
+            return 0;
         RegExpNode* node = new (m_globalData) RegExpNode(m_globalData, pattern, flags);
         int size = pattern.length() + 2; // + 2 for the two /'s
         setExceptionLocation(node, start, start + size, start + size);
diff --git a/Source/JavaScriptCore/parser/JSParser.cpp b/Source/JavaScriptCore/parser/JSParser.cpp
index 4201555..142f403 100644
--- a/Source/JavaScriptCore/parser/JSParser.cpp
+++ b/Source/JavaScriptCore/parser/JSParser.cpp
@@ -68,7 +68,7 @@ COMPILE_ASSERT(LastUntaggedToken < 64, LessThan64UntaggedTokens);
 class JSParser {
 public:
     JSParser(Lexer*, JSGlobalData*, FunctionParameters*, bool isStrictContext, bool isFunction, SourceProvider*);
-    bool parseProgram();
+    const char* parseProgram();
 private:
     struct AllowInOverride {
         AllowInOverride(JSParser* parser)
@@ -130,10 +130,28 @@ private:
     bool strictMode() { return currentScope()->strictMode(); }
     bool isValidStrictMode() { return currentScope()->isValidStrictMode(); }
     bool declareParameter(const Identifier* ident) { return currentScope()->declareParameter(ident); }
-    bool breakIsValid() { return currentScope()->breakIsValid(); }
+    bool breakIsValid()
+    {
+        ScopeRef current = currentScope();
+        while (!current->breakIsValid()) {
+            if (!current.hasContainingScope())
+                return false;
+            current = current.containingScope();
+        }
+        return true;
+    }
     void pushLabel(const Identifier* label) { currentScope()->pushLabel(label); }
     void popLabel() { currentScope()->popLabel(); }
-    bool hasLabel(const Identifier* label) { return currentScope()->hasLabel(label); }
+    bool hasLabel(const Identifier* label)
+    {
+        ScopeRef current = currentScope();
+        while (!current->hasLabel(label)) {
+            if (!current.hasContainingScope())
+                return false;
+            current = current.containingScope();
+        }
+        return true;
+    }
 
     enum SourceElementsMode { CheckForStrictMode, DontCheckForStrictMode };
     template <SourceElementsMode mode, class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&);
@@ -202,6 +220,7 @@ private:
     Lexer* m_lexer;
     StackBounds m_stack;
     bool m_error;
+    const char* m_errorMessage;
     JSGlobalData* m_globalData;
     JSToken m_token;
     bool m_allowsIn;
@@ -241,6 +260,7 @@ private:
             , m_allowsNewDecls(true)
             , m_strictMode(strictMode)
             , m_isFunction(isFunction)
+            , m_isFunctionBoundary(false)
             , m_isValidStrictMode(true)
             , m_loopDepth(0)
             , m_switchDepth(0)
@@ -280,8 +300,13 @@ private:
             return false;
         }
 
-        void setIsFunction() { m_isFunction = true; }
+        void setIsFunction()
+        {
+            m_isFunction = true;
+            m_isFunctionBoundary = true;
+        }
         bool isFunction() { return m_isFunction; }
+        bool isFunctionBoundary() { return m_isFunctionBoundary; }
         
         bool declareVariable(const Identifier* ident)
         {
@@ -376,6 +401,7 @@ private:
         bool m_allowsNewDecls : 1;
         bool m_strictMode : 1;
         bool m_isFunction : 1;
+        bool m_isFunctionBoundary : 1;
         bool m_isValidStrictMode : 1;
         int m_loopDepth;
         int m_switchDepth;
@@ -397,11 +423,45 @@ private:
         }
         Scope* operator->() { return &m_scopeStack->at(m_index); }
         unsigned index() const { return m_index; }
+
+        bool hasContainingScope()
+        {
+            return m_index && !m_scopeStack->at(m_index).isFunctionBoundary();
+        }
+
+        ScopeRef containingScope()
+        {
+            ASSERT(hasContainingScope());
+            return ScopeRef(m_scopeStack, m_index - 1);
+        }
+
     private:
         ScopeStack* m_scopeStack;
         unsigned m_index;
     };
-    
+
+    struct AutoPopScopeRef : public ScopeRef {
+        AutoPopScopeRef(JSParser* parser, ScopeRef scope)
+            : ScopeRef(scope)
+            , m_parser(parser)
+        {
+        }
+
+        ~AutoPopScopeRef()
+        {
+            if (m_parser)
+                m_parser->popScope(*this, false);
+        }
+
+        void setPopped()
+        {
+            m_parser = 0;
+        }
+
+    private:
+        JSParser* m_parser;
+    };
+
     ScopeRef currentScope()
     {
         return ScopeRef(&m_scopeStack, m_scopeStack.size() - 1);
@@ -419,7 +479,7 @@ private:
         return currentScope();
     }
 
-    bool popScope(ScopeRef scope, bool shouldTrackClosedVariables)
+    bool popScopeInternal(ScopeRef& scope, bool shouldTrackClosedVariables)
     {
         ASSERT_UNUSED(scope, scope.index() == m_scopeStack.size() - 1);
         ASSERT(m_scopeStack.size() > 1);
@@ -427,7 +487,18 @@ private:
         m_scopeStack.removeLast();
         return result;
     }
-    
+
+    bool popScope(ScopeRef& scope, bool shouldTrackClosedVariables)
+    {
+        return popScopeInternal(scope, shouldTrackClosedVariables);
+    }
+
+    bool popScope(AutoPopScopeRef& scope, bool shouldTrackClosedVariables)
+    {
+        scope.setPopped();
+        return popScopeInternal(scope, shouldTrackClosedVariables);
+    }
+
     bool declareVariable(const Identifier* ident)
     {
         unsigned i = m_scopeStack.size() - 1;
@@ -448,7 +519,7 @@ private:
     ScopeStack m_scopeStack;
 };
 
-int jsParse(JSGlobalData* globalData, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode parserMode, const SourceCode* source)
+const char* jsParse(JSGlobalData* globalData, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode parserMode, const SourceCode* source)
 {
     JSParser parser(globalData->lexer, globalData, parameters, strictness == JSParseStrict, parserMode == JSParseFunctionCode, source->provider());
     return parser.parseProgram();
@@ -458,6 +529,7 @@ JSParser::JSParser(Lexer* lexer, JSGlobalData* globalData, FunctionParameters* p
     : m_lexer(lexer)
     , m_stack(globalData->stack())
     , m_error(false)
+    , m_errorMessage("Parse error")
     , m_globalData(globalData)
     , m_allowsIn(true)
     , m_tokenCount(0)
@@ -483,7 +555,7 @@ JSParser::JSParser(Lexer* lexer, JSGlobalData* globalData, FunctionParameters* p
     m_lexer->setLastLineNumber(tokenLine());
 }
 
-bool JSParser::parseProgram()
+const char* JSParser::parseProgram()
 {
     ASTBuilder context(m_globalData, m_lexer);
     if (m_lexer->isReparsing())
@@ -491,7 +563,7 @@ bool JSParser::parseProgram()
     ScopeRef scope = currentScope();
     SourceElements* sourceElements = parseSourceElements<CheckForStrictMode>(context);
     if (!sourceElements || !consume(EOFTOK))
-        return true;
+        return m_errorMessage;
     IdentifierSet capturedVariables;
     scope->getCapturedVariables(capturedVariables);
     CodeFeatures features = context.features();
@@ -502,7 +574,7 @@ bool JSParser::parseProgram()
 
     m_globalData->parser->didFinishParsing(sourceElements, context.varDeclarations(), context.funcDeclarations(), features,
                                            m_lastLine, context.numConstants(), capturedVariables);
-    return false;
+    return 0;
 }
 
 bool JSParser::allowAutomaticSemicolon()
@@ -785,12 +857,12 @@ template <class TreeBuilder> TreeStatement JSParser::parseBreakStatement(TreeBui
     next();
 
     if (autoSemiColon()) {
-        failIfFalseIfStrict(breakIsValid());
+        failIfFalse(breakIsValid());
         return context.createBreakStatement(startCol, endCol, startLine, endLine);
     }
     matchOrFail(IDENT);
     const Identifier* ident = m_token.m_data.ident;
-    failIfFalseIfStrict(hasLabel(ident));
+    failIfFalse(hasLabel(ident));
     endCol = tokenEnd();
     endLine = tokenLine();
     next();
@@ -808,12 +880,12 @@ template <class TreeBuilder> TreeStatement JSParser::parseContinueStatement(Tree
     next();
 
     if (autoSemiColon()) {
-        failIfFalseIfStrict(breakIsValid());
+        failIfFalse(breakIsValid());
         return context.createContinueStatement(startCol, endCol, startLine, endLine);
     }
     matchOrFail(IDENT);
     const Identifier* ident = m_token.m_data.ident;
-    failIfFalseIfStrict(hasLabel(ident));
+    failIfFalse(hasLabel(ident));
     endCol = tokenEnd();
     endLine = tokenLine();
     next();
@@ -824,7 +896,7 @@ template <class TreeBuilder> TreeStatement JSParser::parseContinueStatement(Tree
 template <class TreeBuilder> TreeStatement JSParser::parseReturnStatement(TreeBuilder& context)
 {
     ASSERT(match(RETURN));
-    failIfFalseIfStrict(currentScope()->isFunction());
+    failIfFalse(currentScope()->isFunction());
     int startLine = tokenLine();
     int endLine = startLine;
     int start = tokenStart();
@@ -974,7 +1046,7 @@ template <class TreeBuilder> TreeStatement JSParser::parseTryStatement(TreeBuild
         matchOrFail(IDENT);
         ident = m_token.m_data.ident;
         next();
-        ScopeRef catchScope = pushScope();
+        AutoPopScopeRef catchScope(this, pushScope());
         failIfFalseIfStrict(catchScope->declareVariable(ident));
         catchScope->preventNewDecls();
         consumeOrFail(CLOSEPAREN);
@@ -1118,7 +1190,7 @@ template <class TreeBuilder> TreeFunctionBody JSParser::parseFunctionBody(TreeBu
 
 template <JSParser::FunctionRequirements requirements, bool nameIsInContainingScope, class TreeBuilder> bool JSParser::parseFunctionInfo(TreeBuilder& context, const Identifier*& name, TreeFormalParameterList& parameters, TreeFunctionBody& body, int& openBracePos, int& closeBracePos, int& bodyStartLine)
 {
-    ScopeRef functionScope = pushScope();
+    AutoPopScopeRef functionScope(this, pushScope());
     functionScope->setIsFunction();
     if (match(IDENT)) {
         name = m_token.m_data.ident;
@@ -1188,10 +1260,12 @@ template <class TreeBuilder> TreeStatement JSParser::parseExpressionOrLabelState
     int end = tokenEnd();
     consumeOrFail(COLON);
     const Identifier* unused = 0;
-    if (strictMode() && !m_syntaxAlreadyValidated)
+    if (!m_syntaxAlreadyValidated) {
+        failIfTrue(hasLabel(ident));
         pushLabel(ident);
+    }
     TreeStatement statement = parseStatement(context, unused);
-    if (strictMode() && !m_syntaxAlreadyValidated)
+    if (!m_syntaxAlreadyValidated)
         popLabel();
     failIfFalse(statement);
     return context.createLabelStatement(ident, statement, start, end);
@@ -1679,7 +1753,13 @@ template <class TreeBuilder> TreeExpression JSParser::parsePrimaryExpression(Tre
 
         int start = tokenStart();
         next();
-        return context.createRegex(*pattern, *flags, start);
+        TreeExpression re = context.createRegExp(*pattern, *flags, start);
+        if (!re) {
+            m_errorMessage = Yarr::checkSyntax(pattern->ustring());
+            ASSERT(m_errorMessage);
+            fail();
+        }
+        return re;
     }
     default:
         fail();
diff --git a/Source/JavaScriptCore/parser/JSParser.h b/Source/JavaScriptCore/parser/JSParser.h
index 0676b41..8bb7dbb 100644
--- a/Source/JavaScriptCore/parser/JSParser.h
+++ b/Source/JavaScriptCore/parser/JSParser.h
@@ -159,6 +159,6 @@ struct JSToken {
 enum JSParserStrictness { JSParseNormal, JSParseStrict };
 enum JSParserMode { JSParseProgramCode, JSParseFunctionCode };
 
-int jsParse(JSGlobalData*, FunctionParameters*, JSParserStrictness, JSParserMode, const SourceCode*);
+const char* jsParse(JSGlobalData*, FunctionParameters*, JSParserStrictness, JSParserMode, const SourceCode*);
 }
 #endif // JSParser_h
diff --git a/Source/JavaScriptCore/parser/Nodes.h b/Source/JavaScriptCore/parser/Nodes.h
index b8e9cdf..54b7231 100644
--- a/Source/JavaScriptCore/parser/Nodes.h
+++ b/Source/JavaScriptCore/parser/Nodes.h
@@ -273,7 +273,6 @@ namespace JSC {
 
     protected:
         RegisterID* emitThrowReferenceError(BytecodeGenerator&, const UString& message);
-        RegisterID* emitThrowSyntaxError(BytecodeGenerator&, const UString& message);
 
     private:
         uint32_t m_divot;
diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp
index 7d95051..fc1e986 100644
--- a/Source/JavaScriptCore/parser/Parser.cpp
+++ b/Source/JavaScriptCore/parser/Parser.cpp
@@ -48,14 +48,14 @@ void Parser::parse(JSGlobalData* globalData, FunctionParameters* parameters, JSP
     Lexer& lexer = *globalData->lexer;
     lexer.setCode(*m_source, m_arena);
 
-    int parseError = jsParse(globalData, parameters, strictness, mode, m_source);
+    const char* parseError = jsParse(globalData, parameters, strictness, mode, m_source);
     int lineNumber = lexer.lineNumber();
     bool lexError = lexer.sawError();
     lexer.clear();
 
     if (parseError || lexError) {
         *errLine = lineNumber;
-        *errMsg = "Parse error";
+        *errMsg = parseError ? parseError : "Parse error";
         m_sourceElements = 0;
     }
 }
diff --git a/Source/JavaScriptCore/parser/SyntaxChecker.h b/Source/JavaScriptCore/parser/SyntaxChecker.h
index b00e710..1fab41f 100644
--- a/Source/JavaScriptCore/parser/SyntaxChecker.h
+++ b/Source/JavaScriptCore/parser/SyntaxChecker.h
@@ -26,6 +26,8 @@
 #ifndef SyntaxChecker_h
 #define SyntaxChecker_h
 
+#include "YarrSyntaxChecker.h"
+
 namespace JSC {
 class SyntaxChecker {
 public:
@@ -107,7 +109,7 @@ public:
     ExpressionType createNull() { return NullExpr; }
     ExpressionType createBracketAccess(ExpressionType, ExpressionType, bool, int, int, int) { return BracketExpr; }
     ExpressionType createDotAccess(ExpressionType, const Identifier&, int, int, int) { return DotExpr; }
-    ExpressionType createRegex(const Identifier&, const Identifier&, int) { return RegExpExpr; }
+    ExpressionType createRegExp(const Identifier& pattern, const Identifier&, int) { return Yarr::checkSyntax(pattern.ustring()) ? 0 : RegExpExpr; }
     ExpressionType createNewExpr(ExpressionType, int, int, int, int) { return NewExpr; }
     ExpressionType createNewExpr(ExpressionType, int, int) { return NewExpr; }
     ExpressionType createConditionalExpr(ExpressionType, ExpressionType, ExpressionType) { return ConditionalExpr; }
diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
index 1ef264c..4a58800 100644
--- a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
+++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -130,11 +130,16 @@ JSObject* createNotAnObjectError(ExecState* exec, JSValue value)
 JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const UString& propertyName)
 {
     return createReferenceError(exec, makeUString("Strict mode forbids implicit creation of global property '", propertyName, "'"));
-}    
+}
+
+JSObject* createOutOfMemoryError(JSGlobalObject* globalObject)
+{
+    return createError(globalObject, "Out of memory");
+}
 
 JSObject* throwOutOfMemoryError(ExecState* exec)
 {
-    return throwError(exec, createError(exec, "Out of memory"));
+    return throwError(exec, createOutOfMemoryError(exec->lexicalGlobalObject()));
 }
 
 JSObject* throwStackOverflowError(ExecState* exec)
diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.h b/Source/JavaScriptCore/runtime/ExceptionHelpers.h
index 7edffad..5f1ec6f 100644
--- a/Source/JavaScriptCore/runtime/ExceptionHelpers.h
+++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.h
@@ -47,6 +47,7 @@ namespace JSC {
     JSObject* createTerminatedExecutionException(JSGlobalData*);
     JSObject* createStackOverflowError(ExecState*);
     JSObject* createStackOverflowError(JSGlobalObject*);
+    JSObject* createOutOfMemoryError(JSGlobalObject*);
     JSObject* createUndefinedVariableError(ExecState*, const Identifier&);
     JSObject* createNotAnObjectError(ExecState*, JSValue);
     JSObject* createInvalidParamError(ExecState*, const char* op, JSValue);
diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp
index c7262be..25c551b 100644
--- a/Source/JavaScriptCore/runtime/Executable.cpp
+++ b/Source/JavaScriptCore/runtime/Executable.cpp
@@ -109,8 +109,12 @@ JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scope
     ASSERT(!m_evalCodeBlock);
     m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
     OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get())));
-    generator->generate();
-    
+    if ((exception = generator->generate())) {
+        m_evalCodeBlock.clear();
+        evalNode->destroyData();
+        return exception;
+    }
+
     evalNode->destroyData();
 
 #if ENABLE(JIT)
@@ -157,7 +161,11 @@ JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* sc
     
     m_programCodeBlock = adoptPtr(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()));
     OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock.get())));
-    generator->generate();
+    if ((exception = generator->generate())) {
+        m_programCodeBlock.clear();
+        programNode->destroyData();
+        return exception;
+    }
 
     programNode->destroyData();
 
@@ -194,7 +202,12 @@ JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChain
     ASSERT(!m_codeBlockForCall);
     m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), false));
     OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get())));
-    generator->generate();
+    if ((exception = generator->generate())) {
+        m_codeBlockForCall.clear();
+        body->destroyData();
+        return exception;
+    }
+
     m_numParametersForCall = m_codeBlockForCall->m_numParameters;
     ASSERT(m_numParametersForCall);
     m_numCapturedVariables = m_codeBlockForCall->m_numCapturedVars;
@@ -235,7 +248,12 @@ JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, Scope
     ASSERT(!m_codeBlockForConstruct);
     m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), true));
     OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get())));
-    generator->generate();
+    if ((exception = generator->generate())) {
+        m_codeBlockForConstruct.clear();
+        body->destroyData();
+        return exception;
+    }
+
     m_numParametersForConstruct = m_codeBlockForConstruct->m_numParameters;
     ASSERT(m_numParametersForConstruct);
     m_numCapturedVariables = m_codeBlockForConstruct->m_numCapturedVars;
diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
index 21ca170..30d3eab 100644
--- a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -307,7 +307,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
 
     RefPtr<RegExp> regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
     if (!regExp->isValid())
-        return throwError(exec, createSyntaxError(exec, makeUString("Invalid regular expression: ", regExp->errorMessage())));
+        return throwError(exec, createSyntaxError(exec, regExp->errorMessage()));
     return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
 }
 
diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
index 0a4c8bf..04bcc3b 100644
--- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -95,7 +95,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
     }
 
     if (!regExp->isValid())
-        return throwVMError(exec, createSyntaxError(exec, makeUString("Invalid regular expression: ", regExp->errorMessage())));
+        return throwVMError(exec, createSyntaxError(exec, regExp->errorMessage()));
 
     asRegExpObject(thisValue)->setRegExp(regExp.release());
     asRegExpObject(thisValue)->setLastIndex(0);
diff --git a/Source/JavaScriptCore/yarr/RegexParser.h b/Source/JavaScriptCore/yarr/RegexParser.h
index ec5f589..2e42f8a 100644
--- a/Source/JavaScriptCore/yarr/RegexParser.h
+++ b/Source/JavaScriptCore/yarr/RegexParser.h
@@ -34,6 +34,7 @@
 namespace JSC { namespace Yarr {
 
 static const unsigned quantifyInfinite = UINT_MAX;
+#define REGEXP_ERROR_PREFIX "Invalid regular expression: "
 
 enum BuiltInCharacterClassID {
     DigitClassID,
@@ -673,31 +674,24 @@ private:
      */
     const char* parse()
     {
-        m_delegate.regexBegin();
-
         if (m_size > MAX_PATTERN_SIZE)
             m_err = PatternTooLarge;
         else
             parseTokens();
         ASSERT(atEndOfPattern() || m_err);
 
-        if (m_err)
-            m_delegate.regexError();
-        else
-            m_delegate.regexEnd();
-
         // The order of this array must match the ErrorCode enum.
         static const char* errorMessages[NumberOfErrorCodes] = {
             0, // NoError
-            "regular expression too large",
-            "numbers out of order in {} quantifier",
-            "nothing to repeat",
-            "missing )",
-            "unmatched parentheses",
-            "unrecognized character after (?",
-            "missing terminating ] for character class",
-            "range out of order in character class",
-            "\\ at end of pattern"
+            REGEXP_ERROR_PREFIX "regular expression too large",
+            REGEXP_ERROR_PREFIX "numbers out of order in {} quantifier",
+            REGEXP_ERROR_PREFIX "nothing to repeat",
+            REGEXP_ERROR_PREFIX "missing )",
+            REGEXP_ERROR_PREFIX "unmatched parentheses",
+            REGEXP_ERROR_PREFIX "unrecognized character after (?",
+            REGEXP_ERROR_PREFIX "missing terminating ] for character class",
+            REGEXP_ERROR_PREFIX "range out of order in character class",
+            REGEXP_ERROR_PREFIX "\\ at end of pattern"
         };
 
         return errorMessages[m_err];
@@ -839,14 +833,6 @@ private:
  *
  *    void disjunction();
  *
- *    void regexBegin();
- *    void regexEnd();
- *    void regexError();
- *
- * Before any call recording tokens are made, regexBegin() will be called on the
- * delegate once.  Once parsing is complete either regexEnd() or regexError() will
- * be called, as appropriate.
- *
  * The regular expression is described by a sequence of assertion*() and atom*()
  * callbacks to the delegate, describing the terms in the regular expression.
  * Following an atom a quantifyAtom() call may occur to indicate that the previous
diff --git a/Source/JavaScriptCore/yarr/RegexPattern.cpp b/Source/JavaScriptCore/yarr/RegexPattern.cpp
index e737d0e..f9aa92d 100644
--- a/Source/JavaScriptCore/yarr/RegexPattern.cpp
+++ b/Source/JavaScriptCore/yarr/RegexPattern.cpp
@@ -611,12 +611,6 @@ public:
         m_alternative = m_pattern.m_body->addNewAlternative();
         m_pattern.m_disjunctions.append(m_pattern.m_body);
     }
-    void regexEnd()
-    {
-    }
-    void regexError()
-    {
-    }
 
     unsigned setupAlternativeOffsets(PatternAlternative* alternative, unsigned currentCallFrameSize, unsigned initialInputPosition)
     {
@@ -940,6 +934,7 @@ static const char* compileRegex(const UString& patternString, RegexPattern& patt
 {
     RegexPatternConstructor constructor(pattern);
 
+    constructor.regexBegin();
     if (const char* error = parse(constructor, patternString))
         return error;
     
@@ -951,6 +946,7 @@ static const char* compileRegex(const UString& patternString, RegexPattern& patt
         unsigned numSubpatterns = pattern.m_numSubpatterns;
 
         constructor.reset();
+        constructor.regexBegin();
 #if !ASSERT_DISABLED
         const char* error =
 #endif
diff --git a/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp b/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp
new file mode 100644
index 0000000..a023082
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "YarrSyntaxChecker.h"
+
+#include "RegexParser.h"
+
+namespace JSC { namespace Yarr {
+
+class SyntaxChecker {
+public:
+    void assertionBOL() {}
+    void assertionEOL() {}
+    void assertionWordBoundary(bool) {}
+    void atomPatternCharacter(UChar) {}
+    void atomBuiltInCharacterClass(BuiltInCharacterClassID, bool) {}
+    void atomCharacterClassBegin(bool = false) {}
+    void atomCharacterClassAtom(UChar) {}
+    void atomCharacterClassRange(UChar, UChar) {}
+    void atomCharacterClassBuiltIn(BuiltInCharacterClassID, bool) {}
+    void atomCharacterClassEnd() {}
+    void atomParenthesesSubpatternBegin(bool = true) {}
+    void atomParentheticalAssertionBegin(bool = false) {}
+    void atomParenthesesEnd() {}
+    void atomBackReference(unsigned) {}
+    void quantifyAtom(unsigned, unsigned, bool) {}
+    void disjunction() {}
+};
+
+const char* checkSyntax(const UString& pattern)
+{
+    SyntaxChecker syntaxChecker;
+    return parse(syntaxChecker, pattern);
+}
+
+}} // JSC::YARR
diff --git a/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h b/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h
new file mode 100644
index 0000000..e48cb9e
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef YarrSyntaxChecker_h
+#define YarrSyntaxChecker_h
+
+#include <UString.h>
+
+namespace JSC { namespace Yarr {
+
+const char* checkSyntax(const UString& pattern);
+
+}} // JSC::YARR
+
+#endif // YarrSyntaxChecker_h
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list