globalThis in WebExtension content script doesn't implements Window
Categories
(Firefox :: Untriaged, defect)
Tracking
()
People
(Reporter: descent-tact0m, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3887.7 Safari/537.36
Steps to reproduce:
Run this code in content script
try {
const raf = window.requestAnimationFrame
raf(() => console.log('Okay.'))
} catch (e) {
console.warn(e)
}
These typeof codes are used widely in the JavaScript communicity. They assume in the browser main thread, globalThis / global this
is equal to window.
For example:
https://github.com/facebook/react/blob/0f6e3cd61cf4a5a1491bb3c92780936aebc2a146/packages/scheduler/src/forks/SchedulerHostConfig.default.js#L88
Actual results:
TypeError: "'requestAnimationFrame' called on an object that does not implement interface Window."
Expected results:
Nothing wrong.
Comment 1•5 years ago
|
||
Hi Jack,
Could you attach me a test case like it was done in this bug, please? https://bugzilla.mozilla.org/show_bug.cgi?id=1576010
Thanks in advance, Flor.
Since this === globalThis
in content scripts, I’m duping this to bug 1208775.
Description
•