ObservableArray constructable stylesheets breaks Dark Reader add-on (Error: Accessing from Xray wrapper is not supported.)
Categories
(Core :: DOM: Bindings (WebIDL), defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr91 | --- | unaffected |
| firefox99 | --- | unaffected |
| firefox100 | --- | unaffected |
| firefox101 | + | fixed |
| firefox102 | --- | fixed |
People
(Reporter: aminomancer, Assigned: emilio)
References
(Regression)
Details
(Keywords: regression)
Attachments
(3 files, 1 obsolete file)
|
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
|
4.04 KB,
text/plain
|
Details | |
|
901.25 KB,
text/plain
|
Details |
I'm still trying to work out details but here's what I noticed. Patch for bug 1766227 causes Dark Reader to fail to apply styles on some websites. I noticed it on phabricator which is the most obvious example I found.
To test you just need Nightly and to enable layout.css.constructable-stylesheets.enabled and go to https://phabricator.services.mozilla.com and then reload the page. It seems to succeed on initial load and fail on reload or history navigation (whereupon I guess it falls back to some baseline styles that make the page monochrome gray and white). If you force reload and skip cache (Shift+Accel+R) it seems to fail to apply the fallback styles too, resulting in the normal phabricator theme. You can also try building from D144547
Bisection: mozregression --addon .../addon@darkreader.org.xpi --pref layout.css.constructable-stylesheets.enabled:true --arg="https://phabricator.services.mozilla.com" --good=99
Comment 1•4 years ago
|
||
Set release status flags based on info from the regressing bug 1766227
| Assignee | ||
Comment 3•4 years ago
|
||
I don't see any of the adopted stylesheets code in DocumentOrShadowRoot.cpp getting hit, which makes this particularly hilarious.
| Assignee | ||
Comment 4•4 years ago
|
||
Ok, so this took a ridiculous amount of time to find (well, since my last comment), because dark reader is catching all the exceptions. But the TLDR is that accessing adoptedStyleSheets from an extension now throws:
Error: Accessing from Xray wrapper is not supported.
And that breaks the extension awfully since they do expect adoptedStyleSheets to work.
Edgar, Peter, do you know if we can relax this restriction?
Maybe we can turn the ObservableArray into a plain sequence on getting, at least? Or should I just send a patch to the darkreader add-on to wrap observableArray access in a try-catch? That could probably do for now, but it will bite us in the future, I suspect...
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 5•4 years ago
|
||
[Tracking Requested - why for this release]: If this is not easy to fix or work around we should consider not shipping this feature in 101.
| Assignee | ||
Comment 6•4 years ago
|
||
This will still prevent them from accessing stuff (.length will be
undefined, etc), but seems better than unexpectedly throwing. This fixes
the issue at hand at least.
With this patch, we reject length accesses here:
Your call on whether this patch is enough as-is, or more work is needed.
Also your call on whether if more work is needed that needs to happen on
this bug or somewhere else.
I'm not sure what we'd need to do to support this more "properly",
presumably we'd need to add special XRay support to
ObservableArrayProxyHandler or so? Pointers (or patches of course ;))
welcome.
Also unsure about the setter situation, I think it's fine not to throw
given the code I read, but please sanity-check.
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
Comment 8•4 years ago
|
||
Set release status flags based on info from the regressing bug 1766227
| Assignee | ||
Comment 10•4 years ago
|
||
| Assignee | ||
Comment 11•4 years ago
|
||
| Assignee | ||
Comment 12•4 years ago
|
||
Instead of generating complicated code to deal with something that can't
happen.
Updated•4 years ago
|
Comment 13•4 years ago
|
||
Comment 14•4 years ago
|
||
| bugherder | ||
| Assignee | ||
Comment 16•4 years ago
|
||
Comment on attachment 9274364 [details]
Bug 1766909 - Wrap ObservableArray proxy on getter, rather than throwing. r=peterv,edgar
Beta/Release Uplift Approval Request
- User impact if declined: None known (the relevant add-on was fixed), but potential fallout from other add-ons.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: none
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Simple patch returning an opaque object rather than throwing.
- String changes made/needed: none
- Is Android affected?: Unknown
Comment 17•4 years ago
|
||
Comment on attachment 9274364 [details]
Bug 1766909 - Wrap ObservableArray proxy on getter, rather than throwing. r=peterv,edgar
Approved for 101.0b8.
Comment 18•4 years ago
|
||
| bugherder uplift | ||
Updated•2 years ago
|
Description
•