From 41867817cb4b8bbb7809e206d7afd8b3e5b4069c Mon Sep 17 00:00:00 2001 From: mizzick Date: Wed, 10 Jan 2018 20:27:23 +0700 Subject: [PATCH 1/3] Fix #929 FF legacy preload --- .../browser/firefox/lib/content-script/content-script.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Extension/browser/firefox/lib/content-script/content-script.js b/Extension/browser/firefox/lib/content-script/content-script.js index 2591509702..3d4cbf9032 100644 --- a/Extension/browser/firefox/lib/content-script/content-script.js +++ b/Extension/browser/firefox/lib/content-script/content-script.js @@ -86,4 +86,8 @@ var i18n = (function () { // jshint ignore:line getMessage: getMessage }; -})(); \ No newline at end of file +})(); + +// Backward compatibility with preload.js +adguardContent.i18n = adguardContent.i18n || i18n; +adguardContent.runtimeImpl = adguardContent.runtimeImpl || contentPage; \ No newline at end of file From cdce15abd22ff0ff15f8e77cc5c4196c47ff418a Mon Sep 17 00:00:00 2001 From: mizzick Date: Wed, 10 Jan 2018 21:08:49 +0700 Subject: [PATCH 2/3] Fix #929 FF legacy preload --- .../browser/firefox/lib/content-script/content-script.js | 6 +----- Extension/lib/content-script/preload.js | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Extension/browser/firefox/lib/content-script/content-script.js b/Extension/browser/firefox/lib/content-script/content-script.js index 3d4cbf9032..2591509702 100644 --- a/Extension/browser/firefox/lib/content-script/content-script.js +++ b/Extension/browser/firefox/lib/content-script/content-script.js @@ -86,8 +86,4 @@ var i18n = (function () { // jshint ignore:line getMessage: getMessage }; -})(); - -// Backward compatibility with preload.js -adguardContent.i18n = adguardContent.i18n || i18n; -adguardContent.runtimeImpl = adguardContent.runtimeImpl || contentPage; \ No newline at end of file +})(); \ No newline at end of file diff --git a/Extension/lib/content-script/preload.js b/Extension/lib/content-script/preload.js index 278b5e8c95..acb5d2baad 100644 --- a/Extension/lib/content-script/preload.js +++ b/Extension/lib/content-script/preload.js @@ -65,14 +65,14 @@ * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/880 */ var getContentPage = function () { - if (!window.contentPage) { - window.contentPage = { + if (!contentPage) { + contentPage = { sendMessage: adguardContent.runtimeImpl.sendMessage, onMessage: adguardContent.runtimeImpl.onMessage }; } - return window.contentPage; + return contentPage; }; /** From c2480a7fb272a959053a0a6b18ece289b3842b70 Mon Sep 17 00:00:00 2001 From: mizzick Date: Wed, 10 Jan 2018 21:16:35 +0700 Subject: [PATCH 3/3] Fix #929 FF legacy preload --- Extension/lib/content-script/preload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extension/lib/content-script/preload.js b/Extension/lib/content-script/preload.js index acb5d2baad..b9df7b819c 100644 --- a/Extension/lib/content-script/preload.js +++ b/Extension/lib/content-script/preload.js @@ -65,7 +65,7 @@ * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/880 */ var getContentPage = function () { - if (!contentPage) { + if (typeof contentPage === 'undefined') { contentPage = { sendMessage: adguardContent.runtimeImpl.sendMessage, onMessage: adguardContent.runtimeImpl.onMessage