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

Unified Diff: options.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: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -718,7 +718,14 @@
function(features)
{
hidePref("show_devtools_panel", !features.devToolsPanel);
- hidePref("safari_contentblocker", !features.safariContentBlocker);
+
+ // Only show option to switch between Safari Content Blockers
+ // and event based blocking if both are available.
+ hidePref("safari_contentblocker", !(
+ features.safariContentBlocker &&
+ "canLoad" in safari.self.tab &&
+ "onbeforeload" in Element.prototype
+ ));
});
var filterTextbox = document.querySelector("#custom-filters-add input");
@@ -1080,13 +1087,18 @@
switch (message.type)
{
case "app.respond":
- if (message.action == "addSubscription")
+ switch (message.action)
{
- var subscription = message.args[0];
- var dialog = E("dialog-content-predefined");
- dialog.querySelector("h3").textContent = subscription.title || "";
- dialog.querySelector(".url").textContent = subscription.url;
- openDialog("predefined");
+ case "addSubscription":
+ var subscription = message.args[0];
+ var dialog = E("dialog-content-predefined");
+ dialog.querySelector("h3").textContent = subscription.title || "";
+ dialog.querySelector(".url").textContent = subscription.url;
+ openDialog("predefined");
+ break;
+ case "safariRestartRequired":
+ E("restart-safari").setAttribute("aria-hidden", !message.args[0]);
Thomas Greiner 2016/03/31 14:24:57 Why do we even need the background page for that?
Sebastian Noack 2016/03/31 14:45:37 We should only indicate that restarting Safari is
Sebastian Noack 2016/03/31 15:14:31 Frankly, I don't have a strong opinion here. Patch
Thomas Greiner 2016/03/31 16:29:17 I do agree that we should somehow indicate to the
Sebastian Noack 2016/03/31 17:09:24 FWIW, I just begun to prefer the new patch set wit
Thomas Greiner 2016/03/31 17:17:06 You're right.
+ break;
}
break;
case "filters.respond":
@@ -1104,7 +1116,7 @@
ext.backgroundPage.sendMessage(
{
type: "app.listen",
- filter: ["addSubscription"]
+ filter: ["addSubscription", "safariRestartRequired"]
});
ext.backgroundPage.sendMessage(
{

Powered by Google App Engine
This is Rietveld