Bug 1260620 - Ensure that possibleErrors are not null before attempting to check them. r=jorendorff, a=ritu
authorMorgan Phillips <winter2718@gmail.com>
Wed, 30 Mar 2016 02:53:44 -0700
changeset 324131 967a66bc2a5cb03f6e3de67eb79964b14aa208fb
parent 324130 19b5772630a8c57fc1390cae9167cf94f9c41f29
child 324132 892d0f1308f87e9ac1ef7810fa6fde9864e550fa
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, ritu
bugs1260620
milestone47.0a2
Bug 1260620 - Ensure that possibleErrors are not null before attempting to check them. r=jorendorff, a=ritu
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
@@ -7579,18 +7579,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};",