From db0f9bb3e2380d29af6134a266bcb6cd426e292f Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Mon, 19 Jun 2017 12:28:21 +0000 Subject: [PATCH] put content JS into a closure --- icedeb-content.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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); +})(); -- 2.39.5