Bug 1230194 Part 3 - Add test for thrown values when doing console evaluations, r=nchevobbe.
☠☠ backed out by 84810c2018de ☠ ☠
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 16 Apr 2019 11:53:21 -1000
changeset 531656 e9a1fd460a24faaf398fc4bc3cabb31bb80b85e2
parent 531655 624da9352fd94df3517ba805863d3c0d5d6b85db
child 531657 ab7db57ad2ac2ebb1818346220f2045968b49415
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1230194
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1230194 Part 3 - Add test for thrown values when doing console evaluations, r=nchevobbe. Differential Revision: https://phabricator.services.mozilla.com/D27828
devtools/client/webconsole/test/fixtures/stub-generators/head.js
devtools/client/webconsole/test/fixtures/stubs/evaluationResult.js
devtools/client/webconsole/test/mochitest/browser.ini
devtools/client/webconsole/test/mochitest/browser_webconsole_eval_error.js
devtools/client/webconsole/test/mochitest/head.js
devtools/client/webconsole/test/mochitest/test-eval-error.html
--- a/devtools/client/webconsole/test/fixtures/stub-generators/head.js
+++ b/devtools/client/webconsole/test/fixtures/stub-generators/head.js
@@ -198,16 +198,30 @@ function getCleanedPacket(key, packet) {
           if (frame && existingFrame && frame.sourceId) {
             frame.sourceId = existingFrame.sourceId;
           }
           return frame;
         });
       }
     }
 
+    if (Array.isArray(res.exceptionStack)) {
+      res.exceptionStack = res.exceptionStack.map((frame, i) => {
+        const existingFrame = existingPacket.exceptionStack[i];
+        if (frame && existingFrame && frame.sourceId) {
+          frame.sourceId = existingFrame.sourceId;
+        }
+        return frame;
+      });
+    }
+
+    if (res.frame && existingPacket.frame) {
+      res.frame.sourceId = existingPacket.frame.sourceId;
+    }
+
     if (res.packet) {
       const override = {};
       const keys = ["totalTime", "from", "contentSize", "transferredSize"];
       keys.forEach(x => {
         if (res.packet[x] !== undefined) {
           override[x] = existingPacket.packet[key];
         }
       });
--- a/devtools/client/webconsole/test/fixtures/stubs/evaluationResult.js
+++ b/devtools/client/webconsole/test/fixtures/stubs/evaluationResult.js
@@ -32,18 +32,17 @@ stubPreparedMessages.set(`new Date(0)`, 
       "frozen": false,
       "sealed": false,
       "ownPropertyLength": 0,
       "preview": {
         "timestamp": 0
       }
     }
   ],
-  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"log\",\"parameters\":[{\"type\":\"object\",\"actor\":\"server1.conn0.child1/obj30\",\"class\":\"Date\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":0,\"preview\":{\"timestamp\":0}}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
+  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"log\",\"parameters\":[{\"type\":\"object\",\"actor\":\"server1.conn0.child1/obj30\",\"class\":\"Date\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":0,\"preview\":{\"timestamp\":0}}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null}",
   "frame": null,
   "groupId": null,
   "cssSelectors": "",
   "userProvidedStyles": null,
   "notes": null,
   "indent": 0,
   "prefix": "",
   "chromeContext": false
@@ -60,18 +59,26 @@ stubPreparedMessages.set(`asdf()`, new C
   "level": "error",
   "category": null,
   "messageText": "ReferenceError: asdf is not defined",
   "parameters": [
     {
       "type": "undefined"
     }
   ],
-  "repeatId": "{\"frame\":{\"source\":\"debugger eval code\",\"line\":1,\"column\":1},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"ReferenceError: asdf is not defined\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
+  "repeatId": "{\"frame\":{\"source\":\"debugger eval code\",\"line\":1,\"column\":1},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"ReferenceError: asdf is not defined\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":[{\"filename\":\"debugger eval code\",\"sourceId\":\"server1.conn0.child1/source23\",\"lineNumber\":1,\"columnNumber\":1,\"functionName\":null}]}",
+  "stacktrace": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source23",
+      "lineNumber": 1,
+      "columnNumber": 1,
+      "functionName": null
+    }
+  ],
   "frame": {
     "source": "debugger eval code",
     "line": 1,
     "column": 1
   },
   "groupId": null,
   "errorMessageName": "JSMSG_NOT_DEFINED",
   "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
@@ -94,18 +101,61 @@ stubPreparedMessages.set(`1 + @`, new Co
   "level": "error",
   "category": null,
   "messageText": "SyntaxError: illegal character",
   "parameters": [
     {
       "type": "undefined"
     }
   ],
-  "repeatId": "{\"frame\":{\"source\":\"debugger eval code\",\"line\":1,\"column\":4},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"SyntaxError: illegal character\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
+  "repeatId": "{\"frame\":{\"source\":\"debugger eval code\",\"line\":1,\"column\":4},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"SyntaxError: illegal character\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":[{\"filename\":\"resource://devtools/server/actors/webconsole/eval-with-debugger.js\",\"sourceId\":null,\"lineNumber\":134,\"columnNumber\":28,\"functionName\":\"getEvalResult\"},{\"filename\":\"resource://devtools/server/actors/webconsole/eval-with-debugger.js\",\"sourceId\":null,\"lineNumber\":105,\"columnNumber\":18,\"functionName\":\"exports.evalWithDebugger\"},{\"filename\":\"resource://devtools/server/actors/webconsole.js\",\"sourceId\":null,\"lineNumber\":1005,\"columnNumber\":22,\"functionName\":\"evaluateJS\"},{\"filename\":\"self-hosted\",\"sourceId\":null,\"lineNumber\":1005,\"columnNumber\":17,\"functionName\":\"evaluateJS\"},{\"filename\":\"resource://devtools/server/main.js\",\"sourceId\":null,\"lineNumber\":1291,\"columnNumber\":58,\"functionName\":\"onPacket\"},{\"filename\":\"resource://devtools/shared/transport/child-transport.js\",\"sourceId\":null,\"lineNumber\":66,\"columnNumber\":16,\"functionName\":\"receiveMessage\"}]}",
+  "stacktrace": [
+    {
+      "filename": "resource://devtools/server/actors/webconsole/eval-with-debugger.js",
+      "sourceId": null,
+      "lineNumber": 134,
+      "columnNumber": 28,
+      "functionName": "getEvalResult"
+    },
+    {
+      "filename": "resource://devtools/server/actors/webconsole/eval-with-debugger.js",
+      "sourceId": null,
+      "lineNumber": 105,
+      "columnNumber": 18,
+      "functionName": "exports.evalWithDebugger"
+    },
+    {
+      "filename": "resource://devtools/server/actors/webconsole.js",
+      "sourceId": null,
+      "lineNumber": 1005,
+      "columnNumber": 22,
+      "functionName": "evaluateJS"
+    },
+    {
+      "filename": "self-hosted",
+      "sourceId": null,
+      "lineNumber": 1005,
+      "columnNumber": 17,
+      "functionName": "evaluateJS"
+    },
+    {
+      "filename": "resource://devtools/server/main.js",
+      "sourceId": null,
+      "lineNumber": 1291,
+      "columnNumber": 58,
+      "functionName": "onPacket"
+    },
+    {
+      "filename": "resource://devtools/shared/transport/child-transport.js",
+      "sourceId": null,
+      "lineNumber": 66,
+      "columnNumber": 16,
+      "functionName": "receiveMessage"
+    }
+  ],
   "frame": {
     "source": "debugger eval code",
     "line": 1,
     "column": 4
   },
   "groupId": null,
   "errorMessageName": "JSMSG_ILLEGAL_CHARACTER",
   "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Illegal_character?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
@@ -148,18 +198,17 @@ stubPreparedMessages.set(`inspect({a: 1}
         },
         "ownSymbols": [],
         "ownPropertiesLength": 1,
         "ownSymbolsLength": 0,
         "safeGetterValues": {}
       }
     }
   ],
-  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"log\",\"parameters\":[{\"type\":\"object\",\"actor\":\"server1.conn0.child1/obj35\",\"class\":\"Object\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":1,\"preview\":{\"kind\":\"Object\",\"ownProperties\":{\"a\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":1}},\"ownSymbols\":[],\"ownPropertiesLength\":1,\"ownSymbolsLength\":0,\"safeGetterValues\":{}}}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
+  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"log\",\"parameters\":[{\"type\":\"object\",\"actor\":\"server1.conn0.child1/obj35\",\"class\":\"Object\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":1,\"preview\":{\"kind\":\"Object\",\"ownProperties\":{\"a\":{\"configurable\":true,\"enumerable\":true,\"writable\":true,\"value\":1}},\"ownSymbols\":[],\"ownPropertiesLength\":1,\"ownSymbolsLength\":0,\"safeGetterValues\":{}}}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null}",
   "frame": null,
   "groupId": null,
   "cssSelectors": "",
   "userProvidedStyles": null,
   "notes": null,
   "indent": 0,
   "prefix": "",
   "chromeContext": false
@@ -176,18 +225,17 @@ stubPreparedMessages.set(`cd(document)`,
   "level": "error",
   "category": null,
   "messageText": "Cannot cd() to the given window. Invalid argument.",
   "parameters": [
     {
       "type": "undefined"
     }
   ],
-  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"Cannot cd() to the given window. Invalid argument.\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
+  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"Cannot cd() to the given window. Invalid argument.\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null}",
   "frame": null,
   "groupId": null,
   "cssSelectors": "",
   "userProvidedStyles": null,
   "notes": null,
   "indent": 0,
   "prefix": "",
   "chromeContext": false
@@ -203,18 +251,17 @@ stubPreparedMessages.set(`undefined`, ne
   "helperType": null,
   "level": "log",
   "category": null,
   "parameters": [
     {
       "type": "undefined"
     }
   ],
-  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"log\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
+  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"log\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null}",
   "frame": null,
   "groupId": null,
   "cssSelectors": "",
   "userProvidedStyles": null,
   "notes": null,
   "indent": 0,
   "prefix": "",
   "chromeContext": false
@@ -236,19 +283,32 @@ stubPreparedMessages.set(`longString mes
     "length": 110007,
     "actor": "server1.conn0.child1/longString37"
   },
   "parameters": [
     {
       "type": "undefined"
     }
   ],
-  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":{\"type\":\"longString\",\"initial\":\"Error: Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Lon\",\"length\":110007,\"actor\":\"server1.conn0.child1/longString37\"},\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
-  "frame": null,
+  "repeatId": "{\"frame\":{\"source\":\"debugger eval code\",\"sourceId\":\"server1.conn0.child1/source30\",\"line\":1,\"column\":7},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":{\"type\":\"longString\",\"initial\":\"Error: Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Lon\",\"length\":110007,\"actor\":\"server1.conn0.child1/longString37\"},\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":[{\"filename\":\"debugger eval code\",\"sourceId\":\"server1.conn0.child1/source30\",\"lineNumber\":1,\"columnNumber\":7,\"functionName\":null}]}",
+  "stacktrace": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source30",
+      "lineNumber": 1,
+      "columnNumber": 7,
+      "functionName": null
+    }
+  ],
+  "frame": {
+    "source": "debugger eval code",
+    "sourceId": "server1.conn0.child1/source30",
+    "line": 1,
+    "column": 7
+  },
   "groupId": null,
   "cssSelectors": "",
   "userProvidedStyles": null,
   "notes": null,
   "indent": 0,
   "prefix": "",
   "chromeContext": false
 }));
@@ -264,19 +324,32 @@ stubPreparedMessages.set(`eval throw ""`
   "level": "error",
   "category": null,
   "messageText": "Error",
   "parameters": [
     {
       "type": "undefined"
     }
   ],
-  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"Error\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
-  "frame": null,
+  "repeatId": "{\"frame\":{\"source\":\"debugger eval code\",\"sourceId\":\"server1.conn0.child1/source23\",\"line\":1,\"column\":1},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"Error\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":[{\"filename\":\"debugger eval code\",\"sourceId\":\"server1.conn0.child1/source23\",\"lineNumber\":1,\"columnNumber\":1,\"functionName\":null}]}",
+  "stacktrace": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source23",
+      "lineNumber": 1,
+      "columnNumber": 1,
+      "functionName": null
+    }
+  ],
+  "frame": {
+    "source": "debugger eval code",
+    "sourceId": "server1.conn0.child1/source23",
+    "line": 1,
+    "column": 1
+  },
   "groupId": null,
   "cssSelectors": "",
   "userProvidedStyles": null,
   "notes": null,
   "indent": 0,
   "prefix": "",
   "chromeContext": false
 }));
@@ -292,19 +365,32 @@ stubPreparedMessages.set(`eval throw "to
   "level": "error",
   "category": null,
   "messageText": "Error: tomato",
   "parameters": [
     {
       "type": "undefined"
     }
   ],
-  "repeatId": "{\"frame\":null,\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"Error: tomato\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":null}",
-  "stacktrace": null,
-  "frame": null,
+  "repeatId": "{\"frame\":{\"source\":\"debugger eval code\",\"sourceId\":\"server1.conn0.child1/source23\",\"line\":1,\"column\":1},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"Error: tomato\",\"parameters\":[{\"type\":\"undefined\"}],\"source\":\"javascript\",\"type\":\"result\",\"userProvidedStyles\":null,\"stacktrace\":[{\"filename\":\"debugger eval code\",\"sourceId\":\"server1.conn0.child1/source23\",\"lineNumber\":1,\"columnNumber\":1,\"functionName\":null}]}",
+  "stacktrace": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source23",
+      "lineNumber": 1,
+      "columnNumber": 1,
+      "functionName": null
+    }
+  ],
+  "frame": {
+    "source": "debugger eval code",
+    "sourceId": "server1.conn0.child1/source23",
+    "line": 1,
+    "column": 1
+  },
   "groupId": null,
   "cssSelectors": "",
   "userProvidedStyles": null,
   "notes": null,
   "indent": 0,
   "prefix": "",
   "chromeContext": false
 }));
@@ -353,16 +439,25 @@ stubPackets.set(`asdf()`, {
       "stack": "@debugger eval code:1:1\n",
       "fileName": "debugger eval code",
       "lineNumber": 1,
       "columnNumber": 1
     }
   },
   "exceptionMessage": "ReferenceError: asdf is not defined",
   "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
+  "exceptionStack": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source23",
+      "lineNumber": 1,
+      "columnNumber": 1,
+      "functionName": null
+    }
+  ],
   "errorMessageName": "JSMSG_NOT_DEFINED",
   "frame": {
     "source": "debugger eval code",
     "line": 1,
     "column": 1
   },
   "helperResult": null,
   "notes": null
@@ -390,16 +485,60 @@ stubPackets.set(`1 + @`, {
       "stack": "",
       "fileName": "debugger eval code",
       "lineNumber": 1,
       "columnNumber": 4
     }
   },
   "exceptionMessage": "SyntaxError: illegal character",
   "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Illegal_character?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
+  "exceptionStack": [
+    {
+      "filename": "resource://devtools/server/actors/webconsole/eval-with-debugger.js",
+      "sourceId": null,
+      "lineNumber": 134,
+      "columnNumber": 28,
+      "functionName": "getEvalResult"
+    },
+    {
+      "filename": "resource://devtools/server/actors/webconsole/eval-with-debugger.js",
+      "sourceId": null,
+      "lineNumber": 105,
+      "columnNumber": 18,
+      "functionName": "exports.evalWithDebugger"
+    },
+    {
+      "filename": "resource://devtools/server/actors/webconsole.js",
+      "sourceId": null,
+      "lineNumber": 1005,
+      "columnNumber": 22,
+      "functionName": "evaluateJS"
+    },
+    {
+      "filename": "self-hosted",
+      "sourceId": null,
+      "lineNumber": 1005,
+      "columnNumber": 17,
+      "functionName": "evaluateJS"
+    },
+    {
+      "filename": "resource://devtools/server/main.js",
+      "sourceId": null,
+      "lineNumber": 1291,
+      "columnNumber": 58,
+      "functionName": "onPacket"
+    },
+    {
+      "filename": "resource://devtools/shared/transport/child-transport.js",
+      "sourceId": null,
+      "lineNumber": 66,
+      "columnNumber": 16,
+      "functionName": "receiveMessage"
+    }
+  ],
   "errorMessageName": "JSMSG_ILLEGAL_CHARACTER",
   "frame": {
     "source": "debugger eval code",
     "line": 1,
     "column": 4
   },
   "helperResult": null,
   "notes": null
@@ -505,45 +644,87 @@ stubPackets.set(`longString message Erro
     }
   },
   "exceptionMessage": {
     "type": "longString",
     "initial": "Error: Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Lon",
     "length": 110007,
     "actor": "server1.conn0.child1/longString37"
   },
-  "frame": null,
+  "exceptionStack": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source30",
+      "lineNumber": 1,
+      "columnNumber": 7,
+      "functionName": null
+    }
+  ],
+  "frame": {
+    "source": "debugger eval code",
+    "sourceId": "server1.conn0.child1/source30",
+    "line": 1,
+    "column": 7
+  },
   "helperResult": null,
   "notes": null
 });
 
 stubPackets.set(`eval throw ""`, {
   "from": "server1.conn0.child1/consoleActor2",
   "input": "throw \"\"",
   "result": {
     "type": "undefined"
   },
   "timestamp": 1517990289517,
   "exception": "",
   "exceptionMessage": "",
-  "frame": null,
+  "exceptionStack": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source23",
+      "lineNumber": 1,
+      "columnNumber": 1,
+      "functionName": null
+    }
+  ],
+  "frame": {
+    "source": "debugger eval code",
+    "sourceId": "server1.conn0.child1/source23",
+    "line": 1,
+    "column": 1
+  },
   "helperResult": null,
   "notes": null
 });
 
 stubPackets.set(`eval throw "tomato"`, {
   "from": "server1.conn0.child1/consoleActor2",
   "input": "throw \"tomato\"",
   "result": {
     "type": "undefined"
   },
   "timestamp": 1517990289520,
   "exception": "tomato",
   "exceptionMessage": "tomato",
-  "frame": null,
+  "exceptionStack": [
+    {
+      "filename": "debugger eval code",
+      "sourceId": "server1.conn0.child1/source23",
+      "lineNumber": 1,
+      "columnNumber": 1,
+      "functionName": null
+    }
+  ],
+  "frame": {
+    "source": "debugger eval code",
+    "sourceId": "server1.conn0.child1/source23",
+    "line": 1,
+    "column": 1
+  },
   "helperResult": null,
   "notes": null
 });
 
 module.exports = {
   stubPreparedMessages,
   stubPackets,
 };
--- a/devtools/client/webconsole/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/test/mochitest/browser.ini
@@ -43,16 +43,17 @@ support-files =
   test-data.json^headers^
   test-duplicate-error.html
   test-dynamic-import.html
   test-dynamic-import.js
   test-error.html
   test-error-worker.html
   test-error-worker.js
   test-error-worker2.js
+  test-eval-error.html
   test-eval-in-stackframe.html
   test-eval-sources.html
   test-evaluate-worker.html
   test-evaluate-worker.js
   test-external-script-errors.html
   test-external-script-errors.js
   test-iframe-insecure-form-action.html
   test-iframe1.html
@@ -291,16 +292,17 @@ tags = clipboard
 [browser_webconsole_csp_violation.js]
 [browser_webconsole_cspro.js]
 [browser_webconsole_document_focus.js]
 [browser_webconsole_duplicate_errors.js]
 [browser_webconsole_error_with_grouped_stack.js]
 [browser_webconsole_error_with_longstring_stack.js]
 [browser_webconsole_error_with_unicode.js]
 [browser_webconsole_errors_after_page_reload.js]
+[browser_webconsole_eval_error.js]
 [browser_webconsole_eval_in_debugger_stackframe.js]
 [browser_webconsole_eval_in_debugger_stackframe2.js]
 [browser_webconsole_eval_sources.js]
 [browser_webconsole_execution_scope.js]
 [browser_webconsole_external_script_errors.js]
 [browser_webconsole_file_uri.js]
 skip-if = true #	Bug 1404382
 [browser_webconsole_filter_by_input.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_eval_error.js
@@ -0,0 +1,22 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Tests that throwing uncaught errors while doing console evaluations shows a
+// stack in the console.
+
+"use strict";
+
+const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
+                 "test/mochitest/test-eval-error.html";
+
+add_task(async function() {
+  const hud = await openNewTabAndConsole(TEST_URI);
+
+  hud.jsterm.execute("throwErrorObject()");
+  await checkMessageStack(hud, "ThrowErrorObject", [6, 1]);
+
+  hud.jsterm.execute("throwValue(40 + 2)");
+  await checkMessageStack(hud, "42", [14, 10, 1]);
+});
--- a/devtools/client/webconsole/test/mochitest/head.js
+++ b/devtools/client/webconsole/test/mochitest/head.js
@@ -1329,17 +1329,17 @@ function checkConsoleOutputForWarningGro
  *        message substring to look for
  * @param {Array<number>} frameLines
  *        line numbers of the frames expected in the stack
  */
 async function checkMessageStack(hud, text, frameLines) {
   const msgNode = await waitFor(() => findMessage(hud, text));
   ok(!msgNode.classList.contains("open"), `Error logged not expanded`);
 
-  const button = msgNode.querySelector(".collapse-button");
+  const button = await waitFor(() => msgNode.querySelector(".collapse-button"));
   button.click();
 
   const framesNode = await waitFor(() => msgNode.querySelector(".frames"));
   const frameNodes = framesNode.querySelectorAll(".frame");
   ok(frameNodes.length == frameLines.length, `Found ${frameLines.length} frames`);
   for (let i = 0; i < frameLines.length; i++) {
     ok(frameNodes[i].querySelector(".line").textContent == "" + frameLines[i],
        `Found line ${frameLines[i]} for frame #${i}`);
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/test/mochitest/test-eval-error.html
@@ -0,0 +1,16 @@
+<script>
+/* eslint-disable no-unused-vars */
+"use strict";
+
+function throwErrorObject(value) {
+  throw new Error("ThrowErrorObject");
+}
+
+function throwValue(value) {
+  otherFunction(value);
+}
+
+function otherFunction(value) {
+  throw value;
+}
+</script>