mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1481927. Always pass an object from the "relevant global" to Web IDL APIs that have a non-wrapper-cached "this". r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D4491 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
190adbee05
commit
4c0adfa061
@ -7580,9 +7580,15 @@ class CGPerSignatureCall(CGThing):
|
||||
elif needScopeObject(returnType, arguments, self.extendedAttributes,
|
||||
descriptor.wrapperCache, True,
|
||||
idlNode.getExtendedAttribute("StoreInSlot")):
|
||||
needsUnwrap = True
|
||||
needsUnwrappedVar = True
|
||||
argsPre.append("unwrappedObj ? *unwrappedObj : obj")
|
||||
# The scope object should always be from the relevant
|
||||
# global. Make sure to unwrap it as needed.
|
||||
cgThings.append(CGGeneric(dedent(
|
||||
"""
|
||||
JS::Rooted<JSObject*> unwrappedObj(cx, js::CheckedUnwrap(obj));
|
||||
// Caller should have ensured that "obj" can be unwrapped already.
|
||||
MOZ_DIAGNOSTIC_ASSERT(unwrappedObj);
|
||||
""")))
|
||||
argsPre.append("unwrappedObj")
|
||||
|
||||
if needsUnwrap and needsUnwrappedVar:
|
||||
# We cannot assign into obj because it's a Handle, not a
|
||||
|
@ -31,7 +31,7 @@ TextEncoder::Encode(JSContext* aCx,
|
||||
return;
|
||||
}
|
||||
|
||||
JSAutoRealmAllowCCW ar(aCx, aObj);
|
||||
JSAutoRealm ar(aCx, aObj);
|
||||
JSObject* outView = Uint8Array::Create(
|
||||
aCx, utf8.Length(), reinterpret_cast<const uint8_t*>(utf8.BeginReading()));
|
||||
if (!outView) {
|
||||
|
Loading…
Reference in New Issue
Block a user