Bug 1479712 part 3 - Remove unnecessary AutoJSContext and JSAutoRealmAllowCCW in JSObject2NativeInterface and nsXPConnect::WrapJS. r=bholley

This commit is contained in:
Jan de Mooij 2018-08-02 09:15:42 +02:00
Родитель af31466131
Коммит 1d54f66140
2 изменённых файлов: 2 добавлений и 6 удалений

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

@ -1043,9 +1043,6 @@ XPCConvert::JSObject2NativeInterface(void** dest, HandleObject src,
MOZ_ASSERT(src, "bad param");
MOZ_ASSERT(iid, "bad param");
AutoJSContext cx;
JSAutoRealmAllowCCW ar(cx, src);
*dest = nullptr;
if (pErr)
*pErr = NS_ERROR_XPC_BAD_CONVERT_JS;
@ -1068,7 +1065,7 @@ XPCConvert::JSObject2NativeInterface(void** dest, HandleObject src,
// scope - see nsBindingManager::GetBindingImplementation.
//
// It's also very important that "inner" be rooted here.
RootedObject inner(cx,
RootedObject inner(RootingCx(),
js::CheckedUnwrap(src,
/* stopAtWindowProxy = */ false));
if (!inner) {
@ -1109,7 +1106,7 @@ XPCConvert::JSObject2NativeInterface(void** dest, HandleObject src,
// Deal with Promises being passed as nsISupports. In that situation we
// want to create a dom::Promise and use that.
if (iid->Equals(NS_GET_IID(nsISupports))) {
RootedObject innerObj(cx, inner);
RootedObject innerObj(RootingCx(), inner);
if (IsPromiseObject(innerObj)) {
nsIGlobalObject* glob = NativeGlobal(innerObj);
RefPtr<Promise> p = Promise::CreateFromExisting(glob, innerObj);

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

@ -673,7 +673,6 @@ nsXPConnect::WrapJS(JSContext * aJSContext,
*result = nullptr;
RootedObject aJSObj(aJSContext, aJSObjArg);
JSAutoRealmAllowCCW ar(aJSContext, aJSObj);
nsresult rv = NS_ERROR_UNEXPECTED;
if (!XPCConvert::JSObject2NativeInterface(result, aJSObj,