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

Delta Between Two Patch Sets: background.js

Issue 29829611: Issue 6786 - Display the Safari App Extension migration page (Closed)
Left Patch Set: Created July 13, 2018, 5:36 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 65
66 // Display a page to explain to users of Safari 10 and higher that they need 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 67 // to migrate to our Safari App extension, but only once the migration page
68 // is online. 68 // is online. If it's not online yet, retry in 24 hours.
69
70 function showMigrationPageWhenReady() 69 function showMigrationPageWhenReady()
71 { 70 {
72 fetch("https://eyeo.to/adblockplus/safari-app-extension-migration") 71 fetch("https://eyeo.to/adblockplus/safari-app-extension-migration", {method: " HEAD"})
Sebastian Noack 2018/07/13 18:01:35 I wonder, should we perhaps just send a HEAD reque
kzar 2018/07/13 18:44:04 Done.
73 .then(function(response) 72 .then(function(response)
74 { 73 {
75 if (response.ok) 74 if (response.ok)
76 ext.showPage(response.url); 75 ext.pages.open(response.url);
76 else
77 throw "";
78 })
79 .catch(function()
80 {
81 window.setTimeout(showMigrationPageWhenReady, 1000 * 60 * 60 * 24);
77 }); 82 });
78 } 83 }
79 84
80 if (Services.vc.compare(require("info").applicationVersion, "10") >= 0) 85 if (Services.vc.compare(require("info").applicationVersion, "10") >= 0)
81 {
82 // Show now, and then once every 24 hours.
83 showMigrationPageWhenReady(); 86 showMigrationPageWhenReady();
84 window.setInterval(showMigrationPageWhenReady, 1000 * 60 * 60 * 24);
Sebastian Noack 2018/07/13 18:01:35 As far as I understand the issue description, we o
kzar 2018/07/13 18:44:04 I've adjusted the issue description to clarify.
85 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld