Bug 1453011 - Remove PostCreatePrototype. r=bz.

--HG--
extra : rebase_source : 6c096b964e43a3460a092b0f0b1ed9b512fd98c9
This commit is contained in:
Peter Van der Beken 2018-03-22 11:31:05 +01:00
Родитель 33304e70f6
Коммит d73809b86f
5 изменённых файлов: 6 добавлений и 40 удалений

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

@ -100,8 +100,6 @@ interface nsIXPCScriptable : nsISupports
in JSContextPtr cx, in JSObjectPtr obj,
in jsval val, out boolean bp);
void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
%{ C++
#define GET_IT(f_, c_) \
bool f_() { \

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

@ -99,9 +99,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative* wrapper,
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
#endif
NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext* cx, JSObject* proto)
{return NS_OK;}
/**************************************************************/
#undef XPC_MAP_CLASSNAME

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

@ -198,8 +198,7 @@ XPCWrappedNative::WrapNewGlobal(xpcObjectHelper& nativeHelper,
XPCWrappedNativeProto* proto =
XPCWrappedNativeProto::GetNewOrUsed(scope,
nativeHelper.GetClassInfo(),
scrProto,
/* callPostCreatePrototype = */ false);
scrProto);
if (!proto)
return NS_ERROR_FAILURE;

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

@ -50,8 +50,7 @@ XPCWrappedNativeProto::~XPCWrappedNativeProto()
}
bool
XPCWrappedNativeProto::Init(nsIXPCScriptable* scriptable,
bool callPostCreatePrototype)
XPCWrappedNativeProto::Init(nsIXPCScriptable* scriptable)
{
AutoJSContext cx;
mScriptable = scriptable;
@ -64,35 +63,11 @@ XPCWrappedNativeProto::Init(nsIXPCScriptable* scriptable,
bool success = !!mJSProtoObject;
if (success) {
JS_SetPrivate(mJSProtoObject, this);
if (callPostCreatePrototype)
success = CallPostCreatePrototype();
}
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
XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj)
{
@ -133,8 +108,7 @@ XPCWrappedNativeProto::SystemIsBeingShutDown()
XPCWrappedNativeProto*
XPCWrappedNativeProto::GetNewOrUsed(XPCWrappedNativeScope* scope,
nsIClassInfo* classInfo,
nsIXPCScriptable* scriptable,
bool callPostCreatePrototype)
nsIXPCScriptable* scriptable)
{
AutoJSContext cx;
MOZ_ASSERT(scope, "bad param");
@ -154,7 +128,7 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCWrappedNativeScope* scope,
proto = new XPCWrappedNativeProto(scope, classInfo, set.forget());
if (!proto || !proto->Init(scriptable, callPostCreatePrototype)) {
if (!proto || !proto->Init(scriptable)) {
delete proto.get();
return nullptr;
}

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

@ -1267,8 +1267,7 @@ public:
static XPCWrappedNativeProto*
GetNewOrUsed(XPCWrappedNativeScope* scope,
nsIClassInfo* classInfo,
nsIXPCScriptable* scriptable,
bool callPostCreatePrototype = true);
nsIXPCScriptable* scriptable);
XPCWrappedNativeScope*
GetScope() const {return mScope;}
@ -1291,7 +1290,6 @@ public:
nsIXPCScriptable*
GetScriptable() const { return mScriptable; }
bool CallPostCreatePrototype();
void JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj);
void JSProtoObjectMoved(JSObject* obj, const JSObject* old);
@ -1335,7 +1333,7 @@ protected:
nsIClassInfo* ClassInfo,
already_AddRefed<XPCNativeSet>&& Set);
bool Init(nsIXPCScriptable* scriptable, bool callPostCreatePrototype);
bool Init(nsIXPCScriptable* scriptable);
private:
#ifdef DEBUG