OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 (function() | 5 (function() |
6 { | 6 { |
7 var version = null; | 7 var version = null; |
8 function doPoll() | 8 function doPoll() |
9 { | 9 { |
10 fetch(chrome.extension.getURL("devenvVersion__")) | 10 fetch(browser.extension.getURL("devenvVersion__")) |
11 .then(function(response) | 11 .then(function(response) |
12 { | 12 { |
13 return response.text(); | 13 return response.text(); |
14 }) | 14 }) |
15 .then(function(text) | 15 .then(function(text) |
16 { | 16 { |
17 if (version == null) | 17 if (version == null) |
18 version = text; | 18 version = text; |
19 | 19 |
20 if (text != version) | 20 if (text != version) |
21 chrome.runtime.reload(); | 21 browser.runtime.reload(); |
22 else | 22 else |
23 window.setTimeout(doPoll, 5000); | 23 window.setTimeout(doPoll, 5000); |
24 }); | 24 }); |
25 } | 25 } |
26 | 26 |
27 // Delay first poll to prevent reloading again immediately after a reload | 27 // Delay first poll to prevent reloading again immediately after a reload |
28 doPoll(); | 28 doPoll(); |
29 })(); | 29 })(); |
OLD | NEW |