From: Damyan Ivanov Date: Mon, 19 Jun 2017 12:28:21 +0000 (+0000) Subject: put content JS into a closure X-Git-Tag: 2.0~26 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=db0f9bb3e2380d29af6134a266bcb6cd426e292f;p=icedeb.git put content JS into a closure --- diff --git a/icedeb-content.js b/icedeb-content.js index c2a2d36..30a3cef 100644 --- a/icedeb-content.js +++ b/icedeb-content.js @@ -1,6 +1,9 @@ -function listener(request, sender, sendResponse) { - window.location = request.url; - browser.runtime.onMessage.removeListener(listener); -} +(function () { + var listener; + listener = function(request, sender, sendResponse) { + browser.runtime.onMessage.removeListener(listener); + window.location = request.url; + } -browser.runtime.onMessage.addListener(listener); + browser.runtime.onMessage.addListener(listener); +})();