Bug 1260620 - Ensure that possibleErrors are not null before attempting to check them; r=jorendorff
authorMorgan Phillips <winter2718@gmail.com>
Wed, 30 Mar 2016 02:53:44 -0700
changeset 291153 ebee3c43dfac7613ef1fed463f9b83ce6fa50ef9
parent 291152 0d2dd90e33f4957e20a78cb08e49fedb1161056b
child 291154 fffe8dc49621deab94739de3eb816556d4c6c572
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1260620
milestone48.0a1
Bug 1260620 - Ensure that possibleErrors are not null before attempting to check them; r=jorendorff
js/src/frontend/Parser.cpp
js/src/tests/ecma_6/Object/destructuring-shorthand-defaults.js
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -7582,18 +7582,21 @@ Parser<ParseHandler>::expr(InHandling in
             return null();
 
         // If we find an error here we should report it immedately instead of
         // passing it back out of the function.
         if (possibleErrorInner.hasError())  {
 
             // We begin by checking for an outer pending error since it would
             // have occurred first.
-            if (possibleError->checkForExprErrors())
-                possibleErrorInner.checkForExprErrors();
+            if (possibleError && !possibleError->checkForExprErrors())
+                return null();
+
+            // Go ahead and report the inner error.
+            possibleErrorInner.checkForExprErrors();
             return null();
         }
         handler.addList(seq, pn);
 
         if (!tokenStream.matchToken(&matched, TOK_COMMA))
             return null();
         if (!matched)
             break;
--- a/js/src/tests/ecma_6/Object/destructuring-shorthand-defaults.js
+++ b/js/src/tests/ecma_6/Object/destructuring-shorthand-defaults.js
@@ -33,16 +33,17 @@ const SYNTAX_ERROR_STMTS = [
     "((({w = x} >(-9)",
     "++({x=1})",
     "--{x=1}",
     "!{x=1}={}",
     "delete {x=1}",
     "delete ({x=1})",
     "delete {x=1} = {}",
     "({x=1}.abc)",
+    "x > (0, {a = b} );",
     // declarations
     "var x = 0 + {a=1} = {}",
     "let o = {x=1};",
     "var j = {x=1};",
     "var j = {x={y=1}}={};",
     "const z = {x=1};",
     "const z = {x={y=1}}={};",
     "const {x=1};",