Bug 1132566 - Make test e10s compatible: browser_privatebrowsing_concurrent.js; r=mossop

--HG--
extra : rebase_source : 2719ce69e100751e07064f59d63b774ce9d60934
This commit is contained in:
Steven MacLeod 2015-02-19 11:04:43 -05:00
parent 4cae51d8ad
commit d66e7b1a9f
2 changed files with 46 additions and 53 deletions

View File

@ -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]

View File

@ -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();
});