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; }
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; }
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; }
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; }