LEFT | RIGHT |
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 Loading... |
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(); |
LEFT | RIGHT |