EncodedJSValue JSC_HOST_CALL protoFuncWeakMapHas(CallFrame* callFrame) { WeakMapData* map = getWeakMapData(callFrame, callFrame->thisValue()); if (!map) return JSValue::encode(jsUndefined()); JSValue key = callFrame->argument(0); return JSValue::encode(jsBoolean(key.isObject() && map->contains(asObject(key)))); }
EncodedJSValue JSC_HOST_CALL protoFuncWeakMapHas(CallFrame* callFrame) { WeakMapData* map = getWeakMapData(callFrame, callFrame->thisValue()); if (!map) return JSValue::encode(jsUndefined()); JSValue key = callFrame->argument(0); if (!key.isObject()) return JSValue::encode(throwTypeError(callFrame, WTF::ASCIILiteral("A WeakMap cannot have a non-object key"))); return JSValue::encode(jsBoolean(map->contains(asObject(key)))); }