зеркало из https://github.com/mozilla/gecko-dev.git
Bug 884410 - Handlify JS_GetPrototype. r=terrence
This commit is contained in:
Родитель
fdf14f768c
Коммит
dc4bd05cb5
|
@ -77,7 +77,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
|
|||
JS::Rooted<JSObject*> obj(cx, global);
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
for (;;) {
|
||||
MOZ_ALWAYS_TRUE(JS_GetPrototype(cx, obj, proto.address()));
|
||||
MOZ_ALWAYS_TRUE(JS_GetPrototype(cx, obj, &proto));
|
||||
if (!proto)
|
||||
break;
|
||||
obj = proto;
|
||||
|
|
|
@ -5242,7 +5242,7 @@ nsDocument::Register(JSContext* aCx, const nsAString& aName,
|
|||
|
||||
// Check the proto chain for HTMLElement prototype.
|
||||
JS::Rooted<JSObject*> protoProto(aCx);
|
||||
if (!JS_GetPrototype(aCx, protoObject, protoProto.address())) {
|
||||
if (!JS_GetPrototype(aCx, protoObject, &protoProto)) {
|
||||
rv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -5250,7 +5250,7 @@ nsDocument::Register(JSContext* aCx, const nsAString& aName,
|
|||
if (protoProto == htmlProto) {
|
||||
break;
|
||||
}
|
||||
if (!JS_GetPrototype(aCx, protoProto, protoProto.address())) {
|
||||
if (!JS_GetPrototype(aCx, protoProto, &protoProto)) {
|
||||
rv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -3157,7 +3157,7 @@ nsObjectLoadingContent::LegacyCall(JSContext* aCx,
|
|||
JS::Rooted<JSObject*> pi_obj(aCx);
|
||||
JS::Rooted<JSObject*> pi_proto(aCx);
|
||||
|
||||
rv = GetPluginJSObject(aCx, obj, pi, pi_obj.address(), pi_proto.address());
|
||||
rv = GetPluginJSObject(aCx, obj, pi, &pi_obj, &pi_proto);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return JS::UndefinedValue();
|
||||
|
@ -3223,7 +3223,7 @@ nsObjectLoadingContent::SetupProtoChain(JSContext* aCx,
|
|||
JS::Rooted<JSObject*> pi_obj(aCx); // XPConnect-wrapped peer object, when we get it.
|
||||
JS::Rooted<JSObject*> pi_proto(aCx); // 'pi.__proto__'
|
||||
|
||||
rv = GetPluginJSObject(aCx, aObject, pi, pi_obj.address(), pi_proto.address());
|
||||
rv = GetPluginJSObject(aCx, aObject, pi, &pi_obj, &pi_proto);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -3310,21 +3310,18 @@ nsresult
|
|||
nsObjectLoadingContent::GetPluginJSObject(JSContext *cx,
|
||||
JS::Handle<JSObject*> obj,
|
||||
nsNPAPIPluginInstance *plugin_inst,
|
||||
JSObject **plugin_obj,
|
||||
JSObject **plugin_proto)
|
||||
JS::MutableHandle<JSObject*> plugin_obj,
|
||||
JS::MutableHandle<JSObject*> plugin_proto)
|
||||
{
|
||||
*plugin_obj = nullptr;
|
||||
*plugin_proto = nullptr;
|
||||
|
||||
// NB: We need an AutoEnterCompartment because we can be called from
|
||||
// nsObjectFrame when the plugin loads after the JS object for our content
|
||||
// node has been created.
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
|
||||
if (plugin_inst) {
|
||||
plugin_inst->GetJSObject(cx, plugin_obj);
|
||||
if (*plugin_obj) {
|
||||
if (!::JS_GetPrototype(cx, *plugin_obj, plugin_proto)) {
|
||||
plugin_inst->GetJSObject(cx, plugin_obj.address());
|
||||
if (plugin_obj) {
|
||||
if (!::JS_GetPrototype(cx, plugin_obj, plugin_proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
@ -3352,7 +3349,7 @@ nsObjectLoadingContent::TeardownProtoChain()
|
|||
// all JS objects of the class sNPObjectJSWrapperClass
|
||||
bool removed = false;
|
||||
while (obj) {
|
||||
if (!::JS_GetPrototype(cx, obj, proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return;
|
||||
}
|
||||
if (!proto) {
|
||||
|
@ -3362,7 +3359,7 @@ nsObjectLoadingContent::TeardownProtoChain()
|
|||
// an NP object, that counts too.
|
||||
if (JS_GetClass(js::UncheckedUnwrap(proto)) == &sNPObjectJSWrapperClass) {
|
||||
// We found an NPObject on the proto chain, get its prototype...
|
||||
if (!::JS_GetPrototype(cx, proto, proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, proto, &proto)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -481,8 +481,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
static nsresult GetPluginJSObject(JSContext *cx,
|
||||
JS::Handle<JSObject*> obj,
|
||||
nsNPAPIPluginInstance *plugin_inst,
|
||||
JSObject **plugin_obj,
|
||||
JSObject **plugin_proto);
|
||||
JS::MutableHandle<JSObject*> plugin_obj,
|
||||
JS::MutableHandle<JSObject*> plugin_proto);
|
||||
|
||||
// The final listener for mChannel (uriloader, pluginstreamlistener, etc.)
|
||||
nsCOMPtr<nsIStreamListener> mFinalListener;
|
||||
|
|
|
@ -765,7 +765,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
|||
JS::Rooted<JSObject*> base(cx, scriptObject);
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
for ( ; true; base = proto) { // Will break out on null proto
|
||||
if (!JS_GetPrototype(cx, base, proto.address())) {
|
||||
if (!JS_GetPrototype(cx, base, &proto)) {
|
||||
return;
|
||||
}
|
||||
if (!proto) {
|
||||
|
@ -799,7 +799,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
|||
// Alright! This is the right prototype. Pull it out of the
|
||||
// proto chain.
|
||||
JS::Rooted<JSObject*> grandProto(cx);
|
||||
if (!JS_GetPrototype(cx, proto, grandProto.address())) {
|
||||
if (!JS_GetPrototype(cx, proto, &grandProto)) {
|
||||
return;
|
||||
}
|
||||
::JS_SetPrototype(cx, base, grandProto);
|
||||
|
@ -899,7 +899,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx, JS::Handle<JSObject*> global,
|
|||
nsXBLJSClass* c = nullptr;
|
||||
if (obj) {
|
||||
// Retrieve the current prototype of obj.
|
||||
if (!JS_GetPrototype(cx, obj, parent_proto.address())) {
|
||||
if (!JS_GetPrototype(cx, obj, &parent_proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (parent_proto) {
|
||||
|
|
|
@ -104,7 +104,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
|||
// down on the proto chain.
|
||||
JS::Rooted<JSObject*> base(cx, obj);
|
||||
while (JS_GetClass(base) != &nsXBLDocGlobalObject::gSharedGlobalClass) {
|
||||
if (!::JS_GetPrototype(cx, base, base.address())) {
|
||||
if (!::JS_GetPrototype(cx, base, &base)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!base) {
|
||||
|
|
|
@ -2155,7 +2155,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto)
|
|||
|
||||
#ifdef DEBUG
|
||||
JS::Rooted<JSObject*> proto2(cx);
|
||||
JS_GetPrototype(cx, proto, proto2.address());
|
||||
JS_GetPrototype(cx, proto, &proto2);
|
||||
NS_ASSERTION(proto2 && JS_GetClass(proto2) == sObjectClass,
|
||||
"Hmm, somebody did something evil?");
|
||||
#endif
|
||||
|
@ -2488,7 +2488,7 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> o
|
|||
}
|
||||
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
if (!::JS_GetPrototype(cx, obj, proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
JSBool hasProp;
|
||||
|
@ -2550,7 +2550,7 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx,
|
|||
JS::Rooted<JSObject*> obj(cx, aObj);
|
||||
|
||||
for (;;) {
|
||||
if (!::JS_GetPrototype(cx, obj, proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!proto) {
|
||||
|
@ -2560,7 +2560,7 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx,
|
|||
if (JS_GetClass(proto) == &sGlobalScopePolluterClass) {
|
||||
|
||||
JS::Rooted<JSObject*> proto_proto(cx);
|
||||
if (!::JS_GetPrototype(cx, proto, proto_proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, proto, &proto_proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -2592,7 +2592,7 @@ nsWindowSH::InstallGlobalScopePolluter(JSContext *cx, JS::Handle<JSObject*> obj)
|
|||
// scope polluter (right before Object.prototype).
|
||||
|
||||
for (;;) {
|
||||
if (!::JS_GetPrototype(cx, o, proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, o, &proto)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!proto) {
|
||||
|
@ -3194,7 +3194,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
|
||||
JS::Rooted<JSObject*> proto(cx, dom_obj);
|
||||
for (;;) {
|
||||
if (!JS_GetPrototype(cx, proto, proto.address())) {
|
||||
if (!JS_GetPrototype(cx, proto, &proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (!proto) {
|
||||
|
@ -3556,7 +3556,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
if (dot_prototype) {
|
||||
JSAutoCompartment ac(cx, dot_prototype);
|
||||
JS::Rooted<JSObject*> xpc_proto_proto(cx);
|
||||
if (!::JS_GetPrototype(cx, dot_prototype, xpc_proto_proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, dot_prototype, &xpc_proto_proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -5178,7 +5178,7 @@ nsStorage2SH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
}
|
||||
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
if (!::JS_GetPrototype(cx, realObj, proto.address())) {
|
||||
if (!::JS_GetPrototype(cx, realObj, &proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JSBool hasProp;
|
||||
|
|
|
@ -2073,9 +2073,9 @@ nsGlobalWindow::SetOuterObject(JSContext* aCx, JS::Handle<JSObject*> aOuterObjec
|
|||
js::SetDefaultObjectForContext(aCx, aOuterObject);
|
||||
|
||||
// Set up the prototype for the outer object.
|
||||
JSObject* inner = JS_GetParent(aOuterObject);
|
||||
JS::Rooted<JSObject*> inner(aCx, JS_GetParent(aOuterObject));
|
||||
JS::Rooted<JSObject*> proto(aCx);
|
||||
if (!JS_GetPrototype(aCx, inner, proto.address())) {
|
||||
if (!JS_GetPrototype(aCx, inner, &proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JS_SetPrototype(aCx, aOuterObject, proto);
|
||||
|
@ -2467,7 +2467,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||
// Now that both the the inner and outer windows are initialized
|
||||
// let the script context do its magic to hook them together.
|
||||
#ifdef DEBUG
|
||||
JSObject* newInnerJSObject = newInnerWindow->FastGetGlobalJSObject();
|
||||
JS::Rooted<JSObject*> newInnerJSObject(cx,
|
||||
newInnerWindow->FastGetGlobalJSObject());
|
||||
#endif
|
||||
|
||||
// Now that we're connecting the outer global to the inner one,
|
||||
|
@ -2476,8 +2477,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||
// so update that now since it might have changed.
|
||||
js::SetDefaultObjectForContext(cx, mJSObject);
|
||||
#ifdef DEBUG
|
||||
JSObject *proto1, *proto2;
|
||||
JS_GetPrototype(cx, mJSObject, &proto1);
|
||||
JS::Rooted<JSObject*> rootedJSObject(cx, mJSObject);
|
||||
JS::Rooted<JSObject*> proto1(cx), proto2(cx);
|
||||
JS_GetPrototype(cx, rootedJSObject, &proto1);
|
||||
JS_GetPrototype(cx, newInnerJSObject, &proto2);
|
||||
NS_ASSERTION(proto1 == proto2,
|
||||
"outer and inner globals should have the same prototype");
|
||||
|
@ -6592,7 +6594,7 @@ nsGlobalWindow::CallerInnerWindow()
|
|||
{
|
||||
JSAutoCompartment ac(cx, scope);
|
||||
JS::Rooted<JSObject*> scopeProto(cx);
|
||||
bool ok = JS_GetPrototype(cx, scope, scopeProto.address());
|
||||
bool ok = JS_GetPrototype(cx, scope, &scopeProto);
|
||||
NS_ENSURE_TRUE(ok, nullptr);
|
||||
if (scopeProto && xpc::IsSandboxPrototypeProxy(scopeProto) &&
|
||||
(scopeProto = js::CheckedUnwrap(scopeProto, /* stopAtOuter = */ false)))
|
||||
|
|
|
@ -1755,7 +1755,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
|
|||
"Someone messed with our prototype property?");
|
||||
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
if (!JS_GetPrototype(cx, instance, proto.address())) {
|
||||
if (!JS_GetPrototype(cx, instance, &proto)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1765,7 +1765,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!JS_GetPrototype(cx, proto, proto.address())) {
|
||||
if (!JS_GetPrototype(cx, proto, &proto)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ bool
|
|||
DOMProxyHandler::enumerate(JSContext* cx, JS::Handle<JSObject*> proxy, AutoIdVector& props)
|
||||
{
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
if (!JS_GetPrototype(cx, proxy, proto.address())) {
|
||||
if (!JS_GetPrototype(cx, proxy, &proto)) {
|
||||
return false;
|
||||
}
|
||||
return getOwnPropertyNames(cx, proxy, props) &&
|
||||
|
|
|
@ -1085,7 +1085,7 @@ GetNPObjectWrapper(JSContext *cx, JSObject *aObj, bool wrapResult = true)
|
|||
}
|
||||
return obj;
|
||||
}
|
||||
if (!::JS_GetPrototype(cx, obj, obj.address())) {
|
||||
if (!::JS_GetPrototype(cx, obj, &obj)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -581,7 +581,7 @@ jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval)
|
|||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||
if(!JS_GetPrototype(cx, obj, proto.address()))
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
if(!proto)
|
||||
return NULL;
|
||||
|
@ -632,7 +632,7 @@ jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval)
|
|||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||
if(!JS_GetPrototype(cx, obj, proto.address()))
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
if(!proto)
|
||||
return NULL;
|
||||
|
|
|
@ -476,8 +476,8 @@ SetupAndGetPrototypeObjectForComplexTypeInstance(JSContext *cx,
|
|||
RootedObject prototypeObj(cx,
|
||||
NewObjectWithGivenProto(cx, &JSObject::class_, NULL, global));
|
||||
|
||||
if (!JS_SetPrototype(cx, prototypeObj,
|
||||
complexTypePrototypePrototypeVal.toObjectOrNull()))
|
||||
RootedObject proto(cx, complexTypePrototypePrototypeVal.toObjectOrNull());
|
||||
if (!JS_SetPrototype(cx, prototypeObj, proto))
|
||||
return NULL;
|
||||
|
||||
return prototypeObj;
|
||||
|
|
|
@ -832,7 +832,7 @@ InitCTypeClass(JSContext* cx, HandleObject parent)
|
|||
|
||||
RootedObject ctor(cx, JS_GetFunctionObject(fun));
|
||||
RootedObject fnproto(cx);
|
||||
if (!JS_GetPrototype(cx, ctor, fnproto.address()))
|
||||
if (!JS_GetPrototype(cx, ctor, &fnproto))
|
||||
return NULL;
|
||||
JS_ASSERT(ctor);
|
||||
JS_ASSERT(fnproto);
|
||||
|
@ -3573,13 +3573,14 @@ CType::GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot)
|
|||
}
|
||||
|
||||
JSObject*
|
||||
CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
|
||||
CType::GetProtoFromType(JSContext* cx, JSObject* objArg, CTypeProtoSlot slot)
|
||||
{
|
||||
JS_ASSERT(IsCType(obj));
|
||||
JS_ASSERT(IsCType(objArg));
|
||||
RootedObject obj(cx, objArg);
|
||||
|
||||
// Get the prototype of the type object.
|
||||
RootedObject proto(cx);
|
||||
if (!JS_GetPrototype(cx, obj, proto.address()))
|
||||
if (!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
JS_ASSERT(proto);
|
||||
JS_ASSERT(CType::IsCTypeProto(proto));
|
||||
|
@ -3760,7 +3761,7 @@ CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, JSBool
|
|||
|
||||
RootedObject proto(cx, &v.toObject());
|
||||
for (;;) {
|
||||
if (!JS_GetPrototype(cx, proto, proto.address()))
|
||||
if (!JS_GetPrototype(cx, proto, &proto))
|
||||
return JS_FALSE;
|
||||
if (!proto)
|
||||
break;
|
||||
|
@ -3773,12 +3774,13 @@ CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, JSBool
|
|||
}
|
||||
|
||||
static JSObject*
|
||||
CType::GetGlobalCTypes(JSContext* cx, JSObject* obj)
|
||||
CType::GetGlobalCTypes(JSContext* cx, JSObject* objArg)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::IsCType(objArg));
|
||||
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedObject objTypeProto(cx);
|
||||
if (!JS_GetPrototype(cx, obj, objTypeProto.address()))
|
||||
if (!JS_GetPrototype(cx, obj, &objTypeProto))
|
||||
return NULL;
|
||||
JS_ASSERT(objTypeProto);
|
||||
JS_ASSERT(CType::IsCTypeProto(objTypeProto));
|
||||
|
@ -5997,7 +5999,7 @@ CClosure::Create(JSContext* cx,
|
|||
// Get the prototype of the FunctionType object, of class CTypeProto,
|
||||
// which stores our JSContext for use with the closure.
|
||||
RootedObject proto(cx);
|
||||
if (!JS_GetPrototype(cx, typeObj, proto.address()))
|
||||
if (!JS_GetPrototype(cx, typeObj, &proto))
|
||||
return NULL;
|
||||
JS_ASSERT(proto);
|
||||
JS_ASSERT(CType::IsCTypeProto(proto));
|
||||
|
|
|
@ -31,7 +31,7 @@ BEGIN_TEST(testTypedArrays)
|
|||
CHECK(JS_IsArrayBufferObject(buffer));
|
||||
|
||||
RootedObject proto(cx);
|
||||
JS_GetPrototype(cx, buffer, proto.address());
|
||||
JS_GetPrototype(cx, buffer, &proto);
|
||||
CHECK(!JS_IsArrayBufferObject(proto));
|
||||
RootedObject dummy(cx, JS_GetParent(proto));
|
||||
CHECK(!JS_IsArrayBufferObject(dummy));
|
||||
|
@ -67,7 +67,7 @@ TestPlainTypedArray(JSContext *cx)
|
|||
RootedObject array(cx, Create(cx, 7));
|
||||
CHECK(JS_IsTypedArrayObject(array));
|
||||
RootedObject proto(cx);
|
||||
JS_GetPrototype(cx, array, proto.address());
|
||||
JS_GetPrototype(cx, array, &proto);
|
||||
CHECK(!JS_IsTypedArrayObject(proto));
|
||||
RootedObject dummy(cx, JS_GetParent(proto));
|
||||
CHECK(!JS_IsTypedArrayObject(dummy));
|
||||
|
|
|
@ -2817,13 +2817,9 @@ JS_GetInstancePrivate(JSContext *cx, JSObject *objArg, JSClass *clasp, jsval *ar
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetPrototype(JSContext *cx, JSObject *objArg, JSObject **protop)
|
||||
JS_GetPrototype(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> protop)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedObject proto(cx);
|
||||
bool rv = JSObject::getProto(cx, obj, &proto);
|
||||
*protop = proto;
|
||||
return rv;
|
||||
return JSObject::getProto(cx, obj, protop);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
|
|
@ -3181,7 +3181,7 @@ JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp,
|
|||
jsval *argv);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetPrototype(JSContext *cx, JSObject *obj, JSObject **protop);
|
||||
JS_GetPrototype(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> protop);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto);
|
||||
|
|
|
@ -495,7 +495,7 @@ GetObjectProto(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObj
|
|||
clasp == js::OuterWindowProxyClassPtr ||
|
||||
clasp == js::FunctionProxyClassPtr)
|
||||
{
|
||||
return JS_GetPrototype(cx, obj, proto.address());
|
||||
return JS_GetPrototype(cx, obj, proto);
|
||||
}
|
||||
|
||||
proto.set(reinterpret_cast<const shadow::Object*>(obj.get())->type->proto);
|
||||
|
|
|
@ -83,7 +83,7 @@ ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx,
|
|||
|
||||
// If we found something or have no proto, we're done.
|
||||
RootedObject wrapperProto(cx);
|
||||
if (!JS_GetPrototype(cx, wrapper, wrapperProto.address()))
|
||||
if (!JS_GetPrototype(cx, wrapper, &wrapperProto))
|
||||
return false;
|
||||
if (desc->obj || !wrapperProto)
|
||||
return true;
|
||||
|
@ -107,7 +107,7 @@ ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper,
|
|||
|
||||
// If we found something or have no prototype, we're done.
|
||||
RootedObject wrapperProto(cx);
|
||||
if (!JS_GetPrototype(cx, wrapper, wrapperProto.address()))
|
||||
if (!JS_GetPrototype(cx, wrapper, &wrapperProto))
|
||||
return false;
|
||||
if (*bp || !wrapperProto)
|
||||
return true;
|
||||
|
@ -145,7 +145,7 @@ ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper,
|
|||
|
||||
// If we have no proto, we're done.
|
||||
RootedObject wrapperProto(cx);
|
||||
if (!JS_GetPrototype(cx, wrapper, wrapperProto.address()))
|
||||
if (!JS_GetPrototype(cx, wrapper, &wrapperProto))
|
||||
return false;
|
||||
if (!wrapperProto)
|
||||
return true;
|
||||
|
|
|
@ -576,7 +576,7 @@ WrapperFactory::WrapSOWObject(JSContext *cx, JSObject *objArg)
|
|||
// XUL domain, in which we can't have SOWs. We should never be called in
|
||||
// that case.
|
||||
MOZ_ASSERT(xpc::AllowXBLScope(js::GetContextCompartment(cx)));
|
||||
if (!JS_GetPrototype(cx, obj, proto.address()))
|
||||
if (!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
JSObject *wrapperObj =
|
||||
Wrapper::New(cx, obj, proto, JS_GetGlobalForObject(cx, obj),
|
||||
|
@ -596,7 +596,7 @@ JSObject *
|
|||
WrapperFactory::WrapComponentsObject(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
RootedObject proto(cx);
|
||||
if (!JS_GetPrototype(cx, obj, proto.address()))
|
||||
if (!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
JSObject *wrapperObj =
|
||||
Wrapper::New(cx, obj, proto, JS_GetGlobalForObject(cx, obj),
|
||||
|
|
Загрузка…
Ссылка в новой задаче