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

Unified Diff: options.js

Issue 29829615: Issue 6786 - Switch Safari 12+ users to content blocking API (Closed)
Patch Set: Prevent Safari 12+ users switch content blocking mode off Created July 13, 2018, 6:23 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 | safari/contentBlocking.js » ('j') | safari/ext/content.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
diff --git a/options.js b/options.js
index f1a3c1d817061ba58b3fd78ce6c65f10c1e280e2..c384316732cc72ce5b766f23c3383fa4e7fc4bcb 100644
--- a/options.js
+++ b/options.js
@@ -17,6 +17,9 @@
"use strict";
+var applicatonVersion = navigator.userAgent.match(/Version\/([\d.]+)/)[1];
+var majorApplicationVersion = parseInt(applicatonVersion.split(".")[0], 10);
+
/**
* Creates a wrapping function used to conveniently send a type of message.
*
@@ -158,11 +161,14 @@ function loadOptions()
// running Safari and both the legacy and content blocking APIs are
// available.
document.getElementById("safariContentBlockerContainer").hidden = !(
- features.safariContentBlocker &&
- typeof safari != "undefined" &&
- "canLoad" in safari.self.tab &&
- "onbeforeload" in Element.prototype
+ majorApplicationVersion >= 12 || (
+ features.safariContentBlocker &&
+ typeof safari != "undefined" &&
+ "canLoad" in safari.self.tab &&
+ "onbeforeload" in Element.prototype
+ )
);
+ document.getElementById("safariContentBlocker").disabled = majorApplicationVersion >= 12;
});
getPref("notifications_showui", function(notifications_showui)
{
« no previous file with comments | « no previous file | safari/contentBlocking.js » ('j') | safari/ext/content.js » ('J')

Powered by Google App Engine
This is Rietveld