Index: lib/subscriptionInit.js |
=================================================================== |
--- a/lib/subscriptionInit.js |
+++ b/lib/subscriptionInit.js |
@@ -238,38 +238,35 @@ |
Synchronizer.execute(subscription); |
} |
- if (!Prefs.suppress_first_run_page) |
+ if (firstRun || info.platform == "chromium" && |
+ updatesVersion > Prefs.last_updates_page_displayed) |
{ |
- let page = null; |
- if (firstRun) |
+ Prefs.set("last_updates_page_displayed", updatesVersion).catch(() => |
{ |
- page = "firstRun.html"; |
- } |
- // For now we're limiting the updates page to users of |
kzar
2018/04/24 16:18:46
Mind adding some comments back in? I don't mind if
Sebastian Noack
2018/04/24 17:49:25
OK, I added some more meaningful comments.
kzar
2018/04/25 10:53:51
Thanks
|
- // Chromium-based browsers to gage its impact |
- else if (info.platform == "chromium" && |
- updatesVersion > Prefs.last_updates_page_displayed) |
+ exports.dataCorrupted = true; |
+ }).then(() => |
{ |
- page = "updates.html"; |
- } |
- |
- if (page) |
- { |
- browser.tabs.create({url: browser.extension.getURL(page)}); |
- |
- // For new users and users that have already seen this updates page we |
- // want to avoid showing it again for subsequent updates. |
- Prefs.last_updates_page_displayed = updatesVersion; |
- } |
+ if (!Prefs.suppress_first_run_page) |
+ { |
+ let url; |
+ if (firstRun || exports.dataCorrupted) |
+ url = "firstRun.html"; |
+ else |
+ url = "updates.html"; |
+ browser.tabs.create({url}); |
+ } |
+ }); |
} |
initNotifications(); |
} |
-Promise.all([FilterNotifier.once("load"), |
- Prefs.untilLoaded]).then(detectFirstRun) |
- .then(getSubscriptions) |
- .then(finishInitialization); |
+Promise.all([ |
+ FilterNotifier.once("load"), |
+ Prefs.untilLoaded.catch(() => { exports.dataCorrupted = true; }) |
+]).then(detectFirstRun) |
+ .then(getSubscriptions) |
+ .then(finishInitialization); |
/** |
* Indicates whether the default filter subscriptions have been added |
@@ -281,6 +278,13 @@ |
exports.reinitialized = false; |
/** |
+ * Indicates whether a data corruption was detcted. |
+ * |
+ * @type {boolean} |
+ */ |
+exports.dataCorrupted = false; |
+ |
+/** |
* Sets a callback that is called with an array of subscriptions to be added |
* during initialization. The callback must return an array of subscriptions |
* that will effectively be added. |