mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
// tests third party cookie blocking using a favicon load directly from chrome.
|
|
// in this case, the docshell of the channel is chrome, not content; thus
|
|
// the cookie should be considered third party.
|
|
|
|
function test() {
|
|
waitForExplicitFinish();
|
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
prefs.setIntPref("network.cookie.cookieBehavior", 1);
|
|
|
|
var os = Components.classes["@mozilla.org/observer-service;1"]
|
|
.getService(Components.interfaces.nsIObserverService);
|
|
os.addObserver(function (theSubject, theTopic, theData) {
|
|
var uri = theSubject.QueryInterface(Components.interfaces.nsIURI);
|
|
var domain = uri.host;
|
|
|
|
if (domain == "example.org") {
|
|
ok(true, "foreign favicon cookie was blocked");
|
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
prefs.setIntPref("network.cookie.cookieBehavior", 0);
|
|
|
|
os.removeObserver(arguments.callee, "cookie-rejected");
|
|
|
|
finish();
|
|
}
|
|
}, "cookie-rejected", false);
|
|
|
|
// kick off a favicon load
|
|
PageProxySetIcon("http://example.org/tests/extensions/cookie/test/damonbowling.jpg");
|
|
}
|