Update AdBlock Plus patterns.
[tails-test.git] / config / chroot_local-includes / etc / iceweasel / profile / extensions / {00084897-021a-4361-8423-083407a033e0} / components / nsCSTempExceptions.js
blob5b108e9985bfbedeb1ebc402d348e0b6f16bf7a6
1 /***************************************************************************
2 Name: CS Lite
3 Description: Control cookie permissions.
4 Author: Ron Beckman
5 Homepage: http://addons.mozilla.org
7 Copyright (C) 2007 Ron Beckman
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to:
22 Free Software Foundation, Inc.
23 51 Franklin Street
24 Fifth Floor
25 Boston, MA 02110-1301
26 USA
27 ***************************************************************************/
30 const CSTEMPEXCEPTIONS_CONTRACTID = '@mozilla.org/CSTempExceptions;1';
31 const CSTEMPEXCEPTIONS_CID = Components.ID('{8742629c-8f6a-4787-9c44-2db49b392531}');
32 const CSTEMPEXCEPTIONS_IID = Components.interfaces.nsICSTempExceptions;
33 const CSTEMPEXCEPTIONS_SERVICENAME = 'CS Temp Exceptions';
35 var nsCSTempExceptions = {
37 hosts: [],
39 testTempExceptions: function(host) {
40 for (var i=0; i<this.hosts.length; ++i) {
41 if (this.hosts[i]==host) return true;
44 return false;
47 getTempExceptions: function() {
48 return this.hosts.join(' ');
51 addTempExceptions: function(host) {
52 var found = this.testTempExceptions(host);
53 if (!found) {
54 this.hosts.push(host);
57 //keep track of temp exceptions in a char pref in case browser
58 //crashes before all of the temp exceptions have been cleared
59 var prefs = this.getPrefs();
60 prefs.setCharPref('tempExceptions',this.hosts.join(' '));
63 removeTempExceptions: function(host) {
64 this.hosts = this.hosts.filter(function(value) {
65 return value != host;
66 });
68 //keep track of temp exceptions in a char pref in case browser
69 //crashes before all of the temp exceptions have been cleared
70 var prefs = this.getPrefs();
71 prefs.setCharPref('tempExceptions',this.hosts.join(' '));
74 clearTempExceptions: function() {
75 this.hosts = [];
77 //keep track of temp exceptions in a char pref in case browser
78 //crashes before all of the temp exceptions have been cleared
79 var prefs = this.getPrefs();
80 prefs.setCharPref('tempExceptions','');
83 getPrefs: function() {
84 return Components.classes["@mozilla.org/preferences-service;1"].
85 getService(Components.interfaces.nsIPrefService).
86 getBranch("cookiesafe.");
89 QueryInterface: function(iid) {
90 if (!iid.equals(Components.interfaces.nsISupports) &&
91 !iid.equals(CSTEMPEXCEPTIONS_IID))
92 throw Components.results.NS_ERROR_NO_INTERFACE;
93 return this;
97 var nsCSTempExceptionsModule = {
99 registerSelf: function(compMgr, fileSpec, location, type) {
100 compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
101 compMgr.registerFactoryLocation(CSTEMPEXCEPTIONS_CID,
102 CSTEMPEXCEPTIONS_SERVICENAME,
103 CSTEMPEXCEPTIONS_CONTRACTID,
104 fileSpec,location,type);
107 unregisterSelf: function (compMgr, fileSpec, location) {
108 compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
109 compMgr.unregisterFactoryLocation(CSTEMPEXCEPTIONS_CID,fileSpec);
112 getClassObject: function(compMgr, cid, iid) {
113 if (!cid.equals(CSTEMPEXCEPTIONS_CID))
114 throw Components.results.NS_ERROR_NO_INTERFACE;
115 if (!iid.equals(Components.interfaces.nsIFactory))
116 throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
117 return this.nsCSTempExceptionsFactory;
120 canUnload: function(compMgr) {
121 return true;
124 nsCSTempExceptionsFactory: {
126 createInstance: function(outer, iid) {
127 if (outer != null)
128 throw Components.results.NS_ERROR_NO_AGGREGATION;
129 if (!iid.equals(CSTEMPEXCEPTIONS_IID) &&
130 !iid.equals(Components.interfaces.nsISupports))
131 throw Components.results.NS_ERROR_INVALID_ARG;
132 return nsCSTempExceptions;
137 function NSGetModule(comMgr, fileSpec) { return nsCSTempExceptionsModule; }