| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
|
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
|
| index c462463ac6a8bed03d4d50ec643c311a70d3615c..328df5975ce0beec7687978cf9ed21a05a75418a 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "bindings/core/v8/ScriptPromise.h"
|
| #include "bindings/core/v8/ScriptPromiseResolver.h"
|
| +#include "core/dom/DOMException.h"
|
| #include "core/events/Event.h"
|
| #include "core/inspector/ConsoleMessage.h"
|
| #include "modules/bluetooth/Bluetooth.h"
|
| @@ -105,8 +106,8 @@ void BluetoothRemoteGATTCharacteristic::ReadValueCallback(
|
|
|
| // If the device is disconnected, reject.
|
| if (!getGatt()->RemoveFromActiveAlgorithms(resolver)) {
|
| - resolver->reject(BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerDisconnected));
|
| + resolver->reject(BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_DISCONNECTED));
|
| return;
|
| }
|
|
|
| @@ -117,7 +118,7 @@ void BluetoothRemoteGATTCharacteristic::ReadValueCallback(
|
| setValue(domDataView);
|
| resolver->resolve(domDataView);
|
| } else {
|
| - resolver->reject(BluetoothError::take(resolver, result));
|
| + resolver->reject(BluetoothError::CreateDOMException(result));
|
| }
|
| }
|
|
|
| @@ -126,16 +127,16 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::readValue(
|
| if (!getGatt()->connected()) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerNotConnected));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_NOT_CONNECTED));
|
| }
|
|
|
| if (!getGatt()->device()->isValidCharacteristic(
|
| m_characteristic->instance_id)) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kInvalidCharacteristic));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::INVALID_CHARACTERISTIC));
|
| }
|
|
|
| ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
|
| @@ -162,8 +163,8 @@ void BluetoothRemoteGATTCharacteristic::WriteValueCallback(
|
|
|
| // If the device is disconnected, reject.
|
| if (!getGatt()->RemoveFromActiveAlgorithms(resolver)) {
|
| - resolver->reject(BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerDisconnected));
|
| + resolver->reject(BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_DISCONNECTED));
|
| return;
|
| }
|
|
|
| @@ -171,7 +172,7 @@ void BluetoothRemoteGATTCharacteristic::WriteValueCallback(
|
| setValue(BluetoothRemoteGATTUtils::ConvertWTFVectorToDataView(value));
|
| resolver->resolve();
|
| } else {
|
| - resolver->reject(BluetoothError::take(resolver, result));
|
| + resolver->reject(BluetoothError::CreateDOMException(result));
|
| }
|
| }
|
|
|
| @@ -181,16 +182,16 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::writeValue(
|
| if (!getGatt()->connected()) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerNotConnected));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_NOT_CONNECTED));
|
| }
|
|
|
| if (!getGatt()->device()->isValidCharacteristic(
|
| m_characteristic->instance_id)) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kInvalidCharacteristic));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::INVALID_CHARACTERISTIC));
|
| }
|
|
|
| // Partial implementation of writeValue algorithm:
|
| @@ -231,15 +232,15 @@ void BluetoothRemoteGATTCharacteristic::NotificationsCallback(
|
|
|
| // If the device is disconnected, reject.
|
| if (!getGatt()->RemoveFromActiveAlgorithms(resolver)) {
|
| - resolver->reject(BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerDisconnected));
|
| + resolver->reject(BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_DISCONNECTED));
|
| return;
|
| }
|
|
|
| if (result == mojom::blink::WebBluetoothResult::SUCCESS) {
|
| resolver->resolve(this);
|
| } else {
|
| - resolver->reject(BluetoothError::take(resolver, result));
|
| + resolver->reject(BluetoothError::CreateDOMException(result));
|
| }
|
| }
|
|
|
| @@ -248,16 +249,16 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications(
|
| if (!getGatt()->connected()) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerNotConnected));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_NOT_CONNECTED));
|
| }
|
|
|
| if (!getGatt()->device()->isValidCharacteristic(
|
| m_characteristic->instance_id)) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kInvalidCharacteristic));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::INVALID_CHARACTERISTIC));
|
| }
|
|
|
| ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
|
| @@ -279,16 +280,16 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(
|
| if (!getGatt()->connected()) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerNotConnected));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_NOT_CONNECTED));
|
| }
|
|
|
| if (!getGatt()->device()->isValidCharacteristic(
|
| m_characteristic->instance_id)) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kInvalidCharacteristic));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::INVALID_CHARACTERISTIC));
|
| }
|
|
|
| ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
|
| @@ -347,16 +348,16 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::getDescriptorsImpl(
|
| if (!getGatt()->connected()) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerNotConnected));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_NOT_CONNECTED));
|
| }
|
|
|
| if (!getGatt()->device()->isValidCharacteristic(
|
| m_characteristic->instance_id)) {
|
| return ScriptPromise::rejectWithDOMException(
|
| scriptState,
|
| - BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kInvalidCharacteristic));
|
| + BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::INVALID_CHARACTERISTIC));
|
| }
|
|
|
| ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
|
| @@ -389,8 +390,8 @@ void BluetoothRemoteGATTCharacteristic::GetDescriptorsCallback(
|
|
|
| // If the device is disconnected, reject.
|
| if (!service()->device()->gatt()->RemoveFromActiveAlgorithms(resolver)) {
|
| - resolver->reject(BluetoothRemoteGATTUtils::CreateDOMException(
|
| - BluetoothRemoteGATTUtils::ExceptionType::kGATTServerDisconnected));
|
| + resolver->reject(BluetoothError::CreateDOMException(
|
| + blink::mojom::WebBluetoothResult::GATT_SERVER_DISCONNECTED));
|
| return;
|
| }
|
|
|
| @@ -414,7 +415,7 @@ void BluetoothRemoteGATTCharacteristic::GetDescriptorsCallback(
|
| }
|
| resolver->resolve(gattDescriptors);
|
| } else {
|
| - resolver->reject(BluetoothError::take(resolver, result));
|
| + resolver->reject(BluetoothError::CreateDOMException(result));
|
| }
|
| }
|
|
|
|
|