mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720580 - Stop passing isGlobal everywhere and use the nsIXPCScriptable flags instead. r=mrbkap
This commit is contained in:
parent
ccb745bc93
commit
fe4872737f
@ -4223,8 +4223,7 @@ nsXPCComponents::AttachNewComponentsObject(XPCCallContext& ccx,
|
|||||||
|
|
||||||
nsCOMPtr<XPCWrappedNative> wrapper;
|
nsCOMPtr<XPCWrappedNative> wrapper;
|
||||||
xpcObjectHelper helper(cholder);
|
xpcObjectHelper helper(cholder);
|
||||||
XPCWrappedNative::GetNewOrUsed(ccx, helper, aScope, iface,
|
XPCWrappedNative::GetNewOrUsed(ccx, helper, aScope, iface, getter_AddRefs(wrapper));
|
||||||
OBJ_IS_NOT_GLOBAL, getter_AddRefs(wrapper));
|
|
||||||
if (!wrapper)
|
if (!wrapper)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -348,16 +348,9 @@ XPCConvert::NativeData2JS(XPCLazyCallContext& lccx, jsval* d, const void* s,
|
|||||||
pErr, d);
|
pErr, d);
|
||||||
}
|
}
|
||||||
// else...
|
// else...
|
||||||
|
|
||||||
// XXX The OBJ_IS_NOT_GLOBAL here is not really right. In
|
|
||||||
// fact, this code is depending on the fact that the
|
|
||||||
// global object will not have been collected, and
|
|
||||||
// therefore this NativeInterface2JSObject will not end up
|
|
||||||
// creating a new XPCNativeScriptableShared.
|
|
||||||
xpcObjectHelper helper(iface);
|
xpcObjectHelper helper(iface);
|
||||||
if (!NativeInterface2JSObject(lccx, d, nsnull, helper, iid,
|
if (!NativeInterface2JSObject(lccx, d, nsnull, helper, iid,
|
||||||
nsnull, true,
|
nsnull, true, pErr))
|
||||||
OBJ_IS_NOT_GLOBAL, pErr))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -876,7 +869,6 @@ XPCConvert::NativeInterface2JSObject(XPCLazyCallContext& lccx,
|
|||||||
const nsID* iid,
|
const nsID* iid,
|
||||||
XPCNativeInterface** Interface,
|
XPCNativeInterface** Interface,
|
||||||
bool allowNativeWrapper,
|
bool allowNativeWrapper,
|
||||||
bool isGlobal,
|
|
||||||
nsresult* pErr)
|
nsresult* pErr)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!Interface || iid,
|
NS_ASSERTION(!Interface || iid,
|
||||||
@ -1016,7 +1008,6 @@ XPCConvert::NativeInterface2JSObject(XPCLazyCallContext& lccx,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
rv = XPCWrappedNative::GetNewOrUsed(ccx, aHelper, xpcscope, iface,
|
rv = XPCWrappedNative::GetNewOrUsed(ccx, aHelper, xpcscope, iface,
|
||||||
isGlobal,
|
|
||||||
getter_AddRefs(strongWrapper));
|
getter_AddRefs(strongWrapper));
|
||||||
|
|
||||||
wrapper = strongWrapper;
|
wrapper = strongWrapper;
|
||||||
|
@ -622,7 +622,6 @@ XPCNativeScriptableSharedMap::~XPCNativeScriptableSharedMap()
|
|||||||
JSBool
|
JSBool
|
||||||
XPCNativeScriptableSharedMap::GetNewOrUsed(uint32_t flags,
|
XPCNativeScriptableSharedMap::GetNewOrUsed(uint32_t flags,
|
||||||
char* name,
|
char* name,
|
||||||
bool isGlobal,
|
|
||||||
PRUint32 interfacesBitmap,
|
PRUint32 interfacesBitmap,
|
||||||
XPCNativeScriptableInfo* si)
|
XPCNativeScriptableInfo* si)
|
||||||
{
|
{
|
||||||
@ -643,7 +642,7 @@ XPCNativeScriptableSharedMap::GetNewOrUsed(uint32_t flags,
|
|||||||
interfacesBitmap);
|
interfacesBitmap);
|
||||||
if (!shared)
|
if (!shared)
|
||||||
return false;
|
return false;
|
||||||
shared->PopulateJSClass(isGlobal);
|
shared->PopulateJSClass();
|
||||||
}
|
}
|
||||||
si->SetScriptableShared(shared);
|
si->SetScriptableShared(shared);
|
||||||
return true;
|
return true;
|
||||||
|
@ -580,8 +580,8 @@ public:
|
|||||||
|
|
||||||
static XPCNativeScriptableSharedMap* newMap(int size);
|
static XPCNativeScriptableSharedMap* newMap(int size);
|
||||||
|
|
||||||
JSBool GetNewOrUsed(uint32_t flags, char* name, bool isGlobal,
|
JSBool GetNewOrUsed(uint32_t flags, char* name, PRUint32 interfacesBitmap,
|
||||||
PRUint32 interfacesBitmap, XPCNativeScriptableInfo* si);
|
XPCNativeScriptableInfo* si);
|
||||||
|
|
||||||
inline uint32_t Count() {return mTable->entryCount;}
|
inline uint32_t Count() {return mTable->entryCount;}
|
||||||
inline uint32_t Enumerate(JSDHashEnumerator f, void *arg)
|
inline uint32_t Enumerate(JSDHashEnumerator f, void *arg)
|
||||||
|
@ -1111,16 +1111,10 @@ xpc_qsXPCOMObjectToJsval(XPCLazyCallContext &lccx, qsObjectHelper &aHelper,
|
|||||||
|
|
||||||
JSContext *cx = lccx.GetJSContext();
|
JSContext *cx = lccx.GetJSContext();
|
||||||
|
|
||||||
// XXX The OBJ_IS_NOT_GLOBAL here is not really right. In
|
|
||||||
// fact, this code is depending on the fact that the
|
|
||||||
// global object will not have been collected, and
|
|
||||||
// therefore this NativeInterface2JSObject will not end up
|
|
||||||
// creating a new XPCNativeScriptableShared.
|
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
if (!XPCConvert::NativeInterface2JSObject(lccx, rval, nsnull,
|
if (!XPCConvert::NativeInterface2JSObject(lccx, rval, nsnull,
|
||||||
aHelper, iid, iface,
|
aHelper, iid, iface,
|
||||||
true, OBJ_IS_NOT_GLOBAL, &rv)) {
|
true, &rv)) {
|
||||||
// I can't tell if NativeInterface2JSObject throws JS exceptions
|
// I can't tell if NativeInterface2JSObject throws JS exceptions
|
||||||
// or not. This is a sloppy stab at the right semantics; the
|
// or not. This is a sloppy stab at the right semantics; the
|
||||||
// method really ought to be fixed to behave consistently.
|
// method really ought to be fixed to behave consistently.
|
||||||
|
@ -1315,8 +1315,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
|
|||||||
JSBool ok =
|
JSBool ok =
|
||||||
XPCConvert::NativeInterface2JSObject(ccx,
|
XPCConvert::NativeInterface2JSObject(ccx,
|
||||||
&v, nsnull, helper, newWrapperIID,
|
&v, nsnull, helper, newWrapperIID,
|
||||||
nsnull, false, false,
|
nsnull, false, nsnull);
|
||||||
nsnull);
|
|
||||||
if (newWrapperIID)
|
if (newWrapperIID)
|
||||||
nsMemory::Free(newWrapperIID);
|
nsMemory::Free(newWrapperIID);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
@ -331,7 +331,6 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
xpcObjectHelper& helper,
|
xpcObjectHelper& helper,
|
||||||
XPCWrappedNativeScope* Scope,
|
XPCWrappedNativeScope* Scope,
|
||||||
XPCNativeInterface* Interface,
|
XPCNativeInterface* Interface,
|
||||||
JSBool isGlobal,
|
|
||||||
XPCWrappedNative** resultWrapper)
|
XPCWrappedNative** resultWrapper)
|
||||||
{
|
{
|
||||||
nsWrapperCache *cache = helper.GetWrapperCache();
|
nsWrapperCache *cache = helper.GetWrapperCache();
|
||||||
@ -452,8 +451,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
XPCWrappedNativeScope* betterScope =
|
XPCWrappedNativeScope* betterScope =
|
||||||
XPCWrappedNativeScope::FindInJSObjectScope(ccx, parent);
|
XPCWrappedNativeScope::FindInJSObjectScope(ccx, parent);
|
||||||
if (betterScope != Scope)
|
if (betterScope != Scope)
|
||||||
return GetNewOrUsed(ccx, helper, betterScope, Interface,
|
return GetNewOrUsed(ccx, helper, betterScope, Interface, resultWrapper);
|
||||||
isGlobal, resultWrapper);
|
|
||||||
|
|
||||||
newParentVal = OBJECT_TO_JSVAL(parent);
|
newParentVal = OBJECT_TO_JSVAL(parent);
|
||||||
}
|
}
|
||||||
@ -522,7 +520,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
// wrapper is actually created, but before JS code can see it.
|
// wrapper is actually created, but before JS code can see it.
|
||||||
|
|
||||||
if (info && !isClassInfo) {
|
if (info && !isClassInfo) {
|
||||||
proto = XPCWrappedNativeProto::GetNewOrUsed(ccx, Scope, info, &sciProto, isGlobal);
|
proto = XPCWrappedNativeProto::GetNewOrUsed(ccx, Scope, info, &sciProto);
|
||||||
if (!proto)
|
if (!proto)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -558,7 +556,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
NS_ASSERTION(!xpc::WrapperFactory::IsXrayWrapper(parent),
|
NS_ASSERTION(!xpc::WrapperFactory::IsXrayWrapper(parent),
|
||||||
"Xray wrapper being used to parent XPCWrappedNative?");
|
"Xray wrapper being used to parent XPCWrappedNative?");
|
||||||
|
|
||||||
if (!wrapper->Init(ccx, parent, isGlobal, &sciWrapper)) {
|
if (!wrapper->Init(ccx, parent, &sciWrapper)) {
|
||||||
NS_RELEASE(wrapper);
|
NS_RELEASE(wrapper);
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@ -1062,8 +1060,7 @@ static PRUint32 sMorphedSlimWrappers;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
XPCWrappedNative::Init(XPCCallContext& ccx,
|
XPCWrappedNative::Init(XPCCallContext& ccx, JSObject* parent,
|
||||||
JSObject* parent, JSBool isGlobal,
|
|
||||||
const XPCNativeScriptableCreateInfo* sci)
|
const XPCNativeScriptableCreateInfo* sci)
|
||||||
{
|
{
|
||||||
// setup our scriptable info...
|
// setup our scriptable info...
|
||||||
@ -1076,7 +1073,7 @@ XPCWrappedNative::Init(XPCCallContext& ccx,
|
|||||||
}
|
}
|
||||||
if (!mScriptableInfo) {
|
if (!mScriptableInfo) {
|
||||||
mScriptableInfo =
|
mScriptableInfo =
|
||||||
XPCNativeScriptableInfo::Construct(ccx, isGlobal, sci);
|
XPCNativeScriptableInfo::Construct(ccx, sci);
|
||||||
|
|
||||||
if (!mScriptableInfo)
|
if (!mScriptableInfo)
|
||||||
return false;
|
return false;
|
||||||
@ -1088,7 +1085,7 @@ XPCWrappedNative::Init(XPCCallContext& ccx,
|
|||||||
|
|
||||||
JSClass* jsclazz = si ? si->GetJSClass() : Jsvalify(&XPC_WN_NoHelper_JSClass.base);
|
JSClass* jsclazz = si ? si->GetJSClass() : Jsvalify(&XPC_WN_NoHelper_JSClass.base);
|
||||||
|
|
||||||
if (isGlobal) {
|
if (si && si->GetFlags().IsGlobalObject()) {
|
||||||
// Resolving a global object's class can cause us to create a global's
|
// Resolving a global object's class can cause us to create a global's
|
||||||
// JS class without the proper global flags. Notice that here and fix
|
// JS class without the proper global flags. Notice that here and fix
|
||||||
// the problem.
|
// the problem.
|
||||||
@ -1458,9 +1455,7 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCCallContext& ccx,
|
|||||||
newProto =
|
newProto =
|
||||||
XPCWrappedNativeProto::GetNewOrUsed(ccx, aNewScope,
|
XPCWrappedNativeProto::GetNewOrUsed(ccx, aNewScope,
|
||||||
oldProto->GetClassInfo(),
|
oldProto->GetClassInfo(),
|
||||||
&ci,
|
&ci, oldProto->GetOffsetsMasked());
|
||||||
(info->GetJSClass()->flags & JSCLASS_IS_GLOBAL),
|
|
||||||
oldProto->GetOffsetsMasked());
|
|
||||||
if (!newProto) {
|
if (!newProto) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@ -2999,9 +2994,7 @@ NS_IMETHODIMP XPCWrappedNative::RefreshPrototype()
|
|||||||
XPCNativeScriptableInfo *info = oldProto->GetScriptableInfo();
|
XPCNativeScriptableInfo *info = oldProto->GetScriptableInfo();
|
||||||
XPCNativeScriptableCreateInfo ci(*info);
|
XPCNativeScriptableCreateInfo ci(*info);
|
||||||
newProto = XPCWrappedNativeProto::GetNewOrUsed(ccx, oldProto->GetScope(),
|
newProto = XPCWrappedNativeProto::GetNewOrUsed(ccx, oldProto->GetScope(),
|
||||||
oldProto->GetClassInfo(),
|
oldProto->GetClassInfo(), &ci,
|
||||||
&ci,
|
|
||||||
(info->GetJSClass()->flags & JSCLASS_IS_GLOBAL),
|
|
||||||
oldProto->GetOffsetsMasked());
|
oldProto->GetOffsetsMasked());
|
||||||
if (!newProto)
|
if (!newProto)
|
||||||
return UnexpectedFailure(NS_ERROR_FAILURE);
|
return UnexpectedFailure(NS_ERROR_FAILURE);
|
||||||
@ -3686,10 +3679,8 @@ ConstructSlimWrapper(XPCCallContext &ccx,
|
|||||||
sciProto(aHelper.forgetXPCClassInfo(), flags, interfacesBitmap);
|
sciProto(aHelper.forgetXPCClassInfo(), flags, interfacesBitmap);
|
||||||
|
|
||||||
AutoMarkingWrappedNativeProtoPtr xpcproto(ccx);
|
AutoMarkingWrappedNativeProtoPtr xpcproto(ccx);
|
||||||
JSBool isGlobal = false;
|
|
||||||
xpcproto = XPCWrappedNativeProto::GetNewOrUsed(ccx, xpcScope,
|
xpcproto = XPCWrappedNativeProto::GetNewOrUsed(ccx, xpcScope,
|
||||||
classInfoHelper, &sciProto,
|
classInfoHelper, &sciProto);
|
||||||
isGlobal);
|
|
||||||
if (!xpcproto)
|
if (!xpcproto)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1349,7 +1349,6 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JSObject *obj)
|
|||||||
// static
|
// static
|
||||||
XPCNativeScriptableInfo*
|
XPCNativeScriptableInfo*
|
||||||
XPCNativeScriptableInfo::Construct(XPCCallContext& ccx,
|
XPCNativeScriptableInfo::Construct(XPCCallContext& ccx,
|
||||||
JSBool isGlobal,
|
|
||||||
const XPCNativeScriptableCreateInfo* sci)
|
const XPCNativeScriptableCreateInfo* sci)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(sci, "bad param");
|
NS_ASSERTION(sci, "bad param");
|
||||||
@ -1372,7 +1371,7 @@ XPCNativeScriptableInfo::Construct(XPCCallContext& ccx,
|
|||||||
XPCNativeScriptableSharedMap* map = rt->GetNativeScriptableSharedMap();
|
XPCNativeScriptableSharedMap* map = rt->GetNativeScriptableSharedMap();
|
||||||
{ // scoped lock
|
{ // scoped lock
|
||||||
XPCAutoLock lock(rt->GetMapLock());
|
XPCAutoLock lock(rt->GetMapLock());
|
||||||
success = map->GetNewOrUsed(sci->GetFlags(), name, isGlobal,
|
success = map->GetNewOrUsed(sci->GetFlags(), name,
|
||||||
sci->GetInterfacesBitmap(), newObj);
|
sci->GetInterfacesBitmap(), newObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1385,7 +1384,7 @@ XPCNativeScriptableInfo::Construct(XPCCallContext& ccx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XPCNativeScriptableShared::PopulateJSClass(JSBool isGlobal)
|
XPCNativeScriptableShared::PopulateJSClass()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mJSClass.base.name, "bad state!");
|
NS_ASSERTION(mJSClass.base.name, "bad state!");
|
||||||
|
|
||||||
@ -1393,7 +1392,7 @@ XPCNativeScriptableShared::PopulateJSClass(JSBool isGlobal)
|
|||||||
JSCLASS_PRIVATE_IS_NSISUPPORTS |
|
JSCLASS_PRIVATE_IS_NSISUPPORTS |
|
||||||
JSCLASS_NEW_RESOLVE;
|
JSCLASS_NEW_RESOLVE;
|
||||||
|
|
||||||
if (isGlobal)
|
if (mFlags.IsGlobalObject())
|
||||||
mJSClass.base.flags |= XPCONNECT_GLOBAL_FLAGS;
|
mJSClass.base.flags |= XPCONNECT_GLOBAL_FLAGS;
|
||||||
|
|
||||||
JSPropertyOp addProperty;
|
JSPropertyOp addProperty;
|
||||||
|
@ -89,7 +89,6 @@ XPCWrappedNativeProto::~XPCWrappedNativeProto()
|
|||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
XPCWrappedNativeProto::Init(XPCCallContext& ccx,
|
XPCWrappedNativeProto::Init(XPCCallContext& ccx,
|
||||||
JSBool isGlobal,
|
|
||||||
const XPCNativeScriptableCreateInfo* scriptableCreateInfo)
|
const XPCNativeScriptableCreateInfo* scriptableCreateInfo)
|
||||||
{
|
{
|
||||||
nsIXPCScriptable *callback = scriptableCreateInfo ?
|
nsIXPCScriptable *callback = scriptableCreateInfo ?
|
||||||
@ -97,7 +96,7 @@ XPCWrappedNativeProto::Init(XPCCallContext& ccx,
|
|||||||
nsnull;
|
nsnull;
|
||||||
if (callback) {
|
if (callback) {
|
||||||
mScriptableInfo =
|
mScriptableInfo =
|
||||||
XPCNativeScriptableInfo::Construct(ccx, isGlobal, scriptableCreateInfo);
|
XPCNativeScriptableInfo::Construct(ccx, scriptableCreateInfo);
|
||||||
if (!mScriptableInfo)
|
if (!mScriptableInfo)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -195,7 +194,6 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
XPCWrappedNativeScope* scope,
|
XPCWrappedNativeScope* scope,
|
||||||
nsIClassInfo* classInfo,
|
nsIClassInfo* classInfo,
|
||||||
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
|
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
|
||||||
JSBool isGlobal,
|
|
||||||
QITableEntry* offsets)
|
QITableEntry* offsets)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(scope, "bad param");
|
NS_ASSERTION(scope, "bad param");
|
||||||
@ -226,7 +224,7 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCCallContext& ccx,
|
|||||||
|
|
||||||
proto = new XPCWrappedNativeProto(scope, classInfo, ciFlags, set, offsets);
|
proto = new XPCWrappedNativeProto(scope, classInfo, ciFlags, set, offsets);
|
||||||
|
|
||||||
if (!proto || !proto->Init(ccx, isGlobal, scriptableCreateInfo)) {
|
if (!proto || !proto->Init(ccx, scriptableCreateInfo)) {
|
||||||
delete proto.get();
|
delete proto.get();
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
@ -106,17 +106,11 @@ static bool
|
|||||||
XPCOMObjectToJsval(JSContext *cx, JSObject *scope, xpcObjectHelper &helper,
|
XPCOMObjectToJsval(JSContext *cx, JSObject *scope, xpcObjectHelper &helper,
|
||||||
bool allowNativeWrapper, jsval *rval)
|
bool allowNativeWrapper, jsval *rval)
|
||||||
{
|
{
|
||||||
// XXX The OBJ_IS_NOT_GLOBAL here is not really right. In
|
|
||||||
// fact, this code is depending on the fact that the
|
|
||||||
// global object will not have been collected, and
|
|
||||||
// therefore this NativeInterface2JSObject will not end up
|
|
||||||
// creating a new XPCNativeScriptableShared.
|
|
||||||
|
|
||||||
XPCLazyCallContext lccx(JS_CALLER, cx, scope);
|
XPCLazyCallContext lccx(JS_CALLER, cx, scope);
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
if (!XPCConvert::NativeInterface2JSObject(lccx, rval, NULL, helper, NULL, NULL,
|
if (!XPCConvert::NativeInterface2JSObject(lccx, rval, NULL, helper, NULL, NULL,
|
||||||
allowNativeWrapper, OBJ_IS_NOT_GLOBAL, &rv)) {
|
allowNativeWrapper, &rv)) {
|
||||||
// I can't tell if NativeInterface2JSObject throws JS exceptions
|
// I can't tell if NativeInterface2JSObject throws JS exceptions
|
||||||
// or not. This is a sloppy stab at the right semantics; the
|
// or not. This is a sloppy stab at the right semantics; the
|
||||||
// method really ought to be fixed to behave consistently.
|
// method really ought to be fixed to behave consistently.
|
||||||
|
@ -1271,7 +1271,7 @@ nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext,
|
|||||||
if (!XPCConvert::NativeInterface2JSObject(ccx, &v,
|
if (!XPCConvert::NativeInterface2JSObject(ccx, &v,
|
||||||
getter_AddRefs(holder),
|
getter_AddRefs(holder),
|
||||||
helper, &NS_GET_IID(nsISupports), nsnull,
|
helper, &NS_GET_IID(nsISupports), nsnull,
|
||||||
false, OBJ_IS_GLOBAL, &rv))
|
false, &rv))
|
||||||
return UnexpectedFailure(rv);
|
return UnexpectedFailure(rv);
|
||||||
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv) && holder, "Didn't wrap properly");
|
NS_ASSERTION(NS_SUCCEEDED(rv) && holder, "Didn't wrap properly");
|
||||||
@ -1372,8 +1372,7 @@ NativeInterface2JSObject(XPCLazyCallContext & lccx,
|
|||||||
nsresult rv;
|
nsresult rv;
|
||||||
xpcObjectHelper helper(aCOMObj, aCache);
|
xpcObjectHelper helper(aCOMObj, aCache);
|
||||||
if (!XPCConvert::NativeInterface2JSObject(lccx, aVal, aHolder, helper, aIID,
|
if (!XPCConvert::NativeInterface2JSObject(lccx, aVal, aHolder, helper, aIID,
|
||||||
nsnull, aAllowWrapping,
|
nsnull, aAllowWrapping, &rv))
|
||||||
OBJ_IS_NOT_GLOBAL, &rv))
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -2120,8 +2119,7 @@ nsXPConnect::GetWrappedNativePrototype(JSContext * aJSContext,
|
|||||||
XPCWrappedNative::GatherProtoScriptableCreateInfo(aClassInfo, sciProto);
|
XPCWrappedNative::GatherProtoScriptableCreateInfo(aClassInfo, sciProto);
|
||||||
|
|
||||||
AutoMarkingWrappedNativeProtoPtr proto(ccx);
|
AutoMarkingWrappedNativeProtoPtr proto(ccx);
|
||||||
proto = XPCWrappedNativeProto::GetNewOrUsed(ccx, scope, aClassInfo,
|
proto = XPCWrappedNativeProto::GetNewOrUsed(ccx, scope, aClassInfo, &sciProto);
|
||||||
&sciProto, OBJ_IS_NOT_GLOBAL);
|
|
||||||
if (!proto)
|
if (!proto)
|
||||||
return UnexpectedFailure(NS_ERROR_FAILURE);
|
return UnexpectedFailure(NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
@ -459,9 +459,6 @@ AddToCCKind(JSGCTraceKind kind)
|
|||||||
return kind == JSTRACE_OBJECT || kind == JSTRACE_XML || kind == JSTRACE_SCRIPT;
|
return kind == JSTRACE_OBJECT || kind == JSTRACE_XML || kind == JSTRACE_SCRIPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool OBJ_IS_GLOBAL = true;
|
|
||||||
const bool OBJ_IS_NOT_GLOBAL = false;
|
|
||||||
|
|
||||||
class nsXPConnect : public nsIXPConnect,
|
class nsXPConnect : public nsIXPConnect,
|
||||||
public nsIThreadObserver,
|
public nsIThreadObserver,
|
||||||
public nsSupportsWeakReference,
|
public nsSupportsWeakReference,
|
||||||
@ -2076,7 +2073,7 @@ public:
|
|||||||
{char* name=(char*)mJSClass.base.name; mJSClass.base.name = nsnull;
|
{char* name=(char*)mJSClass.base.name; mJSClass.base.name = nsnull;
|
||||||
return name;}
|
return name;}
|
||||||
|
|
||||||
void PopulateJSClass(JSBool isGlobal);
|
void PopulateJSClass();
|
||||||
|
|
||||||
void Mark() {mFlags.Mark();}
|
void Mark() {mFlags.Mark();}
|
||||||
void Unmark() {mFlags.Unmark();}
|
void Unmark() {mFlags.Unmark();}
|
||||||
@ -2096,8 +2093,7 @@ class XPCNativeScriptableInfo
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static XPCNativeScriptableInfo*
|
static XPCNativeScriptableInfo*
|
||||||
Construct(XPCCallContext& ccx, JSBool isGlobal,
|
Construct(XPCCallContext& ccx, const XPCNativeScriptableCreateInfo* sci);
|
||||||
const XPCNativeScriptableCreateInfo* sci);
|
|
||||||
|
|
||||||
nsIXPCScriptable*
|
nsIXPCScriptable*
|
||||||
GetCallback() const {return mCallback;}
|
GetCallback() const {return mCallback;}
|
||||||
@ -2208,7 +2204,6 @@ public:
|
|||||||
XPCWrappedNativeScope* scope,
|
XPCWrappedNativeScope* scope,
|
||||||
nsIClassInfo* classInfo,
|
nsIClassInfo* classInfo,
|
||||||
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
|
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
|
||||||
JSBool isGlobal,
|
|
||||||
QITableEntry* offsets = UNKNOWN_OFFSETS);
|
QITableEntry* offsets = UNKNOWN_OFFSETS);
|
||||||
|
|
||||||
XPCWrappedNativeScope*
|
XPCWrappedNativeScope*
|
||||||
@ -2336,7 +2331,7 @@ protected:
|
|||||||
XPCNativeSet* Set,
|
XPCNativeSet* Set,
|
||||||
QITableEntry* offsets);
|
QITableEntry* offsets);
|
||||||
|
|
||||||
JSBool Init(XPCCallContext& ccx, JSBool isGlobal,
|
JSBool Init(XPCCallContext& ccx,
|
||||||
const XPCNativeScriptableCreateInfo* scriptableCreateInfo);
|
const XPCNativeScriptableCreateInfo* scriptableCreateInfo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -2590,7 +2585,6 @@ public:
|
|||||||
xpcObjectHelper& helper,
|
xpcObjectHelper& helper,
|
||||||
XPCWrappedNativeScope* Scope,
|
XPCWrappedNativeScope* Scope,
|
||||||
XPCNativeInterface* Interface,
|
XPCNativeInterface* Interface,
|
||||||
JSBool isGlobal,
|
|
||||||
XPCWrappedNative** wrapper);
|
XPCWrappedNative** wrapper);
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
@ -2791,8 +2785,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
JSBool Init(XPCCallContext& ccx, JSObject* parent, JSBool isGlobal,
|
JSBool Init(XPCCallContext& ccx, JSObject* parent, const XPCNativeScriptableCreateInfo* sci);
|
||||||
const XPCNativeScriptableCreateInfo* sci);
|
|
||||||
JSBool Init(XPCCallContext &ccx, JSObject *existingJSObject);
|
JSBool Init(XPCCallContext &ccx, JSObject *existingJSObject);
|
||||||
JSBool FinishInit(XPCCallContext &ccx);
|
JSBool FinishInit(XPCCallContext &ccx);
|
||||||
|
|
||||||
@ -3278,7 +3271,6 @@ public:
|
|||||||
* will be QI'ed to get the cache)
|
* will be QI'ed to get the cache)
|
||||||
* @param allowNativeWrapper if true, this method may wrap the resulting
|
* @param allowNativeWrapper if true, this method may wrap the resulting
|
||||||
* JSObject in an XPCNativeWrapper and return that, as needed.
|
* JSObject in an XPCNativeWrapper and return that, as needed.
|
||||||
* @param isGlobal
|
|
||||||
* @param pErr [out] relevant error code, if any.
|
* @param pErr [out] relevant error code, if any.
|
||||||
* @param src_is_identity optional performance hint. Set to true only
|
* @param src_is_identity optional performance hint. Set to true only
|
||||||
* if src is the identity pointer.
|
* if src is the identity pointer.
|
||||||
@ -3290,12 +3282,11 @@ public:
|
|||||||
const nsID* iid,
|
const nsID* iid,
|
||||||
XPCNativeInterface** Interface,
|
XPCNativeInterface** Interface,
|
||||||
bool allowNativeWrapper,
|
bool allowNativeWrapper,
|
||||||
bool isGlobal,
|
|
||||||
nsresult* pErr)
|
nsresult* pErr)
|
||||||
{
|
{
|
||||||
XPCLazyCallContext lccx(ccx);
|
XPCLazyCallContext lccx(ccx);
|
||||||
return NativeInterface2JSObject(lccx, d, dest, aHelper, iid, Interface,
|
return NativeInterface2JSObject(lccx, d, dest, aHelper, iid, Interface,
|
||||||
allowNativeWrapper, isGlobal, pErr);
|
allowNativeWrapper, pErr);
|
||||||
}
|
}
|
||||||
static JSBool NativeInterface2JSObject(XPCLazyCallContext& lccx,
|
static JSBool NativeInterface2JSObject(XPCLazyCallContext& lccx,
|
||||||
jsval* d,
|
jsval* d,
|
||||||
@ -3304,7 +3295,6 @@ public:
|
|||||||
const nsID* iid,
|
const nsID* iid,
|
||||||
XPCNativeInterface** Interface,
|
XPCNativeInterface** Interface,
|
||||||
bool allowNativeWrapper,
|
bool allowNativeWrapper,
|
||||||
bool isGlobal,
|
|
||||||
nsresult* pErr);
|
nsresult* pErr);
|
||||||
|
|
||||||
static JSBool GetNativeInterfaceFromJSObject(XPCCallContext& ccx,
|
static JSBool GetNativeInterfaceFromJSObject(XPCCallContext& ccx,
|
||||||
|
Loading…
Reference in New Issue
Block a user