Closed Bug 1810579 Opened 1 year ago Closed 1 year ago

stylesheets manager does not notify about already registered stylesheets

Categories

(DevTools :: Style Editor, defect, P3)

defect

Tracking

(firefox111 fixed)

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

Attachments

(2 files)

Spotted while working on https://phabricator.services.mozilla.com/D166311

If anything on the server side already triggered the registration of a stylesheet on the stylesheets manager, before the client is watching for stylesheets resources, the manager will not emit the existing stylesheets as resources.

STRs to force the issue:

  • in devtools/server/actors/targets/window-global.js update ensureCSSErrorReportingEnabled in order to register all stylesheets on the stylesheets manager
  • run the test at devtools/client/webconsole/test/browser/browser_webconsole_location_styleeditor_link.js

In this test, we have a few CSS warnings which will trigger an early registration of the stylesheets, which means that the stylesheet manager will skip emitting the corresponding events when startWatching is called.

We should try to force emitting the events for already registered stylesheets.

Depends on D167098

This is normally not triggered by any scenario with the current DevTools but there is no reason actors should not be allowed to use the stylesheet-manager
unless a client has started it.

Depends on D167164

I was hoping to remove this noop watcher thanks to the previous patch, but we have to keep it.
Updated the comment to highlight the main reason why the watchResources call is needed here.

Alternatively, instead of a no-op here, we could either

  • cache the stylesheet resources in the inspector front and remove getResourceById on resourceCommand
  • or automatically watch stylesheets
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9338af8dc025
[devtools] Notify about already registered stylesheets in stylesheets-manager r=devtools-reviewers,ochameau
https://hg.mozilla.org/integration/autoland/rev/e2f8224674a4
[devtools] Update comment about noop watcher for stylesheets r=devtools-reviewers,ochameau
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: