Bug 1514261. Skip messing around with compartments in FunctionForwarder if the forwarder is already same-compartment with the underlying callee. r=bholley
This commit is contained in:
@@ -296,16 +296,20 @@ static bool FunctionForwarder(JSContext* cx, unsigned argc, Value* vp) {
|
|||||||
// here, because certain function wrappers (notably content->nsEP) are
|
// here, because certain function wrappers (notably content->nsEP) are
|
||||||
// not callable.
|
// not callable.
|
||||||
JSAutoRealm ar(cx, unwrappedFun);
|
JSAutoRealm ar(cx, unwrappedFun);
|
||||||
if (!CheckSameOriginArg(cx, options, thisVal) ||
|
bool crossCompartment = js::GetObjectCompartment(unwrappedFun) !=
|
||||||
!JS_WrapValue(cx, &thisVal)) {
|
js::GetObjectCompartment(&args.callee());
|
||||||
return false;
|
if (crossCompartment) {
|
||||||
}
|
if (!CheckSameOriginArg(cx, options, thisVal) ||
|
||||||
|
!JS_WrapValue(cx, &thisVal)) {
|
||||||
for (size_t n = 0; n < args.length(); ++n) {
|
|
||||||
if (!CheckSameOriginArg(cx, options, args[n]) ||
|
|
||||||
!JS_WrapValue(cx, args[n])) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t n = 0; n < args.length(); ++n) {
|
||||||
|
if (!CheckSameOriginArg(cx, options, args[n]) ||
|
||||||
|
!JS_WrapValue(cx, args[n])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RootedValue fval(cx, ObjectValue(*unwrappedFun));
|
RootedValue fval(cx, ObjectValue(*unwrappedFun));
|
||||||
|
|||||||
Reference in New Issue
Block a user