Bug 1398071 - Rewrite youtube embeds that use enablejsapi; r?cpeterson
Youtube has now deprecated flash embeds completely, meaning
enablejsapi in embeds will no longer work. We can now rewrite these to
use HTML5, as any functionality related to the js api will no
longer function anyways.
MozReview-Commit-ID: kZTwpyLaYw
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -1399,20 +1399,16 @@ nsObjectLoadingContent::MaybeRewriteYout
// See if requester is planning on using the JS API.
nsAutoCString uri;
nsresult rv = aURI->GetSpec(uri);
if (NS_FAILED(rv)) {
return;
}
- if (uri.Find("enablejsapi=1", true, 0, -1) != kNotFound) {
- return;
- }
-
// Some YouTube urls have parameters in path components, e.g.
// http://youtube.com/embed/7LcUOEP7Brc&start=35. These URLs work with flash,
// but break iframe/object embedding. If this situation occurs with rewritten
// URLs, convert the parameters to query in order to make the video load
// correctly as an iframe. In either case, warn about it in the
// developer console.
int32_t ampIndex = uri.FindChar('&', 0);
bool replaceQuery = false;
--- a/dom/base/nsObjectLoadingContent.h
+++ b/dom/base/nsObjectLoadingContent.h
@@ -577,22 +577,22 @@ class nsObjectLoadingContent : public ns
* Used for identifying whether we can rewrite a youtube flash embed to
* possibly use HTML5 instead.
*
* Returns true if plugin.rewrite_youtube_embeds pref is true and the
* element this nsObjectLoadingContent instance represents:
*
* - is an embed or object node
* - has a URL pointing at the youtube.com domain, using "/v/" style video
- * path reference, and without enablejsapi=1 in the path
+ * path reference.
*
* Having the enablejsapi flag means the document that contains the element
* could possibly be manipulating the youtube video elsewhere on the page
- * via javascript. We can't rewrite these kinds of elements without possibly
- * breaking content, which we want to avoid.
+ * via javascript. In the context of embed elements, this usage has been
+ * deprecated by youtube, so we can just rewrite as normal.
*
* If we can rewrite the URL, we change the "/v/" to "/embed/", and change
* our type to eType_Document so that we render similarly to an iframe
* embed.
*/
void MaybeRewriteYoutubeEmbed(nsIURI* aURI,
nsIURI* aBaseURI,
nsIURI** aRewrittenURI);