1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/extensions/cookie/test/browser_test_favicon.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,27 @@ 1.4 +// tests third party cookie blocking using a favicon load directly from chrome. 1.5 +// in this case, the docshell of the channel is chrome, not content; thus 1.6 +// the cookie should be considered third party. 1.7 + 1.8 +function test() { 1.9 + waitForExplicitFinish(); 1.10 + 1.11 + Services.prefs.setIntPref("network.cookie.cookieBehavior", 1); 1.12 + 1.13 + Services.obs.addObserver(function (theSubject, theTopic, theData) { 1.14 + var uri = theSubject.QueryInterface(Components.interfaces.nsIURI); 1.15 + var domain = uri.host; 1.16 + 1.17 + if (domain == "example.org") { 1.18 + ok(true, "foreign favicon cookie was blocked"); 1.19 + 1.20 + Services.prefs.setIntPref("network.cookie.cookieBehavior", 0); 1.21 + 1.22 + Services.obs.removeObserver(arguments.callee, "cookie-rejected"); 1.23 + 1.24 + finish(); 1.25 + } 1.26 + }, "cookie-rejected", false); 1.27 + 1.28 + // kick off a favicon load 1.29 + gBrowser.setIcon(gBrowser.selectedTab, "http://example.org/tests/extensions/cookie/test/damonbowling.jpg"); 1.30 +}