OLD | NEW |
1 /* | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * This file is part of the Adblock Plus build tools, | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | 4 |
18 (function() | 5 (function() |
19 { | 6 { |
20 var version = null; | 7 var version = null; |
21 function doPoll() | 8 function doPoll() |
22 { | 9 { |
23 var request = new XMLHttpRequest(); | 10 var request = new XMLHttpRequest(); |
24 request.open("GET", chrome.extension.getURL("devenvVersion__")); | 11 request.open("GET", chrome.extension.getURL("devenvVersion__")); |
25 request.addEventListener("load", function() | 12 request.addEventListener("load", function() |
26 { | 13 { |
27 if (version == null) | 14 if (version == null) |
28 version = request.responseText; | 15 version = request.responseText; |
29 | 16 |
30 if (request.responseText != version) | 17 if (request.responseText != version) |
31 chrome.runtime.reload(); | 18 chrome.runtime.reload(); |
32 else | 19 else |
33 window.setTimeout(doPoll, 5000); | 20 window.setTimeout(doPoll, 5000); |
34 }, false); | 21 }, false); |
35 request.send(null); | 22 request.send(null); |
36 } | 23 } |
37 | 24 |
38 // Delay first poll to prevent reloading again immediately after a reload | 25 // Delay first poll to prevent reloading again immediately after a reload |
39 doPoll(); | 26 doPoll(); |
40 })(); | 27 })(); |
OLD | NEW |