Closed Bug 1593933 Opened 5 years ago Closed 4 years ago

Navigating should close existing console.group

Categories

(DevTools :: Console, defect, P3)

defect

Tracking

(firefox83 fixed)

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: nchevobbe, Assigned: mroncancio19)

References

Details

Attachments

(4 files)

Steps to reproduce

  1. Navigate to data:text/html,<script>console.group("hello")</script>
  2. Open the console
  3. Ensure the "Persist Logs" setting is ON
  4. Reload the tab several time

Actual results

The existing groups never close, which looks quite weird:

┌────────────────────────────────────────┐
│  ▼ hello                               │
├──┬─────────────────────────────────────┤
│  │ Navigated to data:text/html         │
├──┼─────────────────────────────────────┤
│  │  ▼ hello                            │
├──┴──┬──────────────────────────────────┤
│     │ Navigated to data:text/html      │
├─────┼──────────────────────────────────┤
│     │▼ hello                           │
└─────┴──────────────────────────────────┘

Hey I just tried replicating this error in the latest pull of the mozilla-central and wasn't able to replicate this issue. The logs groups didn't persist

Here's the screenshot

Yes, it looks like bugzilla encoded some chars in Comment 0.

You can reproduce by evaluating console.group("hello"); document.location.reload(); a few time, having the "persist logs" option ON.
Let me know if you can reproduce.

I also assigned you the bug :)

Assignee: nobody → kgkartikeyagokhale
Status: NEW → ASSIGNED
Attached image console.group bug

Hey I tried recreating that bug however wasn't able to do it.
I've attached the screenshot. Am I doing something wrong?

Go to https://unclosed-console-group.glitch.me/ , open the console, and reload the page several times. It should reproduce.

Yeah it is showing now.
Could you please guide me more regarding where I would be able to fix this? and what all tests should be added/changed?
Thanks

So this is the piece of state that holds the current group: devtools/client/webconsole/reducers/messages.js#100-101
This needs to be set to null when the "Navigated to" message is added. The message is added from devtools/client/webconsole/webconsole-wrapper.js#257-258 , in the end, this will cause this redux action to be dispatched devtools/client/webconsole/actions/messages.js#50-53 .
This action is then handled in the messages reducer devtools/client/webconsole/reducers/messages.js#393
What we need to do is to check the type, and if it matches the navigation message type, set the currentGroup property to null.

When persist log is on and the page is reloaded, if the console.group command is used, the newer logs keep on getting appended to the older ones.
Solved this by looking for the navigation marker message and when intercepted, sent a synthetic endGroup message to close the current group.

Bug 1593933 - Navigating should close existing console.group

Kartikeya, are you still interested in fixing this bug? There is a review comment waiting for your action.

Honza

Flags: needinfo?(kgkartikeyagokhale)

I apologize for the delay but currently I wont be able to work on this. :(

Flags: needinfo?(kgkartikeyagokhale)

Thanks for the heads-up Kartikeya, I'll unassign the bug :)

Assignee: kgkartikeyagokhale → nobody
Status: ASSIGNED → NEW

I'd like to work on this!

Thanks Miguel, it's now yours :)

Assignee: nobody → mroncancio19
Status: NEW → ASSIGNED
Attachment #9180188 - Attachment description: Bug 1593933 - Navigating should close existing console.group messages → Bug 1593933 - [devtools] Navigating should close existing console.group messages. r=nchevobbe
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cdf395992b18
[devtools] Navigating should close existing console.group messages. r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: