зеркало из https://github.com/mozilla/pjs.git
Bug 734472 - Pass JSObject to nsIScriptContext::SetProperty; r=jst
This commit is contained in:
Родитель
a2f1032bc7
Коммит
edfd0f9e25
|
@ -76,8 +76,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
|
||||||
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
||||||
|
|
||||||
#define NS_ISCRIPTCONTEXT_IID \
|
#define NS_ISCRIPTCONTEXT_IID \
|
||||||
{ 0xb0eca8ac, 0x2a77, 0x4d04, \
|
{ 0x6a536a37, 0x9773, 0x467e, \
|
||||||
{ 0xaf, 0x71, 0xca, 0x86, 0x98, 0xa4, 0xc3, 0xe7 } }
|
{ 0x93, 0xb2, 0xdb, 0xe6, 0xe6, 0xec, 0x24, 0xc3 } }
|
||||||
|
|
||||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||||
know what language we have is a little silly... */
|
know what language we have is a little silly... */
|
||||||
|
@ -401,7 +401,7 @@ public:
|
||||||
|
|
||||||
// SetProperty is suspect and jst believes should not be needed. Currenly
|
// SetProperty is suspect and jst believes should not be needed. Currenly
|
||||||
// used only for "arguments".
|
// used only for "arguments".
|
||||||
virtual nsresult SetProperty(void *aTarget, const char *aPropName, nsISupports *aVal) = 0;
|
virtual nsresult SetProperty(JSObject* aTarget, const char* aPropName, nsISupports* aVal) = 0;
|
||||||
/**
|
/**
|
||||||
* Called to set/get information if the script context is
|
* Called to set/get information if the script context is
|
||||||
* currently processing a script tag
|
* currently processing a script tag
|
||||||
|
|
|
@ -2293,7 +2293,7 @@ nsJSContext::InitializeExternalClasses()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsJSContext::SetProperty(void *aTarget, const char *aPropName, nsISupports *aArgs)
|
nsJSContext::SetProperty(JSObject* aTarget, const char* aPropName, nsISupports* aArgs)
|
||||||
{
|
{
|
||||||
PRUint32 argc;
|
PRUint32 argc;
|
||||||
jsval *argv = nsnull;
|
jsval *argv = nsnull;
|
||||||
|
@ -2302,8 +2302,8 @@ nsJSContext::SetProperty(void *aTarget, const char *aPropName, nsISupports *aArg
|
||||||
|
|
||||||
Maybe<nsRootedJSValueArray> tempStorage;
|
Maybe<nsRootedJSValueArray> tempStorage;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv =
|
||||||
rv = ConvertSupportsTojsvals(aArgs, GetNativeGlobal(), &argc, &argv, tempStorage);
|
ConvertSupportsTojsvals(aArgs, GetNativeGlobal(), &argc, &argv, tempStorage);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
jsval vargs;
|
jsval vargs;
|
||||||
|
@ -2327,11 +2327,9 @@ nsJSContext::SetProperty(void *aTarget, const char *aPropName, nsISupports *aArg
|
||||||
|
|
||||||
// Make sure to use JS_DefineProperty here so that we can override
|
// Make sure to use JS_DefineProperty here so that we can override
|
||||||
// readonly XPConnect properties here as well (read dialogArguments).
|
// readonly XPConnect properties here as well (read dialogArguments).
|
||||||
rv = ::JS_DefineProperty(mContext, reinterpret_cast<JSObject *>(aTarget),
|
return JS_DefineProperty(mContext, aTarget, aPropName, vargs, NULL, NULL, 0)
|
||||||
aPropName, vargs, nsnull, nsnull, 0) ?
|
? NS_OK
|
||||||
NS_OK : NS_ERROR_FAILURE;
|
: NS_ERROR_FAILURE;
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -2360,7 +2358,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||||
|
|
||||||
if (!aArgs)
|
if (!aArgs)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
PRUint32 argCtr, argCount;
|
PRUint32 argCount;
|
||||||
// This general purpose function may need to convert an arg array
|
// This general purpose function may need to convert an arg array
|
||||||
// (window.arguments, event-handler args) and a generic property.
|
// (window.arguments, event-handler args) and a generic property.
|
||||||
nsCOMPtr<nsIArray> argsArray(do_QueryInterface(aArgs));
|
nsCOMPtr<nsIArray> argsArray(do_QueryInterface(aArgs));
|
||||||
|
@ -2381,7 +2379,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
|
||||||
jsval *argv = aTempStorage.ref().Elements();
|
jsval *argv = aTempStorage.ref().Elements();
|
||||||
|
|
||||||
if (argsArray) {
|
if (argsArray) {
|
||||||
for (argCtr = 0; argCtr < argCount && NS_SUCCEEDED(rv); argCtr++) {
|
for (PRUint32 argCtr = 0; argCtr < argCount && NS_SUCCEEDED(rv); argCtr++) {
|
||||||
nsCOMPtr<nsISupports> arg;
|
nsCOMPtr<nsISupports> arg;
|
||||||
jsval *thisval = argv + argCtr;
|
jsval *thisval = argv + argCtr;
|
||||||
argsArray->QueryElementAt(argCtr, NS_GET_IID(nsISupports),
|
argsArray->QueryElementAt(argCtr, NS_GET_IID(nsISupports),
|
||||||
|
|
|
@ -151,7 +151,7 @@ public:
|
||||||
virtual bool GetScriptsEnabled();
|
virtual bool GetScriptsEnabled();
|
||||||
virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
|
virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
|
||||||
|
|
||||||
virtual nsresult SetProperty(void *aTarget, const char *aPropName, nsISupports *aVal);
|
virtual nsresult SetProperty(JSObject* aTarget, const char* aPropName, nsISupports* aVal);
|
||||||
|
|
||||||
virtual bool GetProcessingScriptTag();
|
virtual bool GetProcessingScriptTag();
|
||||||
virtual void SetProcessingScriptTag(bool aResult);
|
virtual void SetProcessingScriptTag(bool aResult);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче