1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_bug578534.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +function test() { 1.9 + let uriString = "http://example.com/"; 1.10 + let cookieBehavior = "network.cookie.cookieBehavior"; 1.11 + let uriObj = Services.io.newURI(uriString, null, null) 1.12 + let cp = Components.classes["@mozilla.org/cookie/permission;1"] 1.13 + .getService(Components.interfaces.nsICookiePermission); 1.14 + 1.15 + Services.prefs.setIntPref(cookieBehavior, 2); 1.16 + 1.17 + cp.setAccess(uriObj, cp.ACCESS_ALLOW); 1.18 + gBrowser.selectedTab = gBrowser.addTab(uriString); 1.19 + waitForExplicitFinish(); 1.20 + gBrowser.selectedBrowser.addEventListener("load", onTabLoaded, true); 1.21 + 1.22 + function onTabLoaded() { 1.23 + is(gBrowser.selectedBrowser.contentWindow.navigator.cookieEnabled, true, 1.24 + "navigator.cookieEnabled should be true"); 1.25 + // Clean up 1.26 + gBrowser.selectedBrowser.removeEventListener("load", onTabLoaded, true); 1.27 + gBrowser.removeTab(gBrowser.selectedTab); 1.28 + Services.prefs.setIntPref(cookieBehavior, 0); 1.29 + cp.setAccess(uriObj, cp.ACCESS_DEFAULT); 1.30 + finish(); 1.31 + } 1.32 +}