Backed out changeset 8ba41a1bd062 (bug 1348095)

This commit is contained in:
Carsten "Tomcat" Book
2017-03-23 08:45:45 +01:00
parent 05570024b8
commit 3dbcd17f6b

View File

@@ -2410,36 +2410,17 @@ XrayWrapper<Base, Traits>::getPrototype(JSContext* cx, JS::HandleObject wrapper,
// only if there's been a set. If there's not an expando, or the expando
// slot is |undefined|, hand back the default proto, appropriately wrapped.
if (expando) {
RootedValue v(cx);
{ // Scope for JSAutoCompartment
if (expando) {
JSAutoCompartment ac(cx, expando);
v = JS_GetReservedSlot(expando, JSSLOT_EXPANDO_PROTOTYPE);
}
if (!v.isUndefined()) {
if (v.isUndefined())
return getPrototypeHelper(cx, wrapper, target, protop);
protop.set(v.toObjectOrNull());
return JS_WrapObject(cx, protop);
}
}
// Check our holder, and cache there if we don't have it cached already.
RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper));
if (!holder)
return false;
Value cached = js::GetReservedSlot(holder,
Traits::HOLDER_SLOT_CACHED_PROTO);
if (cached.isUndefined()) {
if (!getPrototypeHelper(cx, wrapper, target, protop))
return false;
js::SetReservedSlot(holder, Traits::HOLDER_SLOT_CACHED_PROTO,
ObjectOrNullValue(protop));
} else {
protop.set(cached.toObjectOrNull());
}
return true;
}
template <typename Base, typename Traits>
bool