Bug 1480678 part 4 - Use current global as conversion scope in the Xray case when wrapping the return value in generated bindings. r=bz

This commit is contained in:
Jan de Mooij 2018-08-04 15:30:40 +02:00
parent ef4718f482
commit ff502e7cc6

View File

@ -7871,7 +7871,10 @@ class CGPerSignatureCall(CGThing):
slotStorageSteps += preserveWrapper
if checkForXray:
conversionScope = "isXray ? obj : slotStorage"
# In the Xray case we use the current global as conversion
# scope, as explained in the big compartment/conversion comment
# above.
conversionScope = "isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage"
else:
conversionScope = "slotStorage"
@ -7879,7 +7882,7 @@ class CGPerSignatureCall(CGThing):
"""
{
JS::Rooted<JSObject*> conversionScope(cx, ${conversionScope});
JSAutoRealmAllowCCW ar(cx, conversionScope);
JSAutoRealm ar(cx, conversionScope);
do { // block we break out of when done wrapping
$*{wrapCode}
} while (false);