зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1481467 part 1 - Use JSAutoRealm instead of JSAutoRealmAllowCCW in mozJSComponentLoader::ImportInto. r=kmag
The targetVal argument is always same-compartment with the JSContext, so we only need to use JSAutoRealm in the FindTargetObject case.
This commit is contained in:
Родитель
0ca03d4a6d
Коммит
21af7a61b0
|
@ -993,6 +993,8 @@ mozJSComponentLoader::ImportInto(const nsACString& registryLocation,
|
|||
|
||||
RootedValue targetVal(cx, targetValArg);
|
||||
RootedObject targetObject(cx, nullptr);
|
||||
|
||||
Maybe<JSAutoRealm> ar;
|
||||
if (optionalArgc) {
|
||||
// The caller passed in the optional second argument. Get it.
|
||||
if (targetVal.isObject()) {
|
||||
|
@ -1016,12 +1018,12 @@ mozJSComponentLoader::ImportInto(const nsACString& registryLocation,
|
|||
}
|
||||
} else {
|
||||
FindTargetObject(cx, &targetObject);
|
||||
if (targetObject) {
|
||||
ar.emplace(cx, targetObject);
|
||||
}
|
||||
}
|
||||
|
||||
Maybe<JSAutoRealmAllowCCW> ar;
|
||||
if (targetObject) {
|
||||
ar.emplace(cx, targetObject);
|
||||
}
|
||||
js::AssertSameCompartment(cx, targetObject);
|
||||
|
||||
RootedObject global(cx);
|
||||
nsresult rv = ImportInto(registryLocation, targetObject, cx, &global);
|
||||
|
|
Загрузка…
Ссылка в новой задаче