Closed Bug 1358937 Opened 8 years ago Closed 8 years ago

Long error message crashes the new console frontend

Categories

(DevTools :: Console, defect, P1)

52 Branch
defect

Tracking

(firefox55 verified)

VERIFIED FIXED
Firefox 55
Iteration:
55.4 - May 1
Tracking Status
firefox55 --- verified

People

(Reporter: Oriol, Assigned: nchevobbe)

References

Details

(Whiteboard: [console-html])

Attachments

(3 files)

1. Go to about:newtab 2. Open the web console 3. Enter this code: var w = window.open(); w.close(); Reflect.apply(w); 4. The console shows no output and stops working. This specific case was introduced by 1303795, unrelated to the console.
Summary: DeadObject and Reflect.apply crashs console → DeadObject and Reflect.apply crash the console
This is only a problem on the new frontend. I see this in the browser console: rror: Minified React error #31; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Btype%2C%20initial%2C%20length%2C%20actor%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
Summary: DeadObject and Reflect.apply crash the console → DeadObject and Reflect.apply crash the new console frontend
Full message with dev js modules: Error: Objects are not valid as a React child (found: object with keys {type, initial, length, actor}). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of `Message`.
Whiteboard: [console-html]
Flags: qe-verify?
Priority: -- → P2
Flags: qe-verify? → qe-verify+
QA Contact: iulia.cristescu
Yes, it seems the error contains an object instead of a message, and the console didn't expect this. > try{var w = window.open(); w.close(); Reflect.apply(w);}catch(err){err} TypeError: [object Object] Stack trace: @debugger eval code:1:39 WCA_evalWithDebugger@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:1385:16 WCA_onEvaluateJS@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:898:20 WCA_onEvaluateJSAsync@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:868:20 onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/main.js:1759:15 receiveMessage@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/transport/transport.js:761:7 > try{var w = window.open(); w.close(); Reflect.apply(w);}catch(err){err.message} "({InstallTrigger:null, get window() { [native code] }, get document() { [native code] }, get location() { [native code] }, set location() { [native code] }, get top() { [native code] }, close:function close() { [native code] }, stop:function stop() { [native code] }, focus:function focus() { [native code] }, blur:function blur() { [native code] }, open:function open() { [native code] }, alert:function alert() { [native code] }, confirm:function confirm() { [native code] }, prompt:function prompt() { [native code] }, print:function print() { [native code] }, showModalDialog:function showModalDialog() { [native code] }, postMessage:function postMessage() { [native code] }, captureEvents:function captureEvents() { [native code] }, releaseEvents:function releaseEvents() { [native code] }, getSelection:function getSelection() { [native code] }, getComputedStyle:function getComputedStyle() { [native code] }, matc…" Compare with Reflect.construct: > try{var w = window.open(); w.close(); Reflect.construct(w);}catch(err){err} TypeError: w is not a constructor Stack trace: @debugger eval code:1:39 WCA_evalWithDebugger@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:1385:16 WCA_onEvaluateJS@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:898:20 WCA_onEvaluateJSAsync@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/webconsole.js:868:20 onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/main.js:1759:15 receiveMessage@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/transport/transport.js:761:7 > try{var w = window.open(); w.close(); Reflect.construct(w);}catch(err){err.message} "w is not a constructor"
This crash is caused because we make the assumption that the exceptionMessage of the packet is a string. But here, we receive exceptionMessage as a longString [1], hence the error. This should be easy to fix naively first, by getting the content of exceptionMessage.initial. Still, it could be nice if the user could expand the message to get the whole content. We already have a bug to track this feature for logged longString (Bug 1310630), so I'll add a comment there saying we should handle long error messages too. [1] Packet : { "from": "server1.conn1.child1/consoleActor2", "input": " var w = window.open(); w.close(); Reflect.apply(w);", "result": { "type": "undefined" }, "timestamp": 1493106355440, "exception": { "type": "object", "actor": "server1.conn1.child1/obj35", "class": "Error", "extensible": true, "frozen": false, "sealed": false, "ownPropertyLength": 4, "preview": { "kind": "Error", "name": "TypeError", "message": { "type": "longString", "initial": "({close:function close() {\n [native code]\n}, stop:function stop() {\n [native code]\n}, focus:function focus() {\n [native code]\n}, blur:function blur() {\n [native code]\n}, open:function open() {\n [native code]\n}, alert:function alert() {\n [native code]\n}, confirm:function confirm() {\n [native code]\n}, prompt:function prompt() {\n [native code]\n}, print:function print() {\n [native code]\n}, postMessage:function postMessage() {\n [native code]\n}, captureEvents:function captureEvents() {\n [native code]\n}, releaseEvents:function releaseEvents() {\n [native code]\n}, getSelection:function getSelection() {\n [native code]\n}, getComputedStyle:function getComputedStyle() {\n [native code]\n}, matchMedia:function matchMedia() {\n [native code]\n}, moveTo:function moveTo() {\n [native code]\n}, moveBy:function moveBy() {\n [native code]\n}, resizeTo:function resizeTo() {\n [native code]\n}, resizeBy:function resizeBy() {\n [native code]\n}, scroll:function sc", "length": 13482, "actor": "server1.conn1.child1/longString32" }, "stack": "@debugger eval code:1:39\n", "fileName": "debugger eval code", "lineNumber": 1, "columnNumber": 39 } }, "exceptionMessage": { "type": "longString", "initial": "TypeError: ({close:function close() {\n [native code]\n}, stop:function stop() {\n [native code]\n}, focus:function focus() {\n [native code]\n}, blur:function blur() {\n [native code]\n}, open:function open() {\n [native code]\n}, alert:function alert() {\n [native code]\n}, confirm:function confirm() {\n [native code]\n}, prompt:function prompt() {\n [native code]\n}, print:function print() {\n [native code]\n}, postMessage:function postMessage() {\n [native code]\n}, captureEvents:function captureEvents() {\n [native code]\n}, releaseEvents:function releaseEvents() {\n [native code]\n}, getSelection:function getSelection() {\n [native code]\n}, getComputedStyle:function getComputedStyle() {\n [native code]\n}, matchMedia:function matchMedia() {\n [native code]\n}, moveTo:function moveTo() {\n [native code]\n}, moveBy:function moveBy() {\n [native code]\n}, resizeTo:function resizeTo() {\n [native code]\n}, resizeBy:function resizeBy() {\n [native code]\n}, scroll:", "length": 13493, "actor": "server1.conn1.child1/longString36" }, "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_a_function?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default", "frame": { "source": "debugger eval code", "line": 1, "column": 39 }, "helperResult": null }
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Iteration: --- → 55.4 - May 1
Priority: P2 → P1
Note that `var w = window.open(); w.close(); Reflect.apply(w);` producing that longstring seems part of bug 1358939. The expected error should be `TypeError: w is not a function`. So if you know some other way to get a longstring, better use that as the test.
(In reply to Oriol from comment #9) > Note that `var w = window.open(); w.close(); Reflect.apply(w);` producing > that longstring seems part of bug 1358939. > The expected error should be `TypeError: w is not a function`. > So if you know some other way to get a longstring, better use that as the > test. Thanks, I'll switch to something a bit more predictable then.
Comment on attachment 8861385 [details] Bug 1358937 - Fix console crash due to longString error messages; https://reviewboard.mozilla.org/r/133376/#review136530
Attachment #8861385 - Flags: review?(bgrinstead) → review+
(In reply to Nicolas Chevobbe [:nchevobbe] from comment #10) > (In reply to Oriol from comment #9) > > Note that `var w = window.open(); w.close(); Reflect.apply(w);` producing > > that longstring seems part of bug 1358939. > > The expected error should be `TypeError: w is not a function`. > > So if you know some other way to get a longstring, better use that as the > > test. > > Thanks, I'll switch to something a bit more predictable then. What about `throw new Error("Long error".repeat(10000))`?
(In reply to Brian Grinstead [:bgrins] from comment #12) > (In reply to Nicolas Chevobbe [:nchevobbe] from comment #10) > > (In reply to Oriol from comment #9) > > > Note that `var w = window.open(); w.close(); Reflect.apply(w);` producing > > > that longstring seems part of bug 1358939. > > > The expected error should be `TypeError: w is not a function`. > > > So if you know some other way to get a longstring, better use that as the > > > test. > > > > Thanks, I'll switch to something a bit more predictable then. > > What about `throw new Error("Long error".repeat(10000))`? Works great, thanks. I updated the review
Summary: DeadObject and Reflect.apply crash the new console frontend → Long error message crashes the new console frontend
Comment on attachment 8861386 [details] Bug 1358937 - Add tests for exceptions with longString messages; https://reviewboard.mozilla.org/r/133378/#review136872
Attachment #8861386 - Flags: review?(bgrinstead) → review+
(In reply to Brian Grinstead [:bgrins] from comment #16) > Looks like the stubs file needs to be updated: > https://treeherder.mozilla.org/#/ > jobs?repo=try&revision=f45aafda5e3a&selectedJob=94420766 I updated them though. I think there might be a bug in the check_stubs_* test, I'll have a look
Comment on attachment 8862304 [details] Bug 1358937 - Make getCleanedPacket function handle longString exception messages; https://reviewboard.mozilla.org/r/134228/#review137432
Attachment #8862304 - Flags: review?(bgrinstead) → review+
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/60b547b301b6 Fix console crash due to longString error messages; r=bgrins https://hg.mozilla.org/integration/autoland/rev/e34af094bed2 Add tests for exceptions with longString messages; r=bgrins https://hg.mozilla.org/integration/autoland/rev/607d5fdcc92e Make getCleanedPacket function handle longString exception messages; r=bgrins
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Managed to reproduce the initial issue on 55.0a1 (2017-04-23). I can confirm that it is verified fixed on 55.0a1 (2017-05-02), using Windows 10 x64, Ubuntu 16.04 x64 and Mac OS X 10.11.6.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: