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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 targetPage = sender.page; 55 targetPage = sender.page;
56 56
57 if (targetPage) 57 if (targetPage)
58 { 58 {
59 msg.payload.sender = sender.page.id; 59 msg.payload.sender = sender.page.id;
60 if (msg.expectsResponse) 60 if (msg.expectsResponse)
61 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload)); 61 return new Promise(targetPage.sendMessage.bind(targetPage, msg.payload));
62 targetPage.sendMessage(msg.payload); 62 targetPage.sendMessage(msg.payload);
63 } 63 }
64 }); 64 });
65
66 // Display a page to explain to users of Safari 10 and higher that they need
67 // to migrate to our Safari App extension, but only once the migration page
68 // is online. If it's not online yet, retry in 24 hours.
69 function showMigrationPageWhenReady()
70 {
71 fetch("https://eyeo.to/adblockplus/safari-app-extension-migration", {method: " HEAD"})
72 .then(function(response)
73 {
74 if (response.ok)
75 ext.pages.open(response.url);
76 else
77 throw "";
78 })
79 .catch(function()
80 {
81 window.setTimeout(showMigrationPageWhenReady, 1000 * 60 * 60 * 24);
82 });
83 }
84
85 if (Services.vc.compare(require("info").applicationVersion, "10") >= 0)
86 showMigrationPageWhenReady();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld