mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 16:57:36 +00:00
Bug 856067 - Waive Xrays when SpecialPowers encounters an Opaque XrayWrapper. r=gabor
This commit is contained in:
parent
65bed4527b
commit
a8b3c456f1
@ -98,9 +98,16 @@ function isObjectOrArray(obj) {
|
||||
// security in general, but tends to break tests that try to pass object
|
||||
// literals into SpecialPowers. So we waive [[Object]] and [[Array]]
|
||||
// instances before inspecting properties.
|
||||
//
|
||||
// * When we don't have meaningful Xray semantics, we create an Opaque
|
||||
// XrayWrapper for security reasons. For test code, we generally want to see
|
||||
// through that sort of thing.
|
||||
function waiveXraysIfAppropriate(obj, propName) {
|
||||
if (propName == 'toString' || isObjectOrArray(obj))
|
||||
if (propName == 'toString' || isObjectOrArray(obj) ||
|
||||
/Opaque/.test(Object.prototype.toString.call(obj)))
|
||||
{
|
||||
return XPCNativeWrapper.unwrap(obj);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user