diff --git a/docshell/test/browser/browser.ini b/docshell/test/browser/browser.ini index 83c0a4ef52d..ca571671528 100644 --- a/docshell/test/browser/browser.ini +++ b/docshell/test/browser/browser.ini @@ -103,7 +103,6 @@ skip-if = e10s skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that. [browser_multiple_pushState.js] [browser_onbeforeunload_navigation.js] -skip-if = e10s [browser_search_notification.js] [browser_timelineMarkers-01.js] [browser_timelineMarkers-02.js] diff --git a/docshell/test/browser/browser_onbeforeunload_navigation.js b/docshell/test/browser/browser_onbeforeunload_navigation.js index e99ffe7e791..5c4ff3ca5fa 100644 --- a/docshell/test/browser/browser_onbeforeunload_navigation.js +++ b/docshell/test/browser/browser_onbeforeunload_navigation.js @@ -10,6 +10,7 @@ SpecialPowers.pushPrefEnv({"set": [["dom.require_user_interaction_for_beforeunlo var loadExpected = TEST_PAGE; var testTab; +var testsLength; var loadStarted = false; var tabStateListener = { @@ -40,6 +41,10 @@ function onTabLoaded(event) { return; } + if (!testsLength) { + testsLength = testTab.linkedBrowser.contentWindow.wrappedJSObject.testFns.length; + } + is(loadedPage, loadExpected, "Loaded the expected page"); if (contentWindow) { is(contentWindow.document, event.target, "Same doc"); @@ -102,47 +107,9 @@ function onTabModalDialogLoaded(node) { // Listen for the dialog being created Services.obs.addObserver(onTabModalDialogLoaded, "tabmodal-dialog-loaded", false); -var testFns = [ - function(e) { - e.target.location.href = 'otherpage-href-set.html'; - return "stop"; - }, - function(e) { - e.target.location.reload(); - return "stop"; - }, - function(e) { - e.target.location.replace('otherpage-location-replaced.html'); - return "stop"; - }, - function(e) { - var link = e.target.createElement('a'); - link.href = "otherpage.html"; - e.target.body.appendChild(link); - link.click(); - return "stop"; - }, - function(e) { - var link = e.target.createElement('a'); - link.href = "otherpage.html"; - link.setAttribute("target", "_blank"); - e.target.body.appendChild(link); - link.click(); - return "stop"; - }, - function(e) { - var link = e.target.createElement('a'); - link.href = e.target.location.href; - e.target.body.appendChild(link); - link.setAttribute("target", "somearbitrarywindow"); - link.click(); - return "stop"; - }, -]; - function runNextTest() { currentTest++; - if (currentTest >= testFns.length) { + if (currentTest >= testsLength) { if (!stayingOnPage) { finish(); return; @@ -171,10 +138,10 @@ function runCurrentTest() { contentWindow.dialogWasInvoked = false; originalLocation = contentWindow.location.href; // And run this test: - info("Running test with onbeforeunload " + testFns[currentTest].toSource()); - contentWindow.onbeforeunload = testFns[currentTest]; + info("Running test with onbeforeunload " + contentWindow.wrappedJSObject.testFns[currentTest].toSource()); + contentWindow.onbeforeunload = contentWindow.wrappedJSObject.testFns[currentTest]; loadStarted = false; - contentWindow.location.href = TARGETED_PAGE; + testTab.linkedBrowser.loadURI(TARGETED_PAGE); } var onAfterPageLoad = runNextTest; diff --git a/docshell/test/browser/file_bug1046022.html b/docshell/test/browser/file_bug1046022.html index fd04e796b64..2de68cb43a6 100644 --- a/docshell/test/browser/file_bug1046022.html +++ b/docshell/test/browser/file_bug1046022.html @@ -7,4 +7,44 @@ Waiting for onbeforeunload to hit... + +