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

Unified Diff: messageResponder.js

Issue 29339192: Issue 3880 - Improve behavior of Safari content blocker option (Closed)
Patch Set: Created March 31, 2016, 12:12 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
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -71,6 +71,7 @@
var changeListeners = new global.ext.PageMap();
var listenedPreferences = Object.create(null);
var listenedFilterChanges = Object.create(null);
+ var safariRestartRequired = null;
var messageTypes = {
"app": "app.respond",
"filter": "filters.respond",
@@ -189,6 +190,24 @@
break;
case "app.listen":
getListenerFilters(sender.page).app = message.filter;
+ if (message.filter.indexOf("safariRestartRequired") != -1)
+ {
+ if (safariRestartRequired == null)
+ {
+ safariRestartRequired = false;
+ Prefs.on("safari_contentblocker", function()
+ {
+ safariRestartRequired = !Prefs.safari_contentblocker;
+ sendMessage("app", "safariRestartRequired", safariRestartRequired);
+ });
+ }
+
+ sender.page.sendMessage({
+ type: messageTypes.app,
+ action: "safariRestartRequired",
+ args: [safariRestartRequired]
+ });
+ }
break;
case "app.open":
if (message.what == "options")

Powered by Google App Engine
This is Rietveld