Removing <style>/<link> node doesn't remove stylesheet in StyleEditor
Categories
(DevTools :: Style Editor, defect, P3)
Tracking
(firefox118 fixed)
Tracking | Status | |
---|---|---|
firefox118 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Blocks 2 open bugs)
Details
Attachments
(4 files)
There are no events sent from the platform when a stylesheet is removed at the moment, so we should start with that.
Then it should be a matter of firing onResourceDestroyed
for stylesheet resources and having a dedicated method in the StyleEditorUI.jsm
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
Emilio, as discussed yesterday, I call PostStyleSheetApplicableStateChangeEvent
from DocumentOrShadowRoot::RemoveStyleSheet
(see D147271)
It does work in the end, but if feels a bit off.
The stylesheet is still seen as applicable, so that's not something we can discriminate on; I'm just looking if the stylesheet was registered and if it doesn't have an associated document anymore, which is okay-ish I guess (unless I'm missing something)
But really, the applicable state for the stylesheet didn't "changed".
So should we have another event for this? Or should we make StyleSheet.h check if we have an associated document?
Comment 3•2 years ago
|
||
Right... So, I'd like for the "applicable" state (at least internally in Gecko) to be just "is complete and not disabled" (which is what it does now). It's perfectly legit for non-document-associated sheets (like user or user-agent sheets) to be applicable.
Another event might be sensible, yeah, I guess "applicable state" is not the only thing that devtools cares about. Then again it seems a bit overkill to have a new event just for this. But it might be the cleaner over-all.
Comment 4•2 years ago
|
||
If I understand Emilio correctly, this bug covers any kind of removal from the document, i.e. also disabling a stylesheet or removing it from Document.adoptedStyleSheets
, right?
I am asking because I just saw a related question on Stack Overflow and I was searching whether there's already a bug filed for it.
Sebastian
Comment 5•2 years ago
|
||
Well changing disabled would cause the sheet not to be applicable, so the patch above would work, yeah.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Updated•1 year ago
|
Comment 7•1 year ago
|
||
Make sure that when removed the applicable state of the style sheet is
false
rather than true. Fix tests too (there were a couple typos etc).
Updated•1 year ago
|
Assignee | ||
Comment 8•1 year ago
|
||
Depends on D147271
Assignee | ||
Comment 9•1 year ago
|
||
Depends on D185790
Comment 10•1 year ago
|
||
Comment 11•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/98df24408c27
https://hg.mozilla.org/mozilla-central/rev/a8a1e12c259c
https://hg.mozilla.org/mozilla-central/rev/94d6dd1430fc
Description
•