[Pkg-mozext-commits] [SCM] Cookie Monster extension for Iceweasel/Firefox branch, master, updated. upstream/1.0.5-12-g3ab9ed7
Ximin Luo
infinity0 at gmx.com
Thu Aug 4 23:01:01 UTC 2011
The following commit has been merged in the master branch:
commit 7bb8712941f3c29f7aa09891337f69465728ff91
Author: Ximin Luo <infinity0 at gmx.com>
Date: Thu Aug 4 23:58:03 2011 +0100
expand cookiemonster.jar like xpi-repack would have; this allows `uscan --force-download` to regen the orig.tar.bz2
diff --git a/chrome/cookiemonster.jar b/chrome/cookiemonster.jar
deleted file mode 100644
index 57d710c..0000000
Binary files a/chrome/cookiemonster.jar and /dev/null differ
diff --git a/chrome/cookiemonster.jar!/content/cookieInfo.js b/chrome/cookiemonster.jar!/content/cookieInfo.js
new file mode 100644
index 0000000..c7b76fc
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookieInfo.js
@@ -0,0 +1,585 @@
+/**
+ * Retrieve cookie information for the current URL
+ * @type cookieMonster_CookieInfo
+ */
+var cookieMonster_CookieInfo =
+{
+ choice: null,
+ _bundle: null,
+ _isExactPerm: false,
+ _isEffectiveTLDService: false,
+ _tempAllowList: null,
+ _globalOverrideList: null,
+
+ init: function()
+ {
+ // Declare instance of cookie permission and
+ // query an nsICookiePermission interface
+ this.choice = Components.classes["@mozilla.org/cookie/permission;1"].createInstance();
+ this.choice.QueryInterface(Components.interfaces.nsICookiePermission);
+
+ this._bundle = document.getElementById("cookie-preferences");
+
+ // Check if the method testExactPermission is available
+ // in the version of the Moz engine being used
+ // Note: Currently, testExactPermission is not available
+ // in Moz 1.8 (FF2), but is available in Moz 1.9 (FF3)
+ var accessString = CM_COOKIE_ACCESS_DEFAULT;
+ var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
+ .getService(Components.interfaces.nsIPermissionManager);
+ if (permissionManager.testExactPermission)
+ {
+ this._isExactPerm = true;
+ }
+
+ // Check if the service nsIEffectiveTLDService is available
+ // in the version of the Moz engine being used
+ // Note: Currently, testExactPermission is not available
+ // in Moz 1.8 (FF2), but is available in Moz 1.9 (FF3)
+ if (Components.classes["@mozilla.org/network/effective-tld-service;1"])
+ {
+ this._isEffectiveTLDService = true;
+ }
+
+ // Initialize TempAllow
+ cookieMonster_TempAllow.init();
+
+ // Check if CM_PREFERENCE_TYPE_GLOBAL_OVERRIDE contains
+ // any URLs and if so, add to _globalOverrideList
+ this._globalOverrideList = cookieMonster_nsPreferences.getStringPrefArray(CM_PREFERENCE_TYPE_GLOBAL_OVERRIDE);
+ },
+
+ isExactPermissions: function()
+ {
+ return this._isExactPerm;
+ },
+
+ getGlobalOverrideList: function()
+ {
+ return this._globalOverrideList;
+ },
+
+ setGlobalOverrideList: function()
+ {
+ this._globalOverrideList = cookieMonster_nsPreferences.getStringPrefArray(CM_PREFERENCE_TYPE_GLOBAL_OVERRIDE);
+ },
+
+ // Check the cookie access level for the URI and
+ // return this value
+ checkCookieAccess: function(aRequest, aURI)
+ {
+ aRequest.QueryInterface(Components.interfaces.nsIChannel);
+
+ return this.choice.canAccess(aURI , aRequest.originalURI , aRequest);
+ },
+
+ // Check the cookie access level for the URI and
+ // return a string representation of this value
+ checkCookieAccessString: function(aRequest, aURI)
+ {
+ var accessString = CM_COOKIE_ACCESS_DEFAULT;
+
+ aRequest.QueryInterface(Components.interfaces.nsIChannel);
+
+ switch (this.choice.canAccess(aURI , aRequest.originalURI , aRequest))
+ {
+ case CM_CA_LEVEL_DEFAULT:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessString = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessString = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessString = CM_COOKIE_ACCESS_SESSION;
+ break;
+ default:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+
+ return accessString;
+ },
+
+ // Check the permission access level for the URI and
+ // return a string representation of this value
+ checkPermissionString: function(aURI, aType)
+ {
+ var accessString = CM_COOKIE_ACCESS_DEFAULT;
+ var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
+ .getService(Components.interfaces.nsIPermissionManager);
+
+ switch (permissionManager.testPermission(aURI ,aType))
+ {
+ case 0:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessString = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessString = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessString = CM_COOKIE_ACCESS_SESSION;
+ break;
+ default:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+
+ return accessString;
+ },
+
+ // Check the exact permission access level for the URI and
+ // return an array of string representation of the values
+ // for both the top level and 2nd level domain,
+ // plus a standard testPermission on the URI
+ // testExactPermission requires an exact hostname match - subdomains are not a match
+ checkPermissionArray: function(aURI, aType)
+ {
+ var accessStringTop = CM_COOKIE_ACCESS_DEFAULT;
+ var accessStringSecond = CM_COOKIE_ACCESS_DEFAULT;
+ var accessString = CM_COOKIE_ACCESS_DEFAULT;
+ var accessArray = new Array(accessStringTop, accessStringSecond, accessString);
+ var secondURI = this.getSecondLevelURI(aURI);
+ var tempURIIndex = -1;
+
+ var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
+ .getService(Components.interfaces.nsIPermissionManager);
+
+ // Determine what test permission method to use based
+ // on the value of _isExactPermission
+ if (this._isExactPerm)
+ {
+ // Top level domain
+ switch (permissionManager.testExactPermission(aURI ,aType))
+ {
+ case CM_CA_LEVEL_DEFAULT:
+ accessStringTop = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessStringTop = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessStringTop = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessStringTop = CM_COOKIE_ACCESS_SESSION;
+ break;
+ default:
+ accessStringTop = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+
+ // Second level domain
+ switch (permissionManager.testExactPermission(secondURI ,aType))
+ {
+ case CM_CA_LEVEL_DEFAULT:
+ accessStringSecond = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessStringSecond = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessStringSecond = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessStringSecond = CM_COOKIE_ACCESS_SESSION;
+ break;
+ default:
+ accessStringSecond = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+ }
+ else
+ {
+ // Second level domain
+ switch (permissionManager.testPermission(secondURI ,aType))
+ {
+ case CM_CA_LEVEL_DEFAULT:
+ accessStringSecond = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessStringSecond = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessStringSecond = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessStringSecond = CM_COOKIE_ACCESS_SESSION;
+ break;
+ default:
+ accessStringSecond = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+
+ // Top level domain
+ switch (permissionManager.testPermission(aURI ,aType))
+ {
+ case CM_CA_LEVEL_DEFAULT:
+ accessStringTop = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessStringTop = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessStringTop = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessStringTop = CM_COOKIE_ACCESS_SESSION;
+ break;
+ default:
+ accessStringTop = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+ }
+
+ // Standard testPermission for URI (End Result)
+ switch (permissionManager.testPermission(aURI ,aType))
+ {
+ case CM_CA_LEVEL_DEFAULT:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessString = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessString = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessString = CM_COOKIE_ACCESS_SESSION;
+ break;
+ default:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+
+ // Lastly check to see if this is a temporary permission
+ //tempURIIndex = this._tempAllowList.indexOf(aURI.asciiHost);
+ //if (tempURIIndex > -1)
+ if (cookieMonster_TempAllow.isTempPermission(aURI))
+ {
+ accessStringTop = CM_COOKIE_ACCESS_TEMP_ALLOW;
+ accessString = CM_COOKIE_ACCESS_TEMP_ALLOW;
+ }
+
+ //tempURIIndex = this._tempAllowList.indexOf(secondURI.asciiHost);
+ //if (tempURIIndex > -1)
+ if (cookieMonster_TempAllow.isTempPermission(secondURI))
+ {
+ accessStringSecond = CM_COOKIE_ACCESS_TEMP_ALLOW;
+ accessString = CM_COOKIE_ACCESS_TEMP_ALLOW;
+
+ // If not ExactPerm and second level is temporary,
+ // then if top level is allow, change to temporary
+ // because any cookies will be deleted upon exit
+ if (!this._isExactPerm && (accessStringTop == CM_COOKIE_ACCESS_ALLOW))
+ {
+ accessStringTop = CM_COOKIE_ACCESS_TEMP_ALLOW;
+ }
+ }
+
+ accessArray[CM_TOP_LEVEL] = accessStringTop;
+ accessArray[CM_SECOND_LEVEL] = accessStringSecond;
+ accessArray[CM_URL_STANDARD_LEVEL] = accessString;
+
+ return accessArray;
+ },
+
+ // Input the numeric permission level and
+ // return a string representation of this value
+ getPermissionString: function(aValue)
+ {
+ var accessString = CM_COOKIE_ACCESS_DEFAULT;
+
+ switch (aValue*1)
+ {
+ case CM_CA_LEVEL_DEFAULT:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ case nsIPermissionManager.ALLOW_ACTION:
+ accessString = CM_COOKIE_ACCESS_ALLOW;
+ break;
+ case nsIPermissionManager.DENY_ACTION:
+ accessString = CM_COOKIE_ACCESS_DENY;
+ break;
+ case nsICookiePermission.ACCESS_SESSION:
+ accessString = CM_COOKIE_ACCESS_SESSION;
+ break;
+ case CM_CA_LEVEL_TEMP_ALLOW:
+ accessString = CM_COOKIE_ACCESS_TEMP_ALLOW;
+ break;
+ default:
+ accessString = CM_COOKIE_ACCESS_DEFAULT;
+ break;
+ }
+
+ return accessString;
+ },
+
+ // Input the string representation
+ // of the permission level and
+ // return the numeric representation of this value
+ getPermissionValue: function(aValue)
+ {
+ var accessValue = CM_CA_LEVEL_DEFAULT;
+
+ switch (aValue)
+ {
+ case CM_COOKIE_ACCESS_DEFAULT:
+ accessValue = CM_CA_LEVEL_DEFAULT;
+ break;
+ case CM_COOKIE_ACCESS_ALLOW:
+ accessValue = nsIPermissionManager.ALLOW_ACTION;
+ break;
+ case CM_COOKIE_ACCESS_DENY:
+ accessValue = nsIPermissionManager.DENY_ACTION;
+ break;
+ case CM_COOKIE_ACCESS_SESSION:
+ accessValue = nsICookiePermission.ACCESS_SESSION;
+ break;
+ case CM_COOKIE_ACCESS_TEMP_ALLOW:
+ accessValue = CM_CA_LEVEL_TEMP_ALLOW;
+ break;
+ default:
+ accessValue = CM_CA_LEVEL_DEFAULT;
+ break;
+ }
+
+ return accessValue;
+ },
+
+ // Set override for hosts cookie access
+ setCookieAccess: function(aURI, aAccess, aDomainType)
+ {
+ var hostURI = null;
+ var accessLevel = null;
+ var tempHostIndex = -1;
+
+ if (aDomainType == CM_SECOND_LEVEL)
+ {
+ hostURI = this.getSecondLevelURI(aURI);
+ }
+ else
+ {
+ hostURI = aURI;
+ }
+
+ // Check if temporary access
+ if (aAccess == CM_CA_LEVEL_TEMP_ALLOW)
+ {
+ // Check if URI already has a non-default cookie access
+ cookieMonster_TempAllow.add(hostURI);
+ aAccess = nsIPermissionManager.ALLOW_ACTION;
+ }
+ else if (cookieMonster_TempAllow.isTempPermission(hostURI))
+ {
+ cookieMonster_TempAllow.remove(hostURI);
+
+ // If the updated permission is Deny or Default, where Default
+ // is Deny, then delete any cookies set for this host
+ if ((aAccess == nsIPermissionManager.DENY_ACTION) ||
+ ((aAccess == 0) && (cookieMonster_PrefObserver.getCookiePrefString() == "Rejected")))
+ {
+ //alert("aAccess = " + aAccess);
+ // Set aUseBaseDomain to true
+ this.deleteHostCookies(aURI.asciiHost, true);
+ }
+ }
+
+ this.choice.setAccess(hostURI, aAccess);
+
+ // If new access is deny and the preference
+ // deletecookiesondeny is true
+ // then delete existing cookies for this host
+ if ((aAccess == nsIPermissionManager.DENY_ACTION) &&
+ cookieMonster_nsPreferences.getBoolPref("deletecookiesondeny", false))
+ {
+ this.deleteHostCookies(hostURI.host, false);
+ }
+ },
+
+ // Convert URI to Second Level Domain
+ // (i.e. groups.yahoo.com to yahoo.com)
+ getSecondLevelURI: function(aURI)
+ {
+ // Parse the host string
+ var hostString = aURI.asciiHost;
+ var newHostString = null;
+ var newHost = aURI;
+
+ newHostString = cookieMonster_CookieInfo.getSecondLevelHost(hostString);
+ newHost = cookieMonster_Utils.createURIFromHostName(newHostString);
+
+ return newHost;
+ },
+
+ // Convert Host String to Second Level Domain
+ // (i.e. groups.yahoo.com to yahoo.com)
+ getSecondLevelHost: function(aHost)
+ {
+ // Parse the host string
+ var checkExp = /^com|^net|^org|^edu/i;
+ var checkSpecialTwo = /^au|^uk|^tw|^br/i;
+ var newHostString = null;
+
+ // Is the effective-tld-service available
+ if (this._isEffectiveTLDService)
+ {
+ try
+ {
+ var eTLDService = Components.classes["@mozilla.org/network/effective-tld-service;1"]
+ .getService(Components.interfaces.nsIEffectiveTLDService);
+
+ //alert("Test TLDService: " + eTLDService.getBaseDomain(cookieMonster._oldURL));
+ newHostString = eTLDService.getBaseDomainFromHost(aHost);
+ }
+ catch(e)
+ {
+ newHostString = aHost;
+ }
+ }
+ else
+ {
+ // Is this the special case where
+ // the URI ends in two characters
+ var hostParts = aHost.split(".");
+
+ // Do not parse if hostParts.length < 3
+ if (hostParts.length >= 3)
+ {
+ // Normal URI
+ if (hostParts[hostParts.length - 1].length > 2)
+ {
+ newHostString = hostParts[hostParts.length - 2] + "." +
+ hostParts[hostParts.length - 1];
+ }
+ // Check to see if special
+ // (e.g. www.domain.com.au)/com|net|org|edu/
+ else if((checkExp.test(hostParts[hostParts.length - 2]) &&
+ hostParts[hostParts.length - 1].length <= 2) ||
+ checkSpecialTwo.test(hostParts[hostParts.length - 1]))
+ {
+
+ newHostString = hostParts[hostParts.length - 3] + "." +
+ hostParts[hostParts.length - 2] + "." +
+ hostParts[hostParts.length - 1];
+ }
+ else
+ {
+ newHostString = hostParts[hostParts.length - 2] + "." +
+ hostParts[hostParts.length - 1];
+ }
+ }
+ else
+ {
+ newHostString = aHost;
+ }
+ }
+
+ //alert("Old Host: " + aHost + " New Host: " + newHostString);
+ return newHostString;
+ },
+
+ // Get Override Global cookie permissions for URI
+ checkOverrideGlobal: function(aURI)
+ {
+ var overrideArray = new Array(false, false);
+ var secondURI = this.getSecondLevelURI(aURI);
+ var tempURIIndex = -1;
+
+ // Check both top level and second level URI's
+ tempURIIndex = this._globalOverrideList.indexOf(aURI.asciiHost);
+ overrideArray[CM_TOP_LEVEL] = (tempURIIndex > -1);
+
+ tempURIIndex = this._globalOverrideList.indexOf(secondURI.asciiHost);
+ overrideArray[CM_SECOND_LEVEL] = (tempURIIndex > -1);
+
+ return overrideArray;
+ },
+
+ // Add URI asciihost to Override Global cookie permissions list
+ addOverrideGlobal: function(aHost, aDomainType)
+ {
+ var hostDomain = aHost;
+ if (aDomainType == CM_SECOND_LEVEL)
+ {
+ hostDomain = this.getSecondLevelHost(aHost);
+ }
+
+ this._globalOverrideList.push(hostDomain);
+ cookieMonster_nsPreferences.setAppendToStringPref(CM_PREFERENCE_TYPE_GLOBAL_OVERRIDE, hostDomain);
+ },
+
+ // Remove URI asciihost from Override Global cookie permissions list
+ removeOverrideGlobal: function(aHost, aDomainType)
+ {
+ var hostDomain = aHost;
+ var overrideHostIndex = -1;
+
+ if (aDomainType == CM_SECOND_LEVEL)
+ {
+ hostDomain = this.getSecondLevelHost(aHost);
+ }
+
+ overrideHostIndex = this._globalOverrideList.indexOf(hostDomain);
+ if (overrideHostIndex > -1)
+ {
+ this._globalOverrideList.splice(overrideHostIndex, 1);
+ cookieMonster_nsPreferences.setStringPrefArray(CM_PREFERENCE_TYPE_GLOBAL_OVERRIDE, this._globalOverrideList);
+ }
+ },
+
+ // Remove all URI asciihosts from Override Global cookie permissions list
+ removeAllOverrideGlobal: function()
+ {
+ this._globalOverrideList = new Array();
+ cookieMonster_nsPreferences.clearUserPref(CM_PREFERENCE_TYPE_GLOBAL_OVERRIDE);
+
+ // Reset any global override permissions in place
+ cookieMonster.extResetGlobalCookiePref();
+ },
+
+ // Delete cookies from host
+ deleteHostCookies: function(aHost, aUseBaseDomain)
+ {
+ var deleteHost = aHost;
+ var cookieManager = Components.classes["@mozilla.org/cookiemanager;1"]
+ .getService(Components.interfaces.nsICookieManager);
+
+ // If checking 2nd level domain names, make sure
+ // deleteHost is a 2nd level domain of aHost
+ if (aUseBaseDomain)
+ {
+ deleteHost = this.getSecondLevelHost(aHost);
+ }
+
+ var iter = cookieManager.enumerator;
+ while (iter.hasMoreElements())
+ {
+ var cookie = iter.getNext();
+
+ if (cookie instanceof Components.interfaces.nsICookie)
+ {
+ // Delete cookies matching aHost
+ var cookieHost = (cookie.host.charAt(0) == ".") ? cookie.host.substring(1,cookie.host.length) : cookie.host;
+
+ // If checking 2nd level domain names, make sure
+ // cookieHost is a 2nd level domain of the cookie
+ if (aUseBaseDomain)
+ {
+ cookieHost = this.getSecondLevelHost(cookieHost);
+ }
+
+ if (cookieHost == deleteHost)
+ {
+ //alert("Delete: " + cookie.host);
+ cookieManager.remove(cookie.host , cookie.name , cookie.path , 0);
+ }
+ }
+ }
+ }
+}
diff --git a/chrome/cookiemonster.jar!/content/cookieMonster.js b/chrome/cookiemonster.jar!/content/cookieMonster.js
new file mode 100644
index 0000000..44a1b68
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookieMonster.js
@@ -0,0 +1,1249 @@
+// cookieMonster.js
+// Tony Schilling
+// Created: 01/20/2007
+// Last Updated: 04/08/2010
+
+// Use XPCOM to detect browser tab changes and
+// interface to the cookie manager and the
+// permission manager,
+// in order to read and possibly update
+// the cookie status for the current URI
+
+// Constants
+const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+const nsICookiePermission = Components.interfaces.nsICookiePermission;
+const CM_ICON_DEFAULT_ORIGINAL = "chrome://cookiemonster/skin/face-monkey-small.png";
+const CM_ICON_DEFAULT = "chrome://cookiemonster/skin/cookie-monster-logo.png";
+const CM_ICON_TEMP_ALLOW = "chrome://cookiemonster/skin/face-angel-temp.png";
+const CM_ICON_ALLOW = "chrome://cookiemonster/skin/face-angel.png";
+const CM_ICON_DENY = "chrome://cookiemonster/skin/face-devil-grin.png";
+const CM_ICON_SESSION = "chrome://cookiemonster/skin/face-glasses.png";
+const CM_ICON_ALLOW_OG = "chrome://cookiemonster/skin/face-angel-og.png";
+const CM_ICON_SESSION_OG = "chrome://cookiemonster/skin/face-glasses-og.png";
+const CM_TOP_LEVEL = 0;
+const CM_SECOND_LEVEL = 1;
+const CM_URL_STANDARD_LEVEL = 2;
+const CM_CA_LEVEL_TEMP_ALLOW = -1;
+const CM_CA_LEVEL_DEFAULT = 0;
+const CM_COOKIE_ACCESS_DEFAULT = "Default";
+const CM_COOKIE_ACCESS_DEFAULT_ORIGINAL = "DefaultOriginal";
+const CM_COOKIE_ACCESS_DENY = "Deny";
+const CM_COOKIE_ACCESS_ALLOW = "Allow";
+const CM_COOKIE_ACCESS_SESSION = "Session";
+const CM_COOKIE_ACCESS_TEMP_ALLOW = "Temp";
+const CM_COOKIE_ACCESS_ALLOW_OG = "AllowOG";
+const CM_COOKIE_ACCESS_SESSION_OG = "SessionOG";
+const CM_PERMISSION_TYPE_COOKIE = "cookie";
+const CM_PREFERENCE_TYPE_COOKIE_TEMP = "tempcookie";
+const CM_PREFERENCE_TYPE_GLOBAL_OVERRIDE = "overrideglobal";
+const CM_PREF_COOKIE_BEHAVIOR = 0;
+const CM_PREF_LIFETIME_POLICY = 1;
+const CM_PREF_BLOCK_THIRD_PARTY = 1;
+const CM_GLOBAL_COOKIE_PERM_REJECTED = "Rejected";
+
+// Retrieve the URL for the current (active) browser
+function getURL()
+{
+ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
+ getService(Components.interfaces.nsIWindowMediator);
+ var recentWindow = wm.getMostRecentWindow("navigator:browser");
+ return recentWindow ? recentWindow.content.document.location : null;
+}
+
+// Based upon code sample from MozillaZine
+// http://kb.mozillazine.org/Progress_listeners
+// Progress listeners allow extensions to be notified of events associated
+// with documents loading in the browser and with tab switching events.
+// Progress listeners implement the nsIWebProgressListener interface.
+// Create an object which implements nsIWebProgressListener
+var cookieMonster_urlBarListener =
+{
+ QueryInterface: function(aIID)
+ {
+ if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
+ aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
+ aIID.equals(Components.interfaces.nsISupports))
+ return this;
+ throw Components.results.NS_NOINTERFACE;
+ },
+
+ onLocationChange: function(aProgress, aRequest, aURI)
+ {
+ if ((aURI != null) && cookieMonster.extGetIsAllowGlobalOverride())
+ {
+ cookieMonster.extCheckGlobalCookiePref(aURI);
+ }
+ if (!aProgress.DOMWindow.frameElement)
+ {
+ cookieMonster.processNewURL(aProgress, aRequest, aURI);
+ }
+ return 0;
+ },
+
+ onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
+ {
+ // If you use myListener for more than one tab/window, use
+ // aWebProgress.DOMWindow to obtain the tab/window which triggers the state change
+// if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_START)
+// {
+// // This fires when the load event is initiated
+// //alert("Start State Flags: " + aStateFlags + " Request Name: " + aRequest.name);
+// }
+//
+// if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
+// {
+// // This fires when the load finishes
+// //alert("Stop State Flags: " + aStateFlags + " Host: " + aWebProgress.DOMWindow.document.baseURIObject.host + " Request Name: " + aRequest.name);
+//
+// // Filter out the REQUEST only stops, as they do not indicate
+// // the completion of the page load
+// if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK)
+// //if(aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW &
+// // aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK)
+// {
+// var currentBrowser = aWebProgress.DOMWindow.document;
+// var location = aRequest.QueryInterface(Components.interfaces.nsIChannel).URI;
+//// alert("Load Event Finished for gBrowser : " + gBrowser.currentURI.host +
+//// " and aWebProgress.DOMWindow: " + currentBrowser.baseURIObject.host +
+//// " and aRequest URI: " + location);
+//
+// // Process any cookies not assigned to a host
+// //cookieMonster_ThirdParty.processUnassigned(this._currentLoadHost);
+// //cookieMonster.setThirdPartyCookieSubMenu(cookieMonster_ThirdParty.retrieveData(this._currentLoadHost));
+// }
+// }
+
+ return 0;
+ },
+ onProgressChange: function() {return 0;},
+ onStatusChange: function() {return 0;},
+ onSecurityChange: function() {return 0;},
+ onLinkIconAvailable: function() {return 0;}
+};
+
+// Based upon code sample from MozillaZine
+// http://kb.mozillazine.org/Progress_listeners
+// Progress listeners allow extensions to be notified of events associated
+// with documents loading in the browser and with tab switching events.
+// Progress listeners implement the nsIWebProgressListener interface.
+// Create an object which implements nsIWebProgressListener
+var cookieMonster_tabProgressListener =
+{
+ QueryInterface: function(aIID)
+ {
+ if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
+ aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
+ aIID.equals(Components.interfaces.nsISupports))
+ return this;
+ throw Components.results.NS_NOINTERFACE;
+ },
+
+ onLocationChange: function(aBrowser, aProgress, aRequest, aURI)
+ {
+ //alert("Location Change: " + aBrowser.currentURI.asciiHost);
+ return 0;
+ },
+
+ onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus)
+ {
+ const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+
+ if (aStateFlags & nsIWebProgressListener.STATE_START && aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)
+ {
+ // This fires when the load event of type network is initiated
+ //alert("Start State Flags: " + aStateFlags + " Request Name: " + aRequest.name);
+ cookieMonster_CookieRequest.clearBrowser(aBrowser);
+ }
+
+ if (aStateFlags & nsIWebProgressListener.STATE_STOP && aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)
+ {
+ // Process any cookie requests made by browser during load
+ cookieMonster_CookieRequest.processCookieRequests(aBrowser);
+ }
+
+ return 0;
+ },
+ onProgressChange: function() {return 0;},
+ onStatusChange: function() {return 0;},
+ onSecurityChange: function() {return 0;},
+ onLinkIconAvailable: function() {return 0;}
+};
+
+var cookieMonster =
+{
+ _oldURL: null,
+ _oldAccess: null,
+ _browser: null,
+ _menuBundle: null,
+ _userDefault: null,
+ _statusBarPanel: null,
+ _statusBarMenu: null,
+ _statusBarMenuId: null,
+ _statusBarSubMenu: null,
+ _statusBarSubMenuId: null,
+ _statusBarMenuArray: null,
+ _secondLevel: false,
+ _secondLevelId: null,
+ _secondLevelMenuOption: null,
+ _thirdPartyMenuOption: null,
+ _thirdPartyId: null,
+ _globalOverrideId: null,
+ _globalOverrideMenuOption: null,
+ _usingGlobalOverride: false,
+ _allowGlobalOverride: false,
+ _currentGlobalPreference: new Array(),
+ _currentSubMenu: CM_SECOND_LEVEL,
+ _reloadOnPermissionChange: false,
+ _menuStatus: false,
+ _iconArray: null,
+ _flagMenuEvent: false,
+ _flagGlobalCookieEvent: false,
+
+ init: function()
+ {
+ var copyURI = null;
+ // Listen for webpage loads
+ // gBrowser is only accessible from the scope of Firefox,
+ // to use gBrowser within an extension you must declare it
+ this._browser = document.getElementById("content");
+ this._browser.addProgressListener(cookieMonster_urlBarListener,
+ Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+ gBrowser.addTabsProgressListener(cookieMonster_tabProgressListener);
+
+ gBrowser.tabContainer.addEventListener("TabClose", cookieMonster.tabUnload, false);
+
+ copyURI = Components.classes["@mozilla.org/network/io-service;1"].
+ getService(Components.interfaces.nsIIOService);
+ this._oldURL = copyURI.newURI("about:blank", null, null);
+ this._oldAccess = new Array(CM_COOKIE_ACCESS_DEFAULT, CM_COOKIE_ACCESS_DEFAULT, CM_COOKIE_ACCESS_DEFAULT);
+
+ // Add extension name to cookieMonster_nsPreferences
+ cookieMonster_nsPreferences.mBranch = "cookiemonster";
+
+ // Initialize CookieInfo and Utils
+ cookieMonster_CookieInfo.init();
+ cookieMonster_Utils.init();
+
+ // Register preferences and permission observers
+ cookieMonster_PrefObserver.register();
+ cookieMonster_ObserverService.register();
+
+ // Retrieve users's default cookie permissions
+ this._userDefault = cookieMonster_PrefObserver.getCookiePrefString();
+ this._currentGlobalPreference = cookieMonster_PrefObserver.getCookiePrefArray();
+
+ // Create a reference to all the menu elements
+ this._menuBundle = document.getElementById("cookie-menu-labels");
+ this._statusBarPanel = document.getElementById("cookiemonster-status");
+
+// if (cookieMonster_CookieInfo.isExactPermissions())
+// {
+// this._statusBarMenuId = "cookie-access";
+// this._secondLevelId = "second-level";
+// this._statusBarSubMenuId = "cookie-access-alternate";
+// }
+// else
+// {
+// this._statusBarMenuId = "cookie-access-old";
+// this._secondLevelId = "second-level-old";
+// this._statusBarSubMenuId = "cookie-access-alternate";
+// }
+
+ this._statusBarMenuId = "cookie-access";
+ this._secondLevelId = "option-second-level";
+ this._statusBarSubMenuId = "cookie-access-alternate";
+ this._globalOverrideId = "show-global-override";
+ this._thirdPartyId = "cookie-thirdparty-permissions";
+
+ // Retrieve the current value for secondlevelurl and
+ // initialize secondlevelurl in StatusbarMenu
+ this._secondLevel = cookieMonster_nsPreferences.getBoolPref("secondlevelurl", false);
+
+ this._statusBarMenu = document.getElementById(this._statusBarMenuId);
+ this._statusBarMenu.addEventListener('command', function(event) {cookieMonster.extMenuCommandHandler(event)},
+ true);
+
+ this._statusBarSubMenu = document.getElementById(this._statusBarSubMenuId);
+
+ this._statusBarMenuArray = new Array(this._statusBarMenu, this._statusBarSubMenu);
+
+ this._secondLevelMenuOption = document.getElementById(this._secondLevelId);
+
+ if (this._secondLevel)
+ {
+ this._secondLevelMenuOption.setAttribute("checked", "true");
+ this.switchCookieSubMenu();
+ }
+
+ this._thirdPartyMenuOption = document.getElementById(this._thirdPartyId);
+
+ // Retrieve the current value for enableglobalcookieoverride
+ this._allowGlobalOverride = cookieMonster_nsPreferences.getBoolPref("enableglobalcookieoverride", false);
+ this._globalOverrideMenuOption = document.getElementById(this._globalOverrideId);
+ this._globalOverrideMenuOption.setAttribute("disabled", !this._allowGlobalOverride);
+
+ // Retrieve the current value for reloadOnPermissionChange
+ this._reloadOnPermissionChange = cookieMonster_nsPreferences.getBoolPref("reloadonpermissionchange", false);
+
+ // Set tooltip attribute for enhanced tool tip info
+ this._statusBarPanel.removeAttribute("tooltiptext");
+ this._statusBarPanel.setAttribute("tooltip", "cookie-results");
+
+ this._statusBarPanel.addEventListener('command',
+ function(event) {cookieMonster.extThirdPartyMenuLoadHandler(event)}, false);
+
+ // Load icons into _iconArray (actually an object)
+ this._iconArray = new Object();
+
+ // Determine what default icon to use
+ if (!cookieMonster_nsPreferences.getBoolPref("originaldefaulticon", false))
+ {
+ this._iconArray[CM_COOKIE_ACCESS_DEFAULT] = CM_ICON_DEFAULT;
+ }
+ else
+ {
+ this._iconArray[CM_COOKIE_ACCESS_DEFAULT] = CM_ICON_DEFAULT_ORIGINAL;
+ }
+
+ this._iconArray[CM_COOKIE_ACCESS_TEMP_ALLOW] = CM_ICON_TEMP_ALLOW;
+ this._iconArray[CM_COOKIE_ACCESS_ALLOW] = CM_ICON_ALLOW;
+ this._iconArray[CM_COOKIE_ACCESS_DENY] = CM_ICON_DENY;
+ this._iconArray[CM_COOKIE_ACCESS_SESSION] = CM_ICON_SESSION;
+ this._iconArray[CM_COOKIE_ACCESS_ALLOW_OG] = CM_ICON_ALLOW_OG;
+ this._iconArray[CM_COOKIE_ACCESS_SESSION_OG] = CM_ICON_SESSION_OG;
+ },
+
+ uninit: function()
+ {
+ this._browser.removeProgressListener(cookieMonster_urlBarListener);
+ gBrowser.removeTabsProgressListener(cookieMonster_tabProgressListener);
+
+ gBrowser.tabContainer.removeEventListener("TabClose", cookieMonster.tabUnload, false);
+
+ // Unregister all observers
+ cookieMonster_PrefObserver.unregister();
+ cookieMonster_ObserverService.unregister();
+ },
+
+ tabUnload: function(evt)
+ {
+ var browser = gBrowser.getBrowserForTab(evt.target);
+ //cookieMonster_CookieRequest.removeHost(browser.currentURI.asciiHost);
+ cookieMonster_CookieRequest.removeBrowser(browser);
+ },
+
+ processNewURL: function(aProgress, aRequest, aURI)
+ {
+ // Check to see if the URI contains any data
+ if ((aURI != null) && (aURI.asciiHost != undefined))
+ {
+ // If necessary, "Enable" popup menu for statusbar panel
+ this.setStatusMenuEnabled(true);
+
+ // Check if the URI is changing
+ if (aURI.spec != this._oldURL.spec)
+ {
+ // Update oldURL and oldAccess
+ this._oldURL = aURI.clone();
+ this._oldAccess = cookieMonster_CookieInfo.checkPermissionArray(aURI, CM_PERMISSION_TYPE_COOKIE);
+
+ // if host is empty, "disable" statusbar menu \s\w*
+ if (aURI.asciiHost.replace(/^\s*$/, "") == "")
+ {
+ this.setStatusMenuEnabled(false);
+ }
+ }
+
+ // Update statusbar menu
+ cookieMonster.updateStatusbarMenu(this._oldURL.asciiHost, this._oldAccess);
+ }
+ else
+ {
+ // If URI is blank, then "disable" popup menu for statusbar panel
+ this.setStatusMenuEnabled(false);
+ }
+ },
+
+ // Update the text and menuitems in the statusbar popup menu
+ updateStatusbarMenu: function(aHost, aAccess)
+ {
+ //alert("Host: " + aHost + " Access: " + aAccess[CM_TOP_LEVEL]);
+ var menuNodes = null;
+ var hostDisplay = aHost;
+ var hostDomain = cookieMonster_CookieInfo.getSecondLevelHost(aHost);
+ var hostAccess = aAccess[CM_URL_STANDARD_LEVEL];
+ var checkOldAccess = aAccess[CM_TOP_LEVEL];
+ var permissionsDisplayTop = document.getElementById("permissions-top");
+ var permissionsDisplaySecond = document.getElementById("permissions-second");
+ var permissionsDisplayResult = document.getElementById("permissions-result");
+ var cookieTooltipSite = document.getElementById("cookie-group-site");
+ var cookieTooltipDomain = document.getElementById("cookie-group-domain");
+ var cookieTooltipResult = document.getElementById("cookie-group-result");
+ var showCookiesCurrentDomain = document.getElementById("show-cookies-site");
+ var deleteCookiesCurrentDomain = document.getElementById("delete-cookies-site");
+
+ // If the user has selected 2nd Level domains,
+ // then display as such
+ if (this._secondLevel)
+ {
+ hostDisplay = hostDomain;
+ checkOldAccess = aAccess[CM_SECOND_LEVEL];
+ }
+
+ // Walk the menus to update the menuitems
+ for (var x = 0; x < this._statusBarMenuArray.length; x++)
+ {
+ if (this._statusBarMenuArray[x].hasChildNodes())
+ {
+ menuNodes = this._statusBarMenuArray[x].childNodes;
+ for (var i = 0; i < menuNodes.length; i++)
+ {
+ var menu = menuNodes [i];
+ if (menu.nodeName != "menuitem")
+ {
+ continue;
+ }
+
+ // If access level matches node, then name
+ // current-access in order for image to show
+ var idName = menu.getAttribute("id").split("-");
+ var idDomain = idName[idName.length - 2];
+ var idParsed = idName[idName.length - 1];
+
+ if (idDomain == "top")
+ {
+ if (idParsed == aAccess[CM_TOP_LEVEL].toString().toLowerCase())
+ {
+ menu.setAttribute("name","current-access");
+ }
+ else
+ {
+ menu.setAttribute("name","cookie-top");
+ }
+ menu.setAttribute("label", this._menuBundle.getString(idParsed) + " " + aHost);
+ }
+ else if (idDomain == "second")
+ {
+ if (idParsed == aAccess[CM_SECOND_LEVEL].toString().toLowerCase())
+ {
+ menu.setAttribute("name","current-access");
+ }
+ else
+ {
+ menu.setAttribute("name","cookie-two");
+ }
+ menu.setAttribute("label", this._menuBundle.getString(idParsed) + " " + hostDomain);
+ }
+ else if (idDomain == "default")
+ {
+ if (idParsed == aAccess[CM_URL_STANDARD_LEVEL].toString().toLowerCase())
+ {
+ menu.setAttribute("name","current-access");
+ }
+ else
+ {
+ menu.setAttribute("name","cookie-default");
+ }
+ menu.setAttribute("label", this._menuBundle.getString(idParsed) + " (" + this._userDefault + ")");
+ }
+ else if (idDomain == "access")
+ {
+ // This is for the old version of the menu
+ if (idParsed == checkOldAccess.toString().toLowerCase())
+ {
+ menu.setAttribute("name","current-access");
+ }
+ else
+ {
+ menu.setAttribute("name","cookie-access");
+ }
+ menu.setAttribute("label", this._menuBundle.getString(idParsed) + " " + hostDisplay);
+
+ // For default, display users cookie permission preferences
+ if (idParsed == CM_COOKIE_ACCESS_DEFAULT.toLowerCase())
+ {
+ menu.setAttribute("label", this._menuBundle.getString(idParsed) + " (" + this._userDefault + ")");
+ }
+ }
+ }
+ }
+ }
+
+ // Add domain name to show cookies for current site and delete cookies
+ // for current site
+ showCookiesCurrentDomain.setAttribute("label", this._menuBundle.getString("showcurrentcookies") + " " + hostDomain);
+ showCookiesCurrentDomain.setAttribute("name", hostDomain);
+ deleteCookiesCurrentDomain.setAttribute("label", this._menuBundle.getString("deletecurrentcookies") + " " + hostDomain);
+ deleteCookiesCurrentDomain.setAttribute("name", hostDomain);
+
+ // Update permissions Synopsis and Enhanced Tooltip
+ permissionsDisplayTop.setAttribute("label", this._menuBundle.getString("sitepermissions") +
+ " (" + aHost + "): " + this._menuBundle.getString(aAccess[CM_TOP_LEVEL]));
+ permissionsDisplaySecond.setAttribute("label", this._menuBundle.getString("domainpermissions") +
+ " (" + hostDomain + "): " + this._menuBundle.getString(aAccess[CM_SECOND_LEVEL]));
+ permissionsDisplayResult.setAttribute("label", this._menuBundle.getString("permissionsresultfor") +
+ " " + aHost + ": " + this._menuBundle.getString(hostAccess));
+
+ permissionsDisplayTop.setAttribute("image", this.getIcon(aAccess[CM_TOP_LEVEL])); //this._iconArray[aAccess[CM_TOP_LEVEL]]
+ permissionsDisplaySecond.setAttribute("image", this.getIcon(aAccess[CM_SECOND_LEVEL]));
+ permissionsDisplayResult.setAttribute("image", this.getIcon(hostAccess));
+
+ cookieTooltipSite.firstChild.setAttribute("label", this._menuBundle.getString("sitepermissions") +
+ ": " + this._menuBundle.getString(aAccess[CM_TOP_LEVEL]));
+ cookieTooltipDomain.firstChild.setAttribute("label", this._menuBundle.getString("domainpermissions") +
+ ": " + this._menuBundle.getString(aAccess[CM_SECOND_LEVEL]));
+ cookieTooltipResult.firstChild.setAttribute("label", this._menuBundle.getString("permissionsresult") +
+ ": " + this._menuBundle.getString(hostAccess));
+
+ cookieTooltipSite.firstChild.setAttribute("image", this.getIcon(aAccess[CM_TOP_LEVEL]));
+ cookieTooltipDomain.firstChild.setAttribute("image", this.getIcon(aAccess[CM_SECOND_LEVEL]));
+ cookieTooltipResult.firstChild.setAttribute("image", this.getIcon(hostAccess));
+
+ cookieTooltipSite.lastChild.setAttribute("value", aHost);
+ cookieTooltipDomain.lastChild.setAttribute("value", hostDomain);
+ cookieTooltipResult.lastChild.setAttribute("value", aHost);
+
+ // Set the icon for the status bar menu
+ this._statusBarPanel.setAttribute("src", this.getIcon(hostAccess));
+ },
+
+ // Swap the menu items in the submenu
+ // with those in the main menu,
+ // based on the _secondLevel flag
+ switchCookieSubMenu: function()
+ {
+ if (this._secondLevel)
+ {
+ this.setCookieSubMenu(CM_TOP_LEVEL);
+ }
+ else
+ {
+ this.setCookieSubMenu(CM_SECOND_LEVEL);
+ }
+ },
+
+ // Move cookie setting menu items for aUrlLevel
+ // to the submenu and place the cookie setting menu items
+ // for the other aUrlLevel in the main menu
+ setCookieSubMenu: function(aUrlLevel)
+ {
+ var cookieMenuItems = new Array(
+ new Array(document.getElementById("cookie-access-top-temp"), document.getElementById("cookie-access-second-temp")),
+ new Array(document.getElementById("cookie-access-top-allow"), document.getElementById("cookie-access-second-allow")),
+ new Array(document.getElementById("cookie-access-top-deny"), document.getElementById("cookie-access-second-deny")),
+ new Array(document.getElementById("cookie-access-top-session"), document.getElementById("cookie-access-second-session"))
+ );
+ var cookieMenuSeparator = document.getElementById("temp-after-this");
+ var altAccessMenu = document.getElementById("cookie-access-menu");
+ var accessMenuLabel = this._menuBundle.getString("sitemenulabel");
+ var swapCookieMenuItems;
+
+ // Check current setting to see if
+ // a switch is necessary
+ if (aUrlLevel != this._currentSubMenu)
+ {
+ // Configure how the cookieMenuItems array values
+ // are sent to the replace command
+ if (aUrlLevel == CM_SECOND_LEVEL)
+ {
+ // Reverse the array order for each menu item
+ for (var i = 0, menuItems; menuItems = cookieMenuItems[i]; i++)
+ {
+ menuItems.reverse();
+ }
+
+ // Change the label to (2nd) Domain level
+ accessMenuLabel = this._menuBundle.getString("domainmenulabel");
+ }
+
+ // Replace menu items in sub menu
+ swapCookieMenuItems = cookieMenuItems.map(function(menuItem)
+ {
+ //alert("swapCookieMenuItems: menuItem " + menuItem[0].getAttribute("id"));
+ var replaceItem = this._statusBarSubMenu.replaceChild(menuItem[0], menuItem[1]);
+ return replaceItem;
+ }, cookieMonster);
+
+ // Add replaced menu items to main status bar menu
+ for (var i = 0, swapMenuItem; swapMenuItem = swapCookieMenuItems[i]; i++)
+ {
+ // Place menu item temp after correct menu separator
+ if (i == 0)
+ {
+ this._statusBarMenu.insertBefore(swapMenuItem, cookieMenuSeparator.nextSibling);
+ }
+ else
+ {
+ this._statusBarMenu.appendChild(swapMenuItem);
+ }
+ }
+
+ // Change this._currentSubMenu to aUrllevel
+ this._currentSubMenu = aUrlLevel;
+ altAccessMenu.setAttribute("label", this._menuBundle.getString("alternatecookieaccess") + " (" + accessMenuLabel + ")");
+ }
+ },
+
+ /**
+ * Update the sub menu structure for any 3rd Party Cookies,
+ * including creating menu items for each one
+ * @param {CookieInfo[]} aThirdPartyCookieList
+ */
+ setThirdPartyCookieSubMenu: function(aThirdPartyCookieList)
+ {
+ var defaultMenuItem;
+ var tempAllowAllMenuItem;
+ var tempRevokeAllMenuItem;
+ var thirdPartyHosts = new Array();
+ var menu = this._thirdPartyMenuOption;
+
+ // Remove all menuitems
+ if (menu.hasChildNodes())
+ {
+ while(menu.hasChildNodes())
+ {
+ menu.removeChild(menu.firstChild);
+ }
+ }
+
+ // If aThirdPartyCookieList contains no cookie info,
+ // make the default menu item visible
+ // Else Add menu items for each third party cookie and
+ // make the default menu item invisible
+ if (aThirdPartyCookieList == null || aThirdPartyCookieList.length == 0)
+ {
+ defaultMenuItem = document.createElement("menuitem");
+ defaultMenuItem.id = "cookie-thirdparty-default-none";
+ defaultMenuItem.setAttribute("label", this._menuBundle.getString("thirdpartynone"));
+ defaultMenuItem.setAttribute("class", "menuitem-iconic");
+ defaultMenuItem.setAttribute("disabled", "true");
+ menu.appendChild(defaultMenuItem);
+ }
+ else
+ {
+ aThirdPartyCookieList.forEach(
+ function(tempCookieItem, index)
+ {
+ // First construct the menu
+ var tempMenuItem = document.createElement("menu");
+ var hostAccess = cookieMonster_CookieInfo.getPermissionString(tempCookieItem.accessValue);
+
+ tempMenuItem.id = "cookie-thirdparty-" + index;
+ tempMenuItem.setAttribute("label", this._menuBundle.getString("permissionsresultfor") +
+ " " + tempCookieItem.host + ": " + this._menuBundle.getString(hostAccess));
+ tempMenuItem.setAttribute("image", this.getIcon(hostAccess));
+ tempMenuItem.setAttribute("class", "menu-iconic");
+ tempMenuItem.addEventListener('command',
+ function(event) {cookieMonster.extThirdPartyMenuSiteHandler(event, tempCookieItem.host)}, false);
+ menu.appendChild(tempMenuItem);
+
+ // Then create a popup containing all of the cookie access choices
+ var tempMenuPopup = tempMenuItem.appendChild(document.createElement("menupopup"));
+
+ tempMenuPopup.appendChild(this._createThirdPartyMenuItem("default", 0, tempCookieItem));
+ tempMenuPopup.appendChild(document.createElement("menuseparator"));
+ tempMenuPopup.appendChild(this._createThirdPartyMenuItem("temp", -1, tempCookieItem));
+ tempMenuPopup.appendChild(document.createElement("menuseparator"));
+ tempMenuPopup.appendChild(this._createThirdPartyMenuItem("allow", 1, tempCookieItem));
+ tempMenuPopup.appendChild(this._createThirdPartyMenuItem("deny", 2, tempCookieItem));
+ tempMenuPopup.appendChild(this._createThirdPartyMenuItem("session", 8, tempCookieItem));
+
+ // Add host to third party host array
+ thirdPartyHosts.push(tempCookieItem.host);
+ }, this
+ );
+
+ menu.appendChild(document.createElement("menuseparator"));
+ tempAllowAllMenuItem = document.createElement("menuitem");
+ tempAllowAllMenuItem.id = "cookie-thirdparty-tempallow-all";
+ tempAllowAllMenuItem.setAttribute("label", this._menuBundle.getString("thirdpartytempallowall"));
+ tempAllowAllMenuItem.setAttribute("class", "menuitem-iconic");
+ tempAllowAllMenuItem.addEventListener('command',
+ function(event) {cookieMonster.extThirdPartyMenuAllHandler(event, thirdPartyHosts)}, false);
+ menu.appendChild(tempAllowAllMenuItem);
+
+ tempRevokeAllMenuItem = document.createElement("menuitem");
+ tempRevokeAllMenuItem.id = "cookie-thirdparty-tempallow-revoke";
+ tempRevokeAllMenuItem.setAttribute("label", this._menuBundle.getString("thirdpartytemprevokeall"));
+ tempRevokeAllMenuItem.setAttribute("class", "menuitem-iconic");
+ tempRevokeAllMenuItem.addEventListener('command',
+ function(event) {cookieMonster.extThirdPartyMenuAllHandler(event, thirdPartyHosts, true)}, false);
+ menu.appendChild(tempRevokeAllMenuItem);
+ }
+ },
+
+ /**
+ * Create menu item for third party cookie menu
+ * @param {String} aType
+ * @param {Integer} aMenuItemValue
+ * @param {CookieInfo} aCookieItem
+ * @return {nsIDOMElement} menu item
+ */
+ _createThirdPartyMenuItem: function(aType, aMenuItemValue, aCookieItem)
+ {
+ var cookieMenuItem = document.createElement("menuitem");
+
+ cookieMenuItem.id = "cookie-access-third-" + aType;
+ cookieMenuItem.value = aMenuItemValue.toString();
+ cookieMenuItem.setAttribute("name", "cookie-three");
+ cookieMenuItem.setAttribute("label", this._menuBundle.getString(aType) + " " + aCookieItem.host);
+ cookieMenuItem.setAttribute("class", "menuitem-iconic");
+
+ // Update label if default
+ if (aType == "default")
+ {
+ if (this._currentGlobalPreference[CM_PREF_COOKIE_BEHAVIOR] != CM_PREF_BLOCK_THIRD_PARTY)
+ {
+ cookieMenuItem.setAttribute("label", this._menuBundle.getString(aType) + " (" + this._userDefault + ")");
+ }
+ else
+ {
+ cookieMenuItem.setAttribute("label", this._menuBundle.getString("thirdpartyblocked"));
+ }
+ }
+
+ if (aCookieItem.accessValue == aMenuItemValue)
+ {
+ cookieMenuItem.setAttribute("name", "current-access");
+ }
+
+ return cookieMenuItem;
+ },
+
+ setStatusMenuEnabled: function(aEnable)
+ {
+ // Set popup attribute to desired status, if necessary
+ if (aEnable != this._menuStatus)
+ {
+ if (aEnable)
+ {
+ this._statusBarPanel.setAttribute("popup", this._statusBarMenuId);
+ }
+ else
+ {
+ // If disable popup, then
+ // set the icon for the status bar menu to default
+ this._statusBarPanel.setAttribute("popup", "");
+ this._statusBarPanel.setAttribute("src", this._iconArray[CM_COOKIE_ACCESS_DEFAULT]);
+ }
+
+ // Set member variable to track status of the menu
+ this._menuStatus = aEnable;
+ }
+ },
+
+ // Get the appropriate icon for the access type
+ // (Replaces _iconArray for now, in order to
+ // properly handle the Global Override functionality)
+ getIcon: function(aAccess)
+ {
+ var retValue = this._iconArray[aAccess];
+
+ // Check Global Override settings
+ if (this._usingGlobalOverride && this._allowGlobalOverride)
+ {
+ if (aAccess == CM_COOKIE_ACCESS_ALLOW)
+ {
+ retValue = this._iconArray[CM_COOKIE_ACCESS_ALLOW_OG];
+ }
+ else if (aAccess == CM_COOKIE_ACCESS_SESSION)
+ {
+ retValue = this._iconArray[CM_COOKIE_ACCESS_SESSION_OG];
+ }
+ }
+
+ return retValue;
+ },
+
+ // External access to current URI
+ extGetCurrentURI: function()
+ {
+ return this._oldURL;
+ },
+
+ // External access to current URI.asciihost,
+ // based on domain type
+ extGetCurrentHost: function()
+ {
+ var currentHost = this._oldURL.asciiHost;
+
+ if (this._secondLevel)
+ {
+ currentHost = cookieMonster_CookieInfo.getSecondLevelHost(currentHost);
+ }
+
+ return currentHost;
+ },
+
+ // External access to current domain type
+ extGetCurrentDomainType: function()
+ {
+ var domainType = CM_URL_STANDARD_LEVEL;
+
+ if (this._secondLevel)
+ {
+ domainType = CM_SECOND_LEVEL;
+ }
+ else
+ {
+ domainType = CM_TOP_LEVEL;
+ }
+
+ return domainType;
+ },
+
+ // External access to _allowGlobalOverride
+ extGetIsAllowGlobalOverride: function()
+ {
+ return this._allowGlobalOverride;
+ },
+
+ // External access to reloading the current page
+ extReloadCurrentPage: function()
+ {
+ this._browser.reload(this._browser.webNavigation.LOAD_FLAGS_BYPASS_CACHE);
+ },
+
+ // Return numeric representation of cookie access level
+ // for current URL and domainType
+ // If domainType is not passed, then domainType = CM_URL_STANDARD_LEVEL
+ // by default
+ // If aURI is not passed, then aURI = current URL
+ extGetCookieAccess: function()
+ {
+ var domainType = CM_URL_STANDARD_LEVEL;
+ var aURI = this._oldURL;
+
+ if (arguments.length == 1)
+ {
+ domainType = arguments[0];
+ }
+ else if (arguments.length == 2)
+ {
+ domainType = arguments[0];
+ aURI = arguments[1];
+ }
+
+ var accessLevel = cookieMonster_CookieInfo.checkPermissionArray(aURI, CM_PERMISSION_TYPE_COOKIE);
+ return cookieMonster_CookieInfo.getPermissionValue(accessLevel[domainType]);
+ },
+
+ extSetCookieAccess: function(aAccess, domainType)
+ {
+ //alert("Setting Cookie Status for " + this._oldURL.asciiHost);
+ cookieMonster_CookieInfo.setCookieAccess(this._oldURL, aAccess, domainType);
+ this._oldAccess = cookieMonster_CookieInfo.checkPermissionArray(this._oldURL, CM_PERMISSION_TYPE_COOKIE);
+ },
+
+ extResetTempCookies: function(/*, aQuit */)
+ {
+ var aQuit = false || Boolean(arguments[0]);
+
+ // Set menu event flag so we don't double trigger a permissions update
+ this._flagMenuEvent = true;
+
+ cookieMonster_TempAllow.resetTempCookies();
+
+ if (!aQuit)
+ {
+ this._oldAccess = cookieMonster_CookieInfo.checkPermissionArray(this._oldURL, CM_PERMISSION_TYPE_COOKIE);
+
+ // Only reload page if reloadOnPermissionChange preference == true
+ if (this._reloadOnPermissionChange)
+ {
+ this._browser.reload(this._browser.webNavigation.LOAD_FLAGS_BYPASS_CACHE);
+ }
+
+ this.updateStatusbarMenu(this._oldURL.asciiHost, this._oldAccess);
+ }
+
+ // Reset menu event flag
+ this._flagMenuEvent = false;
+ },
+
+ // If current URL is part of override global cookie list,
+ // then the global cookie prefs will be changed to match
+ // the individual cookie prefs for the URL
+ // Else if current URL is NOT part of override global cookie list
+ // then the global cookies prefs will be set to the user's current
+ // global preferences
+ extCheckGlobalCookiePref: function(aURI)
+ {
+ var overrideGlobal = null;
+ var currentSiteAccess = CM_CA_LEVEL_DEFAULT;
+// var domainType = CM_TOP_LEVEL;
+//
+// if (this._secondLevel)
+// {
+// domainType = CM_SECOND_LEVEL;
+// }
+
+ overrideGlobal = cookieMonster_CookieInfo.checkOverrideGlobal(aURI);
+
+ // For now, set _usingGlobalOverride if either CM_TOP_LEVEL or
+ // CM_SECOND_LEVEL are set, as the Global Override setting
+ // allows cookies, period, thus paying no attention to the
+ // domain level of the cookie
+ this._usingGlobalOverride = overrideGlobal[CM_TOP_LEVEL] || overrideGlobal[CM_SECOND_LEVEL];
+
+ if (this._usingGlobalOverride && this._allowGlobalOverride)
+ {
+ // Set _flagGlobalCookieEvent so _currentGlobalPreferences
+ // are not changed during a global override
+ this._flagGlobalCookieEvent = true;
+
+ // Check for the resulting current site access (CM_URL_STANDARD_LEVEL)
+ // to coincide with the preface of setting global override
+ // if either CM_TOP_LEVEL or CM_SECOND_LEVEL are set
+ currentSiteAccess = cookieMonster.extGetCookieAccess(CM_URL_STANDARD_LEVEL, aURI);
+ //alert("Current URL Access: " + currentSiteAccess);
+
+ if (currentSiteAccess == nsIPermissionManager.ALLOW_ACTION)
+ {
+ cookieMonster_PrefObserver.setCookiePref(new Array(0, 0));
+ }
+ else if (currentSiteAccess == nsICookiePermission.ACCESS_SESSION)
+ {
+ cookieMonster_PrefObserver.setCookiePref(new Array(0, 2));
+ }
+ else
+ {
+ cookieMonster.extResetGlobalCookiePref();
+ }
+
+ // Reset flag
+ this._flagGlobalCookieEvent = false;
+ }
+ else
+ {
+ cookieMonster.extResetGlobalCookiePref();
+ }
+ },
+
+ // Either add or remove current URL from override global list
+ extSetGlobalCookiePref: function()
+ {
+ //var aSet = this._usingGlobalOverride;
+ var domainType = CM_TOP_LEVEL;
+
+ if (this._secondLevel)
+ {
+ domainType = CM_SECOND_LEVEL;
+ }
+ //alert("Setting Global Cookie Status for " + this._oldURL.asciiHost);
+
+ if (this._usingGlobalOverride)
+ {
+ cookieMonster_CookieInfo.addOverrideGlobal(this._oldURL.asciiHost, domainType);
+ }
+ else
+ {
+ cookieMonster_CookieInfo.removeOverrideGlobal(this._oldURL.asciiHost, domainType);
+ }
+ },
+
+ extResetGlobalCookiePref: function()
+ {
+ // Have the global permissions been changed
+ var curGlobalCookie = cookieMonster_PrefObserver.getCookiePrefArray();
+
+ //alert("curGlobalCookie: " + curGlobalCookie + " defaultGlobPref: " + this._currentGlobalPreference);
+ if ((curGlobalCookie[CM_PREF_COOKIE_BEHAVIOR] != this._currentGlobalPreference[CM_PREF_COOKIE_BEHAVIOR]) ||
+ (curGlobalCookie[CM_PREF_LIFETIME_POLICY] != this._currentGlobalPreference[CM_PREF_LIFETIME_POLICY]))
+ {
+ cookieMonster_PrefObserver.setCookiePref(this._currentGlobalPreference);
+ }
+ },
+
+ // Process the commands pertaining
+ // to the menu choices made by the user
+ extMenuCommandHandler: function(evt)
+ {
+ var checkExpCookie = /^cookie-access/i;
+ var checkExpOptions = /^option-/i;
+ var itemPicked = null;
+ var accessString = null;
+ var accessValue = null;
+
+ var itemPicked = document.getElementById(evt.target.id);
+ //alert("Menu Command Event Id: " + evt.target.id + " CM_TOP_LEVEL: " + this._oldAccess[CM_TOP_LEVEL]);
+
+ // Set menu event flag so we don't double trigger a permissions update
+ this._flagMenuEvent = true;
+
+ // If id contains cookie-access and name = cookie, then assign new
+ // cookie access and reload page
+ if (checkExpCookie.test(evt.target.id))
+ {
+ if (itemPicked.getAttribute("name") == "cookie-top")
+ {
+ this.extSetCookieAccess(evt.target.value, CM_TOP_LEVEL);
+ }
+ else if(itemPicked.getAttribute("name") == "cookie-two")
+ {
+ this.extSetCookieAccess(evt.target.value, CM_SECOND_LEVEL);
+ }
+ else if(itemPicked.getAttribute("name") == "cookie-access")
+ {
+ if (this._secondLevel)
+ {
+ this.extSetCookieAccess(evt.target.value, CM_SECOND_LEVEL);
+ }
+ else
+ {
+ this.extSetCookieAccess(evt.target.value, CM_TOP_LEVEL);
+ }
+ }
+ else if(itemPicked.getAttribute("name") == "cookie-default")
+ {
+ this.extSetCookieAccess(evt.target.value, CM_TOP_LEVEL);
+ this.extSetCookieAccess(evt.target.value, CM_SECOND_LEVEL);
+ }
+
+ // Only reload page if reloadOnPermissionChange preference == true
+ if (this._reloadOnPermissionChange)
+ {
+ this._browser.reload(this._browser.webNavigation.LOAD_FLAGS_BYPASS_CACHE);
+ }
+
+ //accessString = cookieMonster_CookieInfo.getPermissionString(evt.target.value);
+ this.updateStatusbarMenu(this._oldURL.asciiHost, this._oldAccess);
+ }
+ else if (checkExpOptions.test(evt.target.id))
+ {
+ // If id=second-level, then determine
+ // if it is checked and set variable and
+ // user preference cookiemonster.secondlevelurl and
+ // call switchCookieSubMenu to check if the cookie
+ // submenu needs to be switched
+ // Else if id = this._globalOverrideId, then
+ // update user cookie preferences
+ if ((evt.target.id == this._secondLevelId) &&
+ (this._secondLevel != itemPicked.getAttribute("checked")))
+ {
+ this._secondLevel = itemPicked.getAttribute("checked");
+ cookieMonster_nsPreferences.setBoolPref("secondlevelurl", this._secondLevel);
+ }
+/* else if((evt.target.id == this._globalOverrideId) &&
+ (this._usingGlobalOverride != itemPicked.getAttribute("checked")))
+ {
+ itemPicked.setAttribute("checked", this._usingGlobalOverride);
+ //this.extSetGlobalCookiePref();
+ //this._browser.reload(this._browser.webNavigation.LOAD_FLAGS_BYPASS_CACHE);
+ //alert("Global Override Option: " + this._usingGlobalOverride);
+ } */
+ }
+
+ // Reset menu event flag
+ this._flagMenuEvent = false;
+
+ return false;
+ },
+
+ /**
+ * Handle the command event for loading the third party menu
+ * @param {Event} evt
+ */
+ extThirdPartyMenuLoadHandler: function(evt)
+ {
+ var cookieRequestData = cookieMonster_CookieRequest.getRequestList(this._oldURL.asciiHost);
+ cookieMonster.setThirdPartyCookieSubMenu(cookieRequestData);
+ //alert("length: " + cookieRequestData.length);
+ evt.stopPropagation();
+ },
+
+ /**
+ * Handle the command event for the third party menu items
+ * @param {Event} evt
+ * @param {String} aHost
+ */
+ extThirdPartyMenuSiteHandler: function(evt, aHost)
+ {
+ var hostURI = cookieMonster_Utils.createURIFromHostName(aHost);
+ cookieMonster_CookieInfo.setCookieAccess(hostURI, evt.target.value, CM_TOP_LEVEL);
+
+ if (!this._reloadOnPermissionChange)
+ {
+ cookieMonster_CookieRequest.updateCookieRequest(aHost, this._oldURL.asciiHost);
+ }
+
+ evt.stopPropagation();
+ },
+
+ /**
+ * Handle the command event for the third party menu items
+ * of temp allow all or temp allow revoke
+ * @param {Event} evt
+ * @param {String[]} aHosts
+ * @optional {Boolean} aRevoke
+ */
+ extThirdPartyMenuAllHandler: function(evt, aHosts /*, aRevoke */)
+ {
+ var aRevoke = false || Boolean(arguments[2]);
+
+ aHosts.forEach(
+ function(host, index)
+ {
+ if (!aRevoke)
+ {
+ var hostURI = cookieMonster_Utils.createURIFromHostName(host);
+ cookieMonster_CookieInfo.setCookieAccess(hostURI, -1, CM_TOP_LEVEL);
+ }
+ else
+ {
+ cookieMonster_TempAllow.resetTempCookie(host);
+ }
+
+ if (!this._reloadOnPermissionChange)
+ {
+ cookieMonster_CookieRequest.updateCookieRequest(host, this._oldURL.asciiHost);
+ }
+ }, this
+ );
+
+ // Only reload page if reloadOnPermissionChange preference == true
+ if (this._reloadOnPermissionChange)
+ {
+ this._browser.reload(this._browser.webNavigation.LOAD_FLAGS_BYPASS_CACHE);
+ }
+
+ //alert("Got to extThirdPartyMenuAllHandler: target: " + evt.currentTarget.id + " hosts: " + aHosts.toSource());
+
+ evt.stopPropagation();
+ },
+
+ extSetSiteRequestedSetCookie: function(evt)
+ {
+ var cookieTooltipAttempt = document.getElementById("cookie-group-attempt");
+ var attemptDisplay = null;
+
+ // Set the tool tip text indicating if the site has requested
+ // to leave cookies
+ if (cookieMonster_CookieRequest.hasMadeCookieRequest(this._oldURL.asciiHost))
+ {
+ attemptDisplay = this._menuBundle.getString("siteattemptedcookie");
+ }
+ else
+ {
+ attemptDisplay = this._menuBundle.getString("sitenotattemptedcookie");
+ }
+
+ cookieTooltipAttempt.lastChild.setAttribute("value", attemptDisplay);
+
+ evt.stopPropagation();
+ },
+
+ // Set values based on preferences
+ extUpdateFromPreferences: function(aPref)
+ {
+ var globalOverridePref = null;
+
+ if (aPref == "secondlevelurl")
+ {
+ this._secondLevel = cookieMonster_nsPreferences.getBoolPref("secondlevelurl", false);
+
+ if (this._secondLevel)
+ {
+ this._secondLevelMenuOption.setAttribute("checked", "true");
+ }
+ else
+ {
+ this._secondLevelMenuOption.setAttribute("checked", "false");
+ }
+
+ this.updateStatusbarMenu(this._oldURL.asciiHost, this._oldAccess);
+ this.switchCookieSubMenu();
+ }
+ else if (aPref == "enableglobalcookieoverride")
+ {
+ // Retrieve the new value for enableglobalcookieoverride
+ globalOverridePref = cookieMonster_nsPreferences.getBoolPref("enableglobalcookieoverride", false);
+
+ // If enableglobalcookieoverride has changed then assign
+ // the updated value, update the menu, reset global cookie
+ // prefs if _allowGlobalOverride is false, and reload page
+ // if the current URI is using global override
+ if (this._allowGlobalOverride != globalOverridePref)
+ {
+ this._allowGlobalOverride = globalOverridePref;
+ this._globalOverrideMenuOption.setAttribute("disabled", !this._allowGlobalOverride);
+
+ if (!this._allowGlobalOverride)
+ {
+ this.extResetGlobalCookiePref();
+ }
+
+ if (this._usingGlobalOverride)
+ {
+ this._browser.reload(this._browser.webNavigation.LOAD_FLAGS_BYPASS_CACHE);
+ }
+ }
+ }
+ else if (aPref == "originaldefaulticon")
+ {
+ // Determine what default icon to use
+ if (!cookieMonster_nsPreferences.getBoolPref("originaldefaulticon", false))
+ {
+ this._iconArray[CM_COOKIE_ACCESS_DEFAULT] = CM_ICON_DEFAULT;
+ }
+ else
+ {
+ this._iconArray[CM_COOKIE_ACCESS_DEFAULT] = CM_ICON_DEFAULT_ORIGINAL;
+ }
+
+ this.updateStatusbarMenu(this._oldURL.asciiHost, this._oldAccess);
+ }
+ else if (aPref == "reloadonpermissionchange")
+ {
+ this._reloadOnPermissionChange = cookieMonster_nsPreferences.getBoolPref("reloadonpermissionchange", false);
+ }
+ else if ((aPref == "cookieBehavior") || (aPref == "lifetimePolicy"))
+ {
+ // Retrieve users's updated default cookie permissions and
+ // update Statusbar menu
+ this._userDefault = cookieMonster_PrefObserver.getCookiePrefString();
+
+ if (!this._flagGlobalCookieEvent)
+ {
+ this._currentGlobalPreference = cookieMonster_PrefObserver.getCookiePrefArray();
+ }
+
+ this.updateStatusbarMenu(this._oldURL.asciiHost, this._oldAccess);
+ }
+ },
+
+ // Set values based on permissions
+ extUpdateFromPermissions: function(aHost)
+ {
+ var currentURL = this._oldURL.host;
+
+ // If the user has selected 2nd Level domains, then compare as such
+ if (this._secondLevel)
+ {
+ currentURL = cookieMonster_CookieInfo.getSecondLevelHost(this._oldURL.host);
+ }
+
+ // Retrieve new cookies permission for current URL, reload page and
+ // update status bar
+ if ((aHost == currentURL) && !this._flagMenuEvent)
+ {
+ //alert("Permission Event and Not Menu Event: " + this._oldAccess);
+ this._oldAccess = cookieMonster_CookieInfo.checkPermissionArray(this._oldURL, CM_PERMISSION_TYPE_COOKIE);
+
+ // Only reload page if reloadOnPermissionChange preference == true
+ if (this._reloadOnPermissionChange)
+ {
+ this._browser.reload(this._browser.webNavigation.LOAD_FLAGS_BYPASS_CACHE);
+ }
+
+ this.updateStatusbarMenu(this._oldURL.asciiHost, this._oldAccess);
+ }
+ }
+};
+
+// Edit: for me on Firefox 2.0, I had to change "document" to "window"
+// for the following lines to work
+window.addEventListener("load", function() {cookieMonster.init()},
+false);
+window.addEventListener("unload", function() {cookieMonster.uninit()},
+false);
diff --git a/chrome/cookiemonster.jar!/content/cookieMonster.xul b/chrome/cookiemonster.jar!/content/cookieMonster.xul
new file mode 100644
index 0000000..b6171d4
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookieMonster.xul
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<!DOCTYPE window SYSTEM "chrome://cookiemonster/locale/cookieMonster.dtd">
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="&title.label;">
+
+<hbox align="center">
+ <description flex="1">&separate.label;</description>
+ <groupbox>
+ <caption label="Cookie Rule"/>
+ <radiogroup oncommand="window.arguments[1](event.target.value); false;">
+ <radio id="default" value="0" selected="true" label="Default"/>
+ <radio id="allow" value="1" label="Allow"/>
+ <radio id="deny" value="2" label="Deny"/>
+ <radio id="session" value="8" label="Session"/>
+ </radiogroup>
+ </groupbox>
+ <spacer style="width: 10px;"/>
+ <button label="&close.label;" oncommand="close();"/>
+</hbox>
+
+</window>
diff --git a/chrome/cookiemonster.jar!/content/cookiePreferences.js b/chrome/cookiemonster.jar!/content/cookiePreferences.js
new file mode 100644
index 0000000..0a6ff9a
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookiePreferences.js
@@ -0,0 +1,493 @@
+/**
+ * cookieMonster_nsPreferences - a wrapper around nsIPrefService. Provides built in
+ * exception handling to make preferences access simpler.
+ * Based on chrome://global/content/nsUserSettings.js
+ **/
+var cookieMonster_nsPreferences =
+{
+ _branch: null,
+
+ get mPrefService()
+ {
+ if (this._branch != undefined)
+ {
+ return Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch)
+ .getBranch(this._branch);
+ }
+ else
+ {
+ return Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+ }
+ },
+
+ set mBranch(aExtension)
+ {
+ this._branch = "extensions." + aExtension + ".";
+ },
+
+ // Boolean preferences
+ setBoolPref: function (aPrefName, aPrefValue)
+ {
+ try
+ {
+ // This looks weird, but otherwise, setBoolPref
+ // for aPrefValue = true does not work for me
+ if (aPrefValue)
+ {
+ this.mPrefService.setBoolPref(aPrefName, true);
+ }
+ else
+ {
+ this.mPrefService.setBoolPref(aPrefName, false);
+ }
+ }
+ catch(e)
+ {
+ }
+ },
+
+ getBoolPref: function (aPrefName, aDefVal)
+ {
+ try
+ {
+ return this.mPrefService.getBoolPref(aPrefName);
+ }
+ catch(e)
+ {
+ return aDefVal != undefined ? aDefVal : null;
+ }
+ return null; // quiet warnings
+ },
+
+ // String preferences
+ setStringPref: function (aPrefName, aPrefValue)
+ {
+ try
+ {
+ this.mPrefService.setCharPref(aPrefName, aPrefValue);
+ }
+ catch(e)
+ {
+ }
+ },
+
+ setAppendToStringPref: function (aPrefName, aPrefValue)
+ {
+ var stringPref = null;
+
+ try
+ {
+ // Get the string preference, add to it and
+ // write back to preferences
+ stringPref = this.getStringPref(aPrefName, false);
+
+ if ((stringPref == null) || (stringPref.length == 0))
+ {
+ this.setStringPref(aPrefName, aPrefValue);
+ }
+ else
+ {
+ this.setStringPref(aPrefName, stringPref + '|' + aPrefValue);
+ }
+ }
+ catch(e)
+ {
+ }
+ },
+
+ setRemoveFromStringPref: function (aPrefName, aPrefValue)
+ {
+ var stringPrefArray = null;
+
+ try
+ {
+ // Get the string preference array, check for aPrefValue,
+ // remove it from array and write back to preferences
+ stringPrefArray = this.getStringPrefArray(aPrefName);
+
+ for (var i = 0; i < stringPrefArray.length; i++)
+ {
+ var tempItem = stringPrefArray[i].split(';');
+
+ if (tempItem[0] === aPrefValue)
+ {
+ stringPrefArray.splice(i, 1);
+ break;
+ }
+ }
+
+ this.setStringPrefArray(aPrefName, stringPrefArray);
+ }
+ catch(e)
+ {
+ }
+ },
+
+ setStringPrefArray: function (aPrefName, aPrefValue)
+ {
+ var stringPref = null;
+
+ try
+ {
+ // Convert aPrefValue into a string,
+ // with array values separated by a '|'
+ stringPref = aPrefValue.join('|');
+
+ this.setStringPref(aPrefName, stringPref);
+ }
+ catch(e)
+ {
+ }
+ },
+
+ getStringPref: function (aPrefName, aDefVal)
+ {
+ try
+ {
+ return this.mPrefService.getCharPref(aPrefName);
+ }
+ catch(e)
+ {
+ return aDefVal != undefined ? aDefVal : null;
+ }
+ return null;
+ },
+
+ getStringPrefArray: function (aPrefName)
+ {
+ var stringPref = null;
+ var retValue = new Array();
+
+ try
+ {
+ stringPref = this.getStringPref(aPrefName, false);
+
+ if ((stringPref != null) && (stringPref != ""))
+ {
+ retValue = stringPref.split('|');
+ }
+ }
+ catch(e)
+ {
+ }
+ return retValue;
+ },
+
+ // Special Int Preference for Global Cookies
+ setCookiePrefInt: function()
+ {
+ try
+ {
+ this.mPrefService.setCharPref(aPrefName, aPrefValue);
+ }
+ catch(e)
+ {
+ }
+ },
+
+ // Clear User preference
+ clearUserPref: function (aPrefName)
+ {
+ try
+ {
+ this.mPrefService.clearUserPref(aPrefName);
+ }
+ catch(e)
+ {
+ }
+ }
+};
+
+// Observer to notify when preferences are changed
+var cookieMonster_PrefObserver =
+{
+ _branchExt: null,
+ _branchNetworkCookie: null,
+ _menuBundle: null,
+
+ register: function()
+ {
+ var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefService);
+ this._branchExt = prefService.getBranch("extensions.cookiemonster.");
+ this._branchExt.QueryInterface(Components.interfaces.nsIPrefBranch2);
+ this._branchExt.addObserver("", this, false);
+
+ this._branchNetworkCookie = prefService.getBranch("network.cookie.");
+ this._branchNetworkCookie.QueryInterface(Components.interfaces.nsIPrefBranch2);
+ this._branchNetworkCookie.addObserver("", this, false);
+
+ // Create a reference to all the menu elements
+ this._menuBundle = document.getElementById("cookie-menu-labels");
+ },
+
+ unregister: function()
+ {
+ if(this._branchExt)
+ {
+ this._branchExt.removeObserver("", this);
+ }
+ if(this._branchNetworkCookie)
+ {
+ this._branchNetworkCookie.removeObserver("", this);
+ }
+ },
+
+ observe: function(aSubject, aTopic, aData)
+ {
+ if(aTopic != "nsPref:changed") return;
+ // aSubject is the nsIPrefBranch we're observing (after appropriate QI)
+ // aData is the name of the pref that's been changed (relative to aSubject)
+
+ cookieMonster.extUpdateFromPreferences(aData);
+ // switch (aData) {
+ // case "secondlevelurl":
+ // cookieMonster.extUpdateFromPreferences(aData);
+ // break;
+ // case "deletecookiesondeny":
+ // // extensions.myextension.pref2 was changed
+ // break;
+ // }
+ },
+
+ // Return array representing user's current
+ // choices for cookie preferences: cookieBehavior and lifetimePolicy
+ getCookiePrefArray: function()
+ {
+ var resultPolicy = new Array(-1, -1);
+
+ var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch)
+ .getBranch("network.cookie.");
+
+ resultPolicy[CM_PREF_COOKIE_BEHAVIOR] = prefService.getIntPref("cookieBehavior");
+ resultPolicy[CM_PREF_LIFETIME_POLICY] = prefService.getIntPref("lifetimePolicy");
+
+ return resultPolicy;
+ },
+
+ // Return string representing user's current
+ // choices for cookie preferences
+ getCookiePrefString: function()
+ {
+ var resultPolicy = null;
+
+ var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch)
+ .getBranch("network.cookie.");
+
+ var cookieBehavior = prefService.getIntPref("cookieBehavior");
+ var lifetimePolicy = prefService.getIntPref("lifetimePolicy");
+
+ if (cookieBehavior != 2)
+ {
+ switch (lifetimePolicy)
+ {
+ case 0: //Server sets time
+ resultPolicy = this._menuBundle.getString("accepted");
+ break;
+ case 1: // The user is prompted
+ resultPolicy = this._menuBundle.getString("userprompted");
+ break;
+ case 2: // Session
+ resultPolicy = this._menuBundle.getString("acceptedsession");
+ break;
+ default:
+ resultPolicy = this._menuBundle.getString("accepted");
+ break;
+ }
+
+ if (cookieBehavior == 1)
+ {
+ // Originator only
+ resultPolicy += " [" + this._menuBundle.getString("originatingsiteonly") + "]";
+ }
+ }
+ else
+ {
+ resultPolicy = this._menuBundle.getString("rejected");
+ //resultPolicy = "Rejected";
+ }
+
+ return resultPolicy;
+ },
+
+ // Set user's current
+ // choices for cookie preferences: cookieBehavior and lifetimePolicy
+ // aGlobalCookiePref is an array of type (int, int)
+ setCookiePref: function(aGlobalCookiePref)
+ {
+ var resultPolicy = new Array(-1, -1);
+
+ var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch)
+ .getBranch("network.cookie.");
+
+ try
+ {
+ prefService.setIntPref("cookieBehavior", aGlobalCookiePref[CM_PREF_COOKIE_BEHAVIOR]);
+ prefService.setIntPref("lifetimePolicy", aGlobalCookiePref[CM_PREF_LIFETIME_POLICY]);
+ }
+ catch(e)
+ {
+ alert("Error in setCookiePref: " + e);
+ }
+ }
+};
+
+// Observer to notify when cookie permissions have changed and
+// when the browser is shutting down
+var cookieMonster_ObserverService =
+{
+ _permService: null,
+ _nsIHttpChannel: Components.interfaces.nsIHttpChannel,
+
+ // Ensure the observers are only added once
+ register: function()
+ {
+ if (this._permService == null)
+ {
+ this._permService = Components.classes["@mozilla.org/observer-service;1"]
+ .getService(Components.interfaces.nsIObserverService);
+ this._permService.addObserver(this, "perm-changed", false);
+ this._permService.addObserver(this, "quit-application-requested", false);
+ this._permService.addObserver(this, "http-on-examine-response", false);
+ this._permService.addObserver(this, "http-on-examine-cached-response", false);
+ }
+ },
+
+ unregister: function()
+ {
+ if (this._permService)
+ {
+ this._permService.removeObserver(this, "perm-changed");
+ this._permService.removeObserver(this, "quit-application-requested");
+ this._permService.removeObserver(this, "http-on-examine-response");
+ this._permService.removeObserver(this, "http-on-examine-cached-response");
+ }
+ },
+
+ observe: function(aSubject, aTopic, aData)
+ {
+ if (aTopic == "perm-changed")
+ {
+ var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
+
+ if (permission.type == "cookie")
+ {
+ //alert("Perm Observer Host: " + permission.host + " Topic: " + aTopic + " Data: " + aData);
+ cookieMonster.extUpdateFromPermissions(permission.host);
+ }
+ }
+ else if (aTopic == "quit-application-requested")
+ {
+ // Delete all cookies from web sites listed
+ // in the CM_PREFERENCE_TYPE_COOKIE_TEMP
+ // preference string and then remove
+ // the sites from the preference
+ // Using quit-application-requested is a little
+ // risky because the quit-application
+ // process can still be aborted at this point,
+ // but I have to in order to catch the browser
+ // being closed by clicking the close [x] button
+ // for the actual window
+ //alert("quit-application-requested " + " Topic: " + aTopic + " Data: " + aData);
+ cookieMonster.extResetTempCookies(true);
+
+ // Also restore the user's current global cookie
+ // permission preferences if override global is used
+ cookieMonster.extResetGlobalCookiePref();
+ }
+ else if (aTopic == "http-on-examine-response" || aTopic == "http-on-examine-cached-response")
+ {
+ var httpChannel = aSubject.QueryInterface(this._nsIHttpChannel);
+
+ if (httpChannel.visitResponseHeaders)
+ {
+ httpChannel.visitResponseHeaders(cookieMonster_HeaderVisitor);
+ }
+
+ if (cookieMonster_HeaderVisitor.isCookieRequest())
+ {
+ httpChannel.visitRequestHeaders(cookieMonster_HeaderVisitor);
+ var browser = cookieMonster_Utils.getBrowserFromChannel(httpChannel);
+
+ if (browser)
+ {
+ cookieMonster_CookieRequest.addCookieRequest(cookieMonster_HeaderVisitor.getHost(),
+ browser, cookieMonster_HeaderVisitor.isDomainCookie());
+ }
+ else
+ {
+ //alert("browser null: cookieRequests: " + cookieRequests + " Request Name: " + requestObject.name + " url: " + url);
+ }
+ }
+
+ cookieMonster_HeaderVisitor.reset();
+ }
+ }
+};
+
+var cookieMonster_HeaderVisitor =
+{
+ _isCookieRequest: false,
+ _isDomainCookie: false,
+ _host: null,
+ _referer: null,
+
+ visitHeader: function (aHeader, aValue)
+ {
+ if (aHeader.indexOf("Set-Cookie") !== -1)
+ {
+ this._isCookieRequest = true;
+ this._isDomainCookie = (aValue.toLowerCase().indexOf("domain=") !== -1);
+ }
+
+ if (aHeader.indexOf("Host") !== -1)
+ {
+ this._host = aValue;
+ }
+
+ if (aHeader.indexOf("Referer") !== -1)
+ {
+ this._referer = aValue;
+ }
+ },
+
+ isCookieRequest: function ()
+ {
+ return this._isCookieRequest;
+ },
+
+ isDomainCookie: function ()
+ {
+ return this._isDomainCookie;
+ },
+
+ getHost: function ()
+ {
+ return this._host;
+ },
+
+ getReferer: function ()
+ {
+ var retValue = "None";
+
+ if (this._referer)
+ {
+ retValue = this._referer;
+ }
+
+ return retValue;
+ },
+
+ reset: function ()
+ {
+ this._isCookieRequest = false;
+ this._isDomainCookie = false;
+ this._host = null;
+ this._referer = null;
+ }
+};
diff --git a/chrome/cookiemonster.jar!/content/cookieRequest.js b/chrome/cookiemonster.jar!/content/cookieRequest.js
new file mode 100644
index 0000000..f729d52
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookieRequest.js
@@ -0,0 +1,314 @@
+/**
+ * Store cookie requests for each browser host
+ * @type cookieMonster_CookieRequest
+ */
+var cookieMonster_CookieRequest =
+{
+ _uriList: new Object(),
+ _browserList: new Array(),
+
+ init: function()
+ {
+ // Do nothing for now
+ },
+
+ /**
+ * Check if the host is already contained in this list
+ * @param {} aList
+ * @param {} elt
+ * @return Integer
+ */
+ _requestHostIndexOf: function(aList, elt /*, checkDomain, from*/)
+ {
+ var len = aList.length >>> 0;
+ var checkDomain = false || Boolean(arguments[2]);
+
+ var from = Number(arguments[3]) || 0;
+ from = (from < 0)
+ ? Math.ceil(from)
+ : Math.floor(from);
+ if (from < 0)
+ from += len;
+
+ if (!checkDomain)
+ {
+ for (; from < len; from++)
+ {
+ if (from in aList &&
+ aList[from].host === elt.host)
+ return from;
+ }
+ }
+ else
+ {
+ for (; from < len; from++)
+ {
+ if (from in aList &&
+ cookieMonster_CookieInfo.getSecondLevelHost(aList[from].host) === elt.host)
+ return from;
+ }
+ }
+
+ return -1;
+ },
+
+ /**
+ * Check if the property is already contained in this list
+ * @param {} aList
+ * @param {} aProperty
+ * @param {} aValue
+ * @return Integer
+ */
+ _requestPropertyIndexOf: function(aList, aProperty, aValue /*, from*/)
+ {
+ var len = aList.length >>> 0;
+ var checkDomain = false || Boolean(arguments[2]);
+
+ var from = Number(arguments[3]) || 0;
+ from = (from < 0)
+ ? Math.ceil(from)
+ : Math.floor(from);
+ if (from < 0)
+ from += len;
+
+ for (; from < len; from++)
+ {
+ if (from in aList &&
+ aList[from][aProperty] === aValue)
+ return from;
+ }
+
+ return -1;
+ },
+
+ containsHost: function(aHost)
+ {
+ return this._uriList.hasOwnProperty(aHost);
+ },
+
+ hasMadeCookieRequest: function(aHost)
+ {
+ var retValue = false;
+
+ if (this.containsHost(aHost))
+ {
+ retValue = this._uriList[aHost].hasMadeCookieRequest;
+ }
+
+ return retValue;
+ },
+
+ /**
+ * Add cookie request to browser list
+ * @param {String} aCookieHost
+ * @param {Browser} aBrowser
+ * @param {Boolean} aIsDomain
+ */
+ addCookieRequest: function(aCookieHost, aBrowser, aIsDomain)
+ {
+ if (aBrowser)
+ {
+ // Check if this browser is already contained in the list
+ var browserIndex = this._requestPropertyIndexOf(this._browserList, 'browser', aBrowser);
+ var cookieHostInfo = {host: aCookieHost, isDomain: aIsDomain};
+
+ if (browserIndex > -1)
+ {
+ this._browserList[browserIndex].cookieRequestList.push(cookieHostInfo);
+ }
+ else
+ {
+ this._browserList.push({browser: aBrowser, cookieRequestList: new Array(cookieHostInfo)});
+ }
+
+ //alert("Add Cookie Request Browser: " + aBrowser.currentURI.asciiHost + " cookieURI: " + aCookieURI);
+ }
+ },
+
+ /**
+ * Process Cookie Requests for aBrowser
+ * @param {Browser} aBrowser
+ */
+ processCookieRequests: function(aBrowser)
+ {
+ // Check if this browser is contained in the list
+ var browserIndex = this._requestPropertyIndexOf(this._browserList, 'browser', aBrowser);
+
+ if (browserIndex > -1)
+ {
+ var browserHost = aBrowser.currentURI.asciiHost;
+
+ // Process each cookie URI in array for aBrowser
+ for (var i = 0, cookieHostInfo; cookieHostInfo = this._browserList[browserIndex].cookieRequestList[i]; i++)
+ {
+ this._processCookieRequest(cookieHostInfo.host, browserHost, cookieHostInfo.isDomain);
+ }
+
+// alert("Loading Cookies for Browser Host: " + browserHost +
+// "\nNumber of 3rd Party Cookies: " + this._uriList[browserHost].cookieRequestList.length +
+// "\nHost attempted to leave Cookie: " + this._uriList[browserHost].hasMadeCookieRequest);
+ }
+ },
+
+ _processCookieRequest: function(aCookieURI, aLoadHost /*, aIsDomain */)
+ {
+ if (!(aCookieURI instanceof Components.interfaces.nsIURI))
+ {
+ aCookieURI = cookieMonster_Utils.createURIFromHostName(aCookieURI);
+ }
+
+ var aIsDomain = false || Boolean(arguments[2]);
+ var secondLevelCookieHost = cookieMonster_CookieInfo.getSecondLevelHost(aCookieURI.host);
+ var secondLevelLoadHost;
+
+ // First of all, check to see if aLoadHost is null
+ if (aLoadHost != null)
+ {
+ secondLevelLoadHost = cookieMonster_CookieInfo.getSecondLevelHost(aLoadHost);
+
+ // Check if this host is already contained in the list
+ if (!this._uriList.hasOwnProperty(aLoadHost))
+ {
+ this._uriList[aLoadHost] = new Object();
+ this._uriList[aLoadHost].cookieRequestList = new Array();
+ this._uriList[aLoadHost].hasMadeCookieRequest = false;
+ }
+
+ //alert("Process secondLevelCookieHost: " + secondLevelCookieHost + " secondLevelLoadHost: " + secondLevelLoadHost);
+
+ // Filter out cookies from the load host
+ if (secondLevelCookieHost != secondLevelLoadHost)
+ {
+ // If this is a domain cookie request, then convert
+ // aCookieURI to a domain
+ if (aIsDomain)
+ {
+ aCookieURI = cookieMonster_CookieInfo.getSecondLevelURI(aCookieURI);
+ }
+
+ // Check if URI already has a non-default cookie access
+ // Use CM_URL_STANDARD_LEVEL in order to reflect the result
+ // of aCookieURI
+ var accessLevel = cookieMonster_CookieInfo.checkPermissionArray(aCookieURI, CM_PERMISSION_TYPE_COOKIE);
+ var accessValue = cookieMonster_CookieInfo.getPermissionValue(accessLevel[CM_URL_STANDARD_LEVEL]);
+ var cookieInfo = {host: aCookieURI.asciiHost, accessValue: accessValue};
+
+ // Check if this URI is already contained in the list for the host and
+ // if so, check to see if the accessValue has changed
+ // Also check for the situation where the TOP LEVEL URL may already be
+ // in the list and a Domain cookie being added
+ var hostIndex = this._requestHostIndexOf(this._uriList[aLoadHost].cookieRequestList, cookieInfo);
+
+ //alert("hostIndex: " + hostIndex + " _uriList: " + this._uriList.toSource());
+ //alert("Process secondLevelCookieHost: " + secondLevelCookieHost + " secondLevelLoadHost: " + secondLevelLoadHost);
+
+ if (hostIndex > -1)
+ {
+ if (this._uriList[aLoadHost].cookieRequestList[hostIndex].accessValue != accessValue)
+ {
+ this._uriList[aLoadHost].cookieRequestList[hostIndex].accessValue = accessValue;
+ }
+ }
+ else
+ {
+ this._uriList[aLoadHost].cookieRequestList.push(cookieInfo);
+ }
+ }
+ else
+ {
+ this._uriList[aLoadHost].hasMadeCookieRequest = true;
+ }
+ }
+ },
+
+ _refreshCookieRequest: function(aLoadHost)
+ {
+ if (this.containsHost(aLoadHost))
+ {
+ this._uriList[aLoadHost].cookieRequestList.forEach(
+ function(tempCookieItem, index)
+ {
+ this._processCookieRequest(tempCookieItem.host, aLoadHost);
+ }, this
+ );
+ }
+ },
+
+ /**
+ * Update the cookie info for aCookieHost
+ * @param {String} aCookieHost
+ * @param {String} aHost
+ */
+ updateCookieRequest: function(aCookieHost, aHost)
+ {
+ this._processCookieRequest(aCookieHost, aHost);
+ },
+
+ /**
+ * Retrieve cookie request list for aLoadHost
+ * @param {String} aLoadHost
+ * @return {cookieInfo[]} cookieInfo {host: accessValue:} objects
+ */
+ getRequestList: function(aLoadHost)
+ {
+ var retValue = null;
+
+ if (this.containsHost(aLoadHost))
+ {
+ this._refreshCookieRequest(aLoadHost);
+ retValue = this._uriList[aLoadHost].cookieRequestList;
+ }
+
+ return (retValue != undefined) ? retValue : null;
+ },
+
+ /**
+ * Clear cookie requests from aBrowser
+ * @param {Browser} aBrowser
+ */
+ clearBrowser: function(aBrowser)
+ {
+ // Check if this browser is contained in the list
+ var browserIndex = this._requestPropertyIndexOf(this._browserList, 'browser', aBrowser);
+
+ if (browserIndex > -1)
+ {
+ this._browserList[browserIndex].cookieRequestList = new Array();
+ }
+ },
+
+ /**
+ * Remove aBrowser from browser list
+ * @param {Browser} aBrowser
+ */
+ removeBrowser: function(aBrowser)
+ {
+ // Check if this browser is contained in the list
+ var browserIndex = this._requestPropertyIndexOf(this._browserList, 'browser', aBrowser);
+
+ //alert(" Browser List Count Before Delete: " + this._browserList.length + " at Index: " + browserIndex);
+
+ if (browserIndex > -1)
+ {
+ this._browserList.splice(browserIndex, 1);
+ }
+ },
+
+ /**
+ * Remove aLoadHost from uri list
+ * @param {String} aLoadHost
+ */
+ removeHost: function(aLoadHost)
+ {
+ if (this.containsHost(aLoadHost))
+ {
+ //alert("uriList contains " + aLoadHost);
+
+ if (!cookieMonster_Utils.isUrlMultipleTabs(aLoadHost, true))
+ {
+ //alert(aLoadHost + " only open in one tab, so deleting host");
+ delete this._uriList[aLoadHost];
+ }
+ }
+ }
+}
diff --git a/chrome/cookiemonster.jar!/content/cookieTempAllow.js b/chrome/cookiemonster.jar!/content/cookieTempAllow.js
new file mode 100644
index 0000000..81bc4c2
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookieTempAllow.js
@@ -0,0 +1,147 @@
+/**
+ * Handle Temporary Allow List by maintaining the config preference
+ * CM_PREFERENCE_TYPE_COOKIE_TEMP
+ * @type cookieMonster_TempAllow
+ */
+var cookieMonster_TempAllow =
+{
+ init: function()
+ {
+ // Do nothing for now
+ },
+
+ /**
+ * Check if the host is already contained in this list
+ * @param {} aList
+ * @param {} elt
+ * @return Integer
+ */
+ _requestHostIndexOf: function(aList, elt /*, checkDomain, from*/)
+ {
+ var len = aList.length >>> 0;
+ var checkDomain = false || Boolean(arguments[2]);
+
+ var from = Number(arguments[3]) || 0;
+ from = (from < 0)
+ ? Math.ceil(from)
+ : Math.floor(from);
+ if (from < 0)
+ from += len;
+
+ if (!checkDomain)
+ {
+ for (; from < len; from++)
+ {
+ if (from in aList &&
+ aList[from].split(';')[0] === elt)
+ return from;
+ }
+ }
+ else
+ {
+ for (; from < len; from++)
+ {
+ if (from in aList &&
+ cookieMonster_CookieInfo.getSecondLevelHost(aList[from].split(';')[0]) === elt)
+ return from;
+ }
+ }
+
+ return -1;
+ },
+
+ add: function(aURI)
+ {
+ // Check if URI already has a non-default cookie access
+ // Use CM_TOP_LEVEL because the level is already inherently defined
+ // by aURI in this case
+ var accessLevel = cookieMonster_CookieInfo.checkPermissionArray(aURI, CM_PERMISSION_TYPE_COOKIE);
+ var accessValue = cookieMonster_CookieInfo.getPermissionValue(accessLevel[CM_TOP_LEVEL]);
+
+ cookieMonster_nsPreferences.setAppendToStringPref(CM_PREFERENCE_TYPE_COOKIE_TEMP, aURI.asciiHost + ';' + accessValue);
+ },
+
+ remove: function(aURI)
+ {
+ cookieMonster_nsPreferences.setRemoveFromStringPref(CM_PREFERENCE_TYPE_COOKIE_TEMP, aURI.asciiHost);
+ },
+
+ // Check to see if aURI is a temporary permission
+ isTempPermission: function(aURI)
+ {
+ var retValue = false;
+ var tempList = cookieMonster_nsPreferences.getStringPrefArray(CM_PREFERENCE_TYPE_COOKIE_TEMP);
+
+ // Each array item should contain a URI and a cookie preference,
+ // separated by a semicolon
+ for (var i = 0; i < tempList.length; i++)
+ {
+ var tempItem = tempList[i].split(';');
+
+ if (tempItem[0] === aURI.asciiHost)
+ {
+ retValue = true;
+ break;
+ }
+ }
+
+ return retValue;
+ },
+
+ /**
+ * Reset permission for aHost from temp allow
+ * back to original permission
+ * @param {string} aHost
+ * @return {Integer} Original Permission Setting
+ */
+ resetTempCookie: function(aHost)
+ {
+ var retValue = null;
+ var tempList = cookieMonster_nsPreferences.getStringPrefArray(CM_PREFERENCE_TYPE_COOKIE_TEMP);
+
+ // Retrieve index position for aURI
+ var hostIndex = this._requestHostIndexOf(tempList, aHost);
+ //alert("Got to resetTempCookie: hostIndex: " + hostIndex + " " + tempList[hostIndex]);
+
+ // Reset cookie permissions back to previous setting and
+ // remove from preference string
+ if (hostIndex > -1)
+ {
+ this._resetTempCookieValues(tempList[hostIndex], hostIndex);
+ cookieMonster_nsPreferences.setRemoveFromStringPref(CM_PREFERENCE_TYPE_COOKIE_TEMP, aHost);
+ retValue = tempList[hostIndex].split(';')[1];
+ }
+
+ return retValue;
+ },
+
+ /**
+ * Reset temp cookie list
+ */
+ resetTempCookies: function()
+ {
+ var tempList = cookieMonster_nsPreferences.getStringPrefArray(CM_PREFERENCE_TYPE_COOKIE_TEMP);
+ tempList.forEach(this._resetTempCookieValues, this);
+
+ cookieMonster_nsPreferences.clearUserPref(CM_PREFERENCE_TYPE_COOKIE_TEMP);
+ },
+
+ // Delete temp cookies from host and reset temp cookie permissions
+ _resetTempCookieValues: function(aItem, aIndex)
+ {
+ var hostURI = null;
+ var item = aItem.split(';');
+ var host = item[0];
+ var prefSetting = item[1];
+
+ // Set aUseBaseDomain to true
+ cookieMonster_CookieInfo.deleteHostCookies(host, true);
+
+ //alert("resetTempCookieValues: Host: " + host + " Previous Setting: " + prefSetting);
+
+ hostURI = cookieMonster_Utils.createURIFromHostName(host);
+
+ // Reset cookie permissions back to previous setting
+ cookieMonster_CookieInfo.choice.setAccess(hostURI, prefSetting);
+ }
+}
diff --git a/chrome/cookiemonster.jar!/content/cookieUtils.js b/chrome/cookiemonster.jar!/content/cookieUtils.js
new file mode 100644
index 0000000..b587162
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookieUtils.js
@@ -0,0 +1,97 @@
+var cookieMonster_Utils =
+{
+ _bundle: null,
+
+ init: function()
+ {
+ this._bundle = document.getElementById("cookie-preferences");
+ },
+
+ getBrowserFromChannel: function (aChannel)
+ {
+ try
+ {
+ var notificationCallbacks =
+ aChannel.notificationCallbacks ? aChannel.notificationCallbacks : aChannel.loadGroup.notificationCallbacks;
+
+ if (!notificationCallbacks)
+ return null;
+
+ var domWin = notificationCallbacks.getInterface(Components.interfaces.nsIDOMWindow);
+ return gBrowser.getBrowserForDocument(domWin.top.document);
+ }
+ catch (e)
+ {
+ dump(e + "\n");
+ return null;
+ }
+ },
+
+ isUrlMultipleTabs: function(aHost /*, checkDomain*/)
+ {
+ var numberTabs = 0;
+ var checkDomain = false || Boolean(arguments[1]);
+ var num = gBrowser.browsers.length;
+
+ if (!checkDomain)
+ {
+ for (var i = 0; i < num; i++)
+ {
+ var b = gBrowser.getBrowserAtIndex(i);
+
+ //alert("browser host " + i + " " + b.currentURI.asciiHost + " host: " + aHost);
+
+ if (b.currentURI.asciiHost === aHost)
+ {
+ if(++numberTabs >= 2)
+ {
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ var secondLevelHost = cookieMonster_CookieInfo.getSecondLevelHost(aHost);
+
+ for (var i = 0; i < num; i++)
+ {
+ var b = gBrowser.getBrowserAtIndex(i);
+ var secondLevelBrowserHost = cookieMonster_CookieInfo.getSecondLevelHost(b.currentURI.asciiHost);
+
+ if (secondLevelBrowserHost === secondLevelHost)
+ {
+ if(++numberTabs >= 2)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ return (numberTabs >= 2);
+ },
+
+ createURIFromHostName: function(aHostName)
+ {
+ var newHost = null;
+
+ try
+ {
+ var ioService = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+
+ newHost = ioService.newURI("http://"+aHostName, null, null);
+ }
+ catch(ex)
+ {
+ var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Components.interfaces.nsIPromptService);
+ var message = this._bundle.getString("invalidURI");
+ var title = this._bundle.getString("invalidURITitle");
+ promptService.alert(window, title, message);
+ }
+
+ return newHost;
+ }
+}
diff --git a/chrome/cookiemonster.jar!/content/cookies.js b/chrome/cookiemonster.jar!/content/cookies.js
new file mode 100644
index 0000000..e6c7d40
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/cookies.js
@@ -0,0 +1,903 @@
+//@line 39 "/e/fx19rel/WINNT_5.2_Depend/mozilla/browser/components/preferences/cookies.js"
+
+const nsICookie = Components.interfaces.nsICookie;
+
+var gSiteCookiesWindow = {
+ _cm : Components.classes["@mozilla.org/cookiemanager;1"]
+ .getService(Components.interfaces.nsICookieManager),
+ _ds : Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
+ .getService(Components.interfaces.nsIScriptableDateFormat),
+ _hosts : {},
+ _hostOrder : [],
+ _tree : null,
+ _bundle : null,
+ _bundleExtra : null,
+ _searchFilterBox : null,
+
+ init: function ()
+ {
+ var os = Components.classes["@mozilla.org/observer-service;1"]
+ .getService(Components.interfaces.nsIObserverService);
+ os.addObserver(this, "cookie-changed", false);
+ os.addObserver(this, "perm-changed", false);
+
+ this._bundle = document.getElementById("bundlePreferences");
+ this._bundleExtra = document.getElementById("site-cookie-labels");
+ this._tree = document.getElementById("cookiesList");
+ this._searchFilterBox = document.getElementById("searchFilter");
+
+ this._loadCookies();
+ this._tree.treeBoxObject.view = this._view;
+ this.sort("rawHost");
+ if (this._view.rowCount > 0)
+ this._tree.view.selection.select(0);
+
+ // Add label and access key for clear button, since FF3.1
+ // removed these from cookies.dtd
+ var clearFilterButton = document.getElementById("clearFilter");
+ clearFilterButton.setAttribute("label", this._bundleExtra.getString("clearlabel"));
+ clearFilterButton.setAttribute("accesskey", this._bundleExtra.getString("clearaccesskey"));
+
+ if ("arguments" in window && window.arguments[0])
+ {
+ if (window.arguments[0].filterString)
+ {
+ this.setFilter(window.arguments[0].filterString);
+ }
+ if (!window.arguments[0].showSearch)
+ {
+ //alert("Argument showSearch: " + !window.arguments[0].showSearch);
+ this._searchFilterBox.setAttribute("hidden", !window.arguments[0].showSearch);
+ }
+ else
+ {
+ document.getElementById("searchFilterLabel").value = gSiteCookiesWindow._bundleExtra.getString("searchbyurl");
+ }
+ }
+
+
+
+ this._saveState();
+
+ document.getElementById("filter").focus();
+ },
+
+ uninit: function ()
+ {
+ var os = Components.classes["@mozilla.org/observer-service;1"]
+ .getService(Components.interfaces.nsIObserverService);
+ os.removeObserver(this, "cookie-changed");
+ os.removeObserver(this, "perm-changed");
+ },
+
+ _cookieEquals: function (aCookieA, aCookieB, aStrippedHost)
+ {
+ return aCookieA.rawHost == aStrippedHost &&
+ aCookieA.name == aCookieB.name &&
+ aCookieA.path == aCookieB.path;
+ },
+
+ observe: function (aCookie, aTopic, aData)
+ {
+ if (aTopic != "cookie-changed")
+ return;
+
+ if (aCookie instanceof Components.interfaces.nsICookie) {
+ var strippedHost = this._makeStrippedHost(aCookie.host);
+ if (aData == "changed")
+ this._handleCookieChanged(aCookie, strippedHost);
+ else if (aData == "added")
+ this._handleCookieAdded(aCookie, strippedHost);
+ }
+ else if (aData == "cleared") {
+ this._hosts = {};
+ this._hostOrder = [];
+
+ var oldRowCount = this._view._rowCount;
+ this._view._rowCount = 0;
+ this._tree.treeBoxObject.rowCountChanged(0, -oldRowCount);
+ this._view.selection.clearSelection();
+ }
+
+ // We don't yet handle aData == "deleted" - it's a less common case
+ // and is rather complicated as selection tracking is difficult
+ },
+
+ _handleCookieChanged: function (changedCookie, strippedHost)
+ {
+ var rowIndex = 0;
+ var cookieItem = null;
+ if (!this._view._filtered) {
+ for (var i = 0; i < this._hostOrder.length; ++i) { // (var host in this._hosts) {
+ ++rowIndex;
+ var hostItem = this._hosts[this._hostOrder[i]]; // var hostItem = this._hosts[host];
+ if (this._hostOrder[i] == strippedHost) { // host == strippedHost) {
+ // Host matches, look for the cookie within this Host collection
+ // and update its data
+ for (var j = 0; j < hostItem.cookies.length; ++j) {
+ ++rowIndex;
+ var currCookie = hostItem.cookies[j];
+ if (this._cookieEquals(currCookie, changedCookie, strippedHost)) {
+ currCookie.value = changedCookie.value;
+ currCookie.isSecure = changedCookie.isSecure;
+ currCookie.isDomain = changedCookie.isDomain;
+ currCookie.expires = changedCookie.expires;
+ cookieItem = currCookie;
+ break;
+ }
+ }
+ }
+ else if (hostItem.open)
+ rowIndex += hostItem.cookies.length;
+ }
+ }
+ else {
+ // Just walk the filter list to find the item. It doesn't matter that
+ // we don't update the main Host collection when we do this, because
+ // when the filter is reset the Host collection is rebuilt anyway.
+ for (rowIndex = 0; rowIndex < this._view._filterSet.length; ++rowIndex) {
+ currCookie = this._view._filterSet[rowIndex];
+ if (this._cookieEquals(currCookie, changedCookie, strippedHost)) {
+ currCookie.value = changedCookie.value;
+ currCookie.isSecure = changedCookie.isSecure;
+ currCookie.isDomain = changedCookie.isDomain;
+ currCookie.expires = changedCookie.expires;
+ cookieItem = currCookie;
+ break;
+ }
+ }
+ }
+
+ // Make sure the tree display is up to date...
+ this._tree.treeBoxObject.invalidateRow(rowIndex);
+ // ... and if the cookie is selected, update the displayed metadata too
+ if (cookieItem != null && this._view.selection.currentIndex == rowIndex)
+ this._updateCookieData(cookieItem);
+ },
+
+ _handleCookieAdded: function (changedCookie, strippedHost)
+ {
+ var rowCountImpact = 0;
+ var addedHost = { value: 0 };
+ this._addCookie(strippedHost, changedCookie, addedHost);
+ if (!this._view._filtered) {
+ // The Host collection for this cookie already exists, and it's not open,
+ // so don't increment the rowCountImpact becaues the user is not going to
+ // see the additional rows as they're hidden.
+ if (addedHost.value || this._hosts[strippedHost].open)
+ ++rowCountImpact;
+ }
+ else {
+ // We're in search mode, and the cookie being added matches
+ // the search condition, so add it to the list.
+ var c = this._makeCookieObject(strippedHost, changedCookie);
+ if (this._cookieMatchesFilter(c)) {
+ this._view._filterSet.push(this._makeCookieObject(strippedHost, changedCookie));
+ ++rowCountImpact;
+ }
+ }
+ // Now update the tree display at the end (we could/should re run the sort
+ // if any to get the position correct.)
+ var oldRowCount = this._rowCount;
+ this._view._rowCount += rowCountImpact;
+ this._tree.treeBoxObject.rowCountChanged(oldRowCount - 1, rowCountImpact);
+
+ document.getElementById("removeAllCookies").disabled = this._view._filtered;
+ },
+
+ _view: {
+ _filtered : false,
+ _filterSet : [],
+ _filterValue: "",
+ _rowCount : 0,
+ _cacheValid : 0,
+ _cacheItems : [],
+ get rowCount()
+ {
+ return this._rowCount;
+ },
+
+ _getItemAtIndex: function (aIndex)
+ {
+ if (this._filtered)
+ return this._filterSet[aIndex];
+
+ var start = 0;
+ var count = 0, hostIndex = 0;
+
+ var cacheIndex = Math.min(this._cacheValid, aIndex);
+ if (cacheIndex > 0) {
+ var cacheItem = this._cacheItems[cacheIndex];
+ start = cacheItem['start'];
+ count = hostIndex = cacheItem['count'];
+ }
+
+ for (var i = start; i < gSiteCookiesWindow._hostOrder.length; ++i) { // var host in gSiteCookiesWindow._hosts) {
+ var currHost = gSiteCookiesWindow._hosts[gSiteCookiesWindow._hostOrder[i]]; // gSiteCookiesWindow._hosts[host];
+ if (!currHost) continue;
+ if (count == aIndex)
+ return currHost;
+ hostIndex = count;
+
+ var cacheEntry = { 'start' : i, 'count' : count };
+ var cacheStart = count;
+
+ if (currHost.open) {
+ if (count < aIndex && aIndex <= (count + currHost.cookies.length)) {
+ // We are looking for an entry within this host's children,
+ // enumerate them looking for the index.
+ ++count;
+ for (var i = 0; i < currHost.cookies.length; ++i) {
+ if (count == aIndex) {
+ var cookie = currHost.cookies[i];
+ cookie.parentIndex = hostIndex;
+ return cookie;
+ }
+ ++count;
+ }
+ }
+ else {
+ // A host entry was open, but we weren't looking for an index
+ // within that host entry's children, so skip forward over the
+ // entry's children. We need to add one to increment for the
+ // host value too.
+ count += currHost.cookies.length + 1;
+ }
+ }
+ else
+ ++count;
+
+ for (var j = cacheStart; j < count; j++)
+ this._cacheItems[j] = cacheEntry;
+ this._cacheValid = count - 1;
+ }
+ return null;
+ },
+
+ _removeItemAtIndex: function (aIndex, aCount)
+ {
+ var removeCount = aCount === undefined ? 1 : aCount;
+ if (this._filtered) {
+ // remove the cookies from the unfiltered set so that they
+ // don't reappear when the filter is changed. See bug 410863.
+ for (var i = aIndex; i < aIndex + removeCount; ++i) {
+ var item = this._filterSet[i];
+ var parent = gSiteCookiesWindow._hosts[item.rawHost];
+ for (var j = 0; j < parent.cookies.length; ++j) {
+ if (item == parent.cookies[j]) {
+ parent.cookies.splice(j, 1);
+ break;
+ }
+ }
+ }
+ this._filterSet.splice(aIndex, removeCount);
+ return;
+ }
+
+ var item = this._getItemAtIndex(aIndex);
+ if (!item) return;
+ this._invalidateCache(aIndex - 1);
+ if (item.container)
+ gSiteCookiesWindow._hosts[item.rawHost] = null;
+ else {
+ var parent = this._getItemAtIndex(item.parentIndex);
+ for (var i = 0; i < parent.cookies.length; ++i) {
+ var cookie = parent.cookies[i];
+ if (item.rawHost == cookie.rawHost &&
+ item.name == cookie.name && item.path == cookie.path)
+ parent.cookies.splice(i, removeCount);
+ }
+ }
+ },
+
+ _invalidateCache: function (aIndex)
+ {
+ this._cacheValid = Math.min(this._cacheValid, aIndex);
+ },
+
+ getCellText: function (aIndex, aColumn)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ if (!item)
+ return "";
+ if (aColumn.id == "domainCol")
+ return item.rawHost;
+ else if (aColumn.id == "nameCol")
+ return item.name;
+ }
+ else {
+ if (aColumn.id == "domainCol")
+ return this._filterSet[aIndex].rawHost;
+ else if (aColumn.id == "nameCol")
+ return this._filterSet[aIndex].name;
+ }
+ return "";
+ },
+
+ _selection: null,
+ get selection () { return this._selection; },
+ set selection (val) { this._selection = val; return val; },
+ getRowProperties: function (aIndex, aProperties) {},
+ getCellProperties: function (aIndex, aColumn, aProperties) {},
+ getColumnProperties: function (aColumn, aProperties) {},
+ isContainer: function (aIndex)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ if (!item) return false;
+ return item.container;
+ }
+ return false;
+ },
+ isContainerOpen: function (aIndex)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ if (!item) return false;
+ return item.open;
+ }
+ return false;
+ },
+ isContainerEmpty: function (aIndex)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ if (!item) return false;
+ return item.cookies.length == 0;
+ }
+ return false;
+ },
+ isSeparator: function (aIndex) { return false; },
+ isSorted: function (aIndex) { return false; },
+ canDrop: function (aIndex, aOrientation) { return false; },
+ drop: function (aIndex, aOrientation) {},
+ getParentIndex: function (aIndex)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ // If an item has no parent index (i.e. it is at the top level) this
+ // function MUST return -1 otherwise we will go into an infinite loop.
+ // Containers are always top level items in the cookies tree, so make
+ // sure to return the appropriate value here.
+ if (!item || item.container) return -1;
+ return item.parentIndex;
+ }
+ return -1;
+ },
+ hasNextSibling: function (aParentIndex, aIndex)
+ {
+ if (!this._filtered) {
+ // |aParentIndex| appears to be bogus, but we can get the real
+ // parent index by getting the entry for |aIndex| and reading the
+ // parentIndex field.
+ // The index of the last item in this host collection is the
+ // index of the parent + the size of the host collection, and
+ // aIndex has a next sibling if it is less than this value.
+ var item = this._getItemAtIndex(aIndex);
+ if (item) {
+ if (item.container) {
+ for (var i = aIndex + 1; i < this.rowCount; ++i) {
+ var subsequent = this._getItemAtIndex(i);
+ if (subsequent.container)
+ return true;
+ }
+ return false;
+ }
+ else {
+ var parent = this._getItemAtIndex(item.parentIndex);
+ if (parent && parent.container)
+ return aIndex < item.parentIndex + parent.cookies.length;
+ }
+ }
+ }
+ return aIndex < this.rowCount - 1;
+ },
+ hasPreviousSibling: function (aIndex)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ if (!item) return false;
+ var parent = this._getItemAtIndex(item.parentIndex);
+ if (parent && parent.container)
+ return aIndex > item.parentIndex + 1;
+ }
+ return aIndex > 0;
+ },
+ getLevel: function (aIndex)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ if (!item) return 0;
+ return item.level;
+ }
+ return 0;
+ },
+ getImageSrc: function (aIndex, aColumn) {},
+ getProgressMode: function (aIndex, aColumn) {},
+ getCellValue: function (aIndex, aColumn) {},
+ setTree: function (aTree) {},
+ toggleOpenState: function (aIndex)
+ {
+ if (!this._filtered) {
+ var item = this._getItemAtIndex(aIndex);
+ if (!item) return;
+ this._invalidateCache(aIndex);
+ var multiplier = item.open ? -1 : 1;
+ var delta = multiplier * item.cookies.length;
+ this._rowCount += delta;
+ item.open = !item.open;
+ gSiteCookiesWindow._tree.treeBoxObject.rowCountChanged(aIndex + 1, delta);
+ gSiteCookiesWindow._tree.treeBoxObject.invalidateRow(aIndex);
+ }
+ },
+ cycleHeader: function (aColumn) {},
+ selectionChanged: function () {},
+ cycleCell: function (aIndex, aColumn) {},
+ isEditable: function (aIndex, aColumn)
+ {
+ return false;
+ },
+ isSelectable: function (aIndex, aColumn)
+ {
+ return false;
+ },
+ setCellValue: function (aIndex, aColumn, aValue) {},
+ setCellText: function (aIndex, aColumn, aValue) {},
+ performAction: function (aAction) {},
+ performActionOnRow: function (aAction, aIndex) {},
+ performActionOnCell: function (aAction, aindex, aColumn) {}
+ },
+
+ _makeStrippedHost: function (aHost)
+ {
+ var formattedHost = aHost.charAt(0) == "." ? aHost.substring(1, aHost.length) : aHost;
+ return formattedHost.substring(0, 4) == "www." ? formattedHost.substring(4, formattedHost.length) : formattedHost;
+ },
+
+ _addCookie: function (aStrippedHost, aCookie, aHostCount)
+ {
+ if (!(aStrippedHost in this._hosts) || !this._hosts[aStrippedHost]) {
+ this._hosts[aStrippedHost] = { cookies : [],
+ rawHost : aStrippedHost,
+ level : 0,
+ open : false,
+ container : true };
+ this._hostOrder.push(aStrippedHost);
+ ++aHostCount.value;
+ }
+
+ var c = this._makeCookieObject(aStrippedHost, aCookie);
+ this._hosts[aStrippedHost].cookies.push(c);
+ },
+
+ _makeCookieObject: function (aStrippedHost, aCookie)
+ {
+ var host = aCookie.host;
+ var formattedHost = host.charAt(0) == "." ? host.substring(1, host.length) : host;
+ var c = { name : aCookie.name,
+ value : aCookie.value,
+ isDomain : aCookie.isDomain,
+ host : aCookie.host,
+ rawHost : aStrippedHost,
+ path : aCookie.path,
+ isSecure : aCookie.isSecure,
+ expires : aCookie.expires,
+ level : 1,
+ container : false };
+ return c;
+ },
+
+ _loadCookies: function ()
+ {
+ var e = this._cm.enumerator;
+ var hostCount = { value: 0 };
+ this._hosts = {};
+ this._hostOrder = [];
+ while (e.hasMoreElements()) {
+ var cookie = e.getNext();
+ if (cookie && cookie instanceof Components.interfaces.nsICookie) {
+ var strippedHost = this._makeStrippedHost(cookie.host);
+ this._addCookie(strippedHost, cookie, hostCount);
+ }
+ else
+ break;
+ }
+ this._view._rowCount = hostCount.value;
+ },
+
+ formatExpiresString: function (aExpires)
+ {
+ if (aExpires) {
+ var date = new Date(1000 * aExpires);
+ return this._ds.FormatDateTime("", this._ds.dateFormatLong,
+ this._ds.timeFormatSeconds,
+ date.getFullYear(),
+ date.getMonth() + 1,
+ date.getDate(),
+ date.getHours(),
+ date.getMinutes(),
+ date.getSeconds());
+ }
+
+ // Due to change in chrome://browser/locale/preferences/preferences.properties
+ // from FF 3.5 to 3.6, AtEndOfSession in <= 3.5 is expireAtEndOfSession in 3.6
+ var endOfsession = null;
+
+ try
+ {
+ endOfSession = this._bundle.getString("expireAtEndOfSession");
+ }
+ catch(e)
+ {
+ endOfSession = this._bundle.getString("AtEndOfSession");
+ }
+
+ return endOfSession;
+ },
+
+ _updateCookieData: function (aItem)
+ {
+ var seln = this._view.selection;
+ var ids = ["name", "value", "host", "path", "isSecure", "expires"];
+ var properties;
+
+ if (aItem && !aItem.container && seln.count > 0) {
+ properties = { name: aItem.name, value: aItem.value, host: aItem.host,
+ path: aItem.path, expires: this.formatExpiresString(aItem.expires),
+ isDomain: aItem.isDomain ? this._bundle.getString("domainColon")
+ : this._bundle.getString("hostColon"),
+ isSecure: aItem.isSecure ? this._bundle.getString("forSecureOnly")
+ : this._bundle.getString("forAnyConnection") };
+ for (var i = 0; i < ids.length; ++i)
+ document.getElementById(ids[i]).disabled = false;
+ }
+ else {
+ var noneSelected = this._bundle.getString("noCookieSelected");
+ properties = { name: noneSelected, value: noneSelected, host: noneSelected,
+ path: noneSelected, expires: noneSelected,
+ isSecure: noneSelected };
+ for (i = 0; i < ids.length; ++i)
+ document.getElementById(ids[i]).disabled = true;
+ }
+ for (var property in properties)
+ document.getElementById(property).value = properties[property];
+ },
+
+ onCookieSelected: function ()
+ {
+ var properties, item;
+ var seln = this._tree.view.selection;
+ if (!this._view._filtered)
+ item = this._view._getItemAtIndex(seln.currentIndex);
+ else
+ item = this._view._filterSet[seln.currentIndex];
+
+ this._updateCookieData(item);
+
+ var rangeCount = seln.getRangeCount();
+ var selectedCookieCount = 0;
+ for (var i = 0; i < rangeCount; ++i) {
+ var min = {}; var max = {};
+ seln.getRangeAt(i, min, max);
+ for (var j = min.value; j <= max.value; ++j) {
+ item = this._view._getItemAtIndex(j);
+ if (!item) continue;
+ if (item.container && !item.open)
+ selectedCookieCount += item.cookies.length;
+ else if (!item.container)
+ ++selectedCookieCount;
+ }
+ }
+ var item = this._view._getItemAtIndex(seln.currentIndex);
+ if (item && seln.count == 1 && item.container && item.open)
+ selectedCookieCount += 2;
+
+ var stringKey = selectedCookieCount == 1 ? "removeCookie" : "removeCookies";
+ document.getElementById("removeCookie").label = this._bundle.getString(stringKey);
+
+ document.getElementById("removeAllCookies").disabled = this._view._filtered;
+ document.getElementById("removeCookie").disabled = !(seln.count > 0);
+ },
+
+ deleteCookie: function ()
+ {
+//@line 651 "/e/fx19rel/WINNT_5.2_Depend/mozilla/browser/components/preferences/cookies.js"
+ var seln = this._view.selection;
+ var tbo = this._tree.treeBoxObject;
+
+ if (seln.count < 1) return;
+
+ var nextSelected = 0;
+ var rowCountImpact = 0;
+ var deleteItems = [];
+ if (!this._view._filtered) {
+ var ci = seln.currentIndex;
+ nextSelected = ci;
+ var invalidateRow = -1;
+ var item = this._view._getItemAtIndex(ci);
+ if (item.container) {
+ rowCountImpact -= (item.open ? item.cookies.length : 0) + 1;
+ deleteItems = deleteItems.concat(item.cookies);
+ if (!this._view.hasNextSibling(-1, ci))
+ --nextSelected;
+ this._view._removeItemAtIndex(ci);
+ }
+ else {
+ var parent = this._view._getItemAtIndex(item.parentIndex);
+ --rowCountImpact;
+ if (parent.cookies.length == 1) {
+ --rowCountImpact;
+ deleteItems.push(item);
+ if (!this._view.hasNextSibling(-1, ci))
+ --nextSelected;
+ if (!this._view.hasNextSibling(-1, item.parentIndex))
+ --nextSelected;
+ this._view._removeItemAtIndex(item.parentIndex);
+ invalidateRow = item.parentIndex;
+ }
+ else {
+ deleteItems.push(item);
+ if (!this._view.hasNextSibling(-1, ci))
+ --nextSelected;
+ this._view._removeItemAtIndex(ci);
+ }
+ }
+ this._view._rowCount += rowCountImpact;
+ tbo.rowCountChanged(ci, rowCountImpact);
+ if (invalidateRow != -1)
+ tbo.invalidateRow(invalidateRow);
+ }
+ else {
+ var rangeCount = seln.getRangeCount();
+ for (var i = 0; i < rangeCount; ++i) {
+ var min = {}; var max = {};
+ seln.getRangeAt(i, min, max);
+ nextSelected = min.value;
+ for (var j = min.value; j <= max.value; ++j) {
+ deleteItems.push(this._view._getItemAtIndex(j));
+ if (!this._view.hasNextSibling(-1, max.value))
+ --nextSelected;
+ }
+ var delta = max.value - min.value + 1;
+ this._view._removeItemAtIndex(min.value, delta);
+ rowCountImpact = -1 * delta;
+ this._view._rowCount += rowCountImpact;
+ tbo.rowCountChanged(min.value, rowCountImpact);
+ }
+ }
+
+ var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+ var blockFutureCookies = false;
+ if (psvc.prefHasUserValue("network.cookie.blockFutureCookies"))
+ blockFutureCookies = psvc.getBoolPref("network.cookie.blockFutureCookies");
+ for (i = 0; i < deleteItems.length; ++i) {
+ var item = deleteItems[i];
+ this._cm.remove(item.host, item.name, item.path, blockFutureCookies);
+ }
+
+ if (nextSelected < 0)
+ seln.clearSelection();
+ else {
+ seln.select(nextSelected);
+ this._tree.focus();
+ }
+ },
+
+ deleteAllCookies: function ()
+ {
+ this._cm.removeAll();
+ this._tree.focus();
+ },
+
+ onCookieKeyPress: function (aEvent)
+ {
+ if (aEvent.keyCode == 46)
+ this.deleteCookie();
+ },
+
+ _lastSortProperty : "",
+ _lastSortAscending: false,
+ sort: function (aProperty)
+ {
+ var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
+ // Sort the Non-Filtered Host Collections
+ if (aProperty == "rawHost") {
+ function sortByHost(a, b)
+ {
+ return a.toLowerCase().localeCompare(b.toLowerCase());
+ }
+ this._hostOrder.sort(sortByHost);
+ if (!ascending)
+ this._hostOrder.reverse();
+ }
+
+ function sortByProperty(a, b)
+ {
+ return a[aProperty].toLowerCase().localeCompare(b[aProperty].toLowerCase());
+ }
+ for (var host in this._hosts) {
+ var cookies = this._hosts[host].cookies;
+ cookies.sort(sortByProperty);
+ if (!ascending)
+ cookies.reverse();
+ }
+ // Sort the Filtered List, if in Filtered mode
+ if (this._view._filtered) {
+ this._view._filterSet.sort(sortByProperty);
+ if (!ascending)
+ this._view._filterSet.reverse();
+ }
+
+ this._view._invalidateCache(0);
+ this._view.selection.clearSelection();
+ this._view.selection.select(0);
+ this._tree.treeBoxObject.invalidate();
+ this._tree.treeBoxObject.ensureRowIsVisible(0);
+
+ this._lastSortAscending = ascending;
+ this._lastSortProperty = aProperty;
+ },
+
+ clearFilter: function ()
+ {
+ // Revert to single-select in the tree
+ this._tree.setAttribute("seltype", "single");
+
+ // Clear the Filter and the Tree Display
+ document.getElementById("filter").value = "";
+ this._view._filtered = false;
+ this._view._rowCount = 0;
+ this._tree.treeBoxObject.rowCountChanged(0, -this._view._filterSet.length);
+ this._view._filterSet = [];
+
+ // Just reload the list to make sure deletions are respected
+ this._loadCookies();
+ this._tree.treeBoxObject.view = this._view;
+
+ // Restore sort order
+ var sortby = this._lastSortProperty;
+ if (sortby == "") {
+ this._lastSortAscending = false;
+ this.sort("rawHost");
+ }
+ else {
+ this._lastSortAscending = !this._lastSortAscending;
+ this.sort(sortby);
+ }
+
+ // Restore open state
+ for (var i = 0; i < this._openIndices.length; ++i)
+ this._view.toggleOpenState(this._openIndices[i]);
+ this._openIndices = [];
+
+ // Restore selection
+ this._view.selection.clearSelection();
+ for (i = 0; i < this._lastSelectedRanges.length; ++i) {
+ var range = this._lastSelectedRanges[i];
+ this._view.selection.rangedSelect(range.min, range.max, true);
+ }
+ this._lastSelectedRanges = [];
+
+ document.getElementById("cookiesIntro").value = this._bundle.getString("cookiesAll");
+ document.getElementById("clearFilter").disabled = true;
+ document.getElementById("filter").focus();
+ },
+
+ _cookieMatchesFilter: function (aCookie)
+ {
+ return aCookie.rawHost.indexOf(this._view._filterValue) != -1 ||
+ aCookie.name.indexOf(this._view._filterValue) != -1 ||
+ aCookie.value.indexOf(this._view._filterValue) != -1;
+ },
+
+ _cookieHostMatchesFilter: function (aCookie)
+ {
+ return aCookie.rawHost.indexOf(this._view._filterValue) != -1;
+ },
+
+ _filterCookies: function (aFilterValue)
+ {
+ this._view._filterValue = aFilterValue;
+ var cookies = [];
+ for (var i = 0; i < gSiteCookiesWindow._hostOrder.length; ++i) { //var host in gSiteCookiesWindow._hosts) {
+ var currHost = gSiteCookiesWindow._hosts[gSiteCookiesWindow._hostOrder[i]]; // gSiteCookiesWindow._hosts[host];
+ if (!currHost) continue;
+ for (var j = 0; j < currHost.cookies.length; ++j) {
+ var cookie = currHost.cookies[j];
+ // Change to only match on host
+ if (this._cookieHostMatchesFilter(cookie))
+ cookies.push(cookie);
+ }
+ }
+ return cookies;
+ },
+
+ _lastSelectedRanges: [],
+ _openIndices: [],
+ _saveState: function ()
+ {
+ // Save selection
+ var seln = this._view.selection;
+ this._lastSelectedRanges = [];
+ var rangeCount = seln.getRangeCount();
+ for (var i = 0; i < rangeCount; ++i) {
+ var min = {}; var max = {};
+ seln.getRangeAt(i, min, max);
+ this._lastSelectedRanges.push({ min: min.value, max: max.value });
+ }
+
+ // Save open states
+ this._openIndices = [];
+ for (i = 0; i < this._view.rowCount; ++i) {
+ var item = this._view._getItemAtIndex(i);
+ if (item && item.container && item.open)
+ this._openIndices.push(i);
+ }
+ },
+
+ _filterTimeout: -1,
+ onFilterInput: function ()
+ {
+ if (this._filterTimeout != -1)
+ clearTimeout(this._filterTimeout);
+
+ function filterCookies()
+ {
+ var filter = document.getElementById("filter").value;
+ if (filter == "") {
+ gSiteCookiesWindow.clearFilter();
+ return;
+ }
+ var view = gSiteCookiesWindow._view;
+ view._filterSet = gSiteCookiesWindow._filterCookies(filter);
+ if (!view._filtered) {
+ // Save Display Info for the Non-Filtered mode when we first
+ // enter Filtered mode.
+ gSiteCookiesWindow._saveState();
+ view._filtered = true;
+ }
+ // Move to multi-select in the tree
+ gSiteCookiesWindow._tree.setAttribute("seltype", "multiple");
+
+ // Clear the display
+ var oldCount = view._rowCount;
+ view._rowCount = 0;
+ gSiteCookiesWindow._tree.treeBoxObject.rowCountChanged(0, -oldCount);
+ // Set up the filtered display
+ view._rowCount = view._filterSet.length;
+ gSiteCookiesWindow._tree.treeBoxObject.rowCountChanged(0, view.rowCount);
+
+ // if the view is not empty then select the first item
+ if (view.rowCount > 0)
+ view.selection.select(0);
+
+ document.getElementById("cookiesIntro").value = gSiteCookiesWindow._bundleExtra.getString("sitelabel") + ' ' + filter;
+ document.getElementById("clearFilter").disabled = false;
+ }
+ window.filterCookies = filterCookies;
+ this._filterTimeout = setTimeout("filterCookies();", 500);
+ },
+
+ onFilterKeyPress: function (aEvent)
+ {
+ var filter = document.getElementById("filter").value;
+ if (aEvent.keyCode == 27 && filter != "") // ESC key
+ this.clearFilter();
+ },
+
+ focusFilterBox: function ()
+ {
+ var filter = document.getElementById("filter");
+ filter.focus();
+ filter.select();
+ },
+
+ setFilter: function (aFilterString)
+ {
+ document.getElementById("filter").value = aFilterString;
+ this.onFilterInput();
+ }
+};
+
diff --git a/chrome/cookiemonster.jar!/content/options.xul b/chrome/cookiemonster.jar!/content/options.xul
new file mode 100644
index 0000000..fe81e6a
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/options.xul
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<!DOCTYPE window SYSTEM "chrome://cookiemonster/locale/options.dtd">
+
+<prefwindow id="cookiemonster-prefs"
+ title="&options_window_title;"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <prefpane id="cookiemonster-options" label="&options;"
+ onpaneload="if (document.getElementById('pref-cookiebehavior').value == 1) {document.getElementById('check-thirdparty').checked = true;} else {document.getElementById('check-thirdparty').checked = false;} if (document.getElementById('pref-cookiebehavior').value == 2) {document.getElementById('check-denybydefault').checked = true; document.getElementById('check-thirdparty').disabled = true;} false;">
+
+ <command id="cmd_cookiebehavior" oncommand="if(document.getElementById('check-denybydefault').checked) {document.getElementById('pref-cookiebehavior').value='2'; document.getElementById('check-thirdparty').disabled=true;} else if (document.getElementById('check-thirdparty').checked) {document.getElementById('pref-cookiebehavior').value='1';} else {document.getElementById('pref-cookiebehavior').value='0'; document.getElementById('check-thirdparty').disabled=false;} false;"/>
+
+ <preferences>
+ <preference id="pref-cookiebehavior" name="network.cookie.cookieBehavior" type="int"
+ onchange="if (value == 2) {document.getElementById('check-denybydefault').checked = true;} else {document.getElementById('check-denybydefault').checked = false;} if (value == 1) {document.getElementById('check-thirdparty').checked = true;} else {document.getElementById('check-thirdparty').checked = false;} false;"/>
+ <preference id="pref-secondlevelurl" name="extensions.cookiemonster.secondlevelurl" type="bool"/>
+ <preference id="pref-reloadonpermissionchange" name="extensions.cookiemonster.reloadonpermissionchange" type="bool"/>
+ <preference id="pref-enablecontextmenu" name="extensions.cookiemonster.enablecontextmenu" type="bool"/>
+ <preference id="pref-deletecookiesondeny" name="extensions.cookiemonster.deletecookiesondeny" type="bool"/>
+ <preference id="pref-enableglobalcookieoverride" name="extensions.cookiemonster.enableglobalcookieoverride" type="bool"/>
+ <preference id="pref-disabledeletecookieconfirm" name="extensions.cookiemonster.disabledeletecookieconfirm" type="bool"/>
+ <preference id="pref-originaldefaulticon" name="extensions.cookiemonster.originaldefaulticon" type="bool"/>
+ </preferences>
+ <vbox>
+ <checkbox id="check-denybydefault" label="&denyCookiesDefault;" command="cmd_cookiebehavior"/>
+ <checkbox id="check-thirdparty" label="&thirdPartyCookies;" command="cmd_cookiebehavior"/>
+ <checkbox label="&secondlevel;" preference="pref-secondlevelurl"/>
+ <checkbox label="&reloadonpermissionchange;" preference="pref-reloadonpermissionchange"/>
+ <checkbox label="&enablecontextmenu;" preference="pref-enablecontextmenu"/>
+ <checkbox label="&deletecookies;" preference="pref-deletecookiesondeny"/>
+ <checkbox label="&enableglobalcookies;" preference="pref-enableglobalcookieoverride"/>
+ <checkbox label="&disabledeletecookieconfirm;" preference="pref-disabledeletecookieconfirm"/>
+ <checkbox label="&originaldefaulticon;" preference="pref-originaldefaulticon"/>
+ </vbox>
+ </prefpane>
+ <!-- <prefpane id="cookiemonster-test" label="OverRide">
+ <label class="header" value="Test OverRide Panel" />
+ </prefpane> -->
+</prefwindow>
\ No newline at end of file
diff --git a/chrome/cookiemonster.jar!/content/overlay.js b/chrome/cookiemonster.jar!/content/overlay.js
new file mode 100644
index 0000000..cbb5f5b
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/overlay.js
@@ -0,0 +1,178 @@
+var ShowCookieExceptions =
+{
+ onLoad: function()
+ {
+ // initialization code
+ this.initialized = true;
+ },
+
+ onMenuItemCommand: function(evt)
+ {
+ var bundlePreferences = document.getElementById("cookie-preferences");
+ var windowAddress = "chrome://browser/content/preferences/permissions.xul";
+ var windowName = "cookieMonster_ShowExceptions";
+ var params =
+ {
+ blockVisible : true,
+ sessionVisible : true,
+ allowVisible : true,
+ prefilledHost : "",
+ permissionType : "cookie",
+ windowTitle : bundlePreferences.getString("cookiepermissionstitle"),
+ introText : bundlePreferences.getString("cookiepermissionstext")
+ };
+
+ if (evt.target.id == 'show-cookies' || evt.target.id == 'show-cookies-site')
+ {
+ //windowAddress = "chrome://browser/content/preferences/cookies.xul";
+ windowAddress = "chrome://cookiemonster/content/siteCookies.xul";
+ windowName = "cookieMonster_ShowCookies";
+ params = {filterString : "", showSearch: true};
+
+ if (evt.target.id == 'show-cookies-site')
+ {
+ //windowAddress = "chrome://cookiemonster/content/siteCookies.xul";
+ var currentDomain = document.getElementById(evt.target.id);
+ params = {filterString : currentDomain.getAttribute("name"), showSearch: false};
+ }
+ }
+
+ var cookieWindow = window.openDialog(windowAddress, windowName, "chrome=yes,close=yes", params);
+ }
+
+};
+
+var ShowOverrideGlobal =
+{
+ // Callback method for overrideGlobal window
+ // to add, delete or delete all URI hosts
+ // from preference list
+ overrideListChange: function(aHost, aListType)
+ {
+ var domainType = cookieMonster.extGetCurrentDomainType();
+
+ //alert("Callback Host: " + aHost + " ListType: " + aListType);
+
+ switch (aListType)
+ {
+ case 0: // Add
+ cookieMonster_CookieInfo.addOverrideGlobal(aHost, domainType);
+ break;
+ case 1: // Delete
+ cookieMonster_CookieInfo.removeOverrideGlobal(aHost, domainType);
+ break;
+ case 2: // Delete All and reload page
+ cookieMonster_CookieInfo.removeAllOverrideGlobal();
+ break;
+ default:
+ break;
+ }
+
+ // If aHost is the current host or if remove all, reload page
+ if ((aHost != null) && (cookieMonster.extGetCurrentHost() == aHost))
+ {
+ cookieMonster.extReloadCurrentPage();
+ }
+ },
+
+ onMenuItemCommand: function(evt)
+ {
+ var bundlePreferences = document.getElementById("cookie-preferences");
+ var windowAddress = "chrome://cookiemonster/content/overrideGlobal.xul";
+ var windowName = "cookieMonster_ShowOverride";
+ var params =
+ {
+ prefilledHost : cookieMonster.extGetCurrentHost(),
+ //aURI : cookieMonster.extGetCurrentURI(),
+ //windowTitle : bundlePreferences.getString("cookiepermissionstitle"),
+ //introText : bundlePreferences.getString("cookiepermissionstext"),
+ globalOverrideList: cookieMonster_CookieInfo.getGlobalOverrideList()
+ };
+
+ var cookieWindow = window.openDialog(windowAddress, windowName, "modal=yes,chrome=yes,close=yes", params, this.overrideListChange);
+ }
+};
+
+var DeleteCookies =
+{
+ onMenuItemCommand: function(evt)
+ {
+ var menuBundle = document.getElementById("cookie-menu-labels");
+ var currentHost = null;
+ var result = true;
+
+ if (evt.target.id == 'delete-cookies-site')
+ {
+ currentHost = cookieMonster.extGetCurrentHost();
+
+ // Display confirmation dialog, unless turned off in Options
+ if (!cookieMonster_nsPreferences.getBoolPref("disabledeletecookieconfirm", false))
+ {
+ var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Components.interfaces.nsIPromptService);
+ result = prompts.confirm(null, menuBundle.getString("confirmtitle"),
+ menuBundle.getFormattedString("confirmtext", [currentHost]));
+ }
+
+ if (result)
+ {
+ cookieMonster_CookieInfo.deleteHostCookies(currentHost, true);
+ }
+
+ //alert("Cookies Deleted for " + currentHost);
+ }
+ }
+};
+
+var ShowCookieMenu =
+{
+ onMenuItemCommand: function(evt)
+ {
+ if (evt.target.id == 'contentAreaContextMenu')
+ {
+ // Make cookie monster menu item visible in context menu and add
+ // the cookie-access menu popup
+ var menuItem = document.getElementById("cookiemonster-context");
+ var cookieMenu = document.getElementById("cookie-access");
+ var statusBar = document.getElementById("status-bar");
+ var statusBarPanel = document.getElementById("cookiemonster-status");
+
+ // Only show the context menu if enablecontextmenu is set to true
+ if (cookieMonster_nsPreferences.getBoolPref("enablecontextmenu", false))
+ {
+ if (evt.type == 'popupshown')
+ {
+ menuItem.hidden = false;
+ menuItem.setAttribute("image", statusBarPanel.getAttribute("src"));
+ cookieMenu.setAttribute("position", "end_before");
+ menuItem.appendChild(cookieMenu);
+ }
+ else if (evt.type == 'popuphidden')
+ {
+ menuItem.hidden = true;
+ statusBar.appendChild(cookieMenu);
+ cookieMenu.setAttribute("position", "before_end");
+ }
+ }
+ }
+ },
+
+ onKeyboardShortcut: function(evt)
+ {
+ if (evt.target.id == 'cookiemonster-key')
+ {
+ // Check if cookie-access menu popup is showing and hide
+ var cookieMenu = document.getElementById("cookie-access");
+
+ if (cookieMenu.state == 'open')
+ {
+ cookieMenu.hidePopup();
+ }
+
+ cookieMenu.openPopup(null, "", 0, 0, false, false);
+ }
+ }
+}
+
+//window.addEventListener("load", function(e) { ShowCookieExceptions.onLoad(e); },
+//false);
diff --git a/chrome/cookiemonster.jar!/content/overlay.xul b/chrome/cookiemonster.jar!/content/overlay.xul
new file mode 100644
index 0000000..29ba348
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/overlay.xul
@@ -0,0 +1,132 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://cookiemonster/skin/overlay.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://cookiemonster/locale/overlay.dtd">
+
+<overlay id="cookieMonster-overlay"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script src="overlay.js"/>
+ <script src="cookieUtils.js"/>
+ <script src="cookiePreferences.js"/>
+ <script src="cookieMonster.js"/>
+ <script src="cookieInfo.js"/>
+ <script src="cookieTempAllow.js"/>
+ <script src="cookieRequest.js"/>
+ <stringbundleset id="stringbundleset">
+ <stringbundle id="cookie-preferences" src="chrome://browser/locale/preferences/preferences.properties"/>
+ <stringbundle id="cookie-menu-labels" src="chrome://cookiemonster/locale/cookieMonster.properties"/>
+ </stringbundleset>
+ <!-- Status Bar -->
+ <statusbar id="status-bar">
+ <statusbarpanel id="cookiemonster-status" label="&cookiemonster;" popup=""
+ src="chrome://cookiemonster/skin/face-monkey-small.png" tooltiptext="Click here to see if this site can leave you cookies" class="statusbarpanel-iconic">
+ </statusbarpanel>
+ <popupset>
+ <!-- Cookie Access Popup Menu from overlay -->
+ <menupopup id="cookie-access" position="before_end" name="hidden" onpopupshowing="this.setAttribute('name', 'visible');" onpopuphidden="this.setAttribute('name', 'hidden');">
+ <menu id="cookie-options-menu" label="&options;">
+ <menupopup id="current-options">
+ <menuitem id="option-second-level" label="&secondlevel;" type="checkbox"/>
+ <menuitem id="show-global-override" label="&globaloverride;" disabled="true"
+ oncommand="ShowOverrideGlobal.onMenuItemCommand(event);"/>
+ <!-- <menu id="current-options-block-menu" label="&globalpermissions;">
+ <menupopup id="current-options-block">
+ <menuitem id="option-block-globally" label="&blockglobal;" type="checkbox"/>
+ <menuitem id="option-block-thirdparty" label="&blockthirdparty;" type="checkbox"/>
+ </menupopup>
+ </menu> -->
+ </menupopup>
+ </menu>
+ <menu id="cookie-view-menu" label="&viewcookies;">
+ <menupopup id="view-cookies">
+ <menuitem id="show-cookies-site" label="&showcookies;" name=""
+ oncommand="ShowCookieExceptions.onMenuItemCommand(event);"/>
+ <menuitem id="show-cookies" label="&showallcookies;"
+ oncommand="ShowCookieExceptions.onMenuItemCommand(event);"/>
+ <menuseparator/>
+ <menuitem id="show-exceptions" label="&showcookieexceptions;"
+ oncommand="ShowCookieExceptions.onMenuItemCommand(event);"/>
+ <menuseparator/>
+ <menuitem id="delete-cookies-site" label="&deletecookies;" name=""
+ oncommand="DeleteCookies.onMenuItemCommand(event);"/>
+ </menupopup>
+ </menu>
+ <menu id="cookie-thirdparty-menu" label="&thirdpartycookies;">
+ <menupopup id="cookie-thirdparty-permissions">
+ <menuitem id="cookie-thirdparty-default-none" label="&thirdpartydefault;" disabled="false" class="menuitem-iconic"/>
+ </menupopup>
+ </menu>
+ <menu id="cookie-permissions-menu" label="¤tpermissions;">
+ <menupopup id="current-permissions">
+ <menuitem id="permissions-top" label="&sitepermissions;" class="menuitem-iconic"/>
+ <menuitem id="permissions-second" label="&domainpermissions;" class="menuitem-iconic"/>
+ <menuseparator/>
+ <menuitem id="permissions-result" label="&permissionsresult;" class="menuitem-iconic"/>
+ <!-- <menuseparator/>
+ <menuitem id="option-override-global" label="&globaloverride;" type="checkbox"/> -->
+ </menupopup>
+ </menu>
+ <menu id="cookie-access-menu" label="&alternatecookieaccess;">
+ <menupopup id="cookie-access-alternate">
+ <menuitem id="cookie-access-second-temp" value="-1" label="&tempallow;" name="cookie-two" class="menuitem-iconic"/>
+ <menuseparator/>
+ <menuitem id="cookie-access-second-allow" value="1" label="&allow;" name="cookie-two" class="menuitem-iconic"/>
+ <menuitem id="cookie-access-second-deny" value="2" label="&deny;" name="cookie-two" class="menuitem-iconic"/>
+ <menuitem id="cookie-access-second-session" value="8" label="&session;" name="cookie-two" class="menuitem-iconic"/>
+ </menupopup>
+ </menu>
+ <menuseparator/>
+ <menuitem id="revoke-temp-permissions" label="&revoketempallow;" class="menuitem-iconic"
+ oncommand="cookieMonster.extResetTempCookies();" />
+ <!-- <menuseparator/>
+ <menuitem id="label-cookie-access" class="header" label="&cookieaccess;"/> -->
+ <menuseparator/>
+ <menuseparator/>
+ <menuitem id="cookie-access-default-default" value="0" label="&default;" name="current-access" class="menuitem-iconic"/>
+ <menuseparator id="temp-after-this"/>
+ <menuitem id="cookie-access-top-temp" value="-1" label="&tempallow;" name="cookie-top" class="menuitem-iconic"/>
+ <menuseparator id="allow-after-this"/>
+ <menuitem id="cookie-access-top-allow" value="1" label="&allow;" name="cookie-top" class="menuitem-iconic"/>
+ <menuitem id="cookie-access-top-deny" value="2" label="&deny;" name="cookie-top" class="menuitem-iconic"/>
+ <menuitem id="cookie-access-top-session" value="8" label="&session;" name="cookie-top" class="menuitem-iconic"/>
+ </menupopup>
+
+ <tooltip id="cookie-results" orient="vertical" position="before_end" class="cookie-status-tooltip"
+ onpopupshowing="cookieMonster.extSetSiteRequestedSetCookie(event); return (document.getElementById('cookie-access').getAttribute('name') == 'hidden');">
+ <label id="cookie-status-header" value="¤tpermissions;"/>
+ <vbox>
+ <groupbox id="cookie-group-site" flex="1">
+ <caption id="cookie-caption-site" label="&sitepermissions;" image="chrome://cookiemonster/skin/face-monkey-small.png"/>
+ <description id="cookie-description-site" value="&default;"/>
+ </groupbox>
+ <groupbox id="cookie-group-domain" flex="1">
+ <caption id="cookie-caption-domain" label="&domainpermissions;" image="chrome://cookiemonster/skin/face-monkey-small.png"/>
+ <description id="cookie-description-domain" value="&default;"/>
+ </groupbox>
+ <separator class="groove"/>
+ <groupbox id="cookie-group-result" flex="1">
+ <caption id="cookie-caption-result" label="&permissionsresult;" image="chrome://cookiemonster/skin/face-monkey-small.png"/>
+ <description id="cookie-description-result" value="&default;"/>
+ </groupbox>
+ <separator class="groove"/>
+ <groupbox id="cookie-group-attempt" flex="1">
+ <description id="cookie-description-attempt" value="&default;"/>
+ </groupbox>
+ </vbox>
+ </tooltip>
+ </popupset>
+ </statusbar>
+
+ <!-- Firefox Context Menu -->
+ <popup id="contentAreaContextMenu" onpopupshown="ShowCookieMenu.onMenuItemCommand(event);"
+ onpopuphidden="ShowCookieMenu.onMenuItemCommand(event);">
+ <menu id="cookiemonster-context" label="&cookiemonster;" hidden="true" class="menu-iconic">
+ </menu>
+ </popup>
+
+ <!-- Shortcut Keys to Menu -->
+ <keyset>
+ <key id="cookiemonster-key" modifiers="control shift" key="M" oncommand="ShowCookieMenu.onKeyboardShortcut(event);"/>
+ </keyset>
+
+</overlay>
diff --git a/chrome/cookiemonster.jar!/content/overrideGlobal.js b/chrome/cookiemonster.jar!/content/overrideGlobal.js
new file mode 100644
index 0000000..08c67c5
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/overrideGlobal.js
@@ -0,0 +1,172 @@
+// overrideGlobal.js
+// Tony Schilling
+// Created: 11/12/2008
+// Last Updated: 11/13/2008
+
+// Constants
+const CM_OG_ADD = 0;
+const CM_OG_REMOVE = 1;
+const CM_OG_REMOVE_ALL = 2;
+
+var gOverrideGlobalWindow = {
+ _bundle : null,
+ _currentHost: null,
+ _list : null,
+ _listChanged: null,
+
+ onLoad: function ()
+ {
+ this._bundle = document.getElementById("bundlePreferences");
+ var params = window.arguments[0];
+ this._listChanged = window.arguments[1];
+ this.init(params);
+ },
+
+ init: function (aParams)
+ {
+ // Load override list array and check
+ // if prefilled host is already in list
+ var urlField = document.getElementById("url");
+ var addUrlButton = document.getElementById("btnAddUrl");
+ var addUrlLabel = document.getElementById("urlLabel");
+ var urlExistsLabel = document.getElementById("urlLabelExists");
+ var closeButton = document.getElementById("btnClose");
+
+ this._currentHost = aParams.prefilledHost;
+ urlField.value = this._currentHost;
+
+ this._loadOverrideList(aParams.globalOverrideList);
+
+ if (aParams.globalOverrideList.indexOf(aParams.prefilledHost) > -1)
+ {
+ addUrlButton.disabled = true;
+ addUrlLabel.hidden = true;
+ urlExistsLabel.hidden = false;
+ closeButton.focus();
+ }
+ else
+ {
+ addUrlButton.focus();
+ }
+ },
+
+ // Public Methods
+ addOverrideGlobalURI: function ()
+ {
+ var urlField = document.getElementById("url");
+ this._list.appendItem(urlField.value);
+ this._listChanged(urlField.value, CM_OG_ADD);
+
+ // Determine what buttons should de enabled/disabled
+ this._updateUI(urlField.value, CM_OG_ADD);
+ },
+
+ // Private Methods
+ _loadOverrideList: function (aList)
+ {
+ this._list = document.getElementById("overrideList");
+
+ // Load array values into list element
+ aList.forEach(this._list.appendItem, this._list);
+ },
+
+ _updateUI: function (aItem, aOperation)
+ {
+ var addUrlButton = document.getElementById("btnAddUrl");
+ var addUrlLabel = document.getElementById("urlLabel");
+ var urlExistsLabel = document.getElementById("urlLabelExists");
+ var closeButton = document.getElementById("btnClose");
+
+ if ((aItem != null) && (aItem == this._currentHost))
+ {
+ if (aOperation == CM_OG_ADD)
+ {
+ addUrlButton.disabled = true;
+ addUrlLabel.hidden = true;
+ urlExistsLabel.hidden = false;
+ }
+ else
+ {
+ addUrlButton.disabled = false;
+ addUrlLabel.hidden = false;
+ urlExistsLabel.hidden = true;
+ }
+ }
+ else if (aOperation == CM_OG_REMOVE_ALL)
+ {
+ addUrlButton.disabled = false;
+ addUrlLabel.hidden = false;
+ urlExistsLabel.hidden = true;
+ }
+
+ this.onListItemSelected();
+ closeButton.focus();
+ },
+
+ // Events
+ onListItemSelected: function ()
+ {
+ var hasSelection = this._list.selectedCount > 0;
+ var hasRows = this._list.getRowCount() > 0;
+ document.getElementById("removePermission").disabled = !hasRows || !hasSelection;
+ document.getElementById("removeAllPermissions").disabled = !hasRows;
+ },
+
+ onListItemDeleted: function ()
+ {
+ var selectedItem = this._list.selectedItem;
+ var hostInList = null;
+
+ // If an item is selected, remove from list and
+ // remove from globalOverrideList
+ if (selectedItem != null)
+ {
+ if (selectedItem.label == this._currentHost)
+ {
+ hostInList = this._currentHost;
+ }
+ this._listChanged(selectedItem.label, CM_OG_REMOVE);
+ this._list.removeItemAt(this._list.selectedIndex);
+ }
+
+ // Determine what buttons should de enabled/disabled
+ this._updateUI(hostInList, CM_OG_REMOVE);
+ },
+
+ onAllListItemsDeleted: function ()
+ {
+ var hostInList = null;
+ var numberRows = this._list.getRowCount();
+
+ // Clear list and globalOverrideList and
+ // if current host is in list, pass back
+ // in _listChanged
+ while (this._list.getRowCount() > 0)
+ {
+ if (this._list.getItemAtIndex(0).label == this._currentHost)
+ {
+ hostInList = this._currentHost;
+ }
+
+ this._list.removeItemAt(0);
+ }
+
+ this._listChanged(hostInList, CM_OG_REMOVE_ALL);
+
+ // Determine what buttons should de enabled/disabled
+ this._updateUI(hostInList, CM_OG_REMOVE_ALL);
+
+ //document.getElementById("removePermission").disabled = true;
+ //document.getElementById("removeAllPermissions").disabled = true;
+ },
+
+ onListKeyPress: function (aEvent)
+ {
+ if (aEvent.keyCode == 46)
+ this.onListItemDeleted();
+ },
+
+ uninit: function ()
+ {
+ }
+}
\ No newline at end of file
diff --git a/chrome/cookiemonster.jar!/content/overrideGlobal.xul b/chrome/cookiemonster.jar!/content/overrideGlobal.xul
new file mode 100644
index 0000000..00fe033
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/overrideGlobal.xul
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
+
+<!DOCTYPE dialog SYSTEM "chrome://cookiemonster/locale/overrideGlobal.dtd" >
+<window id="OverrideGlobalDialog" class="windowDialog"
+ windowtype="Browser:Permissions"
+ title="&window.title;"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="width: &window.width;;"
+ onload="gOverrideGlobalWindow.onLoad();"
+ onunload="gOverrideGlobalWindow.uninit();"
+ persist="screenX screenY width height">
+
+ <script src="overrideGlobal.js"/>
+
+ <stringbundle id="bundlePreferences"
+ src="chrome://browser/locale/preferences/preferences.properties"/>
+
+ <keyset>
+ <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
+ </keyset>
+
+ <vbox class="contentPane" flex="1">
+ <description id="overrideGlobalText" control="url">&overrideglobaltext.label;</description>
+ <separator class="thin"/>
+ <label id="urlLabel" control="url" value="&address.label;" hidden="false"/>
+ <label id="urlLabelExists" class="header" control="url" value="&addressexists.label;" hidden="true"/>
+ <hbox align="start">
+ <textbox id="url" flex="1" readonly="true"
+ oninput="gOverrideGlobalWindow.onHostInput(event.target);"
+ onkeypress="gOverrideGlobalWindow.onHostKeyPress(event);"/>
+ <button id="btnAddUrl" disabled="false" label="&addurl.label;" accesskey="&addurl.accesskey;"
+ oncommand="gOverrideGlobalWindow.addOverrideGlobalURI();"/>
+ </hbox>
+ <separator class="thin"/>
+ <listbox id="overrideList" flex="1" style="height: 18em;"
+ onkeypress="gOverrideGlobalWindow.onListKeyPress(event)"
+ onselect="gOverrideGlobalWindow.onListItemSelected();">
+ </listbox>
+ </vbox>
+ <hbox align="end">
+ <hbox class="actionButtons" flex="1">
+ <button id="removePermission" disabled="true"
+ accesskey="&removepermission.accesskey;"
+ icon="remove" label="&removepermission.label;"
+ oncommand="gOverrideGlobalWindow.onListItemDeleted();"/>
+ <button id="removeAllPermissions"
+ icon="clear" label="&removeallpermissions.label;"
+ accesskey="&removeallpermissions.accesskey;"
+ oncommand="gOverrideGlobalWindow.onAllListItemsDeleted();"/>
+ <spacer flex="1"/>
+ <button id="btnClose" oncommand="close();" icon="close"
+ label="&button.close.label;" accesskey="&button.close.accesskey;"/>
+ </hbox>
+ <resizer dir="bottomright"/>
+ </hbox>
+</window>
diff --git a/chrome/cookiemonster.jar!/content/siteCookies.xul b/chrome/cookiemonster.jar!/content/siteCookies.xul
new file mode 100644
index 0000000..9e87ec3
--- /dev/null
+++ b/chrome/cookiemonster.jar!/content/siteCookies.xul
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
+
+<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/cookies.dtd" >
+<window id="SiteCookiesDialog" windowtype="Browser:Cookies"
+ class="windowDialog" title="&window.title;"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="width: &window.width;"
+ onload="gSiteCookiesWindow.init();"
+ onunload="gSiteCookiesWindow.uninit();"
+ persist="screenX screenY width height">
+
+ <script src="chrome://browser/content/preferences/permissionsutils.js"/>
+ <script src="cookies.js"/>
+
+ <stringbundleset id="stringbundleset">
+ <stringbundle id="bundlePreferences"
+ src="chrome://browser/locale/preferences/preferences.properties"/>
+
+ <stringbundle id="site-cookie-labels"
+ src="chrome://cookiemonster/locale/siteCookies.properties"/>
+ </stringbundleset>
+
+ <keyset>
+ <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
+ <key key="&focusSearch1.key;" modifiers="accel" oncommand="gSiteCookiesWindow.focusFilterBox();"/>
+ <key key="&focusSearch2.key;" modifiers="accel" oncommand="gSiteCookiesWindow.focusFilterBox();"/>
+ </keyset>
+
+ <vbox flex="1" class="contentPane">
+ <hbox id="searchFilter" align="center" hidden="false">
+ <label id="searchFilterLabel" accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
+ <textbox id="filter" flex="1" oninput="gSiteCookiesWindow.onFilterInput();"
+ onkeypress="gSiteCookiesWindow.onFilterKeyPress(event);"/>
+ <!-- <button id="clearFilter" icon="clear" label="&clear.label;"
+ accesskey="&clear.accesskey;"
+ oncommand="gSiteCookiesWindow.clearFilter();" disabled="true"/> -->
+ <button id="clearFilter" icon="clear" label="Clear"
+ accesskey="l"
+ oncommand="gSiteCookiesWindow.clearFilter();" disabled="true"/>
+ </hbox>
+ <separator class="thin"/>
+ <label control="cookiesList" id="cookiesIntro" value="&cookiesonsystem.label;"/>
+ <separator class="thin"/>
+ <tree id="cookiesList" flex="1" style="height: 10em;"
+ onkeypress="gSiteCookiesWindow.onCookieKeyPress(event)"
+ onselect="gSiteCookiesWindow.onCookieSelected();"
+ hidecolumnpicker="true" seltype="single">
+ <treecols>
+ <treecol id="domainCol" label="&cookiedomain.label;" flex="2" primary="true"
+ class="sortDirectionIndicator" persist="width" onclick="gSiteCookiesWindow.sort('rawHost');" />
+ <splitter class="tree-splitter"/>
+ <treecol id="nameCol" label="&cookiename.label;" flex="1"
+ class="sortDirectionIndicator" persist="width"
+ onclick="gSiteCookiesWindow.sort('name');"/>
+ </treecols>
+ <treechildren id="cookiesChildren"/>
+ </tree>
+ <hbox id="cookieInfoBox">
+ <grid flex="1" id="cookieInfoGrid">
+ <columns>
+ <column/>
+ <column flex="1"/>
+ </columns>
+ <rows>
+ <row align="center">
+ <hbox pack="end"><label id="nameLabel" control="name" value="&props.name.label;"/></hbox>
+ <textbox id="name" readonly="true" class="plain"/>
+ </row>
+ <row align="center">
+ <hbox pack="end"><label id="valueLabel" control="value" value="&props.value.label;"/></hbox>
+ <textbox id="value" readonly="true" class="plain"/>
+ </row>
+ <row align="center">
+ <hbox pack="end"><label id="isDomain" control="host" value="&props.domain.label;"/></hbox>
+ <textbox id="host" readonly="true" class="plain"/>
+ </row>
+ <row align="center">
+ <hbox pack="end"><label id="pathLabel" control="path" value="&props.path.label;"/></hbox>
+ <textbox id="path" readonly="true" class="plain"/>
+ </row>
+ <row align="center">
+ <hbox pack="end"><label id="isSecureLabel" control="isSecure" value="&props.secure.label;"/></hbox>
+ <textbox id="isSecure" readonly="true" class="plain"/>
+ </row>
+ <row align="center">
+ <hbox pack="end"><label id="expiresLabel" control="expires" value="&props.expires.label;"/></hbox>
+ <textbox id="expires" readonly="true" class="plain"/>
+ </row>
+ </rows>
+ </grid>
+ </hbox>
+ </vbox>
+ <hbox align="end">
+ <hbox class="actionButtons" flex="1">
+ <button id="removeCookie" disabled="true" icon="remove"
+ label="&button.removecookie.label;" accesskey="&button.removecookie.accesskey;"
+ oncommand="gSiteCookiesWindow.deleteCookie();"/>
+ <button id="removeAllCookies" disabled="true" icon="clear"
+ label="&button.removeallcookies.label;" accesskey="&button.removeallcookies.accesskey;"
+ oncommand="gSiteCookiesWindow.deleteAllCookies();"/>
+ <spacer flex="1"/>
+ <button oncommand="close();" icon="close"
+ label="&button.close.label;" accesskey="&button.close.accesskey;"/>
+ </hbox>
+ <resizer dir="bottomright"/>
+ </hbox>
+</window>
diff --git a/chrome/cookiemonster.jar!/locale/de-DE/cookieMonster.dtd b/chrome/cookiemonster.jar!/locale/de-DE/cookieMonster.dtd
new file mode 100644
index 0000000..b9c195d
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/de-DE/cookieMonster.dtd
@@ -0,0 +1,3 @@
+<!ENTITY title.label "Hallo Welt">
+<!ENTITY separate.label "Das ist ein separates Fenster!">
+<!ENTITY close.label "Schließen">
diff --git a/chrome/cookiemonster.jar!/locale/de-DE/cookieMonster.properties b/chrome/cookiemonster.jar!/locale/de-DE/cookieMonster.properties
new file mode 100644
index 0000000..e0ba0df
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/de-DE/cookieMonster.properties
@@ -0,0 +1,41 @@
+#### Cookie Access for Menu
+
+default=Standardautorisierung
+accepted=erlaube
+userprompted=Nutzer aufgefordert
+acceptedsession=Für Sitzung erlaubt
+rejected=verweigert
+originatingsiteonly=Nur Ursprungsseite
+allow=Erlaube Cookies von
+deny=Verweigere Cookies von
+session=Erlaube Sitzungscookies von
+tooltiptext=Cookiezugriff für
+temp=Erlaube Cookies temporär von
+sitepermissions=Seite
+domainpermissions=Domain
+permissionsresult=Folgeverhalten
+permissionsresultfor=Folgeverhalten für
+showcurrentcookies=Cookies anzeigen für
+deletecurrentcookies=Cookies löschen für
+Default=Standard
+Allow=Erlauben
+Session=Sitzung erlauben
+Deny=Blockieren
+Temp=Temporär erlauben
+alternatecookieaccess=Cookieautorisierung
+sitemenulabel=Seitenbezogen
+domainmenulabel=Domainbezogen
+thirdpartyblocked=Cookie von Drittanbieter blockiert
+
+## Labels for Confirmation Dialog
+confirmtitle=Cookies löschen
+confirmtext=Cookies von %S wirklich löschen?
+
+## Labels for Third Party Menu
+thirdpartynone=Keine erkannt
+thirdpartytempallowall=Temporär alle erlauben
+thirdpartytemprevokeall=Hebe alle temporären Berechtigungen auf
+
+## Label for Site Requesting to Set Cookie Indicator
+siteattemptedcookie=Diese Seite möchte Cookie(s) speichern
+sitenotattemptedcookie=Diese Seite möchte keine(n) Cookie(s) speichern
diff --git a/chrome/cookiemonster.jar!/locale/de-DE/options.dtd b/chrome/cookiemonster.jar!/locale/de-DE/options.dtd
new file mode 100644
index 0000000..652583f
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/de-DE/options.dtd
@@ -0,0 +1,12 @@
+<!ENTITY options_window_title "Cookie Monster Einstellungen">
+<!ENTITY cookiemonster "Hallo Cookies!">
+<!ENTITY options "Einstellungen">
+<!ENTITY secondlevel "2nd Level Domain Namen verwenden">
+<!ENTITY reloadonpermissionchange "Betroffene Seite automatisch bei Änderung der Cookie-Berechtigung neu laden">
+<!ENTITY enablecontextmenu "Kontextmenüeintrag für Cookie Monster anzeigen">
+<!ENTITY deletecookies "Cookies beim Autorisierungswechsel nach verweigert löschen">
+<!ENTITY enableglobalcookies "Überschreiben der globalen Cookieautorisierung aktivieren">
+<!ENTITY thirdPartyCookies "3rd Party Cookies blockieren">
+<!ENTITY denyCookiesDefault "Alle Cookies blockieren">
+<!ENTITY disabledeletecookieconfirm "Bestätigungsdialog beim Löschen von Cookies abschalten">
+<!ENTITY originaldefaulticon "Original Standard Icon verwenden (der Affee)">
diff --git a/chrome/cookiemonster.jar!/locale/de-DE/overlay.dtd b/chrome/cookiemonster.jar!/locale/de-DE/overlay.dtd
new file mode 100644
index 0000000..8ce2587
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/de-DE/overlay.dtd
@@ -0,0 +1,26 @@
+<!ENTITY helloworld "Hallo Welt!">
+<!ENTITY cookiemonster "Hallo Cookies!">
+<!ENTITY secondlevel "2nd Level Domain Namen verwenden">
+<!ENTITY globalpermissions "Globale Cookie-Einstellungen">
+<!ENTITY blockglobal "Alle Cookies verweigern (Abwählen zum erlauben)">
+<!ENTITY blockthirdparty "Nur 3rd Party Cookies verweigern">
+<!ENTITY globaloverride "Überschreibe globale Cookieautorisierung">
+<!ENTITY showcookieexceptions "Cookie Ausnahmen anzeigen">
+<!ENTITY showcookies "Cookies anzeigen">
+<!ENTITY showallcookies "Cookies anzeigen für alle Seiten">
+<!ENTITY viewcookies "Cookies anzeigen">
+<!ENTITY deletecookies "Cookies löschen">
+<!ENTITY currentpermissions "Aktuelle Cookieautorisierung">
+<!ENTITY alternatecookieaccess "Cookie Zugriff setzen">
+<!ENTITY sitepermissions "Seite:">
+<!ENTITY domainpermissions "Domain:">
+<!ENTITY permissionsresult "Folgeverhalten:">
+<!ENTITY options "Optionen">
+<!ENTITY default "Vorgabe">
+<!ENTITY allow "Erlauben">
+<!ENTITY deny "Verweigern">
+<!ENTITY session "Sitzung">
+<!ENTITY tempallow "Temporär Erlauben">
+<!ENTITY thirdpartycookies "Cookies von Drittanbietern">
+<!ENTITY thirdpartydefault "Keine">
+<!ENTITY revoketempallow "Hebe alle temporären Berechtigungen auf">
diff --git a/chrome/cookiemonster.jar!/locale/de-DE/overrideGlobal.dtd b/chrome/cookiemonster.jar!/locale/de-DE/overrideGlobal.dtd
new file mode 100644
index 0000000..bb5933d
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/de-DE/overrideGlobal.dtd
@@ -0,0 +1,16 @@
+<!ENTITY window.title "Globale Cookieautorisierung überschreiben">
+<!ENTITY window.width "30em">
+
+<!ENTITY overrideglobaltext.label "Globales überschreiben der Cookieautorisierung nur verwenden, wenn seitenspezifische Cookieautorisierung nicht korrekt funktioniert, besonders bei Seiten die von JavaScript navigator.cookieEnabled verwenden um die Cookieautorisierung zu erkennen.">
+<!ENTITY removepermission.label "Seite entfernen">
+<!ENTITY removepermission.accesskey "R">
+<!ENTITY removeallpermissions.label "Alle Seiten entfernen">
+<!ENTITY removeallpermissions.accesskey "e">
+<!ENTITY address.label "URL der Internetseite:">
+<!ENTITY addressexists.label "URL bereits vorhanden:">
+<!ENTITY addurl.label "URL hinzufügen">
+<!ENTITY addurl.accesskey "A">
+<!ENTITY windowClose.key "w">
+
+<!ENTITY button.close.label "Schließen">
+<!ENTITY button.close.accesskey "C">
diff --git a/chrome/cookiemonster.jar!/locale/de-DE/siteCookies.properties b/chrome/cookiemonster.jar!/locale/de-DE/siteCookies.properties
new file mode 100644
index 0000000..74cc105
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/de-DE/siteCookies.properties
@@ -0,0 +1,6 @@
+#### Site Cookie Viewer
+
+sitelabel=Cookies für
+searchbyurl=Nach URL suchen
+clearlabel=Löschen
+clearaccesskey=L
diff --git a/chrome/cookiemonster.jar!/locale/en-US/cookieMonster.dtd b/chrome/cookiemonster.jar!/locale/en-US/cookieMonster.dtd
new file mode 100644
index 0000000..6db568c
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/en-US/cookieMonster.dtd
@@ -0,0 +1,3 @@
+<!ENTITY title.label "Hello World">
+<!ENTITY separate.label "This is a separate window!">
+<!ENTITY close.label "Close">
diff --git a/chrome/cookiemonster.jar!/locale/en-US/cookieMonster.properties b/chrome/cookiemonster.jar!/locale/en-US/cookieMonster.properties
new file mode 100644
index 0000000..a94ba10
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/en-US/cookieMonster.properties
@@ -0,0 +1,41 @@
+#### Cookie Access for Menu
+
+default=Default Action
+accepted=Accepted
+userprompted=User Prompted
+acceptedsession=Accepted for Session
+rejected=Rejected
+originatingsiteonly=Originating Site Only
+allow=Accept Cookies from
+deny=Reject Cookies from
+session=Accept Session Cookies from
+tooltiptext=Cookie Access for
+temp=Temporarily Allow Cookies from
+sitepermissions=Site
+domainpermissions=Domain
+permissionsresult=Resulting Action
+permissionsresultfor=Resulting Action for
+showcurrentcookies=Show Cookies for
+deletecurrentcookies=Delete Cookies for
+Default=Default
+Allow=Allow
+Session=Allow Session
+Deny=Block
+Temp=Temporarily Allow
+alternatecookieaccess=Cookie Access
+sitemenulabel=Site Level
+domainmenulabel=Domain Level
+thirdpartyblocked=Third Party Blocked
+
+## Labels for Confirmation Dialog
+confirmtitle=Delete Cookies
+confirmtext=Do you really want to delete cookies for %S?
+
+## Labels for Third Party Menu
+thirdpartynone=None Detected
+thirdpartytempallowall=Temporarily Allow All
+thirdpartytemprevokeall=Revoke Temporarily Allow
+
+## Label for Site Requesting to Set Cookie Indicator
+siteattemptedcookie=This site has requested to set cookie(s)
+sitenotattemptedcookie=This site has NOT requested to set cookie(s)
diff --git a/chrome/cookiemonster.jar!/locale/en-US/options.dtd b/chrome/cookiemonster.jar!/locale/en-US/options.dtd
new file mode 100644
index 0000000..9708311
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/en-US/options.dtd
@@ -0,0 +1,12 @@
+<!ENTITY options_window_title "Cookie Monster Options">
+<!ENTITY cookiemonster "Hello Cookies!">
+<!ENTITY options "Options">
+<!ENTITY secondlevel "Use 2nd Level Domain Names">
+<!ENTITY reloadonpermissionchange "Automatically Reload Affected Page When Cookie Permissions Change">
+<!ENTITY enablecontextmenu "Display Cookie Monster Menu in Context Menu">
+<!ENTITY deletecookies "Delete Cookies When Changing access to Deny">
+<!ENTITY enableglobalcookies "Enable Global Cookie Permissions Override">
+<!ENTITY thirdPartyCookies "Block 3rd Party Cookies">
+<!ENTITY denyCookiesDefault "Block All Cookies">
+<!ENTITY disabledeletecookieconfirm "Disable Confirmation Dialog for Delete Cookies Menu Option">
+<!ENTITY originaldefaulticon "Use Original Default Icon (the Monkey)">
diff --git a/chrome/cookiemonster.jar!/locale/en-US/overlay.dtd b/chrome/cookiemonster.jar!/locale/en-US/overlay.dtd
new file mode 100644
index 0000000..e4b72f3
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/en-US/overlay.dtd
@@ -0,0 +1,26 @@
+<!ENTITY helloworld "Hello World!">
+<!ENTITY cookiemonster "Cookie Monster">
+<!ENTITY secondlevel "Use 2nd Level Domain Names">
+<!ENTITY globalpermissions "Global Cookie Settings">
+<!ENTITY blockglobal "Block All Cookies (Uncheck to Allow)">
+<!ENTITY blockthirdparty "Block 3rd Party Cookies Only">
+<!ENTITY globaloverride "Override Global Cookie Permissions">
+<!ENTITY showcookieexceptions "Show Cookie Exceptions">
+<!ENTITY showcookies "Show Cookies">
+<!ENTITY showallcookies "Show Cookies for All Sites">
+<!ENTITY viewcookies "View Cookies">
+<!ENTITY deletecookies "Delete Cookies">
+<!ENTITY currentpermissions "Current Cookie Permissions">
+<!ENTITY alternatecookieaccess "Set Cookie Access">
+<!ENTITY sitepermissions "Site:">
+<!ENTITY domainpermissions "Domain:">
+<!ENTITY permissionsresult "Resulting Action:">
+<!ENTITY options "Options">
+<!ENTITY default "Default">
+<!ENTITY allow "Allow">
+<!ENTITY deny "Deny">
+<!ENTITY session "Session">
+<!ENTITY tempallow "Temporarily Allow">
+<!ENTITY thirdpartycookies "Third Party Cookies">
+<!ENTITY thirdpartydefault "None">
+<!ENTITY revoketempallow "Revoke All Temporarily Allow">
diff --git a/chrome/cookiemonster.jar!/locale/en-US/overrideGlobal.dtd b/chrome/cookiemonster.jar!/locale/en-US/overrideGlobal.dtd
new file mode 100644
index 0000000..63a4392
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/en-US/overrideGlobal.dtd
@@ -0,0 +1,16 @@
+<!ENTITY window.title "Override Global Cookie Permissions">
+<!ENTITY window.width "30em">
+
+<!ENTITY overrideglobaltext.label "Only use Global Override when per-site cookie permissions do not appear to properly work, most notably sites wherein the javascript uses navigator.cookieEnabled to detect cookie permissions.">
+<!ENTITY removepermission.label "Remove Site">
+<!ENTITY removepermission.accesskey "R">
+<!ENTITY removeallpermissions.label "Remove All Sites">
+<!ENTITY removeallpermissions.accesskey "e">
+<!ENTITY address.label "Address of web site:">
+<!ENTITY addressexists.label "URL already in list:">
+<!ENTITY addurl.label "Add URL">
+<!ENTITY addurl.accesskey "A">
+<!ENTITY windowClose.key "w">
+
+<!ENTITY button.close.label "Close">
+<!ENTITY button.close.accesskey "C">
diff --git a/chrome/cookiemonster.jar!/locale/en-US/siteCookies.properties b/chrome/cookiemonster.jar!/locale/en-US/siteCookies.properties
new file mode 100644
index 0000000..d250fbd
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/en-US/siteCookies.properties
@@ -0,0 +1,6 @@
+#### Site Cookie Viewer
+
+sitelabel=Cookies for
+searchbyurl=Search by URL
+clearlabel=Clear
+clearaccesskey=l
diff --git a/chrome/cookiemonster.jar!/locale/fr-FR/cookieMonster.dtd b/chrome/cookiemonster.jar!/locale/fr-FR/cookieMonster.dtd
new file mode 100644
index 0000000..7c0bde8
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/fr-FR/cookieMonster.dtd
@@ -0,0 +1,3 @@
+<!ENTITY title.label "Hello World">
+<!ENTITY separate.label "Ceci est une fenêtre séparée!">
+<!ENTITY close.label "Fermer">
diff --git a/chrome/cookiemonster.jar!/locale/fr-FR/cookieMonster.properties b/chrome/cookiemonster.jar!/locale/fr-FR/cookieMonster.properties
new file mode 100644
index 0000000..7be45c8
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/fr-FR/cookieMonster.properties
@@ -0,0 +1,41 @@
+#### Cookie Access for Menu
+
+default=Action par défaut
+accepted=Accepter
+userprompted=Demander à l'utilisateur
+acceptedsession=Accepter pour la session
+rejected=Rejeter
+originatingsiteonly=Site d'origine seulement
+allow=Accepter les cookies de
+deny=Interdire les cookies de
+session=Accepter les cookies pour la session
+tooltiptext=Accès du cookie pour
+temp=Autoriser temporairement les cookies de
+sitepermissions=Site
+domainpermissions=Domaine
+permissionsresult=Action effective
+permissionsresultfor=Action effective pour
+showcurrentcookies=Montrer les cookies pour
+deletecurrentcookies=Supprimer les cookies pour
+Default=Défaut
+Allow=Autoriser
+Session=Autoriser pour la session
+Deny=Bloquer
+Temp=Autoriser temporairement
+alternatecookieaccess=Accès aux cookies
+sitemenulabel=Sous-domaine
+domainmenulabel=Ensemble du domaine
+thirdpartyblocked=Cookies Tiers Bloqués
+
+## Labels for Confirmation Dialog
+confirmtitle=Supprimer les cookies
+confirmtext=Voulez-vous vraiment supprimer les cookies pour %S?
+
+## Labels for Third Party Menu
+thirdpartynone=Aucun Détecté
+thirdpartytempallowall=Tout autoriser temporairement
+thirdpartytemprevokeall=Tout interdire temporairement
+
+## Label for Site Requesting to Set Cookie Indicator
+siteattemptedcookie=Ce site a tenté de créer un cookie
+sitenotattemptedcookie=Ce site n'a PAS tenté de créer un cookie
diff --git a/chrome/cookiemonster.jar!/locale/fr-FR/options.dtd b/chrome/cookiemonster.jar!/locale/fr-FR/options.dtd
new file mode 100644
index 0000000..439ea61
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/fr-FR/options.dtd
@@ -0,0 +1,12 @@
+<!ENTITY options_window_title "Options de Cookie Monster">
+<!ENTITY cookiemonster "Bonjour Cookies!">
+<!ENTITY options "Options">
+<!ENTITY secondlevel "Appliquer les même permissions sur l'ensemble du nom de domaine">
+<!ENTITY reloadonpermissionchange "Recharger automatiquement les pages affectées après un changement de permission">
+<!ENTITY enablecontextmenu "Afficher Cookie Monster dans le menu contextuel">
+<!ENTITY deletecookies "Supprimer les cookies lors du passage à l'état 'interdire'">
+<!ENTITY enableglobalcookies "Autoriser d'outre-passer les permissions par défaut">
+<!ENTITY thirdPartyCookies "Bloquer les cookies tiers">
+<!ENTITY denyCookiesDefault "Bloquer tous les cookies">
+<!ENTITY disabledeletecookieconfirm "Ne pas demander confirmation lors de la suppression des cookies via le menu">
+<!ENTITY originaldefaulticon "Utiliser les anciennes icônes de base (le Singe)">
diff --git a/chrome/cookiemonster.jar!/locale/fr-FR/overlay.dtd b/chrome/cookiemonster.jar!/locale/fr-FR/overlay.dtd
new file mode 100644
index 0000000..91d4666
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/fr-FR/overlay.dtd
@@ -0,0 +1,26 @@
+<!ENTITY helloworld "Hello World!">
+<!ENTITY cookiemonster "Bonjour Cookies!">
+<!ENTITY secondlevel "Appliquer les même permissions sur l'ensemble du nom de domaine">
+<!ENTITY globalpermissions "Paramètres globals des cookies">
+<!ENTITY blockglobal "Bloquer tous les cookies (Décocher pour autoriser)">
+<!ENTITY blockthirdparty "Bloque les cookies tiers seulement">
+<!ENTITY globaloverride "Outre-passer les permissions par défaut">
+<!ENTITY showcookieexceptions "Montrer les exceptions">
+<!ENTITY showcookies "Afficher les cookies">
+<!ENTITY showallcookies "Afficher tous les cookies">
+<!ENTITY viewcookies "Voir les cookies">
+<!ENTITY deletecookies "Supprimer les cookies">
+<!ENTITY currentpermissions "Permissions courantes">
+<!ENTITY alternatecookieaccess "Définir l'autorisation du cookie">
+<!ENTITY sitepermissions "Site:">
+<!ENTITY domainpermissions "Domaine:">
+<!ENTITY permissionsresult "Action effective:">
+<!ENTITY options "Options">
+<!ENTITY default "Défaut">
+<!ENTITY allow "Autoriser">
+<!ENTITY deny "Interdire">
+<!ENTITY session "Session">
+<!ENTITY tempallow "Autoriser temporairement">
+<!ENTITY thirdpartycookies "Cookies Tiers">
+<!ENTITY thirdpartydefault "Aucun">
+<!ENTITY revoketempallow "Supprimer toutes les permissions temporaires">
diff --git a/chrome/cookiemonster.jar!/locale/fr-FR/overrideGlobal.dtd b/chrome/cookiemonster.jar!/locale/fr-FR/overrideGlobal.dtd
new file mode 100644
index 0000000..cd207c1
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/fr-FR/overrideGlobal.dtd
@@ -0,0 +1,16 @@
+<!ENTITY window.title "Outre-passer les permissions par défaut">
+<!ENTITY window.width "30em">
+
+<!ENTITY overrideglobaltext.label "Outre-passer les permissions par défaut uniquement lorsque que le site ne semble pas fonctionner correctement. C'est notamment le cas, lorsque celui-ci utilise la fonction javascript 'navigator.cookieEnabled' pour détecter l'activation des cookies.">
+<!ENTITY removepermission.label "Supprimer le site">
+<!ENTITY removepermission.accesskey "R">
+<!ENTITY removeallpermissions.label "Supprimer tous les sites">
+<!ENTITY removeallpermissions.accesskey "e">
+<!ENTITY address.label "Adresse du site web:">
+<!ENTITY addressexists.label "URL déjà dans la liste:">
+<!ENTITY addurl.label "Ajouter une URL">
+<!ENTITY addurl.accesskey "A">
+<!ENTITY windowClose.key "w">
+
+<!ENTITY button.close.label "Fermer">
+<!ENTITY button.close.accesskey "C">
diff --git a/chrome/cookiemonster.jar!/locale/fr-FR/siteCookies.properties b/chrome/cookiemonster.jar!/locale/fr-FR/siteCookies.properties
new file mode 100644
index 0000000..b5b40e4
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/fr-FR/siteCookies.properties
@@ -0,0 +1,6 @@
+#### Site Cookie Viewer
+
+sitelabel=Cookies pour
+searchbyurl=Recherche par URL
+clearlabel=Effacer
+clearaccesskey=E
diff --git a/chrome/cookiemonster.jar!/locale/zh-TW/cookieMonster.dtd b/chrome/cookiemonster.jar!/locale/zh-TW/cookieMonster.dtd
new file mode 100644
index 0000000..1d6f547
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/zh-TW/cookieMonster.dtd
@@ -0,0 +1,3 @@
+<!ENTITY title.label "Hello World">
+<!ENTITY separate.label "這是一個獨立的視窗!">
+<!ENTITY close.label "關閉">
diff --git a/chrome/cookiemonster.jar!/locale/zh-TW/cookieMonster.properties b/chrome/cookiemonster.jar!/locale/zh-TW/cookieMonster.properties
new file mode 100644
index 0000000..cd8c24f
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/zh-TW/cookieMonster.properties
@@ -0,0 +1,41 @@
+#### Cookie Access for Menu
+
+default = 預設動作
+accepted = 接受
+userprompted = 提示使用者
+acceptedsession = 只接受連線階段
+rejected = 拒絕
+originatingsiteonly = 只限原網站
+allow = 接受 Cookies 來自
+deny = 拒絕 Cookies 來自
+session = 接受連線階段 Cookies 來自
+tooltiptext = Cookie 存取權於
+temp = 暫時允許 Cookies 來自
+sitepermissions = 網站
+domainpermissions = 網域
+permissionsresult = 設定後動作
+permissionsresultfor = 設定後動作於
+showcurrentcookies = 顯示 Cookies 於
+deletecurrentcookies = 刪除 Cookies 於
+Default = 預設
+Allow = 允許
+Session = 只允許連線階段
+Deny = 阻擋
+Temp = 暫時允許
+alternatecookieaccess = Cookie 存取權
+sitemenulabel = 網站層級
+domainmenulabel = 網域層級
+thirdpartyblocked=阻擋第三方
+
+## Labels for Confirmation Dialog
+confirmtitle = 刪除 Cookies
+confirmtext = 您確定要刪除 %S 的 cookies?
+
+## Labels for Third Party Menu
+thirdpartynone=未偵測到
+thirdpartytempallowall=暫時全部允許
+thirdpartytemprevokeall=取消暫時允許
+
+## Label for Site Requesting to Set Cookie Indicator
+siteattemptedcookie=此網站已要求設定 cookie(s)
+sitenotattemptedcookie=此網站未要求設定 cookie(s)
diff --git a/chrome/cookiemonster.jar!/locale/zh-TW/options.dtd b/chrome/cookiemonster.jar!/locale/zh-TW/options.dtd
new file mode 100644
index 0000000..46dd7ef
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/zh-TW/options.dtd
@@ -0,0 +1,12 @@
+<!ENTITY options_window_title "Cookie Monster 選項">
+<!ENTITY cookiemonster "Hello Cookies!">
+<!ENTITY options "選項">
+<!ENTITY secondlevel "使用第二層網域名稱">
+<!ENTITY reloadonpermissionchange "Cookie 存取權改變時自動更新受影響的頁面">
+<!ENTITY enablecontextmenu "在右鍵選單顯示 Cookie Monster">
+<!ENTITY deletecookies "存取權變為拒絕時刪除 Cookies">
+<!ENTITY enableglobalcookies "啟用全域 Cookie 權限覆載">
+<!ENTITY thirdPartyCookies "阻擋來自第三方的 Cookies">
+<!ENTITY denyCookiesDefault "阻擋所有 Cookies">
+<!ENTITY disabledeletecookieconfirm "停用刪除 Cookies 選單選項裡的確認對話框">
+<!ENTITY originaldefaulticon "使用原來的預設圖示(猴子)">
diff --git a/chrome/cookiemonster.jar!/locale/zh-TW/overlay.dtd b/chrome/cookiemonster.jar!/locale/zh-TW/overlay.dtd
new file mode 100644
index 0000000..cc1d413
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/zh-TW/overlay.dtd
@@ -0,0 +1,26 @@
+<!ENTITY helloworld "Hello World!">
+<!ENTITY cookiemonster "Cookie Monster">
+<!ENTITY secondlevel "使用第二層網域名稱">
+<!ENTITY globalpermissions "全域 Cookies 設定">
+<!ENTITY blockglobal "阻擋所有 Cookies(若要允許請別勾選)">
+<!ENTITY blockthirdparty "只阻擋第三方 Cookies">
+<!ENTITY globaloverride "覆載全域 Cookie 權限">
+<!ENTITY showcookieexceptions "顯示 Cookie 例外">
+<!ENTITY showcookies "顯示 Cookies">
+<!ENTITY showallcookies "顯示所有網站的 Cookies">
+<!ENTITY viewcookies "檢視 Cookies">
+<!ENTITY deletecookies "刪除 Cookies">
+<!ENTITY currentpermissions "目前的 Cookie 權限">
+<!ENTITY alternatecookieaccess "設定 Cookie 存取權">
+<!ENTITY sitepermissions "網站:">
+<!ENTITY domainpermissions "網域:">
+<!ENTITY permissionsresult "設定後動作:">
+<!ENTITY options "選項">
+<!ENTITY default "預設">
+<!ENTITY allow "允許">
+<!ENTITY deny "拒絕">
+<!ENTITY session "連線階段">
+<!ENTITY tempallow "暫時允許">
+<!ENTITY thirdpartycookies "第三方 Cookies">
+<!ENTITY thirdpartydefault "無">
+<!ENTITY revoketempallow "取消所有暫時允許">
diff --git a/chrome/cookiemonster.jar!/locale/zh-TW/overrideGlobal.dtd b/chrome/cookiemonster.jar!/locale/zh-TW/overrideGlobal.dtd
new file mode 100644
index 0000000..44a7c26
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/zh-TW/overrideGlobal.dtd
@@ -0,0 +1,14 @@
+<!ENTITY window.title "覆載全域 Cookie 權限">
+<!ENTITY window.width "30em">
+<!ENTITY overrideglobaltext.label "全域覆載只在個別網站 cookie 權限似乎無法正常運作時才使用,尤其是那些在 javascript 用 navigator.cookieEnabled 來偵測 cookie 權限的網站。">
+<!ENTITY removepermission.label "移除網站">
+<!ENTITY removepermission.accesskey "R">
+<!ENTITY removeallpermissions.label "移除所有網站">
+<!ENTITY removeallpermissions.accesskey "e">
+<!ENTITY address.label "網站位址:">
+<!ENTITY addressexists.label "網路位址已在清單之中:">
+<!ENTITY addurl.label "新增網路位址">
+<!ENTITY addurl.accesskey "A">
+<!ENTITY windowClose.key "w">
+<!ENTITY button.close.label "關閉">
+<!ENTITY button.close.accesskey "C">
diff --git a/chrome/cookiemonster.jar!/locale/zh-TW/siteCookies.properties b/chrome/cookiemonster.jar!/locale/zh-TW/siteCookies.properties
new file mode 100644
index 0000000..7334ddd
--- /dev/null
+++ b/chrome/cookiemonster.jar!/locale/zh-TW/siteCookies.properties
@@ -0,0 +1,4 @@
+sitelabel = Cookies 於
+searchbyurl = 以網路位址搜尋
+clearlabel = 清除
+clearaccesskey = l
diff --git a/chrome/cookiemonster.jar!/skin/accept.png b/chrome/cookiemonster.jar!/skin/accept.png
new file mode 100644
index 0000000..219bc71
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/accept.png differ
diff --git a/chrome/cookiemonster.jar!/skin/cookie-monster-logo-bigger.png b/chrome/cookiemonster.jar!/skin/cookie-monster-logo-bigger.png
new file mode 100644
index 0000000..5ec3f67
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/cookie-monster-logo-bigger.png differ
diff --git a/chrome/cookiemonster.jar!/skin/cookie-monster-logo.png b/chrome/cookiemonster.jar!/skin/cookie-monster-logo.png
new file mode 100644
index 0000000..cf66a1d
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/cookie-monster-logo.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-angel-og.png b/chrome/cookiemonster.jar!/skin/face-angel-og.png
new file mode 100644
index 0000000..82382c6
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-angel-og.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-angel-temp.png b/chrome/cookiemonster.jar!/skin/face-angel-temp.png
new file mode 100644
index 0000000..584e9ce
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-angel-temp.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-angel.png b/chrome/cookiemonster.jar!/skin/face-angel.png
new file mode 100644
index 0000000..d2c5e94
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-angel.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-devil-grin.png b/chrome/cookiemonster.jar!/skin/face-devil-grin.png
new file mode 100644
index 0000000..8e2cd45
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-devil-grin.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-glasses-og.png b/chrome/cookiemonster.jar!/skin/face-glasses-og.png
new file mode 100644
index 0000000..92cb38b
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-glasses-og.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-glasses.png b/chrome/cookiemonster.jar!/skin/face-glasses.png
new file mode 100644
index 0000000..d13f2c8
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-glasses.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-monkey-small.png b/chrome/cookiemonster.jar!/skin/face-monkey-small.png
new file mode 100644
index 0000000..69db8fa
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-monkey-small.png differ
diff --git a/chrome/cookiemonster.jar!/skin/face-monkey.png b/chrome/cookiemonster.jar!/skin/face-monkey.png
new file mode 100644
index 0000000..ced7b2e
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/face-monkey.png differ
diff --git a/chrome/cookiemonster.jar!/skin/overlay.css b/chrome/cookiemonster.jar!/skin/overlay.css
new file mode 100644
index 0000000..9c1a9bb
--- /dev/null
+++ b/chrome/cookiemonster.jar!/skin/overlay.css
@@ -0,0 +1,62 @@
+/* Overlay CSS Theme
+** for Cookie Monster Extension
+**
+** Modified by: Tony Schilling
+**
+**
+** Date Last Modified: 11/14/2008
+*/
+
+/*
+ menupopup > menuitem#cookie-access-default {
+ list-style-image: url("chrome://cookiemonster/skin/abcardWindow.ico");
+ }
+ */
+
+statusbarpanel#cookiemonster-status {
+ list-style-image: url("chrome://cookiemonster/skin/face-monkey.png");
+}
+
+menuitem[name="cookie-top"] {
+ list-style-image: url("chrome://cookiemonster/skin/record.png");
+}
+
+menuitem[name="cookie-two"] {
+ list-style-image: url("chrome://cookiemonster/skin/record.png");
+}
+
+menuitem[name="cookie-three"] {
+ list-style-image: url("chrome://cookiemonster/skin/record.png");
+}
+
+menuitem[name="cookie-default"] {
+ list-style-image: url("chrome://cookiemonster/skin/record.png");
+}
+
+menuitem[name="cookie-access"] {
+ list-style-image: url("chrome://cookiemonster/skin/record.png");
+}
+
+menuitem[name="current-access"] {
+ list-style-image: url("chrome://cookiemonster/skin/accept.png");
+ font-weight: bold;
+}
+
+/*
+** Set the temporarily items to italics
+*/
+menuitem#cookie-access-top-temp, menuitem#cookie-access-second-temp, menuitem#cookie-access-third-temp, label#cookie-status-header {
+ font-style: italic;
+}
+
+/*
+** Cookie Status Tooltip
+*/
+.cookie-status-tooltip {
+ opacity: 0.8; /* see the background through the tooltip */
+}
+
+caption[name="cookie-caption-image-default"] {
+ list-style-image: url("chrome://cookiemonster/skin/face-monkey-small.png");
+}
+
diff --git a/chrome/cookiemonster.jar!/skin/record.png b/chrome/cookiemonster.jar!/skin/record.png
new file mode 100644
index 0000000..04b6e8c
Binary files /dev/null and b/chrome/cookiemonster.jar!/skin/record.png differ
--
Cookie Monster extension for Iceweasel/Firefox
More information about the Pkg-mozext-commits
mailing list