зеркало из https://github.com/mozilla/gecko-dev.git
Bug 683802 - Add jsval to the XPTCMiniVariant union for type safety. r=mrbkap
This commit is contained in:
Родитель
4764ad32ea
Коммит
85a6b92ebd
|
@ -2848,12 +2848,9 @@ CallMethodHelper::ConvertIndependentParam(uint8 i)
|
|||
// indirectly, regardless of in/out-ness.
|
||||
if(type_tag == nsXPTType::T_JSVAL)
|
||||
{
|
||||
// Assign the value
|
||||
JS_STATIC_ASSERT(sizeof(jsval) <= sizeof(dp->val));
|
||||
jsval *rootp = (jsval *)&dp->val;
|
||||
dp->ptr = rootp;
|
||||
*rootp = JSVAL_VOID;
|
||||
if(!JS_AddValueRoot(mCallContext, rootp))
|
||||
// Root the value.
|
||||
dp->val.j = JSVAL_VOID;
|
||||
if (!JS_AddValueRoot(mCallContext, &dp->val.j))
|
||||
return JS_FALSE;
|
||||
dp->SetValIsJSRoot();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "nsISupports.h"
|
||||
#include "xpt_struct.h"
|
||||
#include "xptinfo.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
struct nsXPTCMiniVariant
|
||||
{
|
||||
|
@ -73,6 +74,11 @@ struct nsXPTCMiniVariant
|
|||
char c;
|
||||
PRUnichar wc;
|
||||
void* p;
|
||||
|
||||
// Types below here are unknown to the assembly implementations, and
|
||||
// therefore _must_ be passed with indirect semantics. We put them in
|
||||
// the union here for type safety, so that we can avoid void* tricks.
|
||||
jsval j;
|
||||
} val;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче