[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

oliver at apple.com oliver at apple.com
Wed Dec 22 14:42:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 18e42d34372fce581b2c36d6ecf5e66a5e85a6fd
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 18 05:42:26 2010 +0000

    2010-10-17  Oliver Hunt  <oliver at apple.com>
    
            Reviewed by Sam Weinig.
    
            Strict mode: arguments is not valid as the base expression for pre- or post-fix expressions
            https://bugs.webkit.org/show_bug.cgi?id=47791
    
            Simple fix, check for arguments in addition to eval.
    
            * parser/JSParser.cpp:
            (JSC::JSParser::parseUnaryExpression):
    2010-10-17  Oliver Hunt  <oliver at apple.com>
    
            Reviewed by Sam Weinig.
    
            Strict mode: arguments is not valid as the base expression for pre- or post-fix expressions
            https://bugs.webkit.org/show_bug.cgi?id=47791
    
            Add arguments tests, and make pre-/post-fix expression tests cover another case I was
            needlessly worried about.
    
            * fast/js/basic-strict-mode-expected.txt:
            * fast/js/script-tests/basic-strict-mode.js:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69941 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index dffb9ca..190847e 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -2,6 +2,18 @@
 
         Reviewed by Sam Weinig.
 
+        Strict mode: arguments is not valid as the base expression for pre- or post-fix expressions
+        https://bugs.webkit.org/show_bug.cgi?id=47791
+
+        Simple fix, check for arguments in addition to eval.
+
+        * parser/JSParser.cpp:
+        (JSC::JSParser::parseUnaryExpression):
+
+2010-10-17  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Strict mode: Assignment that would create a global should be a late ReferenceError, not a syntax failure
         https://bugs.webkit.org/show_bug.cgi?id=47788
 
diff --git a/JavaScriptCore/parser/JSParser.cpp b/JavaScriptCore/parser/JSParser.cpp
index aab1081..7f8cadb 100644
--- a/JavaScriptCore/parser/JSParser.cpp
+++ b/JavaScriptCore/parser/JSParser.cpp
@@ -1869,19 +1869,22 @@ template <class TreeBuilder> TreeExpression JSParser::parseUnaryExpression(TreeB
     int subExprStart = tokenStart();
     TreeExpression expr = parseMemberExpression(context);
     failIfFalse(expr);
-    bool isEval = false;
+    bool isEvalOrArguments = false;
     if (strictMode() && !m_syntaxAlreadyValidated) {
-        if (context.isResolve(expr))
-            isEval = m_globalData->propertyNames->eval == *m_lastIdentifier;
+        if (context.isResolve(expr)) {
+            isEvalOrArguments = m_globalData->propertyNames->eval == *m_lastIdentifier;
+            if (!isEvalOrArguments && currentScope()->isFunction())
+                isEvalOrArguments = m_globalData->propertyNames->arguments == *m_lastIdentifier;
+        }
     }
-    failIfTrueIfStrict(isEval && modifiesExpr);
+    failIfTrueIfStrict(isEvalOrArguments && modifiesExpr);
     switch (m_token.m_type) {
     case PLUSPLUS:
         m_nonTrivialExpressionCount++;
         m_nonLHSCount++;
         expr = context.makePostfixNode(expr, OpPlusPlus, subExprStart, lastTokenEnd(), tokenEnd());
         m_assignmentCount++;
-        failIfTrueIfStrict(isEval);
+        failIfTrueIfStrict(isEvalOrArguments);
         failIfTrueIfStrict(requiresLExpr);
         next();
         break;
@@ -1890,7 +1893,7 @@ template <class TreeBuilder> TreeExpression JSParser::parseUnaryExpression(TreeB
         m_nonLHSCount++;
         expr = context.makePostfixNode(expr, OpMinusMinus, subExprStart, lastTokenEnd(), tokenEnd());
         m_assignmentCount++;
-        failIfTrueIfStrict(isEval);
+        failIfTrueIfStrict(isEvalOrArguments);
         failIfTrueIfStrict(requiresLExpr);
         next();
         break;
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9a59944..1d95113 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -2,6 +2,19 @@
 
         Reviewed by Sam Weinig.
 
+        Strict mode: arguments is not valid as the base expression for pre- or post-fix expressions
+        https://bugs.webkit.org/show_bug.cgi?id=47791
+
+        Add arguments tests, and make pre-/post-fix expression tests cover another case I was
+        needlessly worried about.
+
+        * fast/js/basic-strict-mode-expected.txt:
+        * fast/js/script-tests/basic-strict-mode.js:
+
+2010-10-17  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Strict mode: Assignment that would create a global should be a late ReferenceError, not a syntax failure
         https://bugs.webkit.org/show_bug.cgi?id=47788
 
diff --git a/LayoutTests/fast/js/basic-strict-mode-expected.txt b/LayoutTests/fast/js/basic-strict-mode-expected.txt
index fdb99d6..ccad7c1 100644
--- a/LayoutTests/fast/js/basic-strict-mode-expected.txt
+++ b/LayoutTests/fast/js/basic-strict-mode-expected.txt
@@ -61,6 +61,19 @@ PASS 'use strict'; ++eval threw exception SyntaxError: Parse error.
 PASS 'use strict'; eval++ threw exception SyntaxError: Parse error.
 PASS 'use strict'; --eval threw exception SyntaxError: Parse error.
 PASS 'use strict'; eval-- threw exception SyntaxError: Parse error.
+PASS 'use strict'; function f() { ++arguments } threw exception SyntaxError: Parse error.
+PASS 'use strict'; function f() { arguments++ } threw exception SyntaxError: Parse error.
+PASS 'use strict'; function f() { --arguments } threw exception SyntaxError: Parse error.
+PASS 'use strict'; function f() { arguments-- } threw exception SyntaxError: Parse error.
+PASS global.eval('"use strict"; if (0) ++arguments; true;') is true
+PASS 'use strict'; ++(1, eval) threw exception ReferenceError: Prefix ++ operator applied to value that is not a reference..
+PASS 'use strict'; (1, eval)++ threw exception ReferenceError: Postfix ++ operator applied to value that is not a reference..
+PASS 'use strict'; --(1, eval) threw exception ReferenceError: Prefix -- operator applied to value that is not a reference..
+PASS 'use strict'; (1, eval)-- threw exception ReferenceError: Postfix -- operator applied to value that is not a reference..
+PASS 'use strict'; function f() { ++(1, arguments) } threw exception SyntaxError: Parse error.
+PASS 'use strict'; function f() { (1, arguments)++ } threw exception SyntaxError: Parse error.
+PASS 'use strict'; function f() { --(1, arguments) } threw exception SyntaxError: Parse error.
+PASS 'use strict'; function f() { (1, arguments)-- } threw exception SyntaxError: Parse error.
 PASS 'use strict'; if (0) delete +a.b threw exception SyntaxError: Parse error.
 PASS 'use strict'; if (0) delete ++a.b threw exception SyntaxError: Parse error.
 PASS 'use strict'; if (0) delete void a.b threw exception SyntaxError: Parse error.
diff --git a/LayoutTests/fast/js/script-tests/basic-strict-mode.js b/LayoutTests/fast/js/script-tests/basic-strict-mode.js
index 7f66268..7044746 100644
--- a/LayoutTests/fast/js/script-tests/basic-strict-mode.js
+++ b/LayoutTests/fast/js/script-tests/basic-strict-mode.js
@@ -73,6 +73,20 @@ shouldThrow("'use strict'; ++eval");
 shouldThrow("'use strict'; eval++");
 shouldThrow("'use strict'; --eval");
 shouldThrow("'use strict'; eval--");
+shouldThrow("'use strict'; function f() { ++arguments }");
+shouldThrow("'use strict'; function f() { arguments++ }");
+shouldThrow("'use strict'; function f() { --arguments }");
+shouldThrow("'use strict'; function f() { arguments-- }");
+var global = this;
+shouldBeTrue("global.eval('\"use strict\"; if (0) ++arguments; true;')");
+shouldThrow("'use strict'; ++(1, eval)");
+shouldThrow("'use strict'; (1, eval)++");
+shouldThrow("'use strict'; --(1, eval)");
+shouldThrow("'use strict'; (1, eval)--");
+shouldThrow("'use strict'; function f() { ++(1, arguments) }");
+shouldThrow("'use strict'; function f() { (1, arguments)++ }");
+shouldThrow("'use strict'; function f() { --(1, arguments) }");
+shouldThrow("'use strict'; function f() { (1, arguments)-- }");
 shouldThrow("'use strict'; if (0) delete +a.b");
 shouldThrow("'use strict'; if (0) delete ++a.b");
 shouldThrow("'use strict'; if (0) delete void a.b");

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list