Bug 1148070 - Change nsIClassInfo::getHelperForLanguage() to getScriptableHelper(). r=bholley

This commit is contained in:
Andrew McCreight 2015-03-29 07:52:54 -07:00
Родитель 69bad032ab
Коммит 46dfeaba0b
30 изменённых файлов: 78 добавлений и 124 удалений

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

@ -29,7 +29,7 @@ const Subject = Class({
object: object
};
},
getHelperForLanguage: function() {},
getScriptableHelper: function() {},
getInterfaces: function() {}
});

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

@ -829,16 +829,10 @@ nsDOMClassInfo::GetInterfaces(uint32_t *aCount, nsIID ***aArray)
}
NS_IMETHODIMP
nsDOMClassInfo::GetHelperForLanguage(uint32_t language, nsISupports **_retval)
nsDOMClassInfo::GetScriptableHelper(nsIXPCScriptable **_retval)
{
if (language == nsIProgrammingLanguage::JAVASCRIPT) {
*_retval = static_cast<nsIXPCScriptable *>(this);
NS_ADDREF(*_retval);
} else {
*_retval = nullptr;
}
nsCOMPtr<nsIXPCScriptable> rval = this;
rval.forget(_retval);
return NS_OK;
}

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

@ -202,7 +202,7 @@ nsHostObjectURI::GetInterfaces(uint32_t *count, nsIID * **array)
}
NS_IMETHODIMP
nsHostObjectURI::GetHelperForLanguage(uint32_t language, nsISupports **_retval)
nsHostObjectURI::GetScriptableHelper(nsIXPCScriptable **_retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -16,7 +16,7 @@ SpeechTaskCallback.prototype = {
getInterfaces: function(c) {},
getHelperForLanguage: function() {},
getScriptableHelper: function() {},
onPause: function onPause() {
if (this.onpause)
@ -58,7 +58,7 @@ var TestSpeechServiceWithAudio = SpecialPowers.wrapCallbackObject({
getInterfaces: function(c) {},
getHelperForLanguage: function() {}
getScriptableHelper: function() {}
});
var TestSpeechServiceNoAudio = SpecialPowers.wrapCallbackObject({
@ -98,7 +98,7 @@ var TestSpeechServiceNoAudio = SpecialPowers.wrapCallbackObject({
getInterfaces: function(c) {},
getHelperForLanguage: function() {},
getScriptableHelper: function() {},
expectedSpeaks: []
});

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

@ -144,7 +144,7 @@ this.XPCOMUtils = {
countRef.value = _interfaces.length;
return _interfaces;
},
getHelperForLanguage: function XPCU_getHelperForLanguage(language) null,
getScriptableHelper: function XPCU_getScriptableHelper() null,
contractID: classInfo.contractID,
classDescription: classInfo.classDescription,
classID: classInfo.classID,

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

@ -153,10 +153,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_Interfaces::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_Interfaces::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -397,10 +396,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_InterfacesByID::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_InterfacesByID::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -643,10 +641,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_Classes::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_Classes::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -869,10 +866,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_ClassesByID::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_ClassesByID::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -1118,10 +1114,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_Results::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_Results::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -1324,10 +1319,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_ID::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_ID::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -1541,10 +1535,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_Exception::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_Exception::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -1931,10 +1924,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCConstructor::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCConstructor::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -2186,10 +2178,9 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper(); */
NS_IMETHODIMP
nsXPCComponents_Constructor::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
nsXPCComponents_Constructor::GetScriptableHelper(nsIXPCScriptable** retval)
{
*retval = nullptr;
return NS_OK;
@ -3735,7 +3726,7 @@ public:
// The NS_IMETHODIMP isn't really accurate here, but NS_CALLBACK requires
// the referent to be declared __stdcall on Windows, and this is the only
// macro that does that.
static NS_IMETHODIMP Get(uint32_t aLangId, nsISupports** helper)
static NS_IMETHODIMP Get(nsIXPCScriptable** helper)
{
*helper = &singleton;
return NS_OK;

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

@ -239,15 +239,11 @@ static void EnsureClassObjectsInitialized()
}
}
NS_METHOD GetSharedScriptableHelperForJSIID(uint32_t language,
nsISupports** helper)
NS_METHOD GetSharedScriptableHelperForJSIID(nsIXPCScriptable** helper)
{
EnsureClassObjectsInitialized();
if (language == nsIProgrammingLanguage::JAVASCRIPT) {
nsCOMPtr<nsIXPCScriptable> temp = gSharedScriptableHelperForJSIID.get();
temp.forget(helper);
} else
*helper = nullptr;
nsCOMPtr<nsIXPCScriptable> temp = gSharedScriptableHelperForJSIID.get();
temp.forget(helper);
return NS_OK;
}

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

@ -114,14 +114,12 @@ oom:
return NS_ERROR_OUT_OF_MEMORY;
}
/* nsISupports getHelperForLanguage (in uint32_t language); */
/* nsIXPCScriptable getScriptableHelper (); */
NS_IMETHODIMP
BackstagePass::GetHelperForLanguage(uint32_t language,
nsISupports** retval)
BackstagePass::GetScriptableHelper(nsIXPCScriptable** retval)
{
nsCOMPtr<nsISupports> supports =
do_QueryInterface(static_cast<nsIGlobalObject*>(this));
supports.forget(retval);
nsCOMPtr<nsIXPCScriptable> scriptable = this;
scriptable.forget(retval);
return NS_OK;
}

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

@ -655,16 +655,12 @@ XPCWrappedNative::GatherProtoScriptableCreateInfo(nsIClassInfo* classInfo,
return;
}
nsCOMPtr<nsISupports> possibleHelper;
nsresult rv = classInfo->GetHelperForLanguage(nsIProgrammingLanguage::JAVASCRIPT,
getter_AddRefs(possibleHelper));
if (NS_SUCCEEDED(rv) && possibleHelper) {
nsCOMPtr<nsIXPCScriptable> helper(do_QueryInterface(possibleHelper));
if (helper) {
uint32_t flags = helper->GetScriptableFlags();
sciProto.SetCallback(helper.forget());
sciProto.SetFlags(XPCNativeScriptableFlags(flags));
}
nsCOMPtr<nsIXPCScriptable> helper;
nsresult rv = classInfo->GetScriptableHelper(getter_AddRefs(helper));
if (NS_SUCCEEDED(rv) && helper) {
uint32_t flags = helper->GetScriptableFlags();
sciProto.SetCallback(helper.forget());
sciProto.SetFlags(XPCNativeScriptableFlags(flags));
}
}

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

@ -68,7 +68,7 @@ BlobComponent.prototype =
return interfaces;
},
getHelperForLanguage: function getHelperForLanguage(aLanguage) {
getScriptableHelper: function getScriptableHelper() {
return null;
},

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

@ -93,7 +93,7 @@ FileComponent.prototype =
return interfaces;
},
getHelperForLanguage: function getHelperForLanguage(aLanguage) {
getScriptableHelper: function getScriptableHelper() {
return null;
},

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

@ -35,7 +35,7 @@ FooComponent.prototype =
return interfaces;
},
getHelperForLanguage: function getHelperForLanguage(aLanguage) {
getScriptableHelper: function getScriptableHelper() {
return null;
},
@ -68,7 +68,7 @@ BarComponent.prototype =
return interfaces;
},
getHelperForLanguage: function getHelperForLanguage(aLanguage) {
getScriptableHelper: function getScriptableHelper() {
return null;
},

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

@ -166,7 +166,7 @@ nsJARURI::GetInterfaces(uint32_t *count, nsIID * **array)
}
NS_IMETHODIMP
nsJARURI::GetHelperForLanguage(uint32_t language, nsISupports **_retval)
nsJARURI::GetScriptableHelper(nsIXPCScriptable **_retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -557,7 +557,7 @@ nsSimpleURI::GetInterfaces(uint32_t *count, nsIID * **array)
}
NS_IMETHODIMP
nsSimpleURI::GetHelperForLanguage(uint32_t language, nsISupports **_retval)
nsSimpleURI::GetScriptableHelper(nsIXPCScriptable **_retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -2439,7 +2439,7 @@ nsSocketTransport::GetInterfaces(uint32_t *count, nsIID * **array)
}
NS_IMETHODIMP
nsSocketTransport::GetHelperForLanguage(uint32_t language, nsISupports **_retval)
nsSocketTransport::GetScriptableHelper(nsIXPCScriptable **_retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -3179,7 +3179,7 @@ nsStandardURL::GetInterfaces(uint32_t *count, nsIID * **array)
}
NS_IMETHODIMP
nsStandardURL::GetHelperForLanguage(uint32_t language, nsISupports **_retval)
nsStandardURL::GetScriptableHelper(nsIXPCScriptable **_retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -447,8 +447,7 @@ TransportSecurityInfo::GetInterfaces(uint32_t *count, nsIID * **array)
}
NS_IMETHODIMP
TransportSecurityInfo::GetHelperForLanguage(uint32_t language,
nsISupports **_retval)
TransportSecurityInfo::GetScriptableHelper(nsIXPCScriptable **_retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -1921,8 +1921,7 @@ nsNSSCertificate::GetInterfaces(uint32_t* count, nsIID*** array)
}
NS_IMETHODIMP
nsNSSCertificate::GetHelperForLanguage(uint32_t language,
nsISupports** _retval)
nsNSSCertificate::GetScriptableHelper(nsIXPCScriptable** _retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -290,8 +290,7 @@ nsNSSCertificateFakeTransport::GetInterfaces(uint32_t* count, nsIID*** array)
}
NS_IMETHODIMP
nsNSSCertificateFakeTransport::GetHelperForLanguage(uint32_t,
nsISupports** _retval)
nsNSSCertificateFakeTransport::GetScriptableHelper(nsIXPCScriptable** _retval)
{
*_retval = nullptr;
return NS_OK;

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

@ -214,7 +214,7 @@ nsSSLStatus::GetInterfaces(uint32_t* aCount, nsIID*** aArray)
}
NS_IMETHODIMP
nsSSLStatus::GetHelperForLanguage(uint32_t aLanguage, nsISupports** aHelper)
nsSSLStatus::GetScriptableHelper(nsIXPCScriptable** aHelper)
{
*aHelper = nullptr;
return NS_OK;

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

@ -149,6 +149,6 @@ function Subject(object) {
Subject.prototype = {
QueryInterface: XPCOMUtils.generateQI([]),
getHelperForLanguage: function() {},
getScriptableHelper: function() {},
getInterfaces: function() {}
};

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

@ -58,15 +58,10 @@ public:
}
NS_IMETHODIMP
GetHelperForLanguage(uint32_t aLanguage, nsISupports **_helper) override
GetScriptableHelper(nsIXPCScriptable **_helper) override
{
if (aLanguage == nsIProgrammingLanguage::JAVASCRIPT) {
static AsyncStatementJSHelper sJSHelper;
*_helper = &sJSHelper;
return NS_OK;
}
*_helper = nullptr;
static AsyncStatementJSHelper sJSHelper;
*_helper = &sJSHelper;
return NS_OK;
}

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

@ -60,15 +60,10 @@ public:
}
NS_IMETHODIMP
GetHelperForLanguage(uint32_t aLanguage, nsISupports **_helper) override
GetScriptableHelper(nsIXPCScriptable **_helper) override
{
if (aLanguage == nsIProgrammingLanguage::JAVASCRIPT) {
static StatementJSHelper sJSHelper;
*_helper = &sJSHelper;
return NS_OK;
}
*_helper = nullptr;
static StatementJSHelper sJSHelper;
*_helper = &sJSHelper;
return NS_OK;
}

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

@ -754,7 +754,7 @@ xhr.prototype = {
},
flags: Ci.nsIClassInfo.SINGLETON,
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
getHelperForLanguage: function(aLanguage) null,
getScriptableHelper: function() null,
getInterfaces: function(aCount) {
let interfaces = [Ci.nsISupports];
aCount.value = interfaces.length;

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

@ -3044,7 +3044,7 @@ xhr.prototype = {
},
flags: Ci.nsIClassInfo.SINGLETON,
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
getHelperForLanguage: function(aLanguage) null,
getScriptableHelper: function() null,
getInterfaces: function(aCount) {
let interfaces = [Ci.nsISupports];
aCount.value = interfaces.length;
@ -3102,7 +3102,7 @@ function UpdatePrompt() {
UpdatePrompt.prototype = {
flags: Ci.nsIClassInfo.SINGLETON,
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
getHelperForLanguage: function(aLanguage) null,
getScriptableHelper: function() null,
getInterfaces: function(aCount) {
let interfaces = [Ci.nsISupports, Ci.nsIUpdatePrompt];
aCount.value = interfaces.length;

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

@ -6,13 +6,15 @@
#include "nsISupports.idl"
interface nsIXPCScriptable;
/**
* Provides information about a specific implementation class. If you want
* your class to implement nsIClassInfo, see nsIClassInfoImpl.h for
* instructions--you most likely do not want to inherit from nsIClassInfo.
*/
[scriptable, uuid(986c11d0-f340-11d4-9075-0010a4e73d9a)]
[scriptable, uuid(7a633335-18cc-4794-9ddd-26ac7cab7be6)]
interface nsIClassInfo : nsISupports
{
/**
@ -27,18 +29,10 @@ interface nsIClassInfo : nsISupports
[array, size_is(count), retval] out nsIIDPtr array);
/**
* Get a language mapping specific helper object that may assist in using
* objects of this class in a specific lanaguage. For instance, if asked
* for the helper for nsIProgrammingLanguage::JAVASCRIPT this might return
* an object that can be QI'd into the nsIXPCScriptable interface to assist
* XPConnect in supplying JavaScript specific behavior to callers of the
* instance object.
*
* see: nsIProgrammingLanguage.idl
*
* Should return null if no helper available for given language.
* Return an object to assist XPConnect in supplying JavaScript-specific
* behavior to callers of the instance object, or null if not needed.
*/
nsISupports getHelperForLanguage(in uint32_t language);
nsIXPCScriptable getScriptableHelper();
/**
* A contract ID through which an instance of this class can be created

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

@ -28,11 +28,10 @@ GenericClassInfo::GetInterfaces(uint32_t* aCount, nsIID*** aArray)
}
NS_IMETHODIMP
GenericClassInfo::GetHelperForLanguage(uint32_t aLanguage,
nsISupports** aHelper)
GenericClassInfo::GetScriptableHelper(nsIXPCScriptable** aHelper)
{
if (mData->getlanguagehelper) {
return mData->getlanguagehelper(aLanguage, aHelper);
if (mData->getscriptablehelper) {
return mData->getscriptablehelper(aHelper);
}
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -91,11 +91,10 @@ public:
{
typedef NS_CALLBACK(GetInterfacesProc)(uint32_t* aCountP,
nsIID*** aArray);
typedef NS_CALLBACK(GetLanguageHelperProc)(uint32_t aLanguage,
nsISupports** aHelper);
typedef NS_CALLBACK(GetScriptableHelperProc)(nsIXPCScriptable** aHelper);
GetInterfacesProc getinterfaces;
GetLanguageHelperProc getlanguagehelper;
GetScriptableHelperProc getscriptablehelper;
uint32_t flags;
nsCID cid;
};
@ -115,11 +114,11 @@ private:
extern NS_IMETHODIMP NS_CI_INTERFACE_GETTER_NAME(_class) \
(uint32_t *, nsIID ***);
#define NS_IMPL_CLASSINFO(_class, _getlanguagehelper, _flags, _cid) \
#define NS_IMPL_CLASSINFO(_class, _getscriptablehelper, _flags, _cid) \
NS_DECL_CI_INTERFACE_GETTER(_class) \
static const GenericClassInfo::ClassInfoData k##_class##ClassInfoData = { \
NS_CI_INTERFACE_GETTER_NAME(_class), \
_getlanguagehelper, \
_getscriptablehelper, \
_flags | nsIClassInfo::SINGLETON_CLASSINFO, \
_cid, \
}; \

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

@ -1081,7 +1081,7 @@ _class::GetInterfaces(uint32_t* _count, nsIID*** _array) \
} \
\
NS_IMETHODIMP \
_class::GetHelperForLanguage(uint32_t _language, nsISupports** _retval) \
_class::GetScriptableHelper(nsIXPCScriptable** _retval) \
{ \
*_retval = nullptr; \
return NS_OK; \

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

@ -126,7 +126,7 @@ nsThreadClassInfo::GetInterfaces(uint32_t* aCount, nsIID*** aArray)
}
NS_IMETHODIMP
nsThreadClassInfo::GetHelperForLanguage(uint32_t aLang, nsISupports** aResult)
nsThreadClassInfo::GetScriptableHelper(nsIXPCScriptable** aResult)
{
*aResult = nullptr;
return NS_OK;