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

Unified Diff: lib/subscriptionInit.js

Issue 29760565: Issue 6599 - Detect data corruption of storage.local (Closed)
Patch Set: Created April 24, 2018, 11:02 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/prefs.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/subscriptionInit.js
===================================================================
--- a/lib/subscriptionInit.js
+++ b/lib/subscriptionInit.js
@@ -241,7 +241,7 @@
if (!Prefs.suppress_first_run_page)
{
let page = null;
- if (firstRun)
+ 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
{
page = "firstRun.html";
}
@@ -266,10 +266,12 @@
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 +283,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.
« no previous file with comments | « lib/prefs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld