Left: | ||
Right: |
OLD | NEW |
---|---|
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 { | 234 { |
235 FilterStorage.addSubscription(subscription); | 235 FilterStorage.addSubscription(subscription); |
236 if (subscription instanceof DownloadableSubscription && | 236 if (subscription instanceof DownloadableSubscription && |
237 !subscription.lastDownload) | 237 !subscription.lastDownload) |
238 Synchronizer.execute(subscription); | 238 Synchronizer.execute(subscription); |
239 } | 239 } |
240 | 240 |
241 if (!Prefs.suppress_first_run_page) | 241 if (!Prefs.suppress_first_run_page) |
242 { | 242 { |
243 let page = null; | 243 let page = null; |
244 if (firstRun) | 244 if (firstRun || exports.dataCorrupted) |
kzar
2018/04/24 11:18:01
Well surely this would mean that the first run pag
Sebastian Noack
2018/04/24 11:26:26
Yes, that is the idea, to add this message to the
kzar
2018/04/24 13:34:00
Fair enough, I guess we need to also update the ad
| |
245 { | 245 { |
246 page = "firstRun.html"; | 246 page = "firstRun.html"; |
247 } | 247 } |
248 // For now we're limiting the updates page to users of | 248 // For now we're limiting the updates page to users of |
249 // Chromium-based browsers to gage its impact | 249 // Chromium-based browsers to gage its impact |
250 else if (info.platform == "chromium" && | 250 else if (info.platform == "chromium" && |
251 updatesVersion > Prefs.last_updates_page_displayed) | 251 updatesVersion > Prefs.last_updates_page_displayed) |
252 { | 252 { |
253 page = "updates.html"; | 253 page = "updates.html"; |
254 } | 254 } |
255 | 255 |
256 if (page) | 256 if (page) |
257 { | 257 { |
258 browser.tabs.create({url: browser.extension.getURL(page)}); | 258 browser.tabs.create({url: browser.extension.getURL(page)}); |
259 | 259 |
260 // For new users and users that have already seen this updates page we | 260 // For new users and users that have already seen this updates page we |
261 // want to avoid showing it again for subsequent updates. | 261 // want to avoid showing it again for subsequent updates. |
262 Prefs.last_updates_page_displayed = updatesVersion; | 262 Prefs.last_updates_page_displayed = updatesVersion; |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 initNotifications(); | 266 initNotifications(); |
267 } | 267 } |
268 | 268 |
269 Promise.all([FilterNotifier.once("load"), | 269 Promise.all([ |
270 Prefs.untilLoaded]).then(detectFirstRun) | 270 FilterNotifier.once("load"), |
271 .then(getSubscriptions) | 271 Prefs.untilLoaded.catch(() => { exports.dataCorrupted = true; }) |
272 .then(finishInitialization); | 272 ]).then(detectFirstRun) |
273 .then(getSubscriptions) | |
274 .then(finishInitialization); | |
273 | 275 |
274 /** | 276 /** |
275 * Indicates whether the default filter subscriptions have been added | 277 * Indicates whether the default filter subscriptions have been added |
276 * again because there weren't any subscriptions even though this wasn't | 278 * again because there weren't any subscriptions even though this wasn't |
277 * the first run. | 279 * the first run. |
278 * | 280 * |
279 * @type {boolean} | 281 * @type {boolean} |
280 */ | 282 */ |
281 exports.reinitialized = false; | 283 exports.reinitialized = false; |
282 | 284 |
283 /** | 285 /** |
286 * Indicates whether a data corruption was detcted. | |
287 * | |
288 * @type {boolean} | |
289 */ | |
290 exports.dataCorrupted = false; | |
291 | |
292 /** | |
284 * Sets a callback that is called with an array of subscriptions to be added | 293 * 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 | 294 * during initialization. The callback must return an array of subscriptions |
286 * that will effectively be added. | 295 * that will effectively be added. |
287 * | 296 * |
288 * @param {function} callback | 297 * @param {function} callback |
289 */ | 298 */ |
290 exports.setSubscriptionsCallback = callback => | 299 exports.setSubscriptionsCallback = callback => |
291 { | 300 { |
292 subscriptionsCallback = callback; | 301 subscriptionsCallback = callback; |
293 }; | 302 }; |
OLD | NEW |