Bug 1229117 - Make test_bug741266.html wait for the window to be opened. r=bz
authorAndrew McCreight <continuation@gmail.com>
Tue, 01 Dec 2015 13:32:01 -0800
changeset 309231 f71baaaa598da31010b6e6b52c3f9d448cd3ddcf
parent 309230 aab1935c93207c752622d2b0d80e21648c7d5318
child 309232 2b8b0a674775ec089cb831d979b43e9f0ff448e5
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1229117, 741266
milestone45.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 1229117 - Make test_bug741266.html wait for the window to be opened. r=bz DONTBUILD Change this test to open "/" instead of about:blank so we get an onload event. Then, wait for the window to be loaded before examining it.
dom/html/test/test_bug741266.html
--- a/dom/html/test/test_bug741266.html
+++ b/dom/html/test/test_bug741266.html
@@ -8,28 +8,37 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test for Bug 741266</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=741266">Mozilla Bug 741266</a>
 <p id="display"></p>
 <div id="content" style="display: none">
-  
+
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 741266 **/
-var w = window.open("", "", "width=100,height=100");
-is(w.innerHeight, 100, "Popup height should be 100 when opened with window.open");
-// XXXbz On at least some platforms, the innerWidth is off by the scrollbar
-// width for some reason.  So just make sure it's the same for both popups.
-var width = w.innerWidth;
-w.close();
-w = document.open("", "", "width=100,height=100");
-is(w.innerHeight, 100, "Popup height should be 100 when opened with document.open");
-is(w.innerWidth, width, "Popup width should be the same when opened with document.open");
-w.close();
+SimpleTest.waitForExplicitFinish();
+
+var url = URL.createObjectURL(new Blob([""], { type: "text/html" }));
+var w = window.open(url, "", "width=100,height=100");
+w.onload = function() {
+  is(w.innerHeight, 100, "Popup height should be 100 when opened with window.open");
+  // XXXbz On at least some platforms, the innerWidth is off by the scrollbar
+  // width for some reason.  So just make sure it's the same for both popups.
+  var width = w.innerWidth;
+  w.close();
+
+  w = document.open(url, "", "width=100,height=100");
+  w.onload = function() {
+    is(w.innerHeight, 100, "Popup height should be 100 when opened with document.open");
+    is(w.innerWidth, width, "Popup width should be the same when opened with document.open");
+    w.close();
+    SimpleTest.finish();
+  };
+};
 </script>
 </pre>
 </body>
 </html>