Closed Bug 1577400 Opened 5 years ago Closed 5 years ago

globalThis in WebExtension content script doesn't implements Window

Categories

(Firefox :: Untriaged, defect)

70 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1208775

People

(Reporter: jackworks, 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.

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.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.