Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/elemHideFF.js

Issue 29347265: Issue 4221 - Only forward one elemhideupdate message per update batch to the content process (Closed)
Patch Set: Created July 4, 2016, 12:16 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld