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

Unified Diff: safari/include.youtube.js

Issue 29347034: Issue 1727 - Prevent circumvention via WebSocket (Closed)
Patch Set: Don't hardcode connection state values Created Aug. 10, 2016, 4:25 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 | « lib/requestBlocker.js ('k') | no next file » | 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 5b76e2435e9d5d157d0fc31452cabf2163c43af3..cf73e65c77fa497145137bfbf1ce66d8dbd0631c 100644
--- a/safari/include.youtube.js
+++ b/safari/include.youtube.js
@@ -86,24 +86,16 @@
player.parentNode.replaceChild(newPlayer, player);
}
- function runInPage(fn, arg)
- {
- var script = document.createElement("script");
- script.type = "application/javascript";
- script.async = false;
- script.textContent = "(" + fn + ")(" + arg + ");";
- document.documentElement.appendChild(script);
- document.documentElement.removeChild(script);
- }
-
document.addEventListener("beforeload", function(event)
{
if ((event.target.localName == "object" || event.target.localName == "embed") && /:\/\/[^\/]*\.ytimg\.com\//.test(event.url))
patchPlayer(event.target);
}, true);
- runInPage(function(badArgumentsRegex)
+ runInPage(function(badArgumentsRegexSource)
{
+ var badArgumentsRegex = new RegExp(badArgumentsRegexSource);
+
// If history.pushState is available, YouTube uses the history API
// when navigation from one video to another, and tells the flash
// player with JavaScript which video and which ads to show next,
@@ -179,5 +171,5 @@
ytplayer.config = rawYtplayer.config;
}
});
- }, badArgumentsRegex);
+ }, badArgumentsRegex.source);
})();
« no previous file with comments | « lib/requestBlocker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld