Index: lib/elemHideFF.js |
=================================================================== |
--- a/lib/elemHideFF.js |
+++ b/lib/elemHideFF.js |
@@ -12,16 +12,18 @@ |
* 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/>. |
*/ |
"use strict"; |
+let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
+ |
let {port} = require("messaging"); |
let {ElemHide} = require("elemHide"); |
let {FilterNotifier} = require("filterNotifier"); |
let {FilterStorage} = require("filterStorage"); |
let {Prefs} = require("prefs"); |
let {Policy} = require("contentPolicy"); |
let {Utils} = require("utils"); |
@@ -34,17 +36,37 @@ FilterNotifier.on("elemhideupdate", () = |
isDirty = true; |
Utils.runAsync(() => { |
isDirty = false; |
port.emit("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}) => |
{ |
if (!Prefs.enabled) |
return {enabled: false}; |
let hit = Policy.isFrameWhitelisted(frames, true); |
if (hit) |