Changeset 181829 in webkit
- Timestamp:
- Mar 21, 2015 8:14:47 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181827 r181829 1 2015-03-21 Joseph Pecoraro <pecoraro@apple.com> 2 3 Computed Property names should allow only AssignmentExpressions not any Expression 4 https://bugs.webkit.org/show_bug.cgi?id=142902 5 6 Reviewed by Ryosuke Niwa. 7 8 * js/basic-computed-property-name-expected.txt: 9 * js/object-literal-computed-methods-expected.txt: 10 * js/script-tests/basic-computed-property-name.js: 11 (runTest.runTest.runTest.runTest.runTest.runTest.runTest.runTestThrow): 12 * js/script-tests/object-literal-computed-methods.js: 13 Test that comma expressions are not allowed in computed property/method names. 14 1 15 2015-03-21 Benjamin Poulain <bpoulain@apple.com> 2 16 -
trunk/LayoutTests/js/basic-computed-property-name-expected.txt
r181807 r181829 7 7 PASS 'use strict';({[a]: true}.propertyName) is true 8 8 PASS (function(){'use strict';return ({[a]: true}.propertyName)})() is true 9 PASS ({[(1,a)]: true}.propertyName) is true 10 PASS 'use strict';({[(1,a)]: true}.propertyName) is true 11 PASS (function(){'use strict';return ({[(1,a)]: true}.propertyName)})() is true 9 12 PASS ({[a+1]: true}.propertyName1) is true 10 13 PASS 'use strict';({[a+1]: true}.propertyName1) is true … … 49 52 PASS 'use strict';({__proto__: {get '0'(){ return false; }}, [a]: true}[0]) is true 50 53 PASS (function(){'use strict';return ({__proto__: {get '0'(){ return false; }}, [a]: true}[0])})() is true 54 PASS ({[1,a]: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 55 PASS 'use strict';({[1,a]: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 56 PASS (function(){'use strict';return ({[1,a]: true}.propertyName)})() threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 57 PASS ({propertyName: false, [1,a]: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 58 PASS 'use strict';({propertyName: false, [1,a]: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 59 PASS (function(){'use strict';return ({propertyName: false, [1,a]: true}.propertyName)})() threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 60 PASS ({[1,a]: false, propertyName: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 61 PASS 'use strict';({[1,a]: false, propertyName: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 62 PASS (function(){'use strict';return ({[1,a]: false, propertyName: true}.propertyName)})() threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 63 PASS ({get propertyName(){ return false; }, [1,a]: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 64 PASS 'use strict';({get propertyName(){ return false; }, [1,a]: true}.propertyName) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 65 PASS (function(){'use strict';return ({get propertyName(){ return false; }, [1,a]: true}.propertyName)})() threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 51 66 PASS successfullyParsed is true 52 67 -
trunk/LayoutTests/js/object-literal-computed-methods-expected.txt
r181810 r181829 51 51 PASS ({ [](,,,){} }) threw exception SyntaxError: Unexpected token ']'. 52 52 PASS ({ [1+](){} }) threw exception SyntaxError: Unexpected token ']'. 53 PASS ({ [1,](){} }) threw exception SyntaxError: Unexpected token ']'. 53 PASS ({ [1,](){} }) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 54 PASS ({ [1,'name'](){} }) threw exception SyntaxError: Unexpected token ','. Expected ']' to end a computed property name.. 54 55 PASS ({ [[1](){} }) threw exception SyntaxError: Unexpected token '{'. Expected ']' to end a computed property name.. 55 56 PASS ({ [foo](,,,){} }) threw exception SyntaxError: Unexpected token ','. Expected a parameter pattern or a ')' in parameter list.. -
trunk/LayoutTests/js/script-tests/basic-computed-property-name.js
r181807 r181829 10 10 shouldBeTrue("(function(){'use strict';return "+test+"})()"); 11 11 } 12 12 13 runTest("{[a]: true}.propertyName") 14 runTest("{[(1,a)]: true}.propertyName") 13 15 runTest("{[a+1]: true}.propertyName1") 14 16 runTest("{propertyName: false, [a]: true}.propertyName") … … 26 28 runTest("{[a]: true, get '0'(){ return false; }}[0]") 27 29 runTest("{__proto__: {get '0'(){ return false; }}, [a]: true}[0]") 30 31 function runTestThrow(test) 32 { 33 test = "(" + test + ")" 34 shouldThrow(test); 35 shouldThrow("'use strict';"+test); 36 shouldThrow("(function(){'use strict';return "+test+"})()"); 37 } 38 39 a = "propertyName" 40 runTestThrow("{[1,a]: true}.propertyName") 41 runTestThrow("{propertyName: false, [1,a]: true}.propertyName") 42 runTestThrow("{[1,a]: false, propertyName: true}.propertyName") 43 runTestThrow("{get propertyName(){ return false; }, [1,a]: true}.propertyName") -
trunk/LayoutTests/js/script-tests/object-literal-computed-methods.js
r181183 r181829 63 63 shouldThrow("({ [1+](){} })"); 64 64 shouldThrow("({ [1,](){} })"); 65 shouldThrow("({ [1,'name'](){} })"); 65 66 shouldThrow("({ [[1](){} })"); 66 67 shouldThrow("({ [foo](,,,){} })"); -
trunk/Source/JavaScriptCore/ChangeLog
r181828 r181829 1 2015-03-21 Joseph Pecoraro <pecoraro@apple.com> 2 3 Computed Property names should allow only AssignmentExpressions not any Expression 4 https://bugs.webkit.org/show_bug.cgi?id=142902 5 6 Reviewed by Ryosuke Niwa. 7 8 * parser/Parser.cpp: 9 (JSC::Parser<LexerType>::parseProperty): 10 Limit computed expressions to just assignment expressions instead of 11 any expression (which allowed comma expressions). 12 1 13 2015-03-21 Andreas Kling <akling@apple.com> 2 14 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r181818 r181829 2005 2005 case OPENBRACKET: { 2006 2006 next(); 2007 auto propertyName = parse Expression(context);2007 auto propertyName = parseAssignmentExpression(context); 2008 2008 failIfFalse(propertyName, "Cannot parse computed property name"); 2009 2009 handleProductionOrFail(CLOSEBRACKET, "]", "end", "computed property name");
Note: See TracChangeset
for help on using the changeset viewer.