bool CrossCompartmentWrapper::getPrototype(JSContext* cx, HandleObject wrapper, MutableHandleObject protop) const { { RootedObject wrapped(cx, wrappedObject(wrapper)); AutoCompartment call(cx, wrapped); if (!GetPrototype(cx, wrapped, protop)) return false; if (protop) protop->setDelegate(cx); } return cx->compartment()->wrap(cx, protop); }
bool CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, MutableHandleObject protop) { if (!wrapper->getTaggedProto().isLazy()) { protop.set(wrapper->getTaggedProto().toObjectOrNull()); return true; } { RootedObject wrapped(cx, wrappedObject(wrapper)); AutoCompartment call(cx, wrapped); if (!JSObject::getProto(cx, wrapped, protop)) return false; if (protop) protop->setDelegate(cx); } return cx->compartment->wrap(cx, protop.address()); }
bool CrossCompartmentWrapper::getPrototypeIfOrdinary(JSContext* cx, HandleObject wrapper, bool* isOrdinary, MutableHandleObject protop) const { { RootedObject wrapped(cx, wrappedObject(wrapper)); AutoCompartment call(cx, wrapped); if (!GetPrototypeIfOrdinary(cx, wrapped, isOrdinary, protop)) return false; if (!*isOrdinary) return true; if (protop) { if (!protop->setDelegate(cx)) return false; } } return cx->compartment()->wrap(cx, protop); }