Open Bug 1793685 Opened 2 years ago Updated 3 months ago

Markup view becomes blank for cancelled navigations (eg download link)

Categories

(DevTools :: Inspector, defect, P2)

Firefox 105
defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: hellothereleth, Assigned: jdescottes)

References

()

Details

Attachments

(4 files)

Attached video show.mp4

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

Steps to reproduce:

Clicked on a top level data URI and got a warning in console.

Actual results:

Inspector html content was gone, even after right clicking and hitting inspect again but style and xpath selector still show.
You have to reopen devtools to fix it.

Expected results:

Inspector html content should still be there.

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

Component: Untriaged → Inspector
Product: Firefox → DevTools

Probably similar to Bug 1347761, there is a whole class of links/navigations which seem to blank the inspector markup view

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jdescottes)
Priority: -- → P3
See Also: → 1347761
Attached file test_case.html
Flags: needinfo?(jdescottes)

We get a will-navigate DOCUMENT_EVENT at https://searchfox.org/mozilla-central/rev/76ccfc801e6b736c844cde3fddeab7a748fc8515/devtools/client/inspector/inspector.js#351, which destroys the markup view at https://searchfox.org/mozilla-central/rev/76ccfc801e6b736c844cde3fddeab7a748fc8515/devtools/client/inspector/inspector.js#573 but since the navigation is actually cancelled, we never receive a new root node.

I wonder if we could stop monitoring will-navigate...
We already listen for ROOT_NODE and perform all the necessary cleanups when we receive a new root node.
Beyond potential test failures the only downside I see is that an "old" markup view might persist for a longer time. Otherwise maybe we can find another event but which should still be guaranteed to arrive earlier than ROOT_NODE (eg I don't think dom-complete would be a good fit?)

There are not too many failures actually, they feel test related only.
https://treeherder.mozilla.org/jobs?repo=try&revision=7602e78ac8ed0e12d63b9dac0ff8f9f516120a87

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Summary: Inspector html Empty after getting "Navigation to toplevel data: URI not allowed" warning → Markup view becomes blank for cancelled navigations (eg download link)
Priority: P3 → P2

First of all, we can always cleanup the selection and the markup view when we receive a new root node. We don't necessarily have to do it earlier for the UI to be functional.

Now we might still want to do some early cleanup for the user experience: root node might arrive quite late, so displaying the markup view for the old page in the meantime can be confusing. So I tried to play a bit with other options, mostly to use pagehide, as suggested in bug 1347761.

pagehide works, but it is usually emitted quite late. In a regular webtoolbox, with all the default devtools settings, I will typically receive pagehide after receiving targetDestroyed. So it doesn't dramatically change the experience compared to what happens if we only cleanup when receiving the new root node. It also doesn't help with the few test issues in my WIP patch, because they are related to highlighter changes happening on target destroyed, and would only be fixed if we could cleanup the markup view before target destroyed.

Another option would be to only hide (not destroy) the markupview in will-navigate, and see if we can have some event/logic to show it again in case the navigation got cancelled.

Depends on D160977

Introduce a new document event resource called pagehide.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: