mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 1132566 - Make test e10s compatible: browser_privatebrowsing_concurrent.js; r=mossop
--HG-- extra : rebase_source : 2719ce69e100751e07064f59d63b774ce9d60934
This commit is contained in:
parent
4cae51d8ad
commit
d66e7b1a9f
@ -24,7 +24,6 @@ skip-if = e10s
|
|||||||
[browser_privatebrowsing_cache.js]
|
[browser_privatebrowsing_cache.js]
|
||||||
[browser_privatebrowsing_certexceptionsui.js]
|
[browser_privatebrowsing_certexceptionsui.js]
|
||||||
[browser_privatebrowsing_concurrent.js]
|
[browser_privatebrowsing_concurrent.js]
|
||||||
skip-if = e10s
|
|
||||||
[browser_privatebrowsing_cookieacceptdialog.js]
|
[browser_privatebrowsing_cookieacceptdialog.js]
|
||||||
skip-if = e10s
|
skip-if = e10s
|
||||||
[browser_privatebrowsing_crh.js]
|
[browser_privatebrowsing_crh.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 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
|
// 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';
|
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;
|
let non_private_tab = gBrowser.selectedBrowser;
|
||||||
non_private_tab.addEventListener('load', function() {
|
yield BrowserTestUtils.browserLoaded(non_private_tab);
|
||||||
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);
|
|
||||||
|
|
||||||
non_private_tab.addEventListener('load', function() {
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
non_private_tab.removeEventListener('load', arguments.callee, true);
|
let private_tab = gBrowser.selectedBrowser;
|
||||||
var elts = non_private_tab.contentWindow.document.title.split('|');
|
yield BrowserTestUtils.browserLoaded(private_tab);
|
||||||
isnot(elts[0], 'value2', "public window shouldn't see private storage");
|
yield ContentTask.spawn(private_tab, {}, function* () {
|
||||||
is(elts[1], '1', "public window should only see public items");
|
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() {
|
non_private_tab.loadURI(prefix + '?action=get&name=test2');
|
||||||
private_tab.removeEventListener('load', arguments.callee, true);
|
yield BrowserTestUtils.browserLoaded(non_private_tab);
|
||||||
var elts = private_tab.contentWindow.document.title.split('|');
|
let elts = non_private_tab.contentTitle.split('|');
|
||||||
isnot(elts[0], 'value', "private window shouldn't see public storage");
|
isnot(elts[0], 'value2', "public window shouldn't see private storage");
|
||||||
is(elts[1], '1', "private window should only see private items");
|
is(elts[1], '1', "public window should only see public items");
|
||||||
private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false;
|
|
||||||
|
|
||||||
Components.utils.schedulePreciseGC(function() {
|
private_tab.loadURI(prefix + '?action=get&name=test');
|
||||||
private_tab.addEventListener('load', function() {
|
yield BrowserTestUtils.browserLoaded(private_tab);
|
||||||
private_tab.removeEventListener('load', arguments.callee, true);
|
elts = private_tab.contentTitle.split('|');
|
||||||
var elts = private_tab.contentWindow.document.title.split('|');
|
isnot(elts[0], 'value', "private window shouldn't see public storage");
|
||||||
isnot(elts[0], 'value2', "public window shouldn't see cleared private storage");
|
is(elts[1], '1', "private window should only see private items");
|
||||||
is(elts[1], '1', "public window should only see public items");
|
|
||||||
|
|
||||||
private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
|
yield ContentTask.spawn(private_tab, {}, function* (){
|
||||||
private_tab.addEventListener('load', function() {
|
docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false;
|
||||||
private_tab.removeEventListener('load', arguments.callee, true);
|
});
|
||||||
var elts = private_tab.contentWindow.document.title.split('|');
|
yield new Promise(resolve => Cu.schedulePreciseGC(resolve));
|
||||||
is(elts[1], '1', "private window should only see new private items");
|
|
||||||
|
|
||||||
non_private_tab.addEventListener('load', function() {
|
private_tab.loadURI(prefix + '?action=get&name=test2');
|
||||||
gBrowser.removeCurrentTab();
|
yield BrowserTestUtils.browserLoaded(private_tab);
|
||||||
gBrowser.removeCurrentTab();
|
elts = private_tab.contentTitle.split('|');
|
||||||
finish();
|
isnot(elts[0], 'value2', "public window shouldn't see cleared private storage");
|
||||||
}, true);
|
is(elts[1], '1', "public window should only see public items");
|
||||||
non_private_tab.loadURI(prefix + '?final=true');
|
|
||||||
|
|
||||||
}, true);
|
yield ContentTask.spawn(private_tab, {}, function* (){
|
||||||
private_tab.loadURI(prefix + '?action=set&name=test3&value=value3');
|
docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
|
||||||
}, true);
|
});
|
||||||
private_tab.loadURI(prefix + '?action=get&name=test2');
|
|
||||||
});
|
private_tab.loadURI(prefix + '?action=set&name=test3&value=value3');
|
||||||
}, true);
|
BrowserTestUtils.browserLoaded(private_tab);
|
||||||
private_tab.loadURI(prefix + '?action=get&name=test');
|
elts = private_tab.contentTitle.split('|');
|
||||||
}, true);
|
is(elts[1], '1', "private window should only see new private items");
|
||||||
non_private_tab.loadURI(prefix + '?action=get&name=test2');
|
|
||||||
}, true);
|
// Cleanup.
|
||||||
private_tab.loadURI(prefix + '?action=set&name=test2&value=value2');
|
non_private_tab.loadURI(prefix + '?final=true');
|
||||||
}, true);
|
yield BrowserTestUtils.browserLoaded(non_private_tab);
|
||||||
non_private_tab.loadURI(prefix + '?action=set&name=test&value=value&initial=true');
|
gBrowser.removeCurrentTab();
|
||||||
}
|
gBrowser.removeCurrentTab();
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user