[Pkg-mozext-commits] [adblock-plus] 31/98: Issue 4198 - Don't send Map objects in messages when using Firefox 40 and below
David Prévot
taffit at moszumanska.debian.org
Tue Oct 24 01:30:15 UTC 2017
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit ebe2eafa3c7bbb80c1fdeff5cde9b49eff46ff45
Author: Wladimir Palant <trev at adblockplus.org>
Date: Mon Sep 12 11:09:11 2016 +0200
Issue 4198 - Don't send Map objects in messages when using Firefox 40 and below
---
lib/elemHideFF.js | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/lib/elemHideFF.js b/lib/elemHideFF.js
index 0b4a396..ef3902c 100644
--- a/lib/elemHideFF.js
+++ b/lib/elemHideFF.js
@@ -17,6 +17,8 @@
"use strict";
+let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
+
let {port} = require("messaging");
let {ElemHide} = require("elemHide");
let {FilterNotifier} = require("filterNotifier");
@@ -39,7 +41,27 @@ FilterNotifier.on("elemhideupdate", () =>
}
});
-port.on("getSelectors", () => ElemHide.getSelectors());
+let translateMap = map => map;
+if (Services.vc.compare(Utils.platformVersion, "40.0") <= 0)
+{
+ translateMap = map =>
+ {
+ // We cannot send Map objects with Gecko 40 and below, "translate" them
+ // into nested arrays. This isn't very efficient but that should be ok as
+ // long as only outdated Firefox versions are affected.
+ let translated = [];
+ for (let [key, value] of map)
+ {
+ if (value instanceof Map)
+ translated.push([key, translateMap(value)]);
+ else
+ translated.push([key, value]);
+ }
+ return translated;
+ };
+}
+
+port.on("getSelectors", () => translateMap(ElemHide.getSelectors()));
port.on("elemhideEnabled", ({frames, isPrivate}) =>
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list