Bug 1398071 - Rewrite youtube embeds that use enablejsapi; r=cpeterson
authorKyle Machulis <kyle@nonpolynomial.com>
Fri, 08 Sep 2017 12:59:52 -0700
changeset 429320 bbed5063d5a1ead431993901a9cbdef9f86c4a53
parent 429319 beb76be8dc465040490e2af053b2651b42b58a5c
child 429321 0e9b01271d17bbc4fb5e31071fd18f3d38e7279c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)) {
-  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);