This commit is contained in:
rflint%ryanflint.com 2007-11-24 02:45:42 +00:00
Родитель e9f3916c46
Коммит c6ae2f378d
1 изменённых файлов: 78 добавлений и 18 удалений

Просмотреть файл

@ -42,8 +42,6 @@ const Ci = Components.interfaces;
const Cc = Components.classes; const Cc = Components.classes;
const Cr = Components.results; const Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const PERMS_FILE = 0644; const PERMS_FILE = 0644;
const PERMS_DIRECTORY = 0755; const PERMS_DIRECTORY = 0755;
@ -289,13 +287,21 @@ loadListener.prototype = {
_engine: null, _engine: null,
_stream: null, _stream: null,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver, QueryInterface: function SRCH_loadQI(aIID) {
Ci.nsIStreamListener, if (aIID.equals(Ci.nsISupports) ||
Ci.nsIChannelEventSink, aIID.equals(Ci.nsIRequestObserver) ||
Ci.nsIInterfaceRequestor, aIID.equals(Ci.nsIStreamListener) ||
// See FIXME comment below aIID.equals(Ci.nsIChannelEventSink) ||
Ci.nsIHttpEventSink, aIID.equals(Ci.nsIInterfaceRequestor) ||
Ci.nsIProgressEventSink]), // See FIXME comment below
aIID.equals(Ci.nsIHttpEventSink) ||
aIID.equals(Ci.nsIProgressEventSink) ||
false)
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
// nsIRequestObserver // nsIRequestObserver
onStartRequest: function SRCH_loadStartR(aRequest, aContext) { onStartRequest: function SRCH_loadStartR(aRequest, aContext) {
LOG("loadListener: Starting request: " + aRequest.name); LOG("loadListener: Starting request: " + aRequest.name);
@ -2140,7 +2146,12 @@ Engine.prototype = {
}, },
// nsISupports // nsISupports
QueryInterface: XPCOMUtils.generateQI([Ci.nsISearchEngine]), QueryInterface: function SRCH_ENG_QI(aIID) {
if (aIID.equals(Ci.nsISearchEngine) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
get wrappedJSObject() { get wrappedJSObject() {
return this; return this;
@ -2160,7 +2171,12 @@ Submission.prototype = {
get postData() { get postData() {
return this._postData; return this._postData;
}, },
QueryInterface: XPCOMUtils.generateQI([Ci.nsISearchSubmission]) QueryInterface: function SRCH_SUBM_QI(aIID) {
if (aIID.equals(Ci.nsISearchSubmission) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
}
} }
// nsIBrowserSearchService // nsIBrowserSearchService
@ -2855,11 +2871,13 @@ SearchService.prototype = {
os.removeObserver(this, QUIT_APPLICATION_TOPIC); os.removeObserver(this, QUIT_APPLICATION_TOPIC);
}, },
classDescription: "Browser Search Service", QueryInterface: function SRCH_SVC_QI(aIID) {
contractID: "@mozilla.org/browser/search-service;1", if (aIID.equals(Ci.nsIBrowserSearchService) ||
classID: Components.ID("{7319788a-fe93-4db3-9f39-818cf08f4256}"), aIID.equals(Ci.nsIObserver) ||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserSearchService, aIID.equals(Ci.nsISupports))
Ci.nsIObserver]) return this;
throw Cr.NS_ERROR_NO_INTERFACE;
}
}; };
var engineMetadataService = { var engineMetadataService = {
@ -3080,7 +3098,49 @@ var engineUpdateService = {
} }
}; };
function NSGetModule(componentManager, fileSpec) const kClassID = Components.ID("{7319788a-fe93-4db3-9f39-818cf08f4256}");
XPCOMUtils.generateModule([SearchService]); const kClassName = "Browser Search Service";
const kContractID = "@mozilla.org/browser/search-service;1";
// nsIFactory
const kFactory = {
createInstance: function (outer, iid) {
if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
return (new SearchService()).QueryInterface(iid);
}
};
// nsIModule
const gModule = {
registerSelf: function (componentManager, fileSpec, location, type) {
componentManager.QueryInterface(Ci.nsIComponentRegistrar);
componentManager.registerFactoryLocation(kClassID,
kClassName,
kContractID,
fileSpec, location, type);
},
unregisterSelf: function(componentManager, fileSpec, location) {
componentManager.QueryInterface(Ci.nsIComponentRegistrar);
componentManager.unregisterFactoryLocation(kClassID, fileSpec);
},
getClassObject: function (componentManager, cid, iid) {
if (!cid.equals(kClassID))
throw Cr.NS_ERROR_NO_INTERFACE;
if (!iid.equals(Ci.nsIFactory))
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
return kFactory;
},
canUnload: function (componentManager) {
return true;
}
};
function NSGetModule(componentManager, fileSpec) {
return gModule;
}
#include ../../../toolkit/content/debug.js #include ../../../toolkit/content/debug.js