Bug 1265436 - modernize dom/tests/browser/browser_bug396843.js to work in e10s, also re-enable dom/tests/browser/browser_bug1238427.js as it works as is. r=jimm
authorTracy Walker <twalker@mozilla.com>
Thu, 21 Apr 2016 16:12:40 -0500
changeset 332315 1c638e1c121c51a803f3457e910cba1b021838b1
parent 332314 643063a2427b3a6a5bf5b11fed0bf2830e6bae25
child 332316 e1b99e5251cb9ba6620599a2c1f7e54d00fc413c
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)
reviewersjimm
bugs1265436, 396843, 1238427
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 1265436 - modernize dom/tests/browser/browser_bug396843.js to work in e10s, also re-enable dom/tests/browser/browser_bug1238427.js as it works as is. r=jimm
dom/tests/browser/browser.ini
dom/tests/browser/browser_bug396843.js
--- a/dom/tests/browser/browser.ini
+++ b/dom/tests/browser/browser.ini
@@ -22,19 +22,17 @@ skip-if = e10s
 [browser_ConsoleStorageAPITests.js]
 skip-if = e10s
 [browser_ConsoleStoragePBTest_perwindowpb.js]
 skip-if = e10s
 [browser_autofocus_background.js]
 skip-if= buildapp == 'mulet'
 [browser_autofocus_preference.js]
 [browser_bug1238427.js]
-skip-if = e10s
 [browser_bug396843.js]
-skip-if = e10s
 [browser_focus_steal_from_chrome.js]
 skip-if = e10s
 [browser_focus_steal_from_chrome_during_mousedown.js]
 skip-if = e10s
 [browser_frame_elements.js]
 [browser_localStorage_privatestorageevent.js]
 skip-if = e10s
 [browser_test_new_window_from_content.js]
--- a/dom/tests/browser/browser_bug396843.js
+++ b/dom/tests/browser/browser_bug396843.js
@@ -1,294 +1,283 @@
-function test() {
-    /** Test for Bug 396843 **/
-    waitForExplicitFinish();
+/** Test for Bug 396843 **/
+
+function testInDocument(doc, documentID) {
+
+    var allNodes = [];
+    var XMLNodes = [];
+
+    // HTML
+    function HTML_TAG(name) {
+        allNodes.push(doc.createElement(name));
+    }
 
-    function testInDocument(doc, documentID) {
-        
-        var allNodes = [];
-        var XMLNodes = [];
+    /* List copy/pasted from nsHTMLTagList.h */
+    HTML_TAG("a", "Anchor")
+    HTML_TAG("abbr", "Span")
+    HTML_TAG("acronym", "Span")
+    HTML_TAG("address", "Span")
+    HTML_TAG("applet", "SharedObject")
+    HTML_TAG("area", "Area")
+    HTML_TAG("b", "Span")
+    HTML_TAG("base", "Shared")
+    HTML_TAG("basefont", "Span")
+    HTML_TAG("bdo", "Span")
+    HTML_TAG("bgsound", "Span")
+    HTML_TAG("big", "Span")
+    HTML_TAG("blockquote", "Shared")
+    HTML_TAG("body", "Body")
+    HTML_TAG("br", "BR")
+    HTML_TAG("button", "Button")
+    HTML_TAG("canvas", "Canvas")
+    HTML_TAG("caption", "TableCaption")
+    HTML_TAG("center", "Span")
+    HTML_TAG("cite", "Span")
+    HTML_TAG("code", "Span")
+    HTML_TAG("col", "TableCol")
+    HTML_TAG("colgroup", "TableCol")
+    HTML_TAG("dd", "Span")
+    HTML_TAG("del", "Mod")
+    HTML_TAG("dfn", "Span")
+    HTML_TAG("dir", "Shared")
+    HTML_TAG("div", "Div")
+    HTML_TAG("dl", "SharedList")
+    HTML_TAG("dt", "Span")
+    HTML_TAG("em", "Span")
+    HTML_TAG("embed", "SharedObject")
+    HTML_TAG("fieldset", "FieldSet")
+    HTML_TAG("font", "Font")
+    HTML_TAG("form", "Form")
+    HTML_TAG("frame", "Frame")
+    HTML_TAG("frameset", "FrameSet")
+    HTML_TAG("h1", "Heading")
+    HTML_TAG("h2", "Heading")
+    HTML_TAG("h3", "Heading")
+    HTML_TAG("h4", "Heading")
+    HTML_TAG("h5", "Heading")
+    HTML_TAG("h6", "Heading")
+    HTML_TAG("head", "Head")
+    HTML_TAG("hr", "HR")
+    HTML_TAG("html", "Html")
+    HTML_TAG("i", "Span")
+    HTML_TAG("iframe", "IFrame")
+    HTML_TAG("image", "")
+    HTML_TAG("img", "Image")
+    HTML_TAG("input", "Input")
+    HTML_TAG("ins", "Mod")
+    HTML_TAG("isindex", "Unknown")
+    HTML_TAG("kbd", "Span")
+    HTML_TAG("keygen", "Span")
+    HTML_TAG("label", "Label")
+    HTML_TAG("legend", "Legend")
+    HTML_TAG("li", "LI")
+    HTML_TAG("link", "Link")
+    HTML_TAG("listing", "Span")
+    HTML_TAG("map", "Map")
+    HTML_TAG("marquee", "Div")
+    HTML_TAG("menu", "Shared")
+    HTML_TAG("meta", "Meta")
+    HTML_TAG("multicol", "Unknown")
+    HTML_TAG("nobr", "Span")
+    HTML_TAG("noembed", "Div")
+    HTML_TAG("noframes", "Div")
+    HTML_TAG("noscript", "Div")
+    HTML_TAG("object", "Object")
+    HTML_TAG("ol", "SharedList")
+    HTML_TAG("optgroup", "OptGroup")
+    HTML_TAG("option", "Option")
+    HTML_TAG("p", "Paragraph")
+    HTML_TAG("param", "Shared")
+    HTML_TAG("plaintext", "Span")
+    HTML_TAG("pre", "Pre")
+    HTML_TAG("q", "Shared")
+    HTML_TAG("s", "Span")
+    HTML_TAG("samp", "Span")
+    HTML_TAG("script", "Script")
+    HTML_TAG("select", "Select")
+    HTML_TAG("small", "Span")
+    HTML_TAG("spacer", "Unknown")
+    HTML_TAG("span", "Span")
+    HTML_TAG("strike", "Span")
+    HTML_TAG("strong", "Span")
+    HTML_TAG("style", "Style")
+    HTML_TAG("sub", "Span")
+    HTML_TAG("sup", "Span")
+    HTML_TAG("table", "Table")
+    HTML_TAG("tbody", "TableSection")
+    HTML_TAG("td", "TableCell")
+    HTML_TAG("textarea", "TextArea")
+    HTML_TAG("tfoot", "TableSection")
+    HTML_TAG("th", "TableCell")
+    HTML_TAG("thead", "TableSection")
+    HTML_TAG("template", "Template")
+    HTML_TAG("title", "Title")
+    HTML_TAG("tr", "TableRow")
+    HTML_TAG("tt", "Span")
+    HTML_TAG("u", "Span")
+    HTML_TAG("ul", "SharedList")
+    HTML_TAG("var", "Span")
+    HTML_TAG("wbr", "Shared")
+    HTML_TAG("xmp", "Span")
 
-        // HTML
-        function HTML_TAG(name) {
-            allNodes.push(doc.createElement(name));
-        }
+    function SVG_TAG(name) {
+        allNodes.push(doc.createElementNS("http://www.w3.org/2000/svg", name));
+    }
 
-        /* List copy/pasted from nsHTMLTagList.h */
-        HTML_TAG("a", "Anchor")
-        HTML_TAG("abbr", "Span")
-        HTML_TAG("acronym", "Span")
-        HTML_TAG("address", "Span")
-        HTML_TAG("applet", "SharedObject")
-        HTML_TAG("area", "Area")
-        HTML_TAG("b", "Span")
-        HTML_TAG("base", "Shared")
-        HTML_TAG("basefont", "Span")
-        HTML_TAG("bdo", "Span")
-        HTML_TAG("bgsound", "Span")
-        HTML_TAG("big", "Span")
-        HTML_TAG("blockquote", "Shared")
-        HTML_TAG("body", "Body")
-        HTML_TAG("br", "BR")
-        HTML_TAG("button", "Button")
-        HTML_TAG("canvas", "Canvas")
-        HTML_TAG("caption", "TableCaption")
-        HTML_TAG("center", "Span")
-        HTML_TAG("cite", "Span")
-        HTML_TAG("code", "Span")
-        HTML_TAG("col", "TableCol")
-        HTML_TAG("colgroup", "TableCol")
-        HTML_TAG("dd", "Span")
-        HTML_TAG("del", "Mod")
-        HTML_TAG("dfn", "Span")
-        HTML_TAG("dir", "Shared")
-        HTML_TAG("div", "Div")
-        HTML_TAG("dl", "SharedList")
-        HTML_TAG("dt", "Span")
-        HTML_TAG("em", "Span")
-        HTML_TAG("embed", "SharedObject")
-        HTML_TAG("fieldset", "FieldSet")
-        HTML_TAG("font", "Font")
-        HTML_TAG("form", "Form")
-        HTML_TAG("frame", "Frame")
-        HTML_TAG("frameset", "FrameSet")
-        HTML_TAG("h1", "Heading")
-        HTML_TAG("h2", "Heading")
-        HTML_TAG("h3", "Heading")
-        HTML_TAG("h4", "Heading")
-        HTML_TAG("h5", "Heading")
-        HTML_TAG("h6", "Heading")
-        HTML_TAG("head", "Head")
-        HTML_TAG("hr", "HR")
-        HTML_TAG("html", "Html")
-        HTML_TAG("i", "Span")
-        HTML_TAG("iframe", "IFrame")
-        HTML_TAG("image", "")
-        HTML_TAG("img", "Image")
-        HTML_TAG("input", "Input")
-        HTML_TAG("ins", "Mod")
-        HTML_TAG("isindex", "Unknown")
-        HTML_TAG("kbd", "Span")
-        HTML_TAG("keygen", "Span")
-        HTML_TAG("label", "Label")
-        HTML_TAG("legend", "Legend")
-        HTML_TAG("li", "LI")
-        HTML_TAG("link", "Link")
-        HTML_TAG("listing", "Span")
-        HTML_TAG("map", "Map")
-        HTML_TAG("marquee", "Div")
-        HTML_TAG("menu", "Shared")
-        HTML_TAG("meta", "Meta")
-        HTML_TAG("multicol", "Unknown")
-        HTML_TAG("nobr", "Span")
-        HTML_TAG("noembed", "Div")
-        HTML_TAG("noframes", "Div")
-        HTML_TAG("noscript", "Div")
-        HTML_TAG("object", "Object")
-        HTML_TAG("ol", "SharedList")
-        HTML_TAG("optgroup", "OptGroup")
-        HTML_TAG("option", "Option")
-        HTML_TAG("p", "Paragraph")
-        HTML_TAG("param", "Shared")
-        HTML_TAG("plaintext", "Span")
-        HTML_TAG("pre", "Pre")
-        HTML_TAG("q", "Shared")
-        HTML_TAG("s", "Span")
-        HTML_TAG("samp", "Span")
-        HTML_TAG("script", "Script")
-        HTML_TAG("select", "Select")
-        HTML_TAG("small", "Span")
-        HTML_TAG("spacer", "Unknown")
-        HTML_TAG("span", "Span")
-        HTML_TAG("strike", "Span")
-        HTML_TAG("strong", "Span")
-        HTML_TAG("style", "Style")
-        HTML_TAG("sub", "Span")
-        HTML_TAG("sup", "Span")
-        HTML_TAG("table", "Table")
-        HTML_TAG("tbody", "TableSection")
-        HTML_TAG("td", "TableCell")
-        HTML_TAG("textarea", "TextArea")
-        HTML_TAG("tfoot", "TableSection")
-        HTML_TAG("th", "TableCell")
-        HTML_TAG("thead", "TableSection")
-        HTML_TAG("template", "Template")
-        HTML_TAG("title", "Title")
-        HTML_TAG("tr", "TableRow")
-        HTML_TAG("tt", "Span")
-        HTML_TAG("u", "Span")
-        HTML_TAG("ul", "SharedList")
-        HTML_TAG("var", "Span")
-        HTML_TAG("wbr", "Shared")
-        HTML_TAG("xmp", "Span")
+    // List sorta stolen from SVG element factory.
+    SVG_TAG("a")
+    SVG_TAG("polyline")
+    SVG_TAG("polygon")
+    SVG_TAG("circle")
+    SVG_TAG("ellipse")
+    SVG_TAG("line")
+    SVG_TAG("rect")
+    SVG_TAG("svg")
+    SVG_TAG("g")
+    SVG_TAG("foreignObject")
+    SVG_TAG("path")
+    SVG_TAG("text")
+    SVG_TAG("tspan")
+    SVG_TAG("image")
+    SVG_TAG("style")
+    SVG_TAG("linearGradient")
+    SVG_TAG("metadata")
+    SVG_TAG("radialGradient")
+    SVG_TAG("stop")
+    SVG_TAG("defs")
+    SVG_TAG("desc")
+    SVG_TAG("script")
+    SVG_TAG("use")
+    SVG_TAG("symbol")
+    SVG_TAG("marker")
+    SVG_TAG("title")
+    SVG_TAG("clipPath")
+    SVG_TAG("textPath")
+    SVG_TAG("filter")
+    SVG_TAG("feBlend")
+    SVG_TAG("feColorMatrix")
+    SVG_TAG("feComponentTransfer")
+    SVG_TAG("feComposite")
+    SVG_TAG("feFuncR")
+    SVG_TAG("feFuncG")
+    SVG_TAG("feFuncB")
+    SVG_TAG("feFuncA")
+    SVG_TAG("feGaussianBlur")
+    SVG_TAG("feMerge")
+    SVG_TAG("feMergeNode")
+    SVG_TAG("feMorphology")
+    SVG_TAG("feOffset")
+    SVG_TAG("feFlood")
+    SVG_TAG("feTile")
+    SVG_TAG("feTurbulence")
+    SVG_TAG("feConvolveMatrix")
+    SVG_TAG("feDistantLight")
+    SVG_TAG("fePointLight")
+    SVG_TAG("feSpotLight")
+    SVG_TAG("feDiffuseLighting")
+    SVG_TAG("feSpecularLighting")
+    SVG_TAG("feDisplacementMap")
+    SVG_TAG("feImage")
+    SVG_TAG("pattern")
+    SVG_TAG("mask")
+    SVG_TAG("svgSwitch")
 
-        function SVG_TAG(name) {
-            allNodes.push(doc.createElementNS("http://www.w3.org/2000/svg", name));
+    // Toss in some other namespaced stuff too, for good measure
+    // XUL stuff might not be creatable in content documents
+    try {
+        allNodes.push(doc.createElementNS(
+            "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
+            "window"));
+    } catch (e) {}
+    allNodes.push(doc.createElementNS("http://www.w3.org/1998/Math/MathML",
+                                        "math"));
+    allNodes.push(doc.createElementNS("http://www.w3.org/2001/xml-events",
+                                        "testname"));
+    allNodes.push(doc.createElementNS("bogus.namespace", "testname"));
+
+    var XMLDoc = doc.implementation.createDocument("", "", null);
+
+    // And non-elements
+    allNodes.push(doc.createTextNode("some text"));
+    allNodes.push(doc.createComment("some text"));
+    allNodes.push(doc.createDocumentFragment());
+    XMLNodes.push(XMLDoc.createCDATASection("some text"));
+    XMLNodes.push(XMLDoc.createProcessingInstruction("PI", "data"));
+        
+    function runTestUnwrapped() {
+        if (!("wrappedJSObject" in doc)) {
+            return;
+        }
+        ok(doc.wrappedJSObject.nodePrincipal === undefined,
+            "Must not have document principal for " + documentID);
+        ok(doc.wrappedJSObject.baseURIObject === undefined,
+            "Must not have document base URI for " + documentID);
+        ok(doc.wrappedJSObject.documentURIObject === undefined,
+            "Must not have document URI for " + documentID);
+
+        for (var i = 0; i < allNodes.length; ++i) {
+            ok(allNodes[i].wrappedJSObject.nodePrincipal === undefined,
+                "Unexpected principal appears for " + allNodes[i].nodeName +
+                " in " + documentID);
+            ok(allNodes[i].wrappedJSObject.baseURIObject === undefined,
+                "Unexpected base URI appears for " + allNodes[i].nodeName +
+                " in " + documentID);
+        }
+    }
+
+    function runTestProps() {
+        isnot(doc.nodePrincipal, null,
+                "Must have document principal in " + documentID);
+        is(doc.nodePrincipal instanceof Components.interfaces.nsIPrincipal,
+            true, "document principal must be a principal in " + documentID);
+        isnot(doc.baseURIObject, null,
+                "Must have document base URI in" + documentID);
+        is(doc.baseURIObject instanceof Components.interfaces.nsIURI,
+            true, "document base URI must be a URI in " + documentID);
+        isnot(doc.documentURIObject, null,
+                "Must have document URI " + documentID);
+        is(doc.documentURIObject instanceof Components.interfaces.nsIURI,
+            true, "document URI must be a URI in " + documentID);
+        is(doc.documentURIObject.spec, doc.documentURI,
+               "document URI must be the right URI in " + documentID);
+
+        for (var i = 0; i < allNodes.length; ++i) {
+            is(allNodes[i].nodePrincipal, doc.nodePrincipal,
+                "Unexpected principal for " + allNodes[i].nodeName +
+                " in " + documentID);
+            is(allNodes[i].baseURIObject, doc.baseURIObject,
+                "Unexpected base URI for " + allNodes[i].nodeName +
+                " in " + documentID);
         }
 
-        // List sorta stolen from SVG element factory.
-        SVG_TAG("a")
-        SVG_TAG("polyline")
-        SVG_TAG("polygon")
-        SVG_TAG("circle")
-        SVG_TAG("ellipse")
-        SVG_TAG("line")
-        SVG_TAG("rect")
-        SVG_TAG("svg")
-        SVG_TAG("g")
-        SVG_TAG("foreignObject")
-        SVG_TAG("path")
-        SVG_TAG("text")
-        SVG_TAG("tspan")
-        SVG_TAG("image")
-        SVG_TAG("style")
-        SVG_TAG("linearGradient")
-        SVG_TAG("metadata")
-        SVG_TAG("radialGradient")
-        SVG_TAG("stop")
-        SVG_TAG("defs")
-        SVG_TAG("desc")
-        SVG_TAG("script")
-        SVG_TAG("use")
-        SVG_TAG("symbol")
-        SVG_TAG("marker")
-        SVG_TAG("title")
-        SVG_TAG("clipPath")
-        SVG_TAG("textPath")
-        SVG_TAG("filter")
-        SVG_TAG("feBlend")
-        SVG_TAG("feColorMatrix")
-        SVG_TAG("feComponentTransfer")
-        SVG_TAG("feComposite")
-        SVG_TAG("feFuncR")
-        SVG_TAG("feFuncG")
-        SVG_TAG("feFuncB")
-        SVG_TAG("feFuncA")
-        SVG_TAG("feGaussianBlur")
-        SVG_TAG("feMerge")
-        SVG_TAG("feMergeNode")
-        SVG_TAG("feMorphology")
-        SVG_TAG("feOffset")
-        SVG_TAG("feFlood")
-        SVG_TAG("feTile")
-        SVG_TAG("feTurbulence")
-        SVG_TAG("feConvolveMatrix")
-        SVG_TAG("feDistantLight")
-        SVG_TAG("fePointLight")
-        SVG_TAG("feSpotLight")
-        SVG_TAG("feDiffuseLighting")
-        SVG_TAG("feSpecularLighting")
-        SVG_TAG("feDisplacementMap")
-        SVG_TAG("feImage")
-        SVG_TAG("pattern")
-        SVG_TAG("mask")
-        SVG_TAG("svgSwitch")
-
-        // Toss in some other namespaced stuff too, for good measure
-        // XUL stuff might not be creatable in content documents
-        try {
-            allNodes.push(doc.createElementNS(
-                "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
-                "window"));
-        } catch (e) {}
-        allNodes.push(doc.createElementNS("http://www.w3.org/1998/Math/MathML",
-                                          "math"));
-        allNodes.push(doc.createElementNS("http://www.w3.org/2001/xml-events",
-                                          "testname"));
-        allNodes.push(doc.createElementNS("bogus.namespace", "testname"));
-
-        var XMLDoc = doc.implementation.createDocument("", "", null);
-
-        // And non-elements
-        allNodes.push(doc.createTextNode("some text"));
-        allNodes.push(doc.createComment("some text"));
-        allNodes.push(doc.createDocumentFragment());
-        XMLNodes.push(XMLDoc.createCDATASection("some text"));
-        XMLNodes.push(XMLDoc.createProcessingInstruction("PI", "data"));
-        
-        function runTestUnwrapped() {
-            if (!("wrappedJSObject" in doc)) {
-                return;
-            }
-            ok(doc.wrappedJSObject.nodePrincipal === undefined,
-               "Must not have document principal for " + documentID);
-            ok(doc.wrappedJSObject.baseURIObject === undefined,
-               "Must not have document base URI for " + documentID);
-            ok(doc.wrappedJSObject.documentURIObject === undefined,
-               "Must not have document URI for " + documentID);
-
-            for (var i = 0; i < allNodes.length; ++i) {
-                ok(allNodes[i].wrappedJSObject.nodePrincipal === undefined,
-                   "Unexpected principal appears for " + allNodes[i].nodeName +
-                   " in " + documentID);
-                ok(allNodes[i].wrappedJSObject.baseURIObject === undefined,
-                   "Unexpected base URI appears for " + allNodes[i].nodeName +
-                   " in " + documentID);
-            }
+        for (i = 0; i < XMLNodes.length; ++i) {
+            is(XMLNodes[i].nodePrincipal, doc.nodePrincipal,
+                "Unexpected principal for " + XMLNodes[i].nodeName +
+                " in " + documentID);
+            is(XMLNodes[i].baseURIObject.spec, "about:blank",
+                "Unexpected base URI for " + XMLNodes[i].nodeName +
+                " in " + documentID);
         }
-        
-        function runTestProps() {
-            isnot(doc.nodePrincipal, null,
-                  "Must have document principal in " + documentID);
-            is(doc.nodePrincipal instanceof Components.interfaces.nsIPrincipal,
-               true, "document principal must be a principal in " + documentID);
-            isnot(doc.baseURIObject, null,
-                  "Must have document base URI in" + documentID);
-            is(doc.baseURIObject instanceof Components.interfaces.nsIURI,
-               true, "document base URI must be a URI in " + documentID);
-            isnot(doc.documentURIObject, null,
-                  "Must have document URI " + documentID);
-            is(doc.documentURIObject instanceof Components.interfaces.nsIURI,
-               true, "document URI must be a URI in " + documentID);
-            is(doc.documentURIObject.spec, doc.documentURI,
-               "document URI must be the right URI in " + documentID);
-     
-            for (var i = 0; i < allNodes.length; ++i) {
-                is(allNodes[i].nodePrincipal, doc.nodePrincipal,
-                   "Unexpected principal for " + allNodes[i].nodeName +
-                   " in " + documentID);
-                is(allNodes[i].baseURIObject, doc.baseURIObject,
-                   "Unexpected base URI for " + allNodes[i].nodeName +
-                   " in " + documentID);
-            }
-
-            for (i = 0; i < XMLNodes.length; ++i) {
-                is(XMLNodes[i].nodePrincipal, doc.nodePrincipal,
-                   "Unexpected principal for " + XMLNodes[i].nodeName +
-                   " in " + documentID);
-                is(XMLNodes[i].baseURIObject.spec, "about:blank",
-                   "Unexpected base URI for " + XMLNodes[i].nodeName +
-                   " in " + documentID);
-            }
-        }
-
-        runTestUnwrapped();
-        runTestProps();
-        runTestUnwrapped();
     }
 
-    var testsRunning = 2;
-    
-    testInDocument(document, "browser window");
+    runTestUnwrapped();
+    runTestProps();
+    runTestUnwrapped();
+}
 
-    function newTabTest(url) {
-        var newTab = gBrowser.addTab();
-        var newBrowser = gBrowser.getBrowserForTab(newTab);
-        newBrowser.contentWindow.location.href = url;
-        function testBrowser(event) {
-            newBrowser.removeEventListener("load", testBrowser, true);
-            is(event.target, newBrowser.contentDocument,
-               "Unexpected target in " + url);
-            testInDocument(newBrowser.contentDocument, url);
+add_task(function* test1() {
+    testInDocument(document, "browser window");
+});
 
-            gBrowser.removeTab(newTab);
+function newTabTest(location) {
+    let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, location);
+    let doc = content.document;
+    testInDocument(doc, location);
+    yield BrowserTestUtils.removeTab(tab);
+}
 
-            --testsRunning;
-            if (testsRunning == 0) {
-                finish();
-            }
-        }
-        newBrowser.addEventListener("load", testBrowser, true);
-    }
+add_task(function* test2() {
+    yield newTabTest("about:blank");
+});
 
-    newTabTest("about:blank");
-    newTabTest("about:config");
-}
+add_task(function* test3() {
+    yield newTabTest("about:config");
+});