зеркало из https://github.com/mozilla/gecko-dev.git
Bug 386473 - XPCOMUtilify SearchService. r=gavin a=mconnor
This commit is contained in:
Родитель
21f77ba426
Коммит
734ee73ba9
|
@ -42,6 +42,8 @@ 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;
|
||||||
|
|
||||||
|
@ -287,21 +289,13 @@ loadListener.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
_stream: null,
|
_stream: null,
|
||||||
|
|
||||||
QueryInterface: function SRCH_loadQI(aIID) {
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver,
|
||||||
if (aIID.equals(Ci.nsISupports) ||
|
Ci.nsIStreamListener,
|
||||||
aIID.equals(Ci.nsIRequestObserver) ||
|
Ci.nsIChannelEventSink,
|
||||||
aIID.equals(Ci.nsIStreamListener) ||
|
Ci.nsIInterfaceRequestor,
|
||||||
aIID.equals(Ci.nsIChannelEventSink) ||
|
// See FIXME comment below
|
||||||
aIID.equals(Ci.nsIInterfaceRequestor) ||
|
Ci.nsIHttpEventSink,
|
||||||
// See FIXME comment below
|
Ci.nsIProgressEventSink]),
|
||||||
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);
|
||||||
|
@ -2146,12 +2140,7 @@ Engine.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
QueryInterface: function SRCH_ENG_QI(aIID) {
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISearchEngine]),
|
||||||
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;
|
||||||
|
@ -2171,12 +2160,7 @@ Submission.prototype = {
|
||||||
get postData() {
|
get postData() {
|
||||||
return this._postData;
|
return this._postData;
|
||||||
},
|
},
|
||||||
QueryInterface: function SRCH_SUBM_QI(aIID) {
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISearchSubmission])
|
||||||
if (aIID.equals(Ci.nsISearchSubmission) ||
|
|
||||||
aIID.equals(Ci.nsISupports))
|
|
||||||
return this;
|
|
||||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nsIBrowserSearchService
|
// nsIBrowserSearchService
|
||||||
|
@ -2871,13 +2855,11 @@ SearchService.prototype = {
|
||||||
os.removeObserver(this, QUIT_APPLICATION_TOPIC);
|
os.removeObserver(this, QUIT_APPLICATION_TOPIC);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function SRCH_SVC_QI(aIID) {
|
classDescription: "Browser Search Service",
|
||||||
if (aIID.equals(Ci.nsIBrowserSearchService) ||
|
contractID: "@mozilla.org/browser/search-service;1",
|
||||||
aIID.equals(Ci.nsIObserver) ||
|
classID: Components.ID("{7319788a-fe93-4db3-9f39-818cf08f4256}"),
|
||||||
aIID.equals(Ci.nsISupports))
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserSearchService,
|
||||||
return this;
|
Ci.nsIObserver])
|
||||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var engineMetadataService = {
|
var engineMetadataService = {
|
||||||
|
@ -3098,49 +3080,7 @@ var engineUpdateService = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const kClassID = Components.ID("{7319788a-fe93-4db3-9f39-818cf08f4256}");
|
function NSGetModule(componentManager, fileSpec)
|
||||||
const kClassName = "Browser Search Service";
|
XPCOMUtils.generateModule([SearchService]);
|
||||||
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
|
||||||
|
|
Загрузка…
Ссылка в новой задаче