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

Unified Diff: chromeDevenvPoller__.js

Issue 5732684932317184: Issue 143 - Use chrome.runtime.reload() to reload Adblock Plus in (Closed)
Patch Set: Created April 16, 2014, 10:03 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | packagerChrome.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeDevenvPoller__.js
===================================================================
rename from chromeDevenvPoller__.js.tmpl
rename to chromeDevenvPoller__.js
--- a/chromeDevenvPoller__.js.tmpl
+++ b/chromeDevenvPoller__.js
@@ -12,33 +12,29 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
(function()
{
- var basename = {{metadata.get("general", "basename")|json}};
-
+ var version = null;
function doPoll()
{
var request = new XMLHttpRequest();
- request.open("GET", "http://localhost:43816/");
+ request.open("GET", chrome.extension.getURL("devenvVersion__"));
request.addEventListener("load", function()
{
- if (request.responseText != basename)
- return;
+ if (version == null)
+ version = request.responseText;
- var views = chrome.extension.getViews();
- for (var i = 0; i < views.length; i++)
- if (views[i] != window)
- views[i].close();
- window.location.reload();
+ if (request.responseText != version)
+ chrome.runtime.reload();
+ else
+ window.setTimeout(doPoll, 5000);
}, false);
request.send(null);
-
- window.setTimeout(doPoll, 5000);
}
// Delay first poll to prevent reloading again immediately after a reload
- window.setTimeout(doPoll, 10000);
+ doPoll();
})();
« no previous file with comments | « no previous file | packagerChrome.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld