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

Do not allow modal dialogs (wait for firefox 59) #12

Open

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.

Activity

  1. ghost added on Jan 9, 2018
  2. ghost added this to the Beta Launch milestone on Jul 10, 2018
  3. ghost removed this from the Beta Launch milestone on Jul 10, 2018
  4. fregante commented on Jul 1, 2019

    @fregante

    I recently wrote a Chrome polyfill for browser.contentScripts.register, if that was blocking you from using this API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions