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,6 +296,9 @@ 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);
|
||||||
|
bool crossCompartment = js::GetObjectCompartment(unwrappedFun) !=
|
||||||
|
js::GetObjectCompartment(&args.callee());
|
||||||
|
if (crossCompartment) {
|
||||||
if (!CheckSameOriginArg(cx, options, thisVal) ||
|
if (!CheckSameOriginArg(cx, options, thisVal) ||
|
||||||
!JS_WrapValue(cx, &thisVal)) {
|
!JS_WrapValue(cx, &thisVal)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -307,6 +310,7 @@ static bool FunctionForwarder(JSContext* cx, unsigned argc, Value* vp) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RootedValue fval(cx, ObjectValue(*unwrappedFun));
|
RootedValue fval(cx, ObjectValue(*unwrappedFun));
|
||||||
if (args.isConstructing()) {
|
if (args.isConstructing()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user