Implement chrome.privacy.websites.referrersEnabled

RESOLVED FIXED in Firefox 56

Status

()

Toolkit
WebExtensions: General
P3
normal
RESOLVED FIXED
3 months ago
13 hours ago

People

(Reporter: Manuel Reimer, Assigned: bsilverberg)

Tracking

(Blocks: 1 bug, {dev-doc-complete})

unspecified
mozilla56
dev-doc-complete
Points:
---

Firefox Tracking Flags

(firefox56 fixed)

Details

(Whiteboard: [privacy]triaged)

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Reporter)

Description

3 months ago
Implement "chrome.privacy.websites" API as described here:
https://developer.chrome.com/extensions/privacy#property-websites
I want to use this API to create a simple button to toggle sending the Referrer. I prefer to surf with Referrer disabled completely. I toggle it "on" temporarily for sites which force me to use the Referrer.

Updated

2 months ago
Flags: needinfo?(bob.silverberg)
Whiteboard: investigating
(Assignee)

Comment 1

2 months ago
This is only asking for one of the settings under chrome.privacy.websites, which is `referrersEnabled`, so I am updating the bug title.

Based on my initial research into the privacy API, this can be implemented by changing the pref `network.http.sendRefererHeader` to 0 when set to "false" and to 2 (which is the default) when set to "true".

As this is fairly simple I will take it on and work on implementing it.
Assignee: nobody → bob.silverberg
Blocks: 1363856
Flags: needinfo?(bob.silverberg)
Priority: -- → P3
Summary: Implement chrome.privacy.websites API → Implement chrome.privacy.websites.referrersEnabled
Whiteboard: investigating → [privacy]triaged
Comment hidden (mozreview-request)

Comment 3

2 months ago
mozreview-review
Comment on attachment 8876791 [details]
Bug 1362787 - Implement chrome.privacy.websites.referrersEnabled,

https://reviewboard.mozilla.org/r/148114/#review152604

::: toolkit/components/extensions/ext-privacy.js:123
(Diff revision 1)
> +  // When this setting is true, the pref should be set to 2, and when
> +  // this setting is false, the pref should be set to 0.

This comment is really not helpful, can you include a reference to docs or code where these values come from.

::: toolkit/components/extensions/test/xpcshell/test_ext_privacy.js:277
(Diff revision 1)
> -  async function testSetting(setting, value, truePrefs) {
> +  function checkBoolean(value, pref, prefValue, truePrefs) {
> +    equal(prefValue, truePrefs.includes(pref), `${pref} set correctly for ${value}`);
> +  }
> +
> +  function checkSinglePrefValue(value, pref, prefValue, expectedValue) {
> +    equal(prefValue, expectedValue, `${pref} set correctly for ${value}`);
> +  }
> +
> +  async function testSetting(setting, value, checkArgs, checkFn = checkBoolean) {
>      extension.sendMessage("set", {value: value}, setting);
>      let data = await extension.awaitMessage("settingData");
>      equal(data.value, value);
>      for (let pref in SETTINGS[setting]) {
>        let prefValue = Preferences.get(pref);
> -      equal(prefValue, truePrefs.includes(pref), `${pref} set correctly for ${value}`);
> +      checkFn(value, pref, prefValue, checkArgs);
>      }
>    }

This seems unnecessarily roundabout, it might be more verbose but it would be much more clear to just pass in an array or object with the expected values in all cases.
Attachment #8876791 - Flags: review?(aswan) → review-
Comment hidden (mozreview-request)

Comment 5

a month ago
mozreview-review
Comment on attachment 8876791 [details]
Bug 1362787 - Implement chrome.privacy.websites.referrersEnabled,

https://reviewboard.mozilla.org/r/148114/#review152940

::: toolkit/components/extensions/ext-privacy.js:125
(Diff revisions 1 - 2)
>      "network.http.sendRefererHeader",
>    ],
>  
> -  // When this setting is true, the pref should be set to 2, and when
> -  // this setting is false, the pref should be set to 0.
> +  // Values for network.http.sendRefererHeader:
> +  // 0=don't send any, 1=send only on clicks, 2=send on image requests as well
> +  // http://searchfox.org/mozilla-central/source/modules/libpref/init/all.js#1585

Please make this a permalink

::: toolkit/components/extensions/test/xpcshell/test_ext_privacy.js:281
(Diff revisions 1 - 2)
> -    for (let pref in SETTINGS[setting]) {
> -      let prefValue = Preferences.get(pref);
> +    for (let pref in expected) {
> +      equal(Preferences.get(pref), expected[pref], `${pref} set correctly for ${value}`);
> -      checkFn(value, pref, prefValue, checkArgs);
>      }

nit: can you just use `Assert.deepEqual()` here?
Attachment #8876791 - Flags: review?(aswan) → review+
Comment hidden (mozreview-request)

Comment 7

a month ago
Pushed by bsilverberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6787902423dc
Implement chrome.privacy.websites.referrersEnabled, r=aswan

Comment 8

a month ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/6787902423dc
Status: NEW → RESOLVED
Last Resolved: a month ago
status-firefox56: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
(Assignee)

Updated

a month ago
Keywords: dev-doc-needed
I've updated the compat data for this:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/privacy/websites

Marking as dev-doc-complete, but please let me know if we need anything else here.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.