Open Bug 1364929 Opened 7 years ago Updated 2 years ago

Allow WebExtensions to disable images

Categories

(WebExtensions :: General, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: bsilverberg, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: triaged[browserSettings])

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 `permissions.default.image` preference, which seems to allow the following values [3]:

// 1-Accept, 2-Deny, 3-dontAcceptForeign

Therefore it would make sense to support 3 values for the setting browser.browserSettings.imageBehavior:

accept == 1
reject == 2
reject_foreign = 3

[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/privacy/BrowserSetting
[2] https://docs.google.com/document/d/1HZiI-dqFATzLpmTtN1Bg6tD8y4N0Ne3D74LEWWgttOk/edit#
[3] http://searchfox.org/mozilla-central/source/modules/libpref/init/all.js#2055
Jared, my reading of the codebase related to this pref suggests that you are knowledgeable in this area. Could you please take a look at the above and let me know whether the proposal makes sense for a WebExtensions API to control the behaviour of images? Will changing that pref have the result we expect? Is there anything else we need to consider?
Flags: needinfo?(jaws)
It looks like the extension would use `types.BrowserSetting.clear()` to revert to the default value? This will change the default for all webpages. If a webpage has a non-default permission set to show or block images then that site-specific permission will override what this extension is trying to do.

We haven't had a way to set global permissions for some time now (we removed it from preferences years back because users were unknowingly "breaking" their web browser). We had about:permissions but it was never linked to and has since been removed.

There is a project underway around permissions that Johann is mentoring and it might be a better idea to coordinate with that project so the approaches can be consistent. Forwarding needinfo to Johann so that he can describe more if necessary.
Flags: needinfo?(jaws) → needinfo?(jhofmann)
(In reply to Jared Wein [:jaws] (behind on reviews and bugmail) (please needinfo? me) from comment #2)

Thanks for the reply Jared.

> It looks like the extension would use `types.BrowserSetting.clear()` to
> revert to the default value? 

That is correct. Disabling or uninstalling the extension will also revert to the default value.

> This will change the default for all webpages.
> If a webpage has a non-default permission set to show or block images then
> that site-specific permission will override what this extension is trying to
> do.
> 

I think that is probably okay for our purposes. There hasn't really been any discussion about how these WebExtension APIs for controlling global settings will interact with site settings, but I assume that site settings will take precedence.

> We haven't had a way to set global permissions for some time now (we removed
> it from preferences years back because users were unknowingly "breaking"
> their web browser). We had about:permissions but it was never linked to and
> has since been removed.
> 
> There is a project underway around permissions that Johann is mentoring and
> it might be a better idea to coordinate with that project so the approaches
> can be consistent. Forwarding needinfo to Johann so that he can describe
> more if necessary.

There is another bug related to this for disabling notifications for which we are also discussing the possibility of using permissions, rather than prefs, so this can be part of that discussion as well. Thanks for forwarding to Johann - I look forward to hearing back from him.
Flipping the pref would be fine for this specific case, but looking at the other bugs that block the tracking bug I, too, get the feeling that you might want to work with permissions instead of changing specific prefs. That also gives us the benefit of being able to implement UI around this, e.g. to warn the user that an addon has modified their content blocking settings and to offer an easy way out in the preferences. This could be implemented with a pref exactly like permissions.default.image (permissions.default.notifications, permissions.default.camera, etc.), where the value is the default permission. But maybe there's a better way? :)

Unfortunately we silently dropped the "global disable" use case from the permissions management UI project, so we didn't originally intended to work on this. Your plans could be another reason to pick up at least the technical part of it. I don't think this bug should become a meta-bug for default permission preferences, we should make a new bug for that once we have figured out the general approach.
Flags: needinfo?(jhofmann)
Thanks for your response, Johann. It sounds like we need some coordination around this effort. I will try to set up a meeting for that.
Based on our meeting yesterday, and the fact that images already supports a global default permission via a pref, I think we can proceed with this one.
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 images?
Flags: needinfo?(jhofmann)
(In reply to Bob Silverberg [:bsilverberg] from comment #7)
> 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 images?

permissions.default.image exists and should do what you want. Note that we do not expose the global preference for this to users, because it's _quite_ breaking the internet.
Flags: needinfo?(jhofmann)
Assignee: bob.silverberg → nobody
Priority: P2 → P3
Product: Toolkit → WebExtensions
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.