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 Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const PERMS_FILE = 0644;
const PERMS_DIRECTORY = 0755;
@ -289,13 +287,21 @@ loadListener.prototype = {
_engine: null,
_stream: null,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver,
Ci.nsIStreamListener,
Ci.nsIChannelEventSink,
Ci.nsIInterfaceRequestor,
QueryInterface: function SRCH_loadQI(aIID) {
if (aIID.equals(Ci.nsISupports) ||
aIID.equals(Ci.nsIRequestObserver) ||
aIID.equals(Ci.nsIStreamListener) ||
aIID.equals(Ci.nsIChannelEventSink) ||
aIID.equals(Ci.nsIInterfaceRequestor) ||
// See FIXME comment below
Ci.nsIHttpEventSink,
Ci.nsIProgressEventSink]),
aIID.equals(Ci.nsIHttpEventSink) ||
aIID.equals(Ci.nsIProgressEventSink) ||
false)
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
// nsIRequestObserver
onStartRequest: function SRCH_loadStartR(aRequest, aContext) {
LOG("loadListener: Starting request: " + aRequest.name);
@ -2140,7 +2146,12 @@ Engine.prototype = {
},
// 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() {
return this;
@ -2160,7 +2171,12 @@ Submission.prototype = {
get 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
@ -2855,11 +2871,13 @@ SearchService.prototype = {
os.removeObserver(this, QUIT_APPLICATION_TOPIC);
},
classDescription: "Browser Search Service",
contractID: "@mozilla.org/browser/search-service;1",
classID: Components.ID("{7319788a-fe93-4db3-9f39-818cf08f4256}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserSearchService,
Ci.nsIObserver])
QueryInterface: function SRCH_SVC_QI(aIID) {
if (aIID.equals(Ci.nsIBrowserSearchService) ||
aIID.equals(Ci.nsIObserver) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
var engineMetadataService = {
@ -3080,7 +3098,49 @@ var engineUpdateService = {
}
};
function NSGetModule(componentManager, fileSpec)
XPCOMUtils.generateModule([SearchService]);
const kClassID = Components.ID("{7319788a-fe93-4db3-9f39-818cf08f4256}");
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