This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Description
At the moment there is no WebExtension API to close modal dialogs (window.alert(), etc). browser.tabs.remove has no effect when a modal dialog is displayed. So this means that a modal dialog blocks the entire script run and keeps the window open.
However firefox 59 offers a new API that we could use: browser.contentScripts.register()
This would let us block all modal dialogs for the duration of the script run, for example:
exportFunction(() => {}, window, {defineAs: 'alert'});
And by removing the registration after a script run we can still allow dialogs for normal website after the script run. In principal we could already apply this hack right now, however we would be too late because we need to communicate with the background script first.