Closed Bug 1428717 Opened 2 years ago Closed 2 years ago

netProviderEnhancer for MESSAGE_OPEN action throws when not on a network message

Categories

(DevTools :: Console, defect, P1)

defect

Tracking

(firefox59 fixed)

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

(Whiteboard: [newconsole-mvp])

Attachments

(1 file)

Steps to reproduce:
1. Go to data:text/html,Hello<script>window.setTimeout(() => { throw new Error("ooops")}, 0)</script>
2. Open the console
3. Click on the "Error: oops" expand arrow

Expected results:

The stacktrace is shown, and the arrow is rotated

Actual results:

The stacktrace isn't shown, and the arrow is not rotated. 
There is an error in the browser console : 
TypeError: message is undefined | store.js:203:13
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: -- → P1
Whiteboard: [newconsole-mvp]
The issue lays into those lines : 

https://searchfox.org/mozilla-central/rev/f42618c99dcb522fb674221acfbc68c2d92e7936/devtools/client/webconsole/new-console-output/store.js#200,203

Here, the netProvider enhancer react to a MESSAGE_OPEN action, gets the networkUpdate of the message with the action id and goes on.
The issue is that if the message opened is not a network one, there is no networkUpdate, and thus message.openedOnce will throw.
Guarding the if with message will probably fix the issue.
We should also add a test to make sure we don't regress this.

console.group message are bitten by that too (if you close a group, you can't reopen it).
Summary: Thrown errors can't be expanded → netProviderEnhancer for MESSAGE_OPEN action throws when not on a network message
Comment on attachment 8940724 [details]
Bug 1428717 - Fix netProviderEnhancer for MESSAGE_OPEN action for non-network message;.

https://reviewboard.mozilla.org/r/211018/#review216724

Looks good, thanks for fixing it!

r+, and just one nit comment.

Honza

::: devtools/client/webconsole/new-console-output/test/store/messages.test.js:585
(Diff revision 1)
> +      dispatch(actions.messageClose(firstMessageId));
> +
> +      expanded = getAllMessagesUiById(getState());
> +      expect(expanded.length).toBe(0);
> +
> +      dispatch(actions.messageOpen(firstMessageId));

nit: do we need this last open? The exception has been opened once in this test no?
Attachment #8940724 - Flags: review?(odvarko) → review+
Comment on attachment 8940724 [details]
Bug 1428717 - Fix netProviderEnhancer for MESSAGE_OPEN action for non-network message;.

https://reviewboard.mozilla.org/r/211018/#review216724

> nit: do we need this last open? The exception has been opened once in this test no?

you're right
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d3c95327159c
Fix netProviderEnhancer for MESSAGE_OPEN action for non-network message;r=Honza.
https://hg.mozilla.org/mozilla-central/rev/d3c95327159c
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.