NS_DECL_ISUPPORTS NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult) { MOZ_ASSERT(NS_IsMainThread()); JSContext *cx = nsContentUtils::GetCurrentJSContext(); NS_ENSURE_TRUE(cx, NS_OK); if (!aResult.isNumber()) { BT_WARNING("'" AUDIO_VOLUME_BT_SCO_ID "' is not a number!"); return NS_OK; } BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); hfp->mCurrentVgs = aResult.toNumber(); return NS_OK; }
NS_IMETHODIMP SmsFilter::SetThreadId(JSContext* aCx, JS::Handle<JS::Value> aThreadId) { if (aThreadId.isNull()) { mData.threadId() = 0; return NS_OK; } if (!aThreadId.isNumber()) { return NS_ERROR_INVALID_ARG; } double number = aThreadId.toNumber(); uint64_t integer = static_cast<uint64_t>(number); if (integer == 0 || integer != number) { return NS_ERROR_INVALID_ARG; } mData.threadId() = integer; return NS_OK; }