Index: lib/elemHideFF.js |
=================================================================== |
--- a/lib/elemHideFF.js |
+++ b/lib/elemHideFF.js |
@@ -36,37 +36,29 @@ FilterNotifier.on("elemhideupdate", () = |
isDirty = true; |
Utils.runAsync(() => { |
isDirty = false; |
port.emit("elemhideupdate") |
}); |
} |
}); |
-let translateMap = map => map; |
-if (Services.vc.compare(Utils.platformVersion, "40.0") <= 0) |
+port.on("getUnconditionalSelectors", () => |
{ |
- 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; |
- }; |
-} |
+ return [ |
+ ElemHide.getUnconditionalSelectors(), |
+ ElemHide.getUnconditionalFilterKeys() |
+ ]; |
+}); |
-port.on("getSelectors", () => translateMap(ElemHide.getSelectors())); |
+port.on("getSelectorsForDomain", domain => |
+{ |
+ return ElemHide.getSelectorsForDomain(domain, ElemHide.NO_UNCONDITIONAL, |
+ true); |
+}); |
port.on("elemhideEnabled", ({frames, isPrivate}) => |
{ |
if (!Prefs.enabled) |
return {enabled: false}; |
let hit = Policy.isFrameWhitelisted(frames, true); |
if (hit) |
@@ -81,8 +73,37 @@ port.on("elemhideEnabled", ({frames, isP |
contentType, docDomain, thirdParty, location, |
filter: filter.text, filterType: filter.type |
}; |
} |
} |
return {enabled: true}; |
}); |
+ |
+port.on("registerElemHideHit", ({key, frames, isPrivate}) => |
+{ |
+ let filter = ElemHide.getFilterByKey(key); |
+ if (!filter) |
+ return null; |
+ |
+ if (!isPrivate) |
+ FilterStorage.increaseHitCount(filter); |
+ |
+ let docDomain; |
+ try |
+ { |
+ docDomain = Utils.unwrapURL(frames[0].location).host; |
+ } |
+ catch(e) |
+ { |
+ docDomain = null; |
+ } |
+ |
+ return { |
+ contentType: "ELEMHIDE", |
+ docDomain, |
+ thirdParty: false, |
+ location: filter.text.replace(/^.*?#/, '#'), |
+ filter: filter.text, |
+ filterType: filter.type |
+ }; |
+}); |