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: Addressed Sebastian's feedback Created July 13, 2018, 6:41 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 function showMigrationPageWhenReady() 69 function showMigrationPageWhenReady()
70 { 70 {
71 fetch("https://eyeo.to/adblockplus/safari-app-extension-migration", {method: " HEAD"}) 71 fetch("https://eyeo.to/adblockplus/safari-app-extension-migration", {method: " HEAD"})
72 .then(function(response) 72 .then(function(response)
73 { 73 {
74 if (response.ok) 74 if (response.ok)
75 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);
76 }); 82 });
77
78 window.setTimeout(showMigrationPageWhenReady, 1000 * 60 * 60 * 24);
79 } 83 }
80 84
81 if (Services.vc.compare(require("info").applicationVersion, "10") >= 0) 85 if (Services.vc.compare(require("info").applicationVersion, "10") >= 0)
82 showMigrationPageWhenReady(); 86 showMigrationPageWhenReady();
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