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

Side by Side Diff: lib/subscriptionInit.js

Issue 29759558: Issue 6599 - Hotfix to drop updated page everywhere (Closed)
Patch Set: removed also skin/updates Created April 24, 2018, 10:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/prefs.js ('k') | metadata.chrome » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 DownloadableSubscription, 23 DownloadableSubscription,
24 SpecialSubscription} = 24 SpecialSubscription} =
25 require("../adblockpluscore/lib/subscriptionClasses"); 25 require("../adblockpluscore/lib/subscriptionClasses");
26 const {FilterStorage} = require("../adblockpluscore/lib/filterStorage"); 26 const {FilterStorage} = require("../adblockpluscore/lib/filterStorage");
27 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier"); 27 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier");
28 const info = require("../buildtools/info"); 28 const info = require("../buildtools/info");
29 const {Prefs} = require("./prefs"); 29 const {Prefs} = require("./prefs");
30 const {Synchronizer} = require("../adblockpluscore/lib/synchronizer"); 30 const {Synchronizer} = require("../adblockpluscore/lib/synchronizer");
31 const {Utils} = require("./utils"); 31 const {Utils} = require("./utils");
32 const {initNotifications} = require("./notificationHelper"); 32 const {initNotifications} = require("./notificationHelper");
33 const {updatesVersion} = require("../adblockplusui/lib/prefs");
34 33
35 let firstRun; 34 let firstRun;
36 let subscriptionsCallback = null; 35 let subscriptionsCallback = null;
37 36
38 /** 37 /**
39 * If there aren't any filters, the default subscriptions are added. 38 * If there aren't any filters, the default subscriptions are added.
40 * However, if patterns.ini already did exist and/or any preference 39 * However, if patterns.ini already did exist and/or any preference
41 * is set to a non-default value, this indicates that this isn't the 40 * is set to a non-default value, this indicates that this isn't the
42 * first run, but something went wrong. 41 * first run, but something went wrong.
43 * 42 *
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 subscriptions = subscriptionsCallback(subscriptions); 230 subscriptions = subscriptionsCallback(subscriptions);
232 231
233 for (let subscription of subscriptions) 232 for (let subscription of subscriptions)
234 { 233 {
235 FilterStorage.addSubscription(subscription); 234 FilterStorage.addSubscription(subscription);
236 if (subscription instanceof DownloadableSubscription && 235 if (subscription instanceof DownloadableSubscription &&
237 !subscription.lastDownload) 236 !subscription.lastDownload)
238 Synchronizer.execute(subscription); 237 Synchronizer.execute(subscription);
239 } 238 }
240 239
241 if (!Prefs.suppress_first_run_page) 240 if (!Prefs.suppress_first_run_page && firstRun)
242 { 241 {
243 let page = null; 242 browser.tabs.create({url: browser.extension.getURL("firstRun.html")});
244 if (firstRun)
245 {
246 page = "firstRun.html";
247 }
248 // For now we're limiting the updates page to users of
249 // Chromium-based browsers to gage its impact
250 else if (info.platform == "chromium" &&
251 updatesVersion > Prefs.last_updates_page_displayed)
252 {
253 page = "updates.html";
254 }
255
256 if (page)
257 {
258 browser.tabs.create({url: browser.extension.getURL(page)});
259
260 // For new users and users that have already seen this updates page we
261 // want to avoid showing it again for subsequent updates.
262 Prefs.last_updates_page_displayed = updatesVersion;
263 }
264 } 243 }
265 244
266 initNotifications(); 245 initNotifications();
267 } 246 }
268 247
269 Promise.all([FilterNotifier.once("load"), 248 Promise.all([FilterNotifier.once("load"),
270 Prefs.untilLoaded]).then(detectFirstRun) 249 Prefs.untilLoaded]).then(detectFirstRun)
271 .then(getSubscriptions) 250 .then(getSubscriptions)
272 .then(finishInitialization); 251 .then(finishInitialization);
273 252
(...skipping 10 matching lines...) Expand all
284 * Sets a callback that is called with an array of subscriptions to be added 263 * Sets a callback that is called with an array of subscriptions to be added
285 * during initialization. The callback must return an array of subscriptions 264 * during initialization. The callback must return an array of subscriptions
286 * that will effectively be added. 265 * that will effectively be added.
287 * 266 *
288 * @param {function} callback 267 * @param {function} callback
289 */ 268 */
290 exports.setSubscriptionsCallback = callback => 269 exports.setSubscriptionsCallback = callback =>
291 { 270 {
292 subscriptionsCallback = callback; 271 subscriptionsCallback = callback;
293 }; 272 };
OLDNEW
« no previous file with comments | « lib/prefs.js ('k') | metadata.chrome » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld