Closed Bug 1502726 Opened 6 years ago Closed 6 years ago

window.browser and window.chrome are undefined in content script

Categories

(WebExtensions :: General, defect)

63 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1208775

People

(Reporter: nn1436401, Unassigned)

Details

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

Steps to reproduce:

In content script of any extension the objects chrome and browser are defined.
But window.chrome and window.browser are undefined.



Expected results:

window.chrome should be defined and equal to chrome, window.browser should be equal to browser.
Here is console output from content script:

chrome
Object { menus: Getter & Setter, manifest: Getter & Setter, i18n: Getter & Setter, test: Getter & Setter, storage: {…}, runtime: {…}, extension: {…} }

browser
Object { menus: Getter & Setter, manifest: Getter & Setter, i18n: Getter & Setter, test: Getter & Setter, storage: {…}, runtime: {…}, extension: {…} }

window.chrome
undefined

window.browser
undefined

In JavaScript all objects are part of global object called window.
There is no reason to make these two objects special.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
oops, sorry I completely misunderstood.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → DUPLICATE
Component: Untriaged → General
Product: Firefox → WebExtensions
You need to log in before you can comment on or make changes to this bug.