Title: [181807] trunk
Revision
181807
Author
commit-qu...@webkit.org
Date
2015-03-20 11:10:17 -0700 (Fri, 20 Mar 2015)

Log Message

SyntaxChecker assertion is trapped with computed property name and getter
https://bugs.webkit.org/show_bug.cgi?id=142863

Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-03-20
Reviewed by Ryosuke Niwa.

Source/_javascript_Core:

* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::getName):
Remove invalid assert. Computed properties will not have a name
and the calling code is checking for null expecting it. The
AST path (non-CheckingPath) already does this without the assert
so it is well tested.

LayoutTests:

* js/basic-computed-property-name-expected.txt:
* js/script-tests/basic-computed-property-name.js:
(a.string_appeared_here.runTest):
Add tests that wrap the _expression_ in a function, this
will test the syntax checker.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (181806 => 181807)


--- trunk/LayoutTests/ChangeLog	2015-03-20 18:08:29 UTC (rev 181806)
+++ trunk/LayoutTests/ChangeLog	2015-03-20 18:10:17 UTC (rev 181807)
@@ -1,3 +1,16 @@
+2015-03-20  Joseph Pecoraro  <pecor...@apple.com>
+
+        SyntaxChecker assertion is trapped with computed property name and getter
+        https://bugs.webkit.org/show_bug.cgi?id=142863
+
+        Reviewed by Ryosuke Niwa.
+
+        * js/basic-computed-property-name-expected.txt:
+        * js/script-tests/basic-computed-property-name.js:
+        (a.string_appeared_here.runTest):
+        Add tests that wrap the _expression_ in a function, this
+        will test the syntax checker.
+
 2015-03-20  Alexey Proskuryakov  <a...@apple.com>
 
         platform/mac/fast/loader/file-url-mimetypes-3.html fails when MS Office is installed

Modified: trunk/LayoutTests/js/basic-computed-property-name-expected.txt (181806 => 181807)


--- trunk/LayoutTests/js/basic-computed-property-name-expected.txt	2015-03-20 18:08:29 UTC (rev 181806)
+++ trunk/LayoutTests/js/basic-computed-property-name-expected.txt	2015-03-20 18:10:17 UTC (rev 181807)
@@ -5,34 +5,49 @@
 
 PASS ({[a]: true}.propertyName) is true
 PASS 'use strict';({[a]: true}.propertyName) is true
+PASS (function(){'use strict';return ({[a]: true}.propertyName)})() is true
 PASS ({[a+1]: true}.propertyName1) is true
 PASS 'use strict';({[a+1]: true}.propertyName1) is true
+PASS (function(){'use strict';return ({[a+1]: true}.propertyName1)})() is true
 PASS ({propertyName: false, [a]: true}.propertyName) is true
 PASS 'use strict';({propertyName: false, [a]: true}.propertyName) is true
+PASS (function(){'use strict';return ({propertyName: false, [a]: true}.propertyName)})() is true
 PASS ({[a]: false, propertyName: true}.propertyName) is true
 PASS 'use strict';({[a]: false, propertyName: true}.propertyName) is true
+PASS (function(){'use strict';return ({[a]: false, propertyName: true}.propertyName)})() is true
 PASS ({get propertyName(){ return false; }, [a]: true}.propertyName) is true
 PASS 'use strict';({get propertyName(){ return false; }, [a]: true}.propertyName) is true
+PASS (function(){'use strict';return ({get propertyName(){ return false; }, [a]: true}.propertyName)})() is true
 PASS ({[a]: false, get propertyName(){ return true; }}.propertyName) is true
 PASS 'use strict';({[a]: false, get propertyName(){ return true; }}.propertyName) is true
+PASS (function(){'use strict';return ({[a]: false, get propertyName(){ return true; }}.propertyName)})() is true
 PASS ({__proto__: {get propertyName(){ return false; }}, [a]: true}.propertyName) is true
 PASS 'use strict';({__proto__: {get propertyName(){ return false; }}, [a]: true}.propertyName) is true
+PASS (function(){'use strict';return ({__proto__: {get propertyName(){ return false; }}, [a]: true}.propertyName)})() is true
 PASS ({__proto__: {get propertyName(){ return false; }}, propertyName: true}.propertyName) is true
 PASS 'use strict';({__proto__: {get propertyName(){ return false; }}, propertyName: true}.propertyName) is true
+PASS (function(){'use strict';return ({__proto__: {get propertyName(){ return false; }}, propertyName: true}.propertyName)})() is true
 PASS ({[a]: true}[0]) is true
 PASS 'use strict';({[a]: true}[0]) is true
+PASS (function(){'use strict';return ({[a]: true}[0])})() is true
 PASS ({[a+1]: true}[1]) is true
 PASS 'use strict';({[a+1]: true}[1]) is true
+PASS (function(){'use strict';return ({[a+1]: true}[1])})() is true
 PASS ({0: false, [a]: true}[0]) is true
 PASS 'use strict';({0: false, [a]: true}[0]) is true
+PASS (function(){'use strict';return ({0: false, [a]: true}[0])})() is true
 PASS ({[a]: false, 0: true}[0]) is true
 PASS 'use strict';({[a]: false, 0: true}[0]) is true
+PASS (function(){'use strict';return ({[a]: false, 0: true}[0])})() is true
 PASS ({get '0'(){ return false; }, [a]: true}[0]) is true
 PASS 'use strict';({get '0'(){ return false; }, [a]: true}[0]) is true
+PASS (function(){'use strict';return ({get '0'(){ return false; }, [a]: true}[0])})() is true
 PASS ({[a]: true, get '0'(){ return false; }}[0]) is true
 PASS 'use strict';({[a]: true, get '0'(){ return false; }}[0]) is true
+PASS (function(){'use strict';return ({[a]: true, get '0'(){ return false; }}[0])})() is true
 PASS ({__proto__: {get '0'(){ return false; }}, [a]: true}[0]) is true
 PASS 'use strict';({__proto__: {get '0'(){ return false; }}, [a]: true}[0]) is true
+PASS (function(){'use strict';return ({__proto__: {get '0'(){ return false; }}, [a]: true}[0])})() is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/js/script-tests/basic-computed-property-name.js (181806 => 181807)


--- trunk/LayoutTests/js/script-tests/basic-computed-property-name.js	2015-03-20 18:08:29 UTC (rev 181806)
+++ trunk/LayoutTests/js/script-tests/basic-computed-property-name.js	2015-03-20 18:10:17 UTC (rev 181807)
@@ -7,6 +7,7 @@
     test = "(" + test + ")"
     shouldBeTrue(test);
     shouldBeTrue("'use strict';"+test);
+    shouldBeTrue("(function(){'use strict';return "+test+"})()");
 }
 runTest("{[a]: true}.propertyName")
 runTest("{[a+1]: true}.propertyName1")

Modified: trunk/Source/_javascript_Core/ChangeLog (181806 => 181807)


--- trunk/Source/_javascript_Core/ChangeLog	2015-03-20 18:08:29 UTC (rev 181806)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-03-20 18:10:17 UTC (rev 181807)
@@ -1,3 +1,17 @@
+2015-03-20  Joseph Pecoraro  <pecor...@apple.com>
+
+        SyntaxChecker assertion is trapped with computed property name and getter
+        https://bugs.webkit.org/show_bug.cgi?id=142863
+
+        Reviewed by Ryosuke Niwa.
+
+        * parser/SyntaxChecker.h:
+        (JSC::SyntaxChecker::getName):
+        Remove invalid assert. Computed properties will not have a name
+        and the calling code is checking for null expecting it. The
+        AST path (non-CheckingPath) already does this without the assert
+        so it is well tested.
+
 2015-03-19  Mark Lam  <mark....@apple.com>
 
         JSCallbackObject<JSGlobalObject> should not destroy its JSCallbackObjectData before all its finalizers have been called.

Modified: trunk/Source/_javascript_Core/parser/SyntaxChecker.h (181806 => 181807)


--- trunk/Source/_javascript_Core/parser/SyntaxChecker.h	2015-03-20 18:08:29 UTC (rev 181806)
+++ trunk/Source/_javascript_Core/parser/SyntaxChecker.h	2015-03-20 18:10:17 UTC (rev 181807)
@@ -274,7 +274,7 @@
     
     void assignmentStackAppend(int, int, int, int, int, Operator) { }
     int createAssignment(const JSTokenLocation&, int, int, int, int, int) { RELEASE_ASSERT_NOT_REACHED(); return AssignmentExpr; }
-    const Identifier* getName(const Property& property) const { ASSERT(property.name); return property.name; }
+    const Identifier* getName(const Property& property) const { return property.name; }
     PropertyNode::Type getType(const Property& property) const { return property.type; }
     bool isResolve(ExpressionType expr) const { return expr == ResolveExpr || expr == ResolveEvalExpr; }
     ExpressionType createDeconstructingAssignment(const JSTokenLocation&, int, ExpressionType)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to