Closed Bug 1725547 Opened 3 years ago Closed 2 years ago

StyleEditor does not display same-origin frame stylesheets on reload

Categories

(DevTools :: Style Editor, defect, P2)

defect

Tracking

(firefox-esr78 unaffected, firefox-esr91 wontfix, firefox93 wontfix, firefox94 wontfix)

RESOLVED WORKSFORME
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- wontfix
firefox93 --- wontfix
firefox94 --- wontfix

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

(Regression)

Details

(Keywords: regression, Whiteboard: dt-perf-stability-mvp)

Steps to reproduce

  1. Go to https://same-domain-iframe-stylesheet-reload.glitch.me/
  2. Open DevTools and go to the StyleEditor
  3. There should be 2 stylesheets, one for the top level document, the other for the same origin iframe.
  4. Reload the page

Expected results

The list of stylesheet is cleared, and then the 2 stylesheet are loaded back

Actual results

The list of stylesheet is cleared, but only the top-level stylesheet is displayed
Stylesheets added through the "Add Stylesheet" button are not reflected in the StyleEditor either after the reload

I can reproduce on Firefox 90, regardless of Fission state.
I can't reproduce on Firefox ESR (78).


I did some investigation on this:

We rely on the document.styleSheetChangeEventsEnabled to be notified about stylesheets being added.
This flag is added by the StylesheeManager on all the documents of a given target when we start watching, and then on each window we receive from the window-ready event.

window-ready is emitted from the BrowsingContextTargetActor, via the onWindowCreated handler. This one can be triggered either by a DOMWindowCreated event or by a pageshow event.

Here what seems to happen when reloading:

  • we get the top level DomWindowCreated fine
  • then we get DomWindowCreated for the iframe, which are actually initial documents (isInitialDocument is true). window-ready is sent for all of those and we set the styleSheetChangeEventsEnabled on the document.
  • then I guess those transient documents are "destroyed" (or swapped, not sure, but we don't get them in windowDestroyed) and the "real" one is created (we don't get a DOMWindowCreated for it though). The issue is that it has the same innerWindowId than the initial document, which means we won't get window-ready for those: https://searchfox.org/mozilla-central/rev/8f08c21f093be1c1c42438697f8bca67af94fc77/devtools/server/actors/targets/browsing-context.js#1777-1780 would see them as already handled.
  • at this point, the iframe document.styleSheetChangeEventsEnabled is false and we won't get notified about its stylesheets

Patch for Bug 1724909 is adding a test (devtools/shared/commands/resource/tests/browser_resources_stylesheets_navigation.js) with disabled assertions, that should be enabled as part of this bug.

A proper solution would be to move that flag on the browsing context (we already have devtools-specific flags on it), and setting it would propagate it to the whole browsing context tree

QA Whiteboard: [qa-regression-triage]

(In reply to Alice0775 White from comment #3)

Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b54e100794eef36af9e4cefe3b260fe9642ea3bf&tochange=ccd521ebc464ffdad1a5abfa3f03a9df603c67da

Thanks! I strongly suspect Bug 1625930 (turning stylesheets into resources)

Regressed by: 1625930
Summary: StyleEditor does not display remote frame stylesheets on reload → StyleEditor does not display same-origin frame stylesheets on reload

Removing the regressionwindow-wanted keyword as it was provided in Comment 3.

Has Regression Range: --- → yes
Has STR: --- → yes
Severity: -- → S3
Priority: -- → P2
Flags: needinfo?(odvarko)
Flags: needinfo?(odvarko)
Whiteboard: dt-perf-stability-triage
Whiteboard: dt-perf-stability-triage → dt-perf-stability-
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Whiteboard: dt-perf-stability- → dt-perf-stability-mvp

Set release status flags based on info from the regressing bug 1625930

This should be fixed with EFT

Depends on: 1731740
Depends on: 1737571

EFT is enabled everywhere and all blockers are resolved, we can probably close this

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.