Bug 1330822 - Remove CPOWs from browser_loadURI.js. r=Felipe
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 30 Nov 2016 18:00:06 -0800
changeset 375001 ef6ee3788c6bbe3c6c96f23054b0901ea09cd325
parent 375000 a66860c81eaf8f83e38ab184c1d1fa9e5564edcc
child 375002 e4a95dce8bb83f2d8d83ee72e8c060bd4ffada33
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1330822
milestone53.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 1330822 - Remove CPOWs from browser_loadURI.js. r=Felipe
docshell/test/browser/browser_loadURI.js
--- a/docshell/test/browser/browser_loadURI.js
+++ b/docshell/test/browser/browser_loadURI.js
@@ -20,26 +20,15 @@ function test() {
 
   var postStream = Cc["@mozilla.org/network/mime-input-stream;1"].
                    createInstance(Ci.nsIMIMEInputStream);
   postStream.addHeader("Content-Type", "application/x-www-form-urlencoded");
   postStream.addContentLength = true;
   postStream.setData(dataStream);
 
   tab.linkedBrowser.loadURIWithFlags("http://mochi.test:8888/browser/docshell/test/browser/print_postdata.sjs", 0, null, null, postStream);
-  onTabLoad(tab, function (doc) {
-    var bodyText = doc.body.textContent;
-    is(bodyText, gPostData, "post data was submitted correctly");
-    finish();
+  BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => {
+    ContentTask.spawn(tab.linkedBrowser, gPostData, function(postData) {
+      var bodyText = content.document.body.textContent;
+      is(bodyText, postData, "post data was submitted correctly");
+    }).then(() => { finish(); });
   });
 }
-
-function onTabLoad(tab, cb) {
-  tab.linkedBrowser.addEventListener("load", function listener(event) {
-    if (event.originalTarget != tab.linkedBrowser.contentDocument ||
-        event.target.location.href == "about:blank") {
-      info("skipping spurious load event");
-      return;
-    }
-    tab.linkedBrowser.removeEventListener("load", listener, true);
-    cb(tab.linkedBrowser.contentDocument);
-  }, true);
-}