Bug 1403009 - Intermittent failure in browser_test_favicon.js. r=kershaw

MozReview-Commit-ID: 9phZS4o5FC8

--HG--
extra : rebase_source : efde3a0acbbd92d26b033aaafd65bc11d97f13d2
This commit is contained in:
Marco Bonardo 2017-11-06 21:35:49 +01:00
parent edc2cc261c
commit bf0b20593d
3 changed files with 19 additions and 23 deletions

View File

@ -1,6 +1,9 @@
[DEFAULT]
[browser_test_favicon.js]
support-files =
damonbowling.jpg
damonbowling.jpg^headers^
[browser_permmgr_sync.js]
# The browser_permmgr_sync test tests e10s specific behavior, and runs code
# paths which would hit the debug only assertion in

View File

@ -2,27 +2,22 @@
// in this case, the docshell of the channel is chrome, not content; thus
// the cookie should be considered third party.
function test() {
waitForExplicitFinish();
add_task(async function() {
const iconUrl = "http://example.org/browser/extensions/cookie/test/damonbowling.jpg";
await SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 1]]});
Services.prefs.setIntPref("network.cookie.cookieBehavior", 1);
let promise = TestUtils.topicObserved("cookie-rejected", subject => {
let uri = subject.QueryInterface(Components.interfaces.nsIURI);
return uri.spec == iconUrl;
});
Services.obs.addObserver(function (theSubject, theTopic, theData) {
var uri = theSubject.QueryInterface(Components.interfaces.nsIURI);
var domain = uri.host;
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
registerCleanupFunction(async function() {
await BrowserTestUtils.removeTab(tab);
});
if (domain == "example.org") {
ok(true, "foreign favicon cookie was blocked");
Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
Services.obs.removeObserver(arguments.callee, "cookie-rejected");
finish();
}
}, "cookie-rejected");
// kick off a favicon load
gBrowser.setIcon(gBrowser.selectedTab, "http://example.org/tests/extensions/cookie/test/damonbowling.jpg",
Services.scriptSecurityManager.getSystemPrincipal());
}
// Kick off a favicon load.
gBrowser.setIcon(tab, iconUrl);
await promise;
ok(true, "foreign favicon cookie was blocked");
});

View File

@ -2,8 +2,6 @@
support-files =
beltzner.jpg
beltzner.jpg^headers^
damonbowling.jpg
damonbowling.jpg^headers^
file_chromecommon.js
file_domain_hierarchy_inner.html
file_domain_hierarchy_inner_inner.html