Open Bug 1652419 Opened 5 years ago Updated 5 years ago

Inspector breadcrumbs show outdated content after iframe navigation

Categories

(DevTools :: Inspector, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

Details

Spotted while working on Bug 1628473 (but this one occurs regardless of fission/remote frames):

  • open inspector on a page with an iframe that can navigate
  • select a node inside the iframe
  • your breadcrumbs should look something like html > body > ... > iframe > html > body > ... > some_el and "some_el" should be highlighted
  • in the breadcrumbs, select any node before the iframe. The highlighted node in the breadcrumbs should change, but it should not "reset" the breadcrumbs
  • trigger the iframe navigation
  • the breadcrumbs will still show the outdated markup from the previous location of the iframe

I know the STRs are a bit complex, so I will try to add a test page shortly.

Test page to make it easier:

  • go to https://bug1652419.glitch.me/
  • select the paragraph in the iframe
    • breadcrumbs should be html > body > iframe > html > body > p
    • p should be highlighted
  • select iframe in the breadcrumbs
    • breadcrumbs should still be html > body > iframe > html > body > p
    • iframe should be highlighted
  • click on the button Navigate frame below the iframe

At this point, the breadcrumbs haven't been updated and still show the p element even though the iframe has navigated and no longer contains this markup.

The breadcrumbs try to only update impacted nodes on each mutation. For the scenario we have here, a frame navigation results in a "documentUnload" + "childList" mutation.

Breadcrumbs process childList mutations [1], but try to surgically remove all the nodes that have been removed [2]. However, the "childList" mutation emitted for frame document unloads doesn't contain any added or removed node. It's a fake mutation which is only suposed to force the frontend to request the children of the frame again.

Note that starting with bug 1628473, we will start moving away from mutations here, and use the root-node resource instead.
We filed Bug 1652445 in order to consistently use resources for all navigations, and we should probably wait for it be fixed before we start the work on this one.

[1] https://searchfox.org/mozilla-central/rev/af5cff556a9482d7aa2267a82f2ccfaf18e797e9/devtools/client/inspector/breadcrumbs.js#841-864
[2] https://searchfox.org/mozilla-central/rev/af5cff556a9482d7aa2267a82f2ccfaf18e797e9/devtools/client/inspector/breadcrumbs.js#906-912

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