| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 Synchronizer.execute(subscription); | 240 Synchronizer.execute(subscription); |
| 241 } | 241 } |
| 242 | 242 |
| 243 // Show first run page or the updates page. The latter is only shown | 243 // Show first run page or the updates page. The latter is only shown |
| 244 // on Chromium (since the current updates page announces features that | 244 // on Chromium (since the current updates page announces features that |
| 245 // aren't new to Firefox users), and only if this version of the | 245 // aren't new to Firefox users), and only if this version of the |
| 246 // updates page hasn't been shown yet. | 246 // updates page hasn't been shown yet. |
| 247 if (firstRun || info.platform == "chromium" && | 247 if (firstRun || info.platform == "chromium" && |
| 248 updatesVersion > Prefs.last_updates_page_displayed) | 248 updatesVersion > Prefs.last_updates_page_displayed) |
| 249 { | 249 { |
| 250 return Prefs.set("last_updates_page_displayed", updatesVersion).catch(() => | 250 return Prefs.set("last_updates_page_displayed", updatesVersion).catch(() => |
|
Thomas Greiner
2018/04/27 14:50:13
Personally, I'd love to do that check before runni
Sebastian Noack
2018/04/27 16:01:04
I guess we could add a dummy preference, and try t
Thomas Greiner
2018/04/27 16:27:33
Agreed that more thought needs to be put into it s
Sebastian Noack
2018/04/27 16:33:22
Well, if you have any specific idea that would acc
| |
| 251 { | 251 { |
| 252 dataCorrupted = true; | 252 dataCorrupted = true; |
| 253 }).then(() => | 253 }).then(() => |
| 254 { | 254 { |
| 255 if (!Prefs.suppress_first_run_page) | 255 if (!Prefs.suppress_first_run_page) |
| 256 { | 256 { |
| 257 // Always show the first run page if a data corruption was detected | 257 // Always show the first run page if a data corruption was detected |
| 258 // (either though failure of reading from or writing to storage.local). | 258 // (either through failure of reading from or writing to storage.local). |
|
Thomas Greiner
2018/04/27 14:50:13
Typo: Replace "though" with "through".
Sebastian Noack
2018/04/27 16:01:04
Done.
| |
| 259 // The first run page notifies the user about the data corruption. | 259 // The first run page notifies the user about the data corruption. |
| 260 let url; | 260 let url; |
| 261 if (firstRun || dataCorrupted) | 261 if (firstRun || dataCorrupted) |
| 262 url = "firstRun.html"; | 262 url = "firstRun.html"; |
| 263 else | 263 else |
| 264 url = "updates.html"; | 264 url = "updates.html"; |
| 265 browser.tabs.create({url}); | 265 browser.tabs.create({url}); |
| 266 } | 266 } |
| 267 }); | 267 }); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 Promise.all([ | 271 Promise.all([ |
| 272 FilterNotifier.once("load"), | 272 FilterNotifier.once("load"), |
| 273 Prefs.untilLoaded.catch(() => { dataCorrupted = true; }) | 273 Prefs.untilLoaded.catch(() => { dataCorrupted = true; }) |
| 274 ]).then(detectFirstRun) | 274 ]).then(detectFirstRun) |
| 275 .then(getSubscriptions) | 275 .then(getSubscriptions) |
| 276 .then(addSubscriptionsAndNotifyUser) | 276 .then(addSubscriptionsAndNotifyUser) |
| 277 .then(() => { require("./uninstall").setUninstallURL() }) | 277 // We have to require the "uninstall" module on demand, |
|
Sebastian Noack
2018/04/26 18:25:35
I found an issue with the circular dependency of t
Thomas Greiner
2018/04/27 14:50:13
Acknowledged. Mind adding an inline comment for th
Sebastian Noack
2018/04/27 16:01:04
Done.
| |
| 278 // as the "uninstall" module in turn requires this module. | |
| 279 .then(() => { require("./uninstall").setUninstallURL(); }) | |
| 278 .then(initNotifications); | 280 .then(initNotifications); |
| 279 | 281 |
| 280 /** | 282 /** |
| 281 * Gets a value indicating whether the default filter subscriptions have been | 283 * Gets a value indicating whether the default filter subscriptions have been |
| 282 * added again because there weren't any subscriptions even though this wasn't | 284 * added again because there weren't any subscriptions even though this wasn't |
| 283 * the first run. | 285 * the first run. |
| 284 * | 286 * |
| 285 * @return {boolean} | 287 * @return {boolean} |
| 286 */ | 288 */ |
| 287 exports.isReinitialized = () => reinitialized; | 289 exports.isReinitialized = () => reinitialized; |
| 288 | 290 |
| 289 /** | 291 /** |
| 290 * Gets a value indicating whether a data corruption was detected. | 292 * Gets a value indicating whether a data corruption was detected. |
| 291 * | 293 * |
| 292 * @return {boolean} | 294 * @return {boolean} |
| 293 */ | 295 */ |
| 294 exports.isDataCorrupted = () => dataCorrupted; | 296 exports.isDataCorrupted = () => dataCorrupted; |
| 295 | 297 |
| 296 /** | 298 /** |
| 297 * Sets a callback that is called with an array of subscriptions to be added | 299 * Sets a callback that is called with an array of subscriptions to be added |
| 298 * during initialization. The callback must return an array of subscriptions | 300 * during initialization. The callback must return an array of subscriptions |
| 299 * that will effectively be added. | 301 * that will effectively be added. |
| 300 * | 302 * |
| 301 * @param {function} callback | 303 * @param {function} callback |
| 302 */ | 304 */ |
| 303 exports.setSubscriptionsCallback = callback => | 305 exports.setSubscriptionsCallback = callback => |
| 304 { | 306 { |
| 305 subscriptionsCallback = callback; | 307 subscriptionsCallback = callback; |
| 306 }; | 308 }; |
| LEFT | RIGHT |