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

Unified Diff: safari/include.youtube.js

Issue 29338588: Issue 3699 - Patch DOM API in order to prevent disabling the injected stylesheet (Closed)
Patch Set: Created March 17, 2016, 7:47 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 | « include.preload.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
===================================================================
--- a/safari/include.youtube.js
+++ b/safari/include.youtube.js
@@ -68,23 +68,13 @@
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(document, badArgumentsRegex, function(badArgumentsRegex)
{
// If history.pushState is available, YouTube uses the history API
// when navigation from one video to another, and tells the flash
@@ -161,5 +151,5 @@
ytplayer.config = rawYtplayer.config;
}
});
- }, badArgumentsRegex);
+ });
})();
« no previous file with comments | « include.preload.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld