зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1453011 - Remove PostCreatePrototype. r=bz.
--HG-- extra : rebase_source : 6c096b964e43a3460a092b0f0b1ed9b512fd98c9
This commit is contained in:
Родитель
33304e70f6
Коммит
d73809b86f
|
@ -100,8 +100,6 @@ interface nsIXPCScriptable : nsISupports
|
||||||
in JSContextPtr cx, in JSObjectPtr obj,
|
in JSContextPtr cx, in JSObjectPtr obj,
|
||||||
in jsval val, out boolean bp);
|
in jsval val, out boolean bp);
|
||||||
|
|
||||||
void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
|
|
||||||
|
|
||||||
%{ C++
|
%{ C++
|
||||||
#define GET_IT(f_, c_) \
|
#define GET_IT(f_, c_) \
|
||||||
bool f_() { \
|
bool f_() { \
|
||||||
|
|
|
@ -99,9 +99,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative* wrapper,
|
||||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext* cx, JSObject* proto)
|
|
||||||
{return NS_OK;}
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
#undef XPC_MAP_CLASSNAME
|
#undef XPC_MAP_CLASSNAME
|
||||||
|
|
|
@ -198,8 +198,7 @@ XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
|
||||||
XPCWrappedNativeProto* proto =
|
XPCWrappedNativeProto* proto =
|
||||||
XPCWrappedNativeProto::GetNewOrUsed(scope,
|
XPCWrappedNativeProto::GetNewOrUsed(scope,
|
||||||
nativeHelper.GetClassInfo(),
|
nativeHelper.GetClassInfo(),
|
||||||
scrProto,
|
scrProto);
|
||||||
/* callPostCreatePrototype = */ false);
|
|
||||||
if (!proto)
|
if (!proto)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,7 @@ XPCWrappedNativeProto::~XPCWrappedNativeProto()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XPCWrappedNativeProto::Init(nsIXPCScriptable* scriptable,
|
XPCWrappedNativeProto::Init(nsIXPCScriptable* scriptable)
|
||||||
bool callPostCreatePrototype)
|
|
||||||
{
|
{
|
||||||
AutoJSContext cx;
|
AutoJSContext cx;
|
||||||
mScriptable = scriptable;
|
mScriptable = scriptable;
|
||||||
|
@ -64,35 +63,11 @@ XPCWrappedNativeProto::Init(nsIXPCScriptable* scriptable,
|
||||||
bool success = !!mJSProtoObject;
|
bool success = !!mJSProtoObject;
|
||||||
if (success) {
|
if (success) {
|
||||||
JS_SetPrivate(mJSProtoObject, this);
|
JS_SetPrivate(mJSProtoObject, this);
|
||||||
if (callPostCreatePrototype)
|
|
||||||
success = CallPostCreatePrototype();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
XPCWrappedNativeProto::CallPostCreatePrototype()
|
|
||||||
{
|
|
||||||
AutoJSContext cx;
|
|
||||||
|
|
||||||
// Nothing to do if we don't have a scriptable callback.
|
|
||||||
if (!mScriptable)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Call the helper. This can handle being called if it's not implemented,
|
|
||||||
// so we don't have to check any sort of "want" here. See xpc_map_end.h.
|
|
||||||
nsresult rv = mScriptable->PostCreatePrototype(cx, mJSProtoObject);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
JS_SetPrivate(mJSProtoObject, nullptr);
|
|
||||||
mJSProtoObject = nullptr;
|
|
||||||
XPCThrower::Throw(rv, cx);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj)
|
XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj)
|
||||||
{
|
{
|
||||||
|
@ -133,8 +108,7 @@ XPCWrappedNativeProto::SystemIsBeingShutDown()
|
||||||
XPCWrappedNativeProto*
|
XPCWrappedNativeProto*
|
||||||
XPCWrappedNativeProto::GetNewOrUsed(XPCWrappedNativeScope* scope,
|
XPCWrappedNativeProto::GetNewOrUsed(XPCWrappedNativeScope* scope,
|
||||||
nsIClassInfo* classInfo,
|
nsIClassInfo* classInfo,
|
||||||
nsIXPCScriptable* scriptable,
|
nsIXPCScriptable* scriptable)
|
||||||
bool callPostCreatePrototype)
|
|
||||||
{
|
{
|
||||||
AutoJSContext cx;
|
AutoJSContext cx;
|
||||||
MOZ_ASSERT(scope, "bad param");
|
MOZ_ASSERT(scope, "bad param");
|
||||||
|
@ -154,7 +128,7 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCWrappedNativeScope* scope,
|
||||||
|
|
||||||
proto = new XPCWrappedNativeProto(scope, classInfo, set.forget());
|
proto = new XPCWrappedNativeProto(scope, classInfo, set.forget());
|
||||||
|
|
||||||
if (!proto || !proto->Init(scriptable, callPostCreatePrototype)) {
|
if (!proto || !proto->Init(scriptable)) {
|
||||||
delete proto.get();
|
delete proto.get();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1267,8 +1267,7 @@ public:
|
||||||
static XPCWrappedNativeProto*
|
static XPCWrappedNativeProto*
|
||||||
GetNewOrUsed(XPCWrappedNativeScope* scope,
|
GetNewOrUsed(XPCWrappedNativeScope* scope,
|
||||||
nsIClassInfo* classInfo,
|
nsIClassInfo* classInfo,
|
||||||
nsIXPCScriptable* scriptable,
|
nsIXPCScriptable* scriptable);
|
||||||
bool callPostCreatePrototype = true);
|
|
||||||
|
|
||||||
XPCWrappedNativeScope*
|
XPCWrappedNativeScope*
|
||||||
GetScope() const {return mScope;}
|
GetScope() const {return mScope;}
|
||||||
|
@ -1291,7 +1290,6 @@ public:
|
||||||
nsIXPCScriptable*
|
nsIXPCScriptable*
|
||||||
GetScriptable() const { return mScriptable; }
|
GetScriptable() const { return mScriptable; }
|
||||||
|
|
||||||
bool CallPostCreatePrototype();
|
|
||||||
void JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj);
|
void JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj);
|
||||||
void JSProtoObjectMoved(JSObject* obj, const JSObject* old);
|
void JSProtoObjectMoved(JSObject* obj, const JSObject* old);
|
||||||
|
|
||||||
|
@ -1335,7 +1333,7 @@ protected:
|
||||||
nsIClassInfo* ClassInfo,
|
nsIClassInfo* ClassInfo,
|
||||||
already_AddRefed<XPCNativeSet>&& Set);
|
already_AddRefed<XPCNativeSet>&& Set);
|
||||||
|
|
||||||
bool Init(nsIXPCScriptable* scriptable, bool callPostCreatePrototype);
|
bool Init(nsIXPCScriptable* scriptable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Загрузка…
Ссылка в новой задаче