зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1022773 - Return value rooting for XPConnect, r=bholley
--HG-- extra : rebase_source : 7dd3b1585bbc3d6a4a22812771495dedf600d7e0
This commit is contained in:
Родитель
1f35628fd0
Коммит
04d4a79438
|
@ -3174,8 +3174,8 @@ nsXPCComponents_Utils::GetComponentsForScope(HandleValue vscope, JSContext *cx,
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
JSObject *scopeObj = js::UncheckedUnwrap(&vscope.toObject());
|
||||
XPCWrappedNativeScope *scope = GetObjectScope(scopeObj);
|
||||
RootedObject components(cx, scope->GetComponentsJSObject());
|
||||
if (!components)
|
||||
RootedObject components(cx);
|
||||
if (!scope->GetComponentsJSObject(&components))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!JS_WrapObject(cx, &components))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -526,7 +526,7 @@ bool
|
|||
IsInAddonScope(JSObject *obj)
|
||||
{
|
||||
// We always eagerly create compartment privates for addon scopes.
|
||||
XPCWrappedNativeScope *scope = GetObjectScope(obj);
|
||||
XPCWrappedNativeScope *scope = MaybeGetObjectScope(obj);
|
||||
return scope && scope->IsAddonScope();
|
||||
}
|
||||
|
||||
|
|
|
@ -128,8 +128,8 @@ XPCWrappedNativeScope::IsDyingScope(XPCWrappedNativeScope *scope)
|
|||
return false;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
XPCWrappedNativeScope::GetComponentsJSObject()
|
||||
bool
|
||||
XPCWrappedNativeScope::GetComponentsJSObject(JS::MutableHandleObject obj)
|
||||
{
|
||||
AutoJSContext cx;
|
||||
if (!mComponents) {
|
||||
|
@ -145,17 +145,17 @@ XPCWrappedNativeScope::GetComponentsJSObject()
|
|||
nullptr, nullptr, false,
|
||||
nullptr);
|
||||
if (NS_WARN_IF(!ok))
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
if (NS_WARN_IF(!val.isObject()))
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
// The call to wrap() here is necessary even though the object is same-
|
||||
// compartment, because it applies our security wrapper.
|
||||
JS::RootedObject obj(cx, &val.toObject());
|
||||
if (NS_WARN_IF(!JS_WrapObject(cx, &obj)))
|
||||
return nullptr;
|
||||
return obj;
|
||||
obj.set(&val.toObject());
|
||||
if (NS_WARN_IF(!JS_WrapObject(cx, obj)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -174,8 +174,8 @@ XPCWrappedNativeScope::ForcePrivilegedComponents()
|
|||
bool
|
||||
XPCWrappedNativeScope::AttachComponentsObject(JSContext* aCx)
|
||||
{
|
||||
RootedObject components(aCx, GetComponentsJSObject());
|
||||
if (!components)
|
||||
RootedObject components(aCx);
|
||||
if (!GetComponentsJSObject(&components))
|
||||
return false;
|
||||
|
||||
RootedObject global(aCx, GetGlobalJSObject());
|
||||
|
@ -697,7 +697,7 @@ XPCWrappedNativeScope::RemoveWrappedNativeProtos()
|
|||
}
|
||||
|
||||
JSObject *
|
||||
XPCWrappedNativeScope::GetExpandoChain(JSObject *target)
|
||||
XPCWrappedNativeScope::GetExpandoChain(HandleObject target)
|
||||
{
|
||||
MOZ_ASSERT(GetObjectScope(target) == this);
|
||||
if (!mXrayExpandos.initialized())
|
||||
|
|
|
@ -985,8 +985,8 @@ public:
|
|||
bool AttachComponentsObject(JSContext *aCx);
|
||||
|
||||
// Returns the JS object reflection of the Components object.
|
||||
JSObject*
|
||||
GetComponentsJSObject();
|
||||
bool
|
||||
GetComponentsJSObject(JS::MutableHandleObject obj);
|
||||
|
||||
JSObject*
|
||||
GetGlobalJSObject() const {
|
||||
|
@ -1004,7 +1004,7 @@ public:
|
|||
}
|
||||
|
||||
JSObject*
|
||||
GetExpandoChain(JSObject *target);
|
||||
GetExpandoChain(JS::HandleObject target);
|
||||
|
||||
bool
|
||||
SetExpandoChain(JSContext *cx, JS::HandleObject target, JS::HandleObject chain);
|
||||
|
|
|
@ -208,7 +208,7 @@ public:
|
|||
JSObject* ensureHolder(JSContext *cx, HandleObject wrapper);
|
||||
virtual JSObject* createHolder(JSContext *cx, JSObject *wrapper) = 0;
|
||||
|
||||
JSObject* getExpandoChain(JSObject *obj) {
|
||||
JSObject* getExpandoChain(HandleObject obj) {
|
||||
return GetObjectScope(obj)->GetExpandoChain(obj);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче