Closed Bug 1673829 Opened 4 years ago Closed 4 years ago

rule-view shows "inline" instead of the correct stylesheet after navigating (with enableServerWatcherSupport)

Categories

(DevTools :: Style Editor, defect, P3)

defect

Tracking

(Fission Milestone:M7a)

RESOLVED FIXED
Fission Milestone M7a

People

(Reporter: jdescottes, Assigned: nchevobbe)

References

Details

(Whiteboard: dt-fission-m3-mvp)

STRs:

ER: The rule view should display the correct stylesheet name next to each rule. Clicking on the stylesheet should open the style editor.
AR: The rule view shows "inline" even for styles defined in a stylesheet. Clicking on "inline" doesn't do anything.

Note: This is even more broken without Bug 1664941, which is why I am filing this as a follow up work.

Severity: -- → S3
Priority: -- → P3
Whiteboard: dt-fission, dt-fission-m3-mvp

Tracking dt-fission-m3-mvp bugs for Fission MVP.

Fission Milestone: --- → MVP

Moving some dt-fission-m3-mvp bugs from Fission MVP to M7 (blocking Beta experiment).

Fission Milestone: MVP → M7
Whiteboard: dt-fission, dt-fission-m3-mvp → dt-fission-m3-mvp

Tracking dt-fission-m3-mvp test and infrastructure bugs for Fission M8 (blocking Release experiment).

Fission Milestone: M7 → M8
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

I did some investigation.

inline is shown because in devtools/client/inspector/rules/views/rule-editor.js#293 this.rule.sheet is null, and when we call devtools/client/inspector/rules/views/rule-editor.js#300 it returns inline if the href is null (devtools/shared/inspector/css-logic.js#133-136)

The rule sheet is retrieve from devtools/client/inspector/rules/models/rule.js#218, which calls devtools/client/fronts/style-rule.js#112-122
So we're trying to retrieve a resource from its id, but here, the this._form.parentStyleSheet property is undefined, which explains why we get a null stylesheet rule in the end

And the reason parentStyleSheet is undefined on the form is because we can find the pageStyle's styleSheetWatcher in devtools/server/actors/style-rule.js#331-335 , which is set in devtools/server/actors/page-style.js#115-118, but in our case it's not created yet (but is a bit later)

Here's the trace that leads to the pageStyle actor creation, after navigating:

devtools/server/actors/page-style.js 131 initialize
devtools/server/actors/inspector/inspector.js 162 getPageStyle
devtools/client/fronts/inspector.js initialize
devtools/client/inspector/inspector.js initInspectorFront
devtools/client/inspector/inspector.js _onTargetAvailable

In short:

  • we're notified when a new FRAME target is created
  • for which we initialize an inspector front
  • which creates a pageStyleActor

The issue here being that we're not listening to STYLESHEET resource yet, so styleSheetWatcher isn't set on the pageStyleActor.
Here's the trace that leads to watching STYLESHEET resources, after navigating:

devtools/server/actors/resources/index.js 205 watchResources
devtools/server/actors/targets/target-actor-mixin.js 85 _watchTargetResources
devtools/server/actors/targets/target-actor-mixin.js 34 addWatcherDataEntry
devtools/server/connectors/js-window-actor/DevToolsFrameChild.jsm 411 _addWatcherDataEntry
devtools/server/connectors/js-window-actor/DevToolsFrameChild.jsm 353 receiveMessage
devtools/server/connectors/js-window-actor/DevToolsFrameParent.jsm 94 addWatcherDataEntry
devtools/server/actors/watcher/target-helpers/frame-helper.js 101 addWatcherDataEntry
devtools/server/actors/watcher.js 331 watchResources
[...]
devtools/shared/resources/resource-watcher.js 676 _startListening
devtools/shared/resources/resource-watcher.js 331 _onTargetAvailable/<
devtools/shared/resources/resource-watcher.js 330 _onTargetAvailable
[...]
devtools/shared/resources/target-list.js 197 _onTargetAvailable
devtools/shared/resources/target-list.js 572 switchToTarget
devtools/shared/resources/target-list.js 558 onLocalTabRemotenessChange
[...]
devtools/client/fronts/descriptors/tab.js 223 _onRemotenessChange
devtools/client/fronts/descriptors/tab.js 205 _handleTabEvent
browser/content/tabbrowser.js 5798 didChange
global/content/elements/browser-custom-element.js 1916 finishChangeRemoteness
global/content/customElements.js 696 getInterfaceProxy/get/<

In short:

  • we do a target switch from the client
  • this triggers the onTargetAvailable callback in the resource watcher, that will end up calling watchResources on the watcher actor
  • we go through the DevToolsFrame JSWindowActor to propagate the resources we want to watch to all targets

Looking at the 2 paths, they're quite independent from each other. The only common thing is that they're initialized by an onTargetAvailable callback, but then, the JSWindowActor communication for watching the resource introduces some delay that will mean that the pageStyleActor gets created before the stylesheet resources are watched for a given target.

Depends on: 1692992

Tracking DevTools Post-M8 bugs for Fission MVP milestone. They don't block the Fission Release channel experiment, but we would like them to be completed before we roll out Fission by default.

Fission Milestone: M8 → MVP
Fission Milestone: MVP → M8

Fixed in Bug 1685268 (demonstrated by browser_rules_style-editor-link.js)

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Fission Milestone: M8 → M7a
You need to log in before you can comment on or make changes to this bug.