diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_evaluation_result.js b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_evaluation_result.js index 09a672aac047..af94c2c87af8 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_evaluation_result.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_evaluation_result.js @@ -106,6 +106,59 @@ function getCommands() { throw err; ` ); + evaluationResult.set( + `eval throw Error Object with error cause`, + ` + var originalError = new SyntaxError("original error") + var err = new Error("something went wrong", { + cause: originalError + }); + throw err; + ` + ); + evaluationResult.set( + `eval throw Error Object with cause chain`, + ` + var errA = new Error("err-a") + var errB = new Error("err-b", { cause: errA }) + var errC = new Error("err-c", { cause: errB }) + var errD = new Error("err-d", { cause: errC }) + throw errD; + ` + ); + evaluationResult.set( + `eval throw Error Object with cyclical cause chain`, + ` + var errX = new Error("err-x", { cause: errY}) + var errY = new Error("err-y", { cause: errX }) + throw errY; + ` + ); + evaluationResult.set( + `eval throw Error Object with falsy cause`, + `throw new Error("false cause", { cause: false });` + ); + evaluationResult.set( + `eval throw Error Object with null cause`, + `throw new Error("null cause", { cause: null });` + ); + evaluationResult.set( + `eval throw Error Object with undefined cause`, + `throw new Error("undefined cause", { cause: undefined });` + ); + evaluationResult.set( + `eval throw Error Object with number cause`, + `throw new Error("number cause", { cause: 0 });` + ); + evaluationResult.set( + `eval throw Error Object with string cause`, + `throw new Error("string cause", { cause: "cause message" });` + ); + evaluationResult.set( + `eval throw Error Object with object cause`, + `throw new Error("object cause", { cause: { code: 234, message: "ERR_234"} });` + ); + evaluationResult.set(`eval pending promise`, `new Promise(() => {})`); evaluationResult.set(`eval Promise.resolve`, `Promise.resolve(123)`); evaluationResult.set(`eval Promise.reject`, `Promise.reject("ouch")`); @@ -117,6 +170,16 @@ function getCommands() { `eval rejected promise`, `Promise.resolve().then(() => a.b.c)` ); + evaluationResult.set( + `eval rejected promise with Error`, + `Promise.resolve().then(() => { + try { + a.b.c + } catch(e) { + throw new Error("something went wrong", { cause: e }) + } + })` + ); return evaluationResult; } diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js index f602e42c278d..36a6cbc871af 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_page_error.js @@ -172,6 +172,50 @@ function getCommands() { throw err; ` ); + pageError.set( + `throw Error Object with error cause`, + ` + var originalError = new SyntaxError("original error") + var err = new Error("something went wrong", { + cause: originalError + }); + throw err; + ` + ); + pageError.set( + `throw Error Object with cause chain`, + ` + var a = new Error("err-a") + var b = new Error("err-b", { cause: a }) + var c = new Error("err-c", { cause: b }) + var d = new Error("err-d", { cause: c }) + throw d; + ` + ); + pageError.set( + `throw Error Object with cyclical cause chain`, + ` + var a = new Error("err-a", { cause: b}) + var b = new Error("err-b", { cause: a }) + throw b; + ` + ); + pageError.set( + `throw Error Object with falsy cause`, + `throw new Error("null cause", { cause: null });` + ); + pageError.set( + `throw Error Object with number cause`, + `throw new Error("number cause", { cause: 0 });` + ); + pageError.set( + `throw Error Object with string cause`, + `throw new Error("string cause", { cause: "cause message" });` + ); + pageError.set( + `throw Error Object with object cause`, + `throw new Error("object cause", { cause: { code: 234, message: "ERR_234"} });` + ); pageError.set(`Promise reject ""`, `Promise.reject("")`); pageError.set(`Promise reject "tomato"`, `Promise.reject("tomato")`); pageError.set(`Promise reject false`, `Promise.reject(false)`); @@ -196,5 +240,15 @@ function getCommands() { Promise.reject(err); ` ); + pageError.set( + `Promise reject Error Object with error cause`, + `Promise.resolve().then(() => { + try { + a.b.c + } catch(e) { + throw new Error("something went wrong", { cause: e }) + } + })` + ); return pageError; } diff --git a/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js b/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js index 37107508dea3..680fa245f95f 100644 --- a/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js +++ b/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js @@ -614,6 +614,564 @@ rawPackets.set(`eval throw Error Object with custom name`, { "timestamp": 1572867483805 }); +rawPackets.set(`eval throw Error Object with error cause`, { + "resultID": "1621589071246-16", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj50", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "something went wrong", + "stack": "@debugger eval code:3:15\n", + "fileName": "debugger eval code", + "lineNumber": 3, + "columnNumber": 15, + "cause": { + "type": "object", + "actor": "server0.conn2.child4/obj51", + "class": "SyntaxError", + "ownPropertyLength": 4, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "SyntaxError", + "message": "original error", + "stack": "@debugger eval code:2:25\n", + "fileName": "debugger eval code", + "lineNumber": 2, + "columnNumber": 25 + } + } + } + }, + "actorID": "server0.conn0.child4/obj50" + }, + "exceptionMessage": "Error: something went wrong", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn0.child4/source49", + "lineNumber": 6, + "columnNumber": 5, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn0.child4/source49", + "line": 6, + "column": 5 + }, + "input": "\n var originalError = new SyntaxError(\"original error\")\n var err = new Error(\"something went wrong\", {\n cause: originalError\n });\n throw err;\n ", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with cause chain`, { + "resultID": "1621589071248-17", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj53", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-d", + "stack": "@debugger eval code:5:16\n", + "fileName": "debugger eval code", + "lineNumber": 5, + "columnNumber": 16, + "cause": { + "type": "object", + "actor": "server0.conn2.child4/obj54", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-c", + "stack": "@debugger eval code:4:16\n", + "fileName": "debugger eval code", + "lineNumber": 4, + "columnNumber": 16, + "cause": { + "type": "object", + "actor": "server0.conn2.child4/obj55", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-b", + "stack": "@debugger eval code:3:16\n", + "fileName": "debugger eval code", + "lineNumber": 3, + "columnNumber": 16, + "cause": { + "type": "object", + "actor": "server0.conn2.child4/obj56", + "class": "Error", + "ownPropertyLength": 4, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-a", + "stack": "@debugger eval code:2:16\n", + "fileName": "debugger eval code", + "lineNumber": 2, + "columnNumber": 16 + } + } + } + } + } + } + } + }, + "actorID": "server0.conn0.child4/obj53" + }, + "exceptionMessage": "Error: err-d", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn0.child4/source49", + "lineNumber": 6, + "columnNumber": 5, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn0.child4/source49", + "line": 6, + "column": 5 + }, + "input": "\n var errA = new Error(\"err-a\")\n var errB = new Error(\"err-b\", { cause: errA })\n var errC = new Error(\"err-c\", { cause: errB })\n var errD = new Error(\"err-d\", { cause: errC })\n throw errD;\n ", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with cyclical cause chain`, { + "resultID": "1621589071250-18", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj58", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-y", + "stack": "@debugger eval code:3:16\n", + "fileName": "debugger eval code", + "lineNumber": 3, + "columnNumber": 16, + "cause": { + "type": "object", + "actor": "server0.conn2.child4/obj59", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-x", + "stack": "@debugger eval code:2:16\n", + "fileName": "debugger eval code", + "lineNumber": 2, + "columnNumber": 16, + "cause": { + "type": "undefined" + } + } + } + } + }, + "actorID": "server0.conn0.child4/obj58" + }, + "exceptionMessage": "Error: err-y", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn0.child4/source57", + "lineNumber": 4, + "columnNumber": 5, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn0.child4/source57", + "line": 4, + "column": 5 + }, + "input": "\n var errX = new Error(\"err-x\", { cause: errY})\n var errY = new Error(\"err-y\", { cause: errX })\n throw errY;\n ", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with falsy cause`, { + "resultID": "1621589071252-19", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj63", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "false cause", + "stack": "@debugger eval code:1:7\n", + "fileName": "debugger eval code", + "lineNumber": 1, + "columnNumber": 7, + "cause": false + } + }, + "actorID": "server0.conn0.child4/obj63" + }, + "exceptionMessage": "Error: false cause", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "line": 1, + "column": 7 + }, + "input": "throw new Error(\"false cause\", { cause: false });", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with null cause`, { + "resultID": "1622039251647-20", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn2.child4/obj63", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "null cause", + "stack": "@debugger eval code:1:7\n", + "fileName": "debugger eval code", + "lineNumber": 1, + "columnNumber": 7, + "cause": { + "type": "null" + } + } + }, + "actorID": "server0.conn2.child4/obj63" + }, + "exceptionMessage": "Error: null cause", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn2.child4/source31", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn2.child4/source31", + "line": 1, + "column": 7 + }, + "input": "throw new Error(\"null cause\", { cause: null });", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with undefined cause`, { + "resultID": "1622039251649-21", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn2.child4/obj65", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "undefined cause", + "stack": "@debugger eval code:1:7\n", + "fileName": "debugger eval code", + "lineNumber": 1, + "columnNumber": 7, + "cause": { + "type": "undefined" + } + } + }, + "actorID": "server0.conn2.child4/obj65" + }, + "exceptionMessage": "Error: undefined cause", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn2.child4/source31", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn2.child4/source31", + "line": 1, + "column": 7 + }, + "input": "throw new Error(\"undefined cause\", { cause: undefined });", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with number cause`, { + "resultID": "1621589071253-20", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj65", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "number cause", + "stack": "@debugger eval code:1:7\n", + "fileName": "debugger eval code", + "lineNumber": 1, + "columnNumber": 7, + "cause": 0 + } + }, + "actorID": "server0.conn0.child4/obj65" + }, + "exceptionMessage": "Error: number cause", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "line": 1, + "column": 7 + }, + "input": "throw new Error(\"number cause\", { cause: 0 });", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with string cause`, { + "resultID": "1621589071255-21", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj67", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "string cause", + "stack": "@debugger eval code:1:7\n", + "fileName": "debugger eval code", + "lineNumber": 1, + "columnNumber": 7, + "cause": "cause message" + } + }, + "actorID": "server0.conn0.child4/obj67" + }, + "exceptionMessage": "Error: string cause", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "line": 1, + "column": 7 + }, + "input": "throw new Error(\"string cause\", { cause: \"cause message\" });", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + +rawPackets.set(`eval throw Error Object with object cause`, { + "resultID": "1621589071256-22", + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj69", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "object cause", + "stack": "@debugger eval code:1:7\n", + "fileName": "debugger eval code", + "lineNumber": 1, + "columnNumber": 7, + "cause": { + "type": "object", + "actor": "server0.conn2.child4/obj72", + "class": "Object", + "ownPropertyLength": 2, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": false + } + } + }, + "actorID": "server0.conn0.child4/obj69" + }, + "exceptionMessage": "Error: object cause", + "exceptionStack": [ + { + "filename": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + } + ], + "hasException": true, + "frame": { + "source": "debugger eval code", + "sourceId": "server0.conn0.child4/source31", + "line": 1, + "column": 7 + }, + "input": "throw new Error(\"object cause\", { cause: { code: 234, message: \"ERR_234\"} });", + "result": { + "type": "undefined" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + rawPackets.set(`eval pending promise`, { "resultID": "1609858965386-17", "hasException": false, @@ -794,6 +1352,76 @@ rawPackets.set(`eval rejected promise`, { "timestamp": 1572867483805 }); +rawPackets.set(`eval rejected promise with Error`, { + "resultID": "1621589071278-28", + "hasException": false, + "input": "Promise.resolve().then(() => {\n try {\n a.b.c\n } catch(e) {\n throw new Error(\"something went wrong\", { cause: e })\n }\n })", + "result": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj84", + "class": "Promise", + "ownPropertyLength": 0, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": false, + "preview": { + "kind": "Object", + "ownProperties": { + "": { + "value": "rejected" + }, + "": { + "value": { + "type": "object", + "actor": "server0.conn0.child4/obj85", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "something went wrong", + "stack": "@debugger eval code:5:15\npromise callback*@debugger eval code:1:19\n", + "fileName": "debugger eval code", + "lineNumber": 5, + "columnNumber": 15, + "cause": { + "type": "object", + "actor": "server0.conn2.child4/obj88", + "class": "ReferenceError", + "ownPropertyLength": 4, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "ReferenceError", + "message": "a is not defined", + "stack": "@debugger eval code:3:9\npromise callback*@debugger eval code:1:19\n", + "fileName": "debugger eval code", + "lineNumber": 3, + "columnNumber": 9 + } + } + } + } + } + }, + "ownPropertiesLength": 2 + } + }, + "actorID": "server0.conn0.child4/obj84" + }, + "startTime": 1572867483805, + "timestamp": 1572867483805 +}); + const stubPackets = parsePacketsWithFronts(rawPackets); diff --git a/devtools/client/webconsole/test/node/fixtures/stubs/pageError.js b/devtools/client/webconsole/test/node/fixtures/stubs/pageError.js index 8340442a2e87..09e952eaef40 100644 --- a/devtools/client/webconsole/test/node/fixtures/stubs/pageError.js +++ b/devtools/client/webconsole/test/node/fixtures/stubs/pageError.js @@ -87,7 +87,7 @@ rawPackets.set(`ReferenceError: asdf is not defined`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj25", + "actor": "server0.conn0.child4/obj24", "class": "ReferenceError", "ownPropertyLength": 4, "extensible": true, @@ -104,7 +104,7 @@ rawPackets.set(`ReferenceError: asdf is not defined`, { "columnNumber": 5 } }, - "actorID": "server0.conn4.child2/obj25" + "actorID": "server0.conn0.child4/obj24" }, "hasException": true }, @@ -170,7 +170,7 @@ rawPackets.set(`SyntaxError: redeclaration of let a`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj26", + "actor": "server0.conn0.child4/obj25", "class": "SyntaxError", "ownPropertyLength": 4, "extensible": true, @@ -187,7 +187,7 @@ rawPackets.set(`SyntaxError: redeclaration of let a`, { "columnNumber": 9 } }, - "actorID": "server0.conn4.child2/obj26" + "actorID": "server0.conn0.child4/obj25" }, "hasException": true }, @@ -200,11 +200,11 @@ rawPackets.set(`TypeError longString message`, { "errorMessage": { "_grip": { "type": "longString", - "actor": "server0.conn0.child1/longstractor24", + "actor": "server0.conn0.child4/longstractor27", "length": 110007, "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" }, - "actorID": "server0.conn0.child1/longstractor24" + "actorID": "server0.conn0.child4/longstractor27" }, "errorMessageName": "", "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", @@ -257,7 +257,7 @@ rawPackets.set(`TypeError longString message`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj29", + "actor": "server0.conn0.child4/obj28", "class": "Error", "ownPropertyLength": 4, "extensible": true, @@ -270,11 +270,11 @@ rawPackets.set(`TypeError longString message`, { "message": { "_grip": { "type": "longString", - "actor": "server0.conn4.child2/longstractor30", + "actor": "server0.conn0.child4/longstractor29", "length": 110000, "initial": "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 Long error" }, - "actorID": "server0.conn4.child2/longstractor30" + "actorID": "server0.conn0.child4/longstractor29" }, "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:7\n", "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", @@ -282,7 +282,7 @@ rawPackets.set(`TypeError longString message`, { "columnNumber": 7 } }, - "actorID": "server0.conn4.child2/obj29" + "actorID": "server0.conn0.child4/obj28" }, "hasException": true }, @@ -753,7 +753,7 @@ rawPackets.set(`throw Symbol`, { "isForwardedFromContentProcess": false, "exception": { "type": "symbol", - "actor": "server0.conn4.child2/symbol38", + "actor": "server0.conn0.child4/symbol38", "name": "potato" }, "hasException": true @@ -816,7 +816,7 @@ rawPackets.set(`throw Object`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj40", + "actor": "server0.conn0.child4/obj40", "class": "Object", "ownPropertyLength": 1, "extensible": true, @@ -841,7 +841,7 @@ rawPackets.set(`throw Object`, { "safeGetterValues": {} } }, - "actorID": "server0.conn4.child2/obj40" + "actorID": "server0.conn0.child4/obj40" }, "hasException": true }, @@ -903,7 +903,7 @@ rawPackets.set(`throw Error Object`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj42", + "actor": "server0.conn0.child4/obj42", "class": "Error", "ownPropertyLength": 4, "extensible": true, @@ -920,7 +920,7 @@ rawPackets.set(`throw Error Object`, { "columnNumber": 7 } }, - "actorID": "server0.conn4.child2/obj42" + "actorID": "server0.conn0.child4/obj42" }, "hasException": true }, @@ -982,7 +982,7 @@ rawPackets.set(`throw Error Object with custom name`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj44", + "actor": "server0.conn0.child4/obj44", "class": "Error", "ownPropertyLength": 6, "extensible": true, @@ -999,7 +999,708 @@ rawPackets.set(`throw Error Object with custom name`, { "columnNumber": 15 } }, - "actorID": "server0.conn4.child2/obj44" + "actorID": "server0.conn0.child4/obj44" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`throw Error Object with error cause`, { + "pageError": { + "errorMessage": "Error: something went wrong", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source45", + "lineText": "", + "lineNumber": 3, + "columnNumber": 15, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source45", + "lineNumber": 3, + "columnNumber": 15, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": false, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj46", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "something went wrong", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:3:15\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 3, + "columnNumber": 15, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj47", + "class": "SyntaxError", + "ownPropertyLength": 4, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "SyntaxError", + "message": "original error", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:2:25\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 2, + "columnNumber": 25 + } + } + } + }, + "actorID": "server0.conn0.child4/obj46" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`throw Error Object with cause chain`, { + "pageError": { + "errorMessage": "Error: err-d", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source48", + "lineText": "", + "lineNumber": 5, + "columnNumber": 13, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source48", + "lineNumber": 5, + "columnNumber": 13, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": false, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj49", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-d", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:5:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 5, + "columnNumber": 13, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj50", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-c", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:4:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 4, + "columnNumber": 13, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj51", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-b", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:3:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 3, + "columnNumber": 13, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj52", + "class": "Error", + "ownPropertyLength": 4, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-a", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:2:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 2, + "columnNumber": 13 + } + } + } + } + } + } + } + }, + "actorID": "server0.conn0.child4/obj49" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`throw Error Object with cyclical cause chain`, { + "pageError": { + "errorMessage": "Error: err-b", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source53", + "lineText": "", + "lineNumber": 3, + "columnNumber": 13, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source48", + "lineNumber": 3, + "columnNumber": 13, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": false, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj54", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-b", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:3:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 3, + "columnNumber": 13, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj55", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-a", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:2:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 2, + "columnNumber": 13, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj56", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-b", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:3:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 3, + "columnNumber": 13, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj57", + "class": "Error", + "ownPropertyLength": 4, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "err-a", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:2:13\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 2, + "columnNumber": 13 + } + } + } + } + } + } + } + }, + "actorID": "server0.conn0.child4/obj54" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`throw Error Object with falsy cause`, { + "pageError": { + "errorMessage": "Error: null cause", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source58", + "lineText": "", + "lineNumber": 1, + "columnNumber": 7, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source26", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": false, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj59", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "null cause", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:7\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 1, + "columnNumber": 7, + "cause": { + "type": "null" + } + } + }, + "actorID": "server0.conn0.child4/obj59" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`throw Error Object with number cause`, { + "pageError": { + "errorMessage": "Error: number cause", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source60", + "lineText": "", + "lineNumber": 1, + "columnNumber": 7, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source26", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": false, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj61", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "number cause", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:7\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 1, + "columnNumber": 7, + "cause": 0 + } + }, + "actorID": "server0.conn0.child4/obj61" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`throw Error Object with string cause`, { + "pageError": { + "errorMessage": "Error: string cause", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source62", + "lineText": "", + "lineNumber": 1, + "columnNumber": 7, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source26", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": false, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj63", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "string cause", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:7\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 1, + "columnNumber": 7, + "cause": "cause message" + } + }, + "actorID": "server0.conn0.child4/obj63" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`throw Error Object with object cause`, { + "pageError": { + "errorMessage": "Error: object cause", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source64", + "lineText": "", + "lineNumber": 1, + "columnNumber": 7, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source26", + "lineNumber": 1, + "columnNumber": 7, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": false, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj65", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "object cause", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:7\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 1, + "columnNumber": 7, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj66", + "class": "Object", + "ownPropertyLength": 2, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": false + } + } + }, + "actorID": "server0.conn0.child4/obj65" }, "hasException": true }, @@ -1412,7 +2113,7 @@ rawPackets.set(`Promise reject Symbol`, { "isForwardedFromContentProcess": false, "exception": { "type": "symbol", - "actor": "server0.conn4.child2/symbol52", + "actor": "server0.conn0.child4/symbol74", "name": "potato" }, "hasException": true @@ -1475,7 +2176,7 @@ rawPackets.set(`Promise reject Object`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj54", + "actor": "server0.conn0.child4/obj76", "class": "Object", "ownPropertyLength": 1, "extensible": true, @@ -1500,7 +2201,7 @@ rawPackets.set(`Promise reject Object`, { "safeGetterValues": {} } }, - "actorID": "server0.conn4.child2/obj54" + "actorID": "server0.conn0.child4/obj76" }, "hasException": true }, @@ -1562,7 +2263,7 @@ rawPackets.set(`Promise reject Error Object`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj56", + "actor": "server0.conn0.child4/obj78", "class": "Error", "ownPropertyLength": 4, "extensible": true, @@ -1579,7 +2280,7 @@ rawPackets.set(`Promise reject Error Object`, { "columnNumber": 16 } }, - "actorID": "server0.conn4.child2/obj56" + "actorID": "server0.conn0.child4/obj78" }, "hasException": true }, @@ -1641,7 +2342,7 @@ rawPackets.set(`Promise reject Error Object with custom name`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn4.child2/obj58", + "actor": "server0.conn0.child4/obj80", "class": "Error", "ownPropertyLength": 6, "extensible": true, @@ -1658,7 +2359,113 @@ rawPackets.set(`Promise reject Error Object with custom name`, { "columnNumber": 15 } }, - "actorID": "server0.conn4.child2/obj58" + "actorID": "server0.conn0.child4/obj80" + }, + "hasException": true + }, + "resourceType": "error-message", + "isAlreadyExistingResource": false +}); + +rawPackets.set(`Promise reject Error Object with error cause`, { + "pageError": { + "errorMessage": "Error: something went wrong", + "errorMessageName": "", + "sourceName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": "server0.conn0.child4/source81", + "lineText": "", + "lineNumber": 5, + "columnNumber": 15, + "category": "content javascript", + "innerWindowID": 2147483651, + "timeStamp": 1572867483805, + "warning": false, + "error": true, + "info": false, + "private": false, + "stacktrace": [ + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": null, + "lineNumber": 5, + "columnNumber": 15, + "functionName": null + }, + { + "filename": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "sourceId": null, + "lineNumber": 1, + "columnNumber": 19, + "functionName": null, + "asyncCause": "promise callback" + }, + { + "filename": "resource://testing-common/content-task.js line 110 > eval", + "sourceId": null, + "lineNumber": 6, + "columnNumber": 29, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 111, + "columnNumber": 33, + "functionName": null + }, + { + "filename": "resource://testing-common/content-task.js", + "sourceId": null, + "lineNumber": 64, + "columnNumber": 19, + "functionName": null, + "asyncCause": "MessageListener.receiveMessage" + } + ], + "notes": null, + "chromeContext": false, + "isPromiseRejection": true, + "isForwardedFromContentProcess": false, + "exception": { + "_grip": { + "type": "object", + "actor": "server0.conn0.child4/obj82", + "class": "Error", + "ownPropertyLength": 5, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "Error", + "message": "something went wrong", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:5:15\npromise callback*@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:19\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 5, + "columnNumber": 15, + "cause": { + "type": "object", + "actor": "server0.conn0.child4/obj83", + "class": "TypeError", + "ownPropertyLength": 4, + "extensible": true, + "frozen": false, + "sealed": false, + "isError": true, + "preview": { + "kind": "Error", + "name": "TypeError", + "message": "can't access property \"c\", a.b is undefined", + "stack": "@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:3:9\npromise callback*@http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:19\n", + "fileName": "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", + "lineNumber": 3, + "columnNumber": 9 + } + } + } + }, + "actorID": "server0.conn0.child4/obj82" }, "hasException": true }, diff --git a/devtools/server/actors/object/previewers.js b/devtools/server/actors/object/previewers.js index e9128fc73704..ab2566e17061 100644 --- a/devtools/server/actors/object/previewers.js +++ b/devtools/server/actors/object/previewers.js @@ -645,6 +645,7 @@ previewers.Object = [ const fileName = DevToolsUtils.getProperty(obj, "fileName"); const lineNumber = DevToolsUtils.getProperty(obj, "lineNumber"); const columnNumber = DevToolsUtils.getProperty(obj, "columnNumber"); + grip.preview = { kind: "Error", name: hooks.createValueGrip(name), @@ -654,6 +655,14 @@ previewers.Object = [ lineNumber: hooks.createValueGrip(lineNumber), columnNumber: hooks.createValueGrip(columnNumber), }; + + const errorHasCause = obj.getOwnPropertyNames().includes("cause"); + if (errorHasCause) { + grip.preview.cause = hooks.createValueGrip( + DevToolsUtils.getProperty(obj, "cause", true) + ); + } + return true; default: return false; diff --git a/devtools/shared/commands/resource/tests/browser_resources_error_messages.js b/devtools/shared/commands/resource/tests/browser_resources_error_messages.js index d636f881431d..74f39a869954 100644 --- a/devtools/shared/commands/resource/tests/browser_resources_error_messages.js +++ b/devtools/shared/commands/resource/tests/browser_resources_error_messages.js @@ -622,4 +622,252 @@ const expectedPageErrors = new Map([ [noUncaughtException]: true, }, ], + [ + // Error with a cause + `var originalError = new TypeError("abc"); + var error = new Error("something went wrong", { cause: originalError }) + throw error`, + { + errorMessage: /Error: something went wrong/, + errorMessageName: "", + sourceName: /test_page_errors/, + category: "content javascript", + timeStamp: NUMBER_REGEX, + error: true, + warning: false, + info: false, + lineText: "", + lineNumber: NUMBER_REGEX, + columnNumber: NUMBER_REGEX, + innerWindowID: NUMBER_REGEX, + private: false, + stacktrace: [ + { + filename: /test_page_errors\.html/, + lineNumber: 2, + columnNumber: 19, + functionName: null, + }, + ], + exception: { + preview: { + cause: { + class: "TypeError", + preview: { + message: "abc", + }, + }, + }, + }, + notes: null, + chromeContext: false, + isPromiseRejection: false, + isForwardedFromContentProcess: false, + }, + ], + [ + // Error with a cause chain + `var a = new Error("err-a"); + var b = new Error("err-b", { cause: a }); + var c = new Error("err-c", { cause: b }); + var d = new Error("err-d", { cause: c }); + throw d`, + { + errorMessage: /Error: err-d/, + errorMessageName: "", + sourceName: /test_page_errors/, + category: "content javascript", + timeStamp: NUMBER_REGEX, + error: true, + warning: false, + info: false, + lineText: "", + lineNumber: NUMBER_REGEX, + columnNumber: NUMBER_REGEX, + innerWindowID: NUMBER_REGEX, + private: false, + stacktrace: [ + { + filename: /test_page_errors\.html/, + lineNumber: 4, + columnNumber: 14, + functionName: null, + }, + ], + exception: { + preview: { + cause: { + class: "Error", + preview: { + message: "err-c", + cause: { + class: "Error", + preview: { + message: "err-b", + cause: { + class: "Error", + preview: { + message: "err-a", + }, + }, + }, + }, + }, + }, + }, + }, + notes: null, + chromeContext: false, + isPromiseRejection: false, + isForwardedFromContentProcess: false, + }, + ], + [ + // Error with a null cause + `throw new Error("something went wrong", { cause: null })`, + { + errorMessage: /Error: something went wrong/, + errorMessageName: "", + sourceName: /test_page_errors/, + category: "content javascript", + timeStamp: NUMBER_REGEX, + error: true, + warning: false, + info: false, + lineText: "", + lineNumber: NUMBER_REGEX, + columnNumber: NUMBER_REGEX, + innerWindowID: NUMBER_REGEX, + private: false, + stacktrace: [ + { + filename: /test_page_errors\.html/, + lineNumber: 1, + columnNumber: 7, + functionName: null, + }, + ], + exception: { + preview: { + cause: { + type: "null", + }, + }, + }, + notes: null, + chromeContext: false, + isPromiseRejection: false, + isForwardedFromContentProcess: false, + }, + ], + [ + // Error with an undefined cause + `throw new Error("something went wrong", { cause: undefined })`, + { + errorMessage: /Error: something went wrong/, + errorMessageName: "", + sourceName: /test_page_errors/, + category: "content javascript", + timeStamp: NUMBER_REGEX, + error: true, + warning: false, + info: false, + lineText: "", + lineNumber: NUMBER_REGEX, + columnNumber: NUMBER_REGEX, + innerWindowID: NUMBER_REGEX, + private: false, + stacktrace: [ + { + filename: /test_page_errors\.html/, + lineNumber: 1, + columnNumber: 7, + functionName: null, + }, + ], + exception: { + preview: { + cause: { + type: "undefined", + }, + }, + }, + notes: null, + chromeContext: false, + isPromiseRejection: false, + isForwardedFromContentProcess: false, + }, + ], + [ + // Error with a number cause + `throw new Error("something went wrong", { cause: 0 })`, + { + errorMessage: /Error: something went wrong/, + errorMessageName: "", + sourceName: /test_page_errors/, + category: "content javascript", + timeStamp: NUMBER_REGEX, + error: true, + warning: false, + info: false, + lineText: "", + lineNumber: NUMBER_REGEX, + columnNumber: NUMBER_REGEX, + innerWindowID: NUMBER_REGEX, + private: false, + stacktrace: [ + { + filename: /test_page_errors\.html/, + lineNumber: 1, + columnNumber: 7, + functionName: null, + }, + ], + exception: { + preview: { + cause: 0, + }, + }, + notes: null, + chromeContext: false, + isPromiseRejection: false, + isForwardedFromContentProcess: false, + }, + ], + [ + // Error with a string cause + `throw new Error("something went wrong", { cause: "ooops" })`, + { + errorMessage: /Error: something went wrong/, + errorMessageName: "", + sourceName: /test_page_errors/, + category: "content javascript", + timeStamp: NUMBER_REGEX, + error: true, + warning: false, + info: false, + lineText: "", + lineNumber: NUMBER_REGEX, + columnNumber: NUMBER_REGEX, + innerWindowID: NUMBER_REGEX, + private: false, + stacktrace: [ + { + filename: /test_page_errors\.html/, + lineNumber: 1, + columnNumber: 7, + functionName: null, + }, + ], + exception: { + preview: { + cause: "ooops", + }, + }, + notes: null, + chromeContext: false, + isPromiseRejection: false, + isForwardedFromContentProcess: false, + }, + ], ]);