Closed Bug 1436019 Opened 6 years ago Closed 6 years ago

We can alert() in background page in Chromium, but not in Firefox

Categories

(WebExtensions :: Frontend, enhancement)

60 Branch
All
Unspecified
enhancement
Not set
major

Tracking

(firefox60 affected)

RESOLVED DUPLICATE of bug 1203394
Tracking Status
firefox60 --- affected

People

(Reporter: zdanevich.vitaly, Unassigned)

Details

I ran my WebExtension that works in Chromium. And I faced with
`alert() is not supported in background windows; please use console.log instead.`

Why not? Maybe will be better to have more consistency?

Quote from https://bugzilla.mozilla.org/show_bug.cgi?id=1203394:
`We aren't going to implement the ability to open modal dialogs from background pages. There are important technical reasons that they're problematic`
This important technical reason still exists?

And moreover - is it possible to override alert() ? I tried:

window.alert = text => chrome.tabs.executeScript({'code': `alert(${text})`});

And alert.toSource() return:
"text => chrome.tabs.executeScript({'code': `alert(${text})`})"

But alert() still prints to the console.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Ok from the link above I found that it is impossible to override `alert`, because extension exists in the isolated world. As a minimum - print this to the console too, alongside with `please use console.log instead`?
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
I don't understand the remark about it being impossible to override alert.  If you're in a content script, extensions have a separate view of the window object than the page does, but the rest of the discussion in this bug is about background pages.

We're not going to change what was already done in the duplicate bug, if you have general questions about how to develop extensions, please use the dev-addons mailing list, not bugzilla.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → DUPLICATE
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.