bool InjectedBundle::booleanForKey(WKDictionaryRef dictionary, const char* key) { WKRetainPtr<WKStringRef> wkKey(AdoptWK, WKStringCreateWithUTF8CString(key)); WKTypeRef value = WKDictionaryGetItemForKey(dictionary, wkKey.get()); if (WKGetTypeID(value) != WKBooleanGetTypeID()) { outputText(makeString("Boolean value for key", key, " not found in dictionary\n")); return false; } return WKBooleanGetValue(static_cast<WKBooleanRef>(value)); }
bool InjectedBundle::booleanForKey(WKDictionaryRef dictionary, const char* key) { WKRetainPtr<WKStringRef> wkKey(AdoptWK, WKStringCreateWithUTF8CString(key)); WKTypeRef value = WKDictionaryGetItemForKey(dictionary, wkKey.get()); if (WKGetTypeID(value) != WKBooleanGetTypeID()) { stringBuilder()->appendLiteral("Boolean value for key \""); stringBuilder()->append(key); stringBuilder()->appendLiteral("\" not found in dictionary\n"); return false; } return WKBooleanGetValue(static_cast<WKBooleanRef>(value)); }