diff --git a/browser/components/privatebrowsing/test/browser/browser.ini b/browser/components/privatebrowsing/test/browser/browser.ini index c0553829edc..b155e96eabb 100644 --- a/browser/components/privatebrowsing/test/browser/browser.ini +++ b/browser/components/privatebrowsing/test/browser/browser.ini @@ -24,7 +24,6 @@ skip-if = e10s [browser_privatebrowsing_cache.js] [browser_privatebrowsing_certexceptionsui.js] [browser_privatebrowsing_concurrent.js] -skip-if = e10s [browser_privatebrowsing_cookieacceptdialog.js] skip-if = e10s [browser_privatebrowsing_crh.js] diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js index c06c7c05a4f..4666b36d311 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js @@ -11,63 +11,57 @@ // Step 3: load a page in the tab from step 1 that checks the value of test2 is value2 and the total count in non-private storage is 1 // Step 4: load a page in the tab from step 2 that checks the value of test is value and the total count in private storage is 1 -function test() { +add_task(function test() { let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html'; - waitForExplicitFinish(); - gBrowser.selectedTab = gBrowser.addTab(); + + gBrowser.selectedTab = gBrowser.addTab(prefix + '?action=set&name=test&value=value&initial=true'); let non_private_tab = gBrowser.selectedBrowser; - non_private_tab.addEventListener('load', function() { - non_private_tab.removeEventListener('load', arguments.callee, true); - gBrowser.selectedTab = gBrowser.addTab(); - let private_tab = gBrowser.selectedBrowser; - private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; - private_tab.addEventListener('load', function() { - private_tab.removeEventListener('load', arguments.callee, true); + yield BrowserTestUtils.browserLoaded(non_private_tab); - non_private_tab.addEventListener('load', function() { - non_private_tab.removeEventListener('load', arguments.callee, true); - var elts = non_private_tab.contentWindow.document.title.split('|'); - isnot(elts[0], 'value2', "public window shouldn't see private storage"); - is(elts[1], '1', "public window should only see public items"); + gBrowser.selectedTab = gBrowser.addTab(); + let private_tab = gBrowser.selectedBrowser; + yield BrowserTestUtils.browserLoaded(private_tab); + yield ContentTask.spawn(private_tab, {}, function* () { + docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; + }); + private_tab.loadURI(prefix + '?action=set&name=test2&value=value2'); + yield BrowserTestUtils.browserLoaded(private_tab); - private_tab.addEventListener('load', function() { - private_tab.removeEventListener('load', arguments.callee, true); - var elts = private_tab.contentWindow.document.title.split('|'); - isnot(elts[0], 'value', "private window shouldn't see public storage"); - is(elts[1], '1', "private window should only see private items"); - private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false; + non_private_tab.loadURI(prefix + '?action=get&name=test2'); + yield BrowserTestUtils.browserLoaded(non_private_tab); + let elts = non_private_tab.contentTitle.split('|'); + isnot(elts[0], 'value2', "public window shouldn't see private storage"); + is(elts[1], '1', "public window should only see public items"); - Components.utils.schedulePreciseGC(function() { - private_tab.addEventListener('load', function() { - private_tab.removeEventListener('load', arguments.callee, true); - var elts = private_tab.contentWindow.document.title.split('|'); - isnot(elts[0], 'value2', "public window shouldn't see cleared private storage"); - is(elts[1], '1', "public window should only see public items"); + private_tab.loadURI(prefix + '?action=get&name=test'); + yield BrowserTestUtils.browserLoaded(private_tab); + elts = private_tab.contentTitle.split('|'); + isnot(elts[0], 'value', "private window shouldn't see public storage"); + is(elts[1], '1', "private window should only see private items"); - private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; - private_tab.addEventListener('load', function() { - private_tab.removeEventListener('load', arguments.callee, true); - var elts = private_tab.contentWindow.document.title.split('|'); - is(elts[1], '1', "private window should only see new private items"); + yield ContentTask.spawn(private_tab, {}, function* (){ + docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false; + }); + yield new Promise(resolve => Cu.schedulePreciseGC(resolve)); - non_private_tab.addEventListener('load', function() { - gBrowser.removeCurrentTab(); - gBrowser.removeCurrentTab(); - finish(); - }, true); - non_private_tab.loadURI(prefix + '?final=true'); + private_tab.loadURI(prefix + '?action=get&name=test2'); + yield BrowserTestUtils.browserLoaded(private_tab); + elts = private_tab.contentTitle.split('|'); + isnot(elts[0], 'value2', "public window shouldn't see cleared private storage"); + is(elts[1], '1', "public window should only see public items"); - }, true); - private_tab.loadURI(prefix + '?action=set&name=test3&value=value3'); - }, true); - private_tab.loadURI(prefix + '?action=get&name=test2'); - }); - }, true); - private_tab.loadURI(prefix + '?action=get&name=test'); - }, true); - non_private_tab.loadURI(prefix + '?action=get&name=test2'); - }, true); - private_tab.loadURI(prefix + '?action=set&name=test2&value=value2'); - }, true); - non_private_tab.loadURI(prefix + '?action=set&name=test&value=value&initial=true'); -} + yield ContentTask.spawn(private_tab, {}, function* (){ + docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; + }); + + private_tab.loadURI(prefix + '?action=set&name=test3&value=value3'); + BrowserTestUtils.browserLoaded(private_tab); + elts = private_tab.contentTitle.split('|'); + is(elts[1], '1', "private window should only see new private items"); + + // Cleanup. + non_private_tab.loadURI(prefix + '?final=true'); + yield BrowserTestUtils.browserLoaded(non_private_tab); + gBrowser.removeCurrentTab(); + gBrowser.removeCurrentTab(); +});