Closed Bug 1808912 Opened 2 years ago Closed 2 years ago

Some error message might be displayed twice in the console after reload

Categories

(DevTools :: Console, defect)

defect

Tracking

(firefox110 fixed)

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

Attachments

(1 file)

Steps to reproduce

  1. Open a tab on https://ffx-devtools-duplicated-csp-message-on-reload.glitch.me/
  2. Open the console
  3. Reload the tab

Expected results

The CSP warning is displayed once

Actual results

The CSP warning is displayed twice (see the "repeat bubble" at the right side of the message)


This comes from a race condition due to how we get "cached" messages and register for new ones in https://searchfox.org/mozilla-central/rev/4ebfb48f7e82251145afa4a822f970931dd06c68/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js#44-47
The code there was supposed to handle such case, but this isn't enough.

Even if the code was trying to not get duplicated messages (from the cache and from the listener),
there were still cases where this could happen (e.g. CSP warnings on navigation).
To prevent this, we store the latest message microSecondTimeStamp so we can filter
out any message older than this in the listener.
An existing CSP warning test is modified to ensure we get single messages in the
console output.

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/817487e98df1 [devtools] Filter out nsIConsoleListener message emitted before last retrieved cached message. r=jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: