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

Unified Diff: lib/uninstall.js

Issue 29760565: Issue 6599 - Detect data corruption of storage.local (Closed)
Patch Set: Added dataCorrupted parameter to uninstall page Created April 25, 2018, 1:16 p.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
« lib/subscriptionInit.js ('K') | « lib/subscriptionInit.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/uninstall.js
===================================================================
--- a/lib/uninstall.js
+++ b/lib/uninstall.js
@@ -20,10 +20,18 @@
"use strict";
const info = require("../buildtools/info");
+const subscriptionInit = require("./subscriptionInit.js");
kzar 2018/04/25 14:38:12 Nit: const {dataCorrupted} = require(...)?
Sebastian Noack 2018/04/25 14:46:23 At the time we import subscriptionInit.js, dataCor
kzar 2018/04/25 14:57:04 That's why I suggest making it a getter instead.
const {Prefs} = require("./prefs");
const {Utils} = require("./utils");
-function setUninstallURL()
+let setUninstallURL =
+/**
+ * Sets (or updates) the URL that is openend when the extension is uninstalled.
+ *
+ * Must be called after prefs got initilized and a data corruption
kzar 2018/04/25 14:38:12 Nit: A couple typos 'initialized' and 'notificatio
Sebastian Noack 2018/04/25 14:46:23 Done.
+ * if any was detected, as well when noification data change.
+ */
+exports.setUninstallURL = () =>
{
let search = [];
for (let key of ["addonName", "addonVersion", "application",
@@ -47,16 +55,10 @@
}
search.push("notificationDownloadCount=" + encodeURIComponent(downlCount));
+ search.push("dataCorrupted=" + (subscriptionInit.dataCorrupted ? "1" : "0"));
browser.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" +
search.join("&"));
-}
+};
-// The uninstall URL contains the notification download count as a parameter,
-// therefore we must wait for preferences to be loaded before generating the
-// URL and we need to re-generate it each time the notification data changes.
-if ("setUninstallURL" in browser.runtime)
-{
- Prefs.untilLoaded.then(setUninstallURL);
- Prefs.on("notificationdata", setUninstallURL);
-}
+Prefs.on("notificationdata", setUninstallURL);
« lib/subscriptionInit.js ('K') | « lib/subscriptionInit.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld