Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: safari/contentBlocking.js

Issue 29829615: Issue 6786 - Switch Safari 12+ users to content blocking API (Closed)
Patch Set: Created July 13, 2018, 6:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 }); 176 });
177 } 177 }
178 178
179 if (contentBlockingSupported) 179 if (contentBlockingSupported)
180 { 180 {
181 Promise.all([Prefs.untilLoaded, 181 Promise.all([Prefs.untilLoaded,
182 FilterNotifier.once("load"), 182 FilterNotifier.once("load"),
183 legacyAPISupported]).then(resolvedValues => 183 legacyAPISupported]).then(resolvedValues =>
184 { 184 {
185 let legacyAPISupported = resolvedValues[2]; 185 let legacyAPISupported = resolvedValues[2];
186 if (!legacyAPISupported) 186 if (!legacyAPISupported || Services.vc.compare(require("info").applicationVe rsion, "12") >= 0)
187 Prefs.safariContentBlocker = true; 187 Prefs.safariContentBlocker = true;
188 188
189 if (Prefs.safariContentBlocker) 189 if (Prefs.safariContentBlocker)
190 updateContentBlocker(true, legacyAPISupported); 190 updateContentBlocker(true, legacyAPISupported);
191 191
192 Prefs.on("safariContentBlocker", () => 192 Prefs.on("safariContentBlocker", () =>
193 { 193 {
194 if (!contentBlockingActive && Prefs.safariContentBlocker) 194 if (!contentBlockingActive && Prefs.safariContentBlocker)
195 updateContentBlocker(false, legacyAPISupported); 195 updateContentBlocker(false, legacyAPISupported);
196 }); 196 });
197 197
198 FilterNotifier.on("filter.behaviorChanged", () => 198 FilterNotifier.on("filter.behaviorChanged", () =>
199 { 199 {
200 contentBlockListDirty = true; 200 contentBlockListDirty = true;
201 if (contentBlockingActive) 201 if (contentBlockingActive)
202 updateContentBlocker(false, legacyAPISupported); 202 updateContentBlocker(false, legacyAPISupported);
203 }); 203 });
204 }); 204 });
205 } 205 }
206 206
207 port.on("safari.contentBlockingActive", (msg, sender) => 207 port.on("safari.contentBlockingActive", (msg, sender) =>
208 { 208 {
209 if (!contentBlockingActive && afterContentBlockingFinished) 209 if (!contentBlockingActive && afterContentBlockingFinished)
210 return afterContentBlockingFinished; 210 return afterContentBlockingFinished;
211 return contentBlockingActive; 211 return contentBlockingActive;
212 }); 212 });
OLDNEW
« options.js ('K') | « options.js ('k') | safari/ext/content.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld