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

Unified Diff: safari/include.youtube.js

Issue 29340571: Issue 3687 - Add experimental support for Safari content blockers (Closed)
Patch Set: Improve comments about buggy behavouir Created May 17, 2016, 6:22 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
« lib/tldjs.js ('K') | « safari/ext/content.js ('k') | skin/popup.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: safari/include.youtube.js
diff --git a/safari/include.youtube.js b/safari/include.youtube.js
index 0ad0bc2ed4011681293b8d23dfd01c25a38c9352..25db15e8d80c1da8310a90f637d6033efeced08b 100644
--- a/safari/include.youtube.js
+++ b/safari/include.youtube.js
@@ -19,6 +19,20 @@
if (document.domain != "www.youtube.com")
return;
+ var usingContentBlockerAPI = true;
+ try
+ {
+ if (safari.self.tab.canLoad(beforeLoadEvent,
+ {category: "request",
+ payload: {type: "prefs.get",
+ key: "safariContentBlocker"}}) != true)
+ usingContentBlockerAPI = false;
+ }
+ catch (e) { };
Sebastian Noack 2016/05/17 18:35:26 Nit: Redundant semicolon. Also I wonder whether w
kzar 2016/05/17 19:20:23 Done.
+
+ if (usingContentBlockerAPI)
+ return;
+
if (ext.backgroundPage.sendMessageSync({type: "filters.isPageWhitelisted"}))
return;
@@ -33,7 +47,7 @@
return pairs.join("&");
}
- function patchPlayer(player)
+ function patchPlayer(player)
{
var newPlayer = player.cloneNode(true);
var flashvarsChanged = false;
« lib/tldjs.js ('K') | « safari/ext/content.js ('k') | skin/popup.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld