本文整理汇总了C++中js::Handle::isBoolean方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::isBoolean方法的具体用法?C++ Handle::isBoolean怎么用?C++ Handle::isBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类js::Handle
的用法示例。
在下文中一共展示了Handle::isBoolean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetAGpsDataConn
NS_IMETHODIMP
GonkGPSGeolocationProvider::Handle(const nsAString& aName,
JS::Handle<JS::Value> aResult)
{
#ifdef MOZ_B2G_RIL
if (aName.EqualsLiteral("ril.supl.apn")) {
// When we get the APN, we attempt to call data_call_open of AGPS.
if (aResult.isString()) {
JSContext *cx = nsContentUtils::GetCurrentJSContext();
NS_ENSURE_TRUE(cx, NS_OK);
// NB: No need to enter a compartment to read the contents of a string.
nsAutoJSString apn;
if (!apn.init(cx, aResult.toString())) {
return NS_ERROR_FAILURE;
}
if (!apn.IsEmpty()) {
SetAGpsDataConn(apn);
}
}
} else
#endif // MOZ_B2G_RIL
if (aName.EqualsASCII(kSettingDebugGpsIgnored)) {
gDebug_isGPSLocationIgnored = aResult.isBoolean() ? aResult.toBoolean() : false;
if (gDebug_isLoggingEnabled) {
nsContentUtils::LogMessageToConsole("geo: Debug: GPS ignored %d\n", gDebug_isGPSLocationIgnored);
}
return NS_OK;
} else if (aName.EqualsASCII(kSettingDebugEnabled)) {
gDebug_isLoggingEnabled = aResult.isBoolean() ? aResult.toBoolean() : false;
return NS_OK;
}
return NS_OK;
}
示例2: SetAGpsDataConn
NS_IMETHODIMP
GonkGPSGeolocationProvider::Handle(const nsAString& aName,
JS::Handle<JS::Value> aResult)
{
#ifdef MOZ_B2G_RIL
if (aName.EqualsLiteral("ril.supl.apn")) {
// When we get the APN, we attempt to call data_call_open of AGPS.
if (aResult.isString()) {
JSContext *cx = nsContentUtils::GetCurrentJSContext();
NS_ENSURE_TRUE(cx, NS_OK);
// NB: No need to enter a compartment to read the contents of a string.
nsAutoJSString apn;
if (!apn.init(cx, aResult.toString())) {
return NS_ERROR_FAILURE;
}
if (!apn.IsEmpty()) {
SetAGpsDataConn(apn);
}
}
} else
#endif // MOZ_B2G_RIL
if (aName.EqualsLiteral(SETTING_DEBUG_ENABLED)) {
gGPSDebugging = aResult.isBoolean() ? aResult.toBoolean() : false;
return NS_OK;
}
return NS_OK;
}
示例3:
NS_IMETHODIMP
SmsFilter::SetRead(JSContext* aCx, JS::Handle<JS::Value> aRead)
{
if (aRead.isNull()) {
mData.read() = eReadState_Unknown;
return NS_OK;
}
if (!aRead.isBoolean()) {
return NS_ERROR_INVALID_ARG;
}
mData.read() = aRead.toBoolean() ? eReadState_Read : eReadState_Unread;
return NS_OK;
}
示例4: Handle
NS_DECL_ISUPPORTS
NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult)
{
MOZ_ASSERT(NS_IsMainThread());
if (!aResult.isBoolean()) {
BT_WARNING("Setting for '" BLUETOOTH_ENABLED_SETTING "' is not a boolean!");
return NS_OK;
}
// It is theoretically possible to shut down before the first settings check
// has completed (though extremely unlikely).
if (sBluetoothService) {
return sBluetoothService->HandleStartupSettingsCheck(aResult.toBoolean());
}
return NS_OK;
}