EncodedJSValue JSC_HOST_CALL protoFuncWeakMapDelete(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->remove(asObject(key)))); }
EncodedJSValue JSC_HOST_CALL protoFuncWeakMapDelete(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->remove(asObject(key)))); }