self.Symbol.for is undefined in a content script within a webextension
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
People
(Reporter: me, Unassigned)
Details
Attachments
(1 file)
(deleted),
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0
Steps to reproduce:
Add the following statements to the content script of a webextension:
console.info(self.Symbol is
, self.Symbol)
console.info(self.Symbol.for is
, self.Symbol.for)
Actual results:
self.Symbol is defined and has a "for" property, but self.Symbol.for is undefined. Please see the screenshot attached.
The problem arises only in the content script, it works perfectly within the background script. Also, the problem affects only self.Symbol.for, Symbol.for is defined.
Expected results:
self.Symbol.for should be a function.
Comment 1•4 years ago
|
||
Hi Kirlat,
Is there any way you could share a reduced test case for this issue? I'm moving it over to a component in the meantime so developers can also check it out.
Is there any way you could share a reduced test case for this issue? I'm moving it over to a component in the meantime so developers can also check it out.
I will try to provide it soon.
Comment 3•4 years ago
|
||
I was able to reproduce in one of my webextension.
I checked that it wasn't an issue with the console by calling alert("" + self.Symbol.for)
, which does show the alert with undefined
in it (if I do alert("" + Symbol.for)
, I do see the stringified native function).
For what it's worth, globalThis.Symbol.for
works as intended.
Comment 4•4 years ago
|
||
The issue here is that you're trying to access symbols from a different (page's) global. globalThis gets you the global of your content script. This is basically bug 1208775.
Description
•