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

Unified Diff: background.js

Issue 29829611: Issue 6786 - Display the Safari App Extension migration page (Closed)
Patch Set: Only retry on failure Created July 13, 2018, 7:38 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
diff --git a/background.js b/background.js
index f76a61f18f02e5c90a0c60cb756ac4a607ccbd54..649b333a1bf0253ac60cbc488216460f4b4de689 100644
--- a/background.js
+++ b/background.js
@@ -62,3 +62,25 @@ port.on("forward", function(msg, sender)
targetPage.sendMessage(msg.payload);
}
});
+
+// Display a page to explain to users of Safari 10 and higher that they need
+// to migrate to our Safari App extension, but only once the migration page
+// is online. If it's not online yet, retry in 24 hours.
+function showMigrationPageWhenReady()
+{
+ fetch("https://eyeo.to/adblockplus/safari-app-extension-migration", {method: "HEAD"})
+ .then(function(response)
+ {
+ if (response.ok)
+ ext.pages.open(response.url);
+ else
+ throw "";
+ })
+ .catch(function()
+ {
+ window.setTimeout(showMigrationPageWhenReady, 1000 * 60 * 60 * 24);
+ });
+}
+
+if (Services.vc.compare(require("info").applicationVersion, "10") >= 0)
+ showMigrationPageWhenReady();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld