Bug 1267479 - Use ContentTask to avoid using intermittent CPOWs in browser_bug396843.js. r=wchen
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 21 Jul 2016 15:40:04 -0700
changeset 331499 36bd6dc09186346a0e99c638c433f7d438877d8e
parent 331498 388944aa4d97187fd9a28f10f6ad03d35026940c
child 331500 f9ecbe4d60f8cfd3dbb496a494b176e36c570719
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswchen
bugs1267479, 396843
milestone50.0a1
Bug 1267479 - Use ContentTask to avoid using intermittent CPOWs in browser_bug396843.js. r=wchen
dom/tests/browser/browser_bug396843.js
--- a/dom/tests/browser/browser_bug396843.js
+++ b/dom/tests/browser/browser_bug396843.js
@@ -262,21 +262,25 @@ function testInDocument(doc, documentID)
     runTestProps();
     runTestUnwrapped();
 }
 
 add_task(function* test1() {
     testInDocument(document, "browser window");
 });
 
-function newTabTest(location) {
-    let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, location);
-    let doc = content.document;
-    testInDocument(doc, location);
-    yield BrowserTestUtils.removeTab(tab);
+function* newTabTest(location) {
+    yield BrowserTestUtils.withNewTab({ gBrowser, url: location },
+        function* (browser) {
+          yield ContentTask.spawn(browser, { location, testInDocument_: testInDocument.toSource() },
+            function* ({ location, testInDocument_ }) {
+              let testInDocument = eval(`(() => (${testInDocument_}))()`);
+              testInDocument(content.document, location);
+            });
+        });
 }
 
 add_task(function* test2() {
     yield newTabTest("about:blank");
 });
 
 add_task(function* test3() {
     yield newTabTest("about:config");