Bug 1714407 - fix a regression caused by bug 1714407 where SmartBlock does not always properly inform the anti-tracking UI when users opt into allowing specific content; r=pbz,ksenia,webcompat-reviewers

Three changes here:
- fix the experimental API to check for the "allow" case first, then the "replace" signal
- update the JSON config for the two opt-in shims so they know to also mark the relevant requests as allowed, not just replaced/shimmed
- remove a pointless (unused) unblocksOnOptIn line

Differential Revision: https://phabricator.services.mozilla.com/D116756
This commit is contained in:
Thomas Wisniewski 2021-06-03 19:18:25 +00:00
parent 53a6b651b4
commit 6cd599c6fa
3 changed files with 18 additions and 8 deletions

View File

@ -110,7 +110,11 @@ const AVAILABLE_SHIMS = [
],
needsShimHelpers: ["optIn"],
onlyIfBlockedByETP: true,
unblocksOnOptIn: ["*://pubads.g.doubleclick.net/gampad/ads*"],
unblocksOnOptIn: [
"*://pubads.g.doubleclick.net/gampad/ads*",
"*://cdn.adsafeprotected.com/iasPET.1.js",
"*://static.adsafeprotected.com/vans-adapter-google-ima.js",
],
},
{
id: "AdsByGoogle",
@ -159,6 +163,8 @@ const AVAILABLE_SHIMS = [
needsShimHelpers: ["optIn", "getOptions"],
onlyIfBlockedByETP: true,
unblocksOnOptIn: [
"*://connect.facebook.net/*/sdk.js*",
"*://connect.facebook.net/*/all.js*",
"*://*.xx.fbcdn.net/*", // covers:
// "*://scontent-.*-\d.xx.fbcdn.net/*",
// "*://static.xx.fbcdn.net/rsrc.php/*",
@ -227,7 +233,6 @@ const AVAILABLE_SHIMS = [
"*://securepubads.g.doubleclick.net/gpt/pubads_impl_*.js",
],
onlyIfBlockedByETP: true,
unblocksOnOptIn: ["*://pubads.g.doubleclick.net/ssai/event/*/streams"],
},
{
id: "IMA3",

View File

@ -80,14 +80,19 @@ class Manager {
} catch (_) {
return;
}
// if any allowlist unblocks the request entirely, we allow it
for (const allowList of this._allowLists.values()) {
if (allowList.allows(url, topHost)) {
this._unblockedChannelIds.add(channelId);
channel.allow();
return;
}
}
// otherwise, if any allowlist shims the request we say it's replaced
for (const allowList of this._allowLists.values()) {
if (allowList.shims(url, topHost)) {
this._unblockedChannelIds.add(channelId);
channel.replace(); // we will be shimming this request
return;
} else if (allowList.allows(url, topHost)) {
this._unblockedChannelIds.add(channelId);
channel.allow(); // we just want to allow this request
channel.replace();
return;
}
}

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
"version": "23.2.0",
"version": "23.3.0",
"applications": {
"gecko": {