Bug 1256766 - Make sure all objects load after pref is set in youtube rewrite test; r=bz
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 11 Apr 2016 17:30:34 -0700
changeset 330800 345e0864f66571aea6e6d8302bdb9b5ab5603e4c
parent 330799 9f469891dd2c686f6885ebfc6244876f4f2bb942
child 330801 45c1bcc538ddeb36e06ad117d0fc09b9cb076e4b
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1256766
milestone48.0a1
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 1256766 - Make sure all objects load after pref is set in youtube rewrite test; r=bz
dom/base/test/file_bug769117.html
dom/base/test/mochitest.ini
dom/base/test/test_bug769117.html
new file mode 100644
--- /dev/null
+++ b/dom/base/test/file_bug769117.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html>
+  <!--
+       https://bugzilla.mozilla.org/show_bug.cgi?id=769117
+     -->
+  <head>
+  </head>
+  <body>
+    <embed id="testembed"
+           src="https://mochitest.youtube.com/v/Xm5i5kbIXzc"
+           type="application/x-shockwave-flash"
+           allowscriptaccess="always"></embed>
+    <object id="testobject"
+            data="https://mochitest.youtube.com/v/Xm5i5kbIXzc"></embed>
+  </body>
+</html>
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -142,16 +142,17 @@ support-files =
   file_bug704320_preload_reuse.html
   file_bug704320_preload_noreuse.html
   file_bug704320_redirect.html
   file_bug707142_baseline.json
   file_bug707142_bom.json
   file_bug707142_utf-16.json
   file_bug708620-2.html
   file_bug708620.html
+  file_bug769117.html
   file_bug782342.txt
   file_bug787778.sjs
   file_bug804395.jar
   file_bug869432.eventsource
   file_bug869432.eventsource^headers^
   file_bug902350.html
   file_bug902350_frame.html
   file_bug907892.html
--- a/dom/base/test/test_bug769117.html
+++ b/dom/base/test/test_bug769117.html
@@ -8,44 +8,48 @@
     <title>Test for Bug 769117</title>
     <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     <script type="application/javascript">
      SimpleTest.waitForExplicitFinish();
      /** Test for Bug 769117 **/
      "use strict";
      function onLoad () {
-       let youtube_url = "https://mochitest.youtube.com/v/Xm5i5kbIXzc";
-       let youtube_changed_url = "https://mochitest.youtube.com/embed/Xm5i5kbIXzc";
+       SpecialPowers.pushPrefEnv({"set": [["plugins.rewrite_youtube_embeds", true]]}, function() {
+
+         let youtube_url = "https://mochitest.youtube.com/v/Xm5i5kbIXzc";
+         let youtube_changed_url = "https://mochitest.youtube.com/embed/Xm5i5kbIXzc";
+         let static_iframe = document.getElementById("staticiframe");
 
-       function testEmbed(embed) {
-         ok (embed, "Embed node exists");
-         embed = SpecialPowers.wrap(embed);
-         is (embed.srcURI.spec, youtube_changed_url, "Should have src uri of " + youtube_changed_url);
-       }
-       info("Running static embed youtube rewrite test");
-       testEmbed(document.getElementById("testembed"));
-       testEmbed(document.getElementById("testobject"));
+         function testEmbed(embed) {
+           ok (embed, "Embed node exists");
+           embed = SpecialPowers.wrap(embed);
+           is (embed.srcURI.spec, youtube_changed_url, "Should have src uri of " + youtube_changed_url);
+         }
 
-       info("Running dynamic embed youtube rewrite test");
-       let embed_dynamic = document.createElement("embed");
-       embed_dynamic.src = "https://mochitest.youtube.com/v/Xm5i5kbIXzc";
-       embed_dynamic.type = "application/x-shockwave-flash";
+         function testStatic() {
+           info("Running static embed youtube rewrite test");
+           iframe_doc = static_iframe.contentWindow.document;
+           testEmbed(iframe_doc.getElementById("testembed"));
+           testEmbed(iframe_doc.getElementById("testobject"));
+           SimpleTest.executeSoon(() => {
+             testEmbed(embed_dynamic);
+             SimpleTest.finish();
+           });
+         }
 
-       document.body.appendChild(embed_dynamic);
+         info("Running dynamic embed youtube rewrite test");
+         let embed_dynamic = document.createElement("embed");
+         embed_dynamic.src = "https://mochitest.youtube.com/v/Xm5i5kbIXzc";
+         embed_dynamic.type = "application/x-shockwave-flash";
+         document.body.appendChild(embed_dynamic);
 
-       SimpleTest.executeSoon(() =>
-         {
-           testEmbed(embed_dynamic);
-           SimpleTest.finish();
-         });
+         static_iframe.onload = testStatic;
+         static_iframe.src = "file_bug769117.html"
+
+       });
      }
     </script>
   </head>
   <body onload="onLoad()">
-    <embed id="testembed"
-           src="https://mochitest.youtube.com/v/Xm5i5kbIXzc"
-           type="application/x-shockwave-flash"
-           allowscriptaccess="always"></embed>
-    <object id="testobject"
-            data="https://mochitest.youtube.com/v/Xm5i5kbIXzc"></embed>
+    <iframe id="staticiframe"></iframe>
   </body>
 </html>