Index: lib/uninstall.js |
=================================================================== |
--- a/lib/uninstall.js |
+++ b/lib/uninstall.js |
@@ -20,10 +20,18 @@ |
"use strict"; |
const info = require("../buildtools/info"); |
+const {isDataCorrupted} = require("./subscriptionInit.js"); |
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 initialized and a data corruption |
+ * if any was detected, as well when notification 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=" + (isDataCorrupted() ? "1" : "0")); |
Thomas Greiner
2018/04/27 14:50:13
Suggestion: Instead of passing this parameter on e
Sebastian Noack
2018/04/27 16:01:04
This seems somewhat premature. I guess we can chan
Thomas Greiner
2018/04/27 16:27:33
Ok, I'll bring this up with the Data team for tack
|
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); |