bool AddonWrapper<Base>::set(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id, JS::HandleValue v, JS::HandleValue receiver, JS::ObjectOpResult& result) const { Rooted<JSPropertyDescriptor> desc(cx); if (!InterposeProperty(cx, wrapper, nullptr, id, &desc)) return false; if (!desc.object()) return Base::set(cx, wrapper, id, v, receiver, result); if (desc.setter()) { MOZ_ASSERT(desc.hasSetterObject()); JS::AutoValueVector args(cx); if (!args.append(v)) return false; RootedValue fval(cx, ObjectValue(*desc.setterObject())); RootedValue ignored(cx); if (!JS::Call(cx, receiver, fval, args, &ignored)) return false; return result.succeed(); } return result.failCantSetInterposed(); }
bool DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult &result) const { JS::Rooted<JSObject*> expando(cx); if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) { return JS_DeletePropertyById(cx, expando, id, result); } return result.succeed(); }
bool DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, Handle<PropertyDescriptor> desc, JS::ObjectOpResult &result, bool *defined) const { if (xpc::WrapperFactory::IsXrayWrapper(proxy)) { return result.succeed(); } JS::Rooted<JSObject*> expando(cx, EnsureExpandoObject(cx, proxy)); if (!expando) { return false; } if (!JS_DefinePropertyById(cx, expando, id, desc, result)) { return false; } *defined = true; return true; }