Bug 1061864 - Part 3: Automated tests for the prerendred flag; r=smaug
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 05 Jan 2015 14:08:48 -0500
changeset 222175 d07e602fd38520da2cdbce963ff4d5b7ccce63e6
parent 222174 75a20fb5f86430a9dc8ef49a6cdd0aa7bea9d50c
child 222176 67b3ac5b553ad88f7d1c4ba968da2042cd28ff83
push id28059
push userryanvm@gmail.com
push dateTue, 06 Jan 2015 15:53:01 +0000
treeherdermozilla-central@4d91c33b351c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1061864
milestone37.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 1061864 - Part 3: Automated tests for the prerendred flag; r=smaug
dom/xul/test/1061864.html
dom/xul/test/chrome.ini
dom/xul/test/test_bug1061864_1.xul
dom/xul/test/test_bug1061864_2.xul
new file mode 100644
--- /dev/null
+++ b/dom/xul/test/1061864.html
@@ -0,0 +1,8 @@
+<html>
+<body>
+<script>
+</script>
+<iframe id="childiframe" src="data:text/html,Test">
+</iframe>
+</body>
+</html>
--- a/dom/xul/test/chrome.ini
+++ b/dom/xul/test/chrome.ini
@@ -2,16 +2,17 @@
 support-files =
   398289-resource.xul
   bug497875-iframe.xul
   file_bug236853.rdf
   overlay1_bug335375.xul
   overlay2_bug335375.xul
   window_bug583948.xul
   window_bug757137.xul
+  1061864.html
 
 [test_bug199692.xul]
 [test_bug233643.xul]
 [test_bug236853.xul]
 [test_bug311681.xul]
 [test_bug335375.xul]
 [test_bug391002.xul]
 [test_bug398289.html]
@@ -21,10 +22,12 @@ support-files =
 [test_bug445177.xul]
 [test_bug449457.xul]
 [test_bug468176.xul]
 [test_bug497875.xul]
 [test_bug583948.xul]
 [test_bug640158_overlay_persist.xul]
 [test_bug757137.xul]
 [test_bug775972.xul]
+[test_bug1061864_1.xul]
+[test_bug1061864_2.xul]
 [test_bug1070049_throw_from_script.xul]
 [test_import_xul_to_content.xul]
new file mode 100644
--- /dev/null
+++ b/dom/xul/test/test_bug1061864_1.xul
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1061864
+-->
+<window title="Mozilla Bug 1061864"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="RunTest();">
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+  <!-- test code goes here -->
+  <script type="application/javascript">
+  <![CDATA[
+
+  /** Test for Bug 1061864 **/
+  SimpleTest.waitForExplicitFinish();
+
+  function RunTest()
+  {
+    // Test that the docshell belonging to a prerendered frame loader will
+    // be created with the correct prerendered flag.
+    test(false, function() {
+      test(true, function() {
+        SimpleTest.finish();
+      });
+    });
+  }
+
+  function test(prerendered, callback) {
+    var parentIframe = document.createElement("iframe");
+    if (prerendered) {
+      parentIframe.setIsPrerendered();
+    }
+    parentIframe.onload = function() {
+      var docShell = parentIframe.frameLoader.docShell;
+      is(docShell.isPrerendered, prerendered, "The docshell is" + (prerendered ? "" : " not") + " prerendered");
+      callback();
+    }
+    document.documentElement.appendChild(parentIframe);
+  }
+  ]]>
+  </script>
+
+  <!-- test results are displayed in the html:body -->
+  <body xmlns="http://www.w3.org/1999/xhtml">
+  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1061864"
+     target="_blank">Mozilla Bug 1061864</a>
+  </body>
+</window>
new file mode 100644
--- /dev/null
+++ b/dom/xul/test/test_bug1061864_2.xul
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1061864
+-->
+<window title="Mozilla Bug 1061864"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="RunTest();">
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+  <!-- test code goes here -->
+  <script type="application/javascript">
+  <![CDATA[
+
+  /** Test for Bug 1061864 **/
+  SimpleTest.waitForExplicitFinish();
+
+  function RunTest()
+  {
+    // Test that the docshell prerendered flag will be correctly inherited in
+    // prerendered documents.
+    test(false, function() {
+      test(true, function() {
+        SimpleTest.finish();
+      });
+    });
+  }
+
+  function test(prerendered, callback) {
+    var parentIframe = document.createElement("iframe");
+    if (prerendered) {
+      parentIframe.setIsPrerendered();
+    }
+    parentIframe.setAttribute("src", "1061864.html");
+    parentIframe.onload = function() {
+      var childIframe = parentIframe.contentDocument.getElementById("childiframe");
+      var childDocShell = childIframe.frameLoader.docShell;
+      is(childDocShell.isPrerendered, prerendered, "The docshell is" + (prerendered ? "" : " not") + " prerendered");
+      callback();
+    }
+    document.documentElement.appendChild(parentIframe);
+  }
+  ]]>
+  </script>
+
+  <!-- test results are displayed in the html:body -->
+  <body xmlns="http://www.w3.org/1999/xhtml">
+  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1061864"
+     target="_blank">Mozilla Bug 1061864</a>
+  </body>
+</window>