Open Bug 1832695 Opened 2 years ago Updated 2 years ago

"Navigated message" is displayed too early

Categories

(DevTools :: Console, defect, P3)

Firefox 114
defect

Tracking

(Not tracked)

People

(Reporter: ycw7788, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0

Steps to reproduce:

  1. creates a script, and appends it to index.html
location.replace('another.html')
throw new Error()
  1. in firefox, opens console, enables Persist Logs, then visit index.html

Actual results:

in console, "Navigated to another.html" was logged, followed by the Error

Expected results:

I expected that console logs the Error before showing the navigation info.

The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Console
Product: Firefox → DevTools

reproducible with data:text/html,<meta charset=utf8><button>Reload</button><script>document.querySelector("button").addEventListener("click", function(){ location.reload();throw new Error("booh") })</script>

Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: console logs errors in wrong order after location.replace → "Navigated message" is displaye too early
Summary: "Navigated message" is displaye too early → "Navigated message" is displayed too early

We currently subtract an offset for a navigation event at https://searchfox.org/mozilla-central/rev/e77d89c414eac63a295a2124600045775a6f4715/devtools/server/actors/resources/parent-process-document-event.js#143 which can cause a sorting issues in this case.

On DevTools side, we could change the sorting to be based on the target/window but that would be a massive change which might have performance issues. Otherwise we can hope for a better timing from platform for this navigation event (see comments in file).

Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.