Changeset 69941 in webkit
- Timestamp:
- Oct 17, 2010 10:42:26 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r69940 r69941 1 2010-10-17 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Strict mode: arguments is not valid as the base expression for pre- or post-fix expressions 6 https://bugs.webkit.org/show_bug.cgi?id=47791 7 8 Simple fix, check for arguments in addition to eval. 9 10 * parser/JSParser.cpp: 11 (JSC::JSParser::parseUnaryExpression): 12 1 13 2010-10-17 Oliver Hunt <oliver@apple.com> 2 14 -
trunk/JavaScriptCore/parser/JSParser.cpp
r69940 r69941 1870 1870 TreeExpression expr = parseMemberExpression(context); 1871 1871 failIfFalse(expr); 1872 bool isEval = false;1872 bool isEvalOrArguments = false; 1873 1873 if (strictMode() && !m_syntaxAlreadyValidated) { 1874 if (context.isResolve(expr)) 1875 isEval = m_globalData->propertyNames->eval == *m_lastIdentifier; 1876 } 1877 failIfTrueIfStrict(isEval && modifiesExpr); 1874 if (context.isResolve(expr)) { 1875 isEvalOrArguments = m_globalData->propertyNames->eval == *m_lastIdentifier; 1876 if (!isEvalOrArguments && currentScope()->isFunction()) 1877 isEvalOrArguments = m_globalData->propertyNames->arguments == *m_lastIdentifier; 1878 } 1879 } 1880 failIfTrueIfStrict(isEvalOrArguments && modifiesExpr); 1878 1881 switch (m_token.m_type) { 1879 1882 case PLUSPLUS: … … 1882 1885 expr = context.makePostfixNode(expr, OpPlusPlus, subExprStart, lastTokenEnd(), tokenEnd()); 1883 1886 m_assignmentCount++; 1884 failIfTrueIfStrict(isEval );1887 failIfTrueIfStrict(isEvalOrArguments); 1885 1888 failIfTrueIfStrict(requiresLExpr); 1886 1889 next(); … … 1891 1894 expr = context.makePostfixNode(expr, OpMinusMinus, subExprStart, lastTokenEnd(), tokenEnd()); 1892 1895 m_assignmentCount++; 1893 failIfTrueIfStrict(isEval );1896 failIfTrueIfStrict(isEvalOrArguments); 1894 1897 failIfTrueIfStrict(requiresLExpr); 1895 1898 next(); -
trunk/LayoutTests/ChangeLog
r69940 r69941 1 2010-10-17 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Strict mode: arguments is not valid as the base expression for pre- or post-fix expressions 6 https://bugs.webkit.org/show_bug.cgi?id=47791 7 8 Add arguments tests, and make pre-/post-fix expression tests cover another case I was 9 needlessly worried about. 10 11 * fast/js/basic-strict-mode-expected.txt: 12 * fast/js/script-tests/basic-strict-mode.js: 13 1 14 2010-10-17 Oliver Hunt <oliver@apple.com> 2 15 -
trunk/LayoutTests/fast/js/basic-strict-mode-expected.txt
r69940 r69941 62 62 PASS 'use strict'; --eval threw exception SyntaxError: Parse error. 63 63 PASS 'use strict'; eval-- threw exception SyntaxError: Parse error. 64 PASS 'use strict'; function f() { ++arguments } threw exception SyntaxError: Parse error. 65 PASS 'use strict'; function f() { arguments++ } threw exception SyntaxError: Parse error. 66 PASS 'use strict'; function f() { --arguments } threw exception SyntaxError: Parse error. 67 PASS 'use strict'; function f() { arguments-- } threw exception SyntaxError: Parse error. 68 PASS global.eval('"use strict"; if (0) ++arguments; true;') is true 69 PASS 'use strict'; ++(1, eval) threw exception ReferenceError: Prefix ++ operator applied to value that is not a reference.. 70 PASS 'use strict'; (1, eval)++ threw exception ReferenceError: Postfix ++ operator applied to value that is not a reference.. 71 PASS 'use strict'; --(1, eval) threw exception ReferenceError: Prefix -- operator applied to value that is not a reference.. 72 PASS 'use strict'; (1, eval)-- threw exception ReferenceError: Postfix -- operator applied to value that is not a reference.. 73 PASS 'use strict'; function f() { ++(1, arguments) } threw exception SyntaxError: Parse error. 74 PASS 'use strict'; function f() { (1, arguments)++ } threw exception SyntaxError: Parse error. 75 PASS 'use strict'; function f() { --(1, arguments) } threw exception SyntaxError: Parse error. 76 PASS 'use strict'; function f() { (1, arguments)-- } threw exception SyntaxError: Parse error. 64 77 PASS 'use strict'; if (0) delete +a.b threw exception SyntaxError: Parse error. 65 78 PASS 'use strict'; if (0) delete ++a.b threw exception SyntaxError: Parse error. -
trunk/LayoutTests/fast/js/script-tests/basic-strict-mode.js
r69940 r69941 74 74 shouldThrow("'use strict'; --eval"); 75 75 shouldThrow("'use strict'; eval--"); 76 shouldThrow("'use strict'; function f() { ++arguments }"); 77 shouldThrow("'use strict'; function f() { arguments++ }"); 78 shouldThrow("'use strict'; function f() { --arguments }"); 79 shouldThrow("'use strict'; function f() { arguments-- }"); 80 var global = this; 81 shouldBeTrue("global.eval('\"use strict\"; if (0) ++arguments; true;')"); 82 shouldThrow("'use strict'; ++(1, eval)"); 83 shouldThrow("'use strict'; (1, eval)++"); 84 shouldThrow("'use strict'; --(1, eval)"); 85 shouldThrow("'use strict'; (1, eval)--"); 86 shouldThrow("'use strict'; function f() { ++(1, arguments) }"); 87 shouldThrow("'use strict'; function f() { (1, arguments)++ }"); 88 shouldThrow("'use strict'; function f() { --(1, arguments) }"); 89 shouldThrow("'use strict'; function f() { (1, arguments)-- }"); 76 90 shouldThrow("'use strict'; if (0) delete +a.b"); 77 91 shouldThrow("'use strict'; if (0) delete ++a.b");
Note: See TracChangeset
for help on using the changeset viewer.