Open Bug 1770592 Opened 2 years ago Updated 3 months ago

document.adoptedStyleSheets is not iterable in a content script

Categories

(WebExtensions :: Untriaged, defect, P3)

Firefox 101
defect

Tracking

(firefox100 ?, firefox101 affected, firefox102 affected)

Tracking Status
firefox100 --- ?
firefox101 --- affected
firefox102 --- affected

People

(Reporter: danny0838, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0

Steps to reproduce:

  1. Download and install the attchment as a temporary add-on.
  2. Visit https://example.com and open the inspector from the tab.
  3. Click the browser action.

Actual results:

"document.adoptedStyleSheets is not iterable" is thrown at for (... of document.adoptedStyleSheets)

(tested on Firefox 101.0b9)

Expected results:

No error should occur when running for (... of document.adoptedStyleSheets)

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions

Hello,

I reproduced the issue on the latest Nightly (102.0a1/20220522190601) and Beta (101.0b9/20220519220322) and pretty sure on Release (100.0.220220519220738) as well – an error is thrown but it’s a bit different from what occurs on Nightly and Beta.
Tested under Windows 10 x64 and Ubuntu 16.04 LTS.

On Nightly and Beta, clicking the browser action will throw a TypeError: document.adoptedStyleSheets is not iterable in the web console, while on Release, clicking the browser action will throw a TypeError: document.adoptedStyleSheets is undefined.

For further details, please see the attached screenshots.

Note: I will be marking only Nightly and Beta as affected at the moment, as only there did the bug manifest fully as described.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached image Nightly&Beta.png
Attached image Release 100.0.2.png

@Alex Cornestean:
Thank you for confirmation. document.adoptedStyleSheets is not implemented in Firefox 100.*, so it's unrelated with this issue.

The feature was enabled by default in 101 (bug 1644102).

Emilio, this looks like a XrayWrapper issue. I don't know what an ObservableArray is; could this be caused by bug 1023984 (i.e. should it depend on that bug)?

@emilio, See question in comment 6

Flags: needinfo?(emilio)

This is basically bug 1751346.

Depends on: 1751346
Flags: needinfo?(emilio)
Severity: -- → S4
Priority: -- → P3

Could you raise severity/priority? adoptedStyleSheets is completely unusable in a content script regardless of iterators. The only workaround is wrappedJSObject but it's unsafe.

See Also: → 1817675
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: