Allow WebExtensions to disable popups

NEW
Unassigned

Status

WebExtensions
General
P3
normal
a year ago
6 days ago

People

(Reporter: bsilverberg, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: triaged[browserSettings])

(Reporter)

Description

a year ago
This will use browserSetting [1] to manage which extension has control over the pref. This does not really belong in privacy so will go into the browserSettings API.

According to the notes in [2], this would make use of the `dom.disable_open_during_load`, which seems to be accurate looking at m-c code. That is a boolean, so this can be browser.browserSettings.popupsEnabled.

[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/privacy/BrowserSetting
[2] https://docs.google.com/document/d/1HZiI-dqFATzLpmTtN1Bg6tD8y4N0Ne3D74LEWWgttOk/edit#
(Reporter)

Comment 1

a year ago
This is yet another pref that is exposed via the preferences UI, so before we consider implementing this we need to address the issue of if and how we are going to give WebExtensions access to settings that are also available via the UI. This is being discussed in more detail in bug 1361364.
(Reporter)

Updated

a year ago
Depends on: 1368537
(Reporter)

Comment 2

a year ago
Rob, as the author of the doc that originally asked for this, I am seeking some clarification from you. The discussion that we're having in bug 1339550 seems to indicate that if we want to actually disable all popups, we should both set `dom.disable_open_during_load` to "true" and also set `dom.popup_allowed_events` to "". In fact, `dom.disable_open_during_load` is set to "true" by default, so it seems odd that developers are asking for an API that only sets that pref to "true" if it's usually "true" anyway.

Can you please confirm whether the use cases you were looking at would also require setting `dom.popup_allowed_events` to "", or whether they are only concerned with setting `dom.disable_open_during_load` to "true"?
Flags: needinfo?(rob)

Comment 3

a year ago
(In reply to Bob Silverberg [:bsilverberg] from comment #2)
> Rob, as the author of the doc that originally asked for this, I am seeking
> some clarification from you. The discussion that we're having in bug 1339550
> seems to indicate that if we want to actually disable all popups, we should
> both set `dom.disable_open_during_load` to "true" and also set
> `dom.popup_allowed_events` to "". In fact, `dom.disable_open_during_load` is
> set to "true" by default, so it seems odd that developers are asking for an
> API that only sets that pref to "true" if it's usually "true" anyway.

Popups can be enabled and disabled.
 
> Can you please confirm whether the use cases you were looking at would also
> require setting `dom.popup_allowed_events` to "", or whether they are only
> concerned with setting `dom.disable_open_during_load` to "true"?

I don't think that dom.popup_allowed_events should be touched, because not opening popups in response to a user gesture would break the web.

The meaning of "block popups" should be the same as "block popups" in Firefox settings.
Flags: needinfo?(rob)
(Reporter)

Comment 4

a year ago
We will use the default permission pref (once implemented) for this.
Depends on: 1313939
No longer depends on: 1368537
(Reporter)

Updated

a year ago
Duplicate of this bug: 1339550

Comment 6

a year ago
Hi
I want to know when this bug will resolved?
I talk about this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1339550
Please write some information about it.
It will implement? or not?

Comment 7

a year ago
I need this :
dom.popup_allowed_events
to changed via my addon.
(Reporter)

Comment 8

a year ago
(In reply to Mojtaba Daneshi from comment #7)
> I need this :
> dom.popup_allowed_events
> to changed via my addon.

I'm not sure when it will get resolved. It now depends on bug 1313939 as we will be using permissions for this. I believe that the permission approach will work for you as well, and you will not need to toggle "popup_allowed_events" because if the default permission for pop-ups is set to "false" then pop-ups should be blocked by default.

Comment 9

a year ago
Keep in mind I talk about popups that firefox could NOT blocks them,
They fire after mouse click.
So dom.disable_open_during_load is not enough for me.
Just need to empty events that fire popups with "popup_allowed_events" prefs.
It should has a options to revert prefs after addons uninstalled.
currently we can just set a url when addon become uninstalled and there is not any callback same as onInstalled in web extensions.
So that's better to implement a callback for onUninstalled too.
(Reporter)

Comment 10

a year ago
(In reply to Mojtaba Daneshi from comment #9)
> Keep in mind I talk about popups that firefox could NOT blocks them,
> They fire after mouse click.
> So dom.disable_open_during_load is not enough for me.
> Just need to empty events that fire popups with "popup_allowed_events" prefs.

I'm not sure that you actually need that. If the permission for pop-ups for a page is set to "false" I would have thought that would be enough to block these pop-ups even after mouse clicks. Can you test that, by manually setting the permission yourself, and see if that is the case?

Comment 11

a year ago
I tested it.
Sites can open popups ever permission set to Block.
Please do not change my bug.
Popups Just will blocked when "popup_allowed_events" set to empty.
My bug was about it.
You can test it 
http://www.mehrsamweb.ir/
set permission to Block popups for this page,then just click on that page.
I need it, If you won't implement it let me know to change my way.
Sincerely
(Reporter)

Comment 12

a year ago
(In reply to Mojtaba Daneshi from comment #11)
> I tested it.
> Sites can open popups ever permission set to Block.
> Please do not change my bug.
> Popups Just will blocked when "popup_allowed_events" set to empty.
> My bug was about it.
> You can test it 
> http://www.mehrsamweb.ir/
> set permission to Block popups for this page,then just click on that page.
> I need it, If you won't implement it let me know to change my way.
> Sincerely

Thanks Mojtaba. Yes, that seems to be the case. Even with the permission set to "false" for that page the pop-ups still occur but not if popup_allowed_events is set to "". I'm not sure what the best way to deal with this is though. I'm going to reopen the other bug and discuss it there.

Comment 13

a year ago
Thanks.
Please add a callback for uninstalling addons to revert them to default.
(Reporter)

Comment 14

a year ago
(In reply to Mojtaba Daneshi from comment #13)
> Thanks.
> Please add a callback for uninstalling addons to revert them to default.

If we implement this via browserSettings (which is the intent) then that will be taken care of automatically.

Comment 15

a year ago
Thank you so much.
Depends on: 1379560
No longer depends on: 1313939
(Reporter)

Comment 16

5 months ago
Johann, I'm just following up on this. Do we have things in place right now to implement this, or does some platform work need to be done to support a default permission for popups?
Flags: needinfo?(jhofmann)
(In reply to Bob Silverberg [:bsilverberg] from comment #16)
> Johann, I'm just following up on this. Do we have things in place right now
> to implement this, or does some platform work need to be done to support a
> default permission for popups?

Since, as mentioned, popups are already blocked by default, I assume your intent is to block popups even from allowed user events. Giving extensions access to popup_allowed_events should do the trick.

If we expose this pref to extensions, we should find a way to alert the user about it, because there could be quite some web compat breakage (sites often try to show valid popups in user events).
Flags: needinfo?(jhofmann)

Updated

4 months ago
Assignee: bob.silverberg → nobody
Priority: P2 → P3

Updated

6 days ago
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.