extensions/cookie/test/browser_test_favicon.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 // tests third party cookie blocking using a favicon load directly from chrome.
michael@0 2 // in this case, the docshell of the channel is chrome, not content; thus
michael@0 3 // the cookie should be considered third party.
michael@0 4
michael@0 5 function test() {
michael@0 6 waitForExplicitFinish();
michael@0 7
michael@0 8 Services.prefs.setIntPref("network.cookie.cookieBehavior", 1);
michael@0 9
michael@0 10 Services.obs.addObserver(function (theSubject, theTopic, theData) {
michael@0 11 var uri = theSubject.QueryInterface(Components.interfaces.nsIURI);
michael@0 12 var domain = uri.host;
michael@0 13
michael@0 14 if (domain == "example.org") {
michael@0 15 ok(true, "foreign favicon cookie was blocked");
michael@0 16
michael@0 17 Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
michael@0 18
michael@0 19 Services.obs.removeObserver(arguments.callee, "cookie-rejected");
michael@0 20
michael@0 21 finish();
michael@0 22 }
michael@0 23 }, "cookie-rejected", false);
michael@0 24
michael@0 25 // kick off a favicon load
michael@0 26 gBrowser.setIcon(gBrowser.selectedTab, "http://example.org/tests/extensions/cookie/test/damonbowling.jpg");
michael@0 27 }

mercurial