1 const Cc
= Components
.classes
;
2 const Ci
= Components
.interfaces
;
4 // This is copied from toolkit/components/content/js/lang.js.
5 // It seems cleaner to copy this rather than #include from so far away.
6 Function
.prototype.inherits = function(parentCtor
) {
7 var tempCtor = function(){};
8 tempCtor
.prototype = parentCtor
.prototype;
9 this.superClass_
= parentCtor
.prototype;
10 this.prototype = new tempCtor();
13 #include
../content/application.js
14 #include
../content/globalstore.js
15 #include
../content/list-warden
.js
16 #include
../content/phishing-warden
.js
17 #include
../content/malware-warden
.js
21 var jslib
= Cc
["@mozilla.org/url-classifier/jslib;1"]
22 .getService().wrappedJSObject
;
23 modScope
.G_Debug
= jslib
.G_Debug
;
24 modScope
.G_Assert
= jslib
.G_Assert
;
25 modScope
.G_Alarm
= jslib
.G_Alarm
;
26 modScope
.G_ConditionalAlarm
= jslib
.G_ConditionalAlarm
;
27 modScope
.G_ObserverWrapper
= jslib
.G_ObserverWrapper
;
28 modScope
.G_Preferences
= jslib
.G_Preferences
;
29 modScope
.PROT_XMLFetcher
= jslib
.PROT_XMLFetcher
;
30 modScope
.BindToObject
= jslib
.BindToObject
;
31 modScope
.G_Protocol4Parser
= jslib
.G_Protocol4Parser
;
32 modScope
.PROT_UrlCrypto
= jslib
.PROT_UrlCrypto
;
33 modScope
.RequestBackoff
= jslib
.RequestBackoff
;
35 // We only need to call Init once
36 modScope
.Init = function() {};
40 function SafebrowsingApplicationMod() {
41 this.firstTime
= true;
42 this.cid
= Components
.ID("{c64d0bcb-8270-4ca7-a0b3-3380c8ffecb5}");
43 this.progid
= "@mozilla.org/safebrowsing/application;1";
46 SafebrowsingApplicationMod
.prototype.registerSelf = function(compMgr
, fileSpec
, loc
, type
) {
48 this.firstTime
= false;
49 throw Components
.results
.NS_ERROR_FACTORY_REGISTER_AGAIN
;
51 compMgr
= compMgr
.QueryInterface(Ci
.nsIComponentRegistrar
);
52 compMgr
.registerFactoryLocation(this.cid
,
53 "Safebrowsing Application Module",
59 compMgr
.registerFactoryLocation(this.cid
,
60 "UrlClassifier Blocked Error Page",
61 "@mozilla.org/network/protocol/about;1?what=blocked",
67 SafebrowsingApplicationMod
.prototype.getClassObject = function(compMgr
, cid
, iid
) {
68 if (!cid
.equals(this.cid
))
69 throw Components
.results
.NS_ERROR_NO_INTERFACE
;
70 if (!iid
.equals(Ci
.nsIFactory
))
71 throw Components
.results
.NS_ERROR_NOT_IMPLEMENTED
;
76 SafebrowsingApplicationMod
.prototype.canUnload = function(compMgr
) {
80 SafebrowsingApplicationMod
.prototype.factory
= {
81 createInstance: function(outer
, iid
) {
83 throw Components
.results
.NS_ERROR_NO_AGGREGATION
;
85 return new PROT_Application();
89 var ApplicationModInst
= new SafebrowsingApplicationMod();
91 function NSGetModule(compMgr
, fileSpec
) {
92 return ApplicationModInst
;