Index: lib/elemHideFF.js |
=================================================================== |
--- a/lib/elemHideFF.js |
+++ b/lib/elemHideFF.js |
@@ -18,18 +18,31 @@ |
"use strict"; |
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"); |
-FilterNotifier.on("elemhideupdate", () => port.emit("elemhideupdate")); |
+let isDirty = false; |
+FilterNotifier.on("elemhideupdate", () => |
+{ |
+ // Notify content process asynchronously, only one message per update batch. |
+ if (!isDirty) |
+ { |
+ isDirty = true; |
+ Utils.runAsync(() => { |
+ isDirty = false; |
+ port.emit("elemhideupdate") |
+ }); |
+ } |
+}); |
port.on("getSelectors", () => ElemHide.getSelectors()); |
port.on("elemhideEnabled", ({frames, isPrivate}) => |
{ |
if (!Prefs.enabled) |
return {enabled: false}; |