Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp

Issue 1940923002: bluetooth: Add JS error messages for unimplemented features (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 921625d8c4f7ab15f1b643251ca5b28e966dfabf..42327ee514703afea3977f88a242d25d46552be4 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
@@ -11,6 +11,7 @@
#include "core/dom/DOMException.h"
#include "core/dom/ExceptionCode.h"
#include "core/events/Event.h"
+#include "core/inspector/ConsoleMessage.h"
#include "modules/bluetooth/BluetoothCharacteristicProperties.h"
#include "modules/bluetooth/BluetoothError.h"
#include "modules/bluetooth/BluetoothSupplement.h"
@@ -132,6 +133,13 @@ private:
ScriptPromise BluetoothRemoteGATTCharacteristic::readValue(ScriptState* scriptState)
{
+#if OS(MACOSX)
+ // TODO(jlebel): Remove when readValue is implemented.
+ return ScriptPromise::rejectWithDOMException(scriptState,
+ DOMException::create(NotSupportedError,
+ "readValue is not implemented yet. See https://goo.gl/J6ASzs"));
+#endif // OS(MACOSX)
+
WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptState);
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
@@ -170,6 +178,13 @@ private:
ScriptPromise BluetoothRemoteGATTCharacteristic::writeValue(ScriptState* scriptState, const DOMArrayPiece& value)
{
+#if OS(MACOSX)
+ // TODO(jlebel): Remove when writeValue is implemented.
+ return ScriptPromise::rejectWithDOMException(scriptState,
+ DOMException::create(NotSupportedError,
+ "writeValue is not implemented yet. See https://goo.gl/J6ASzs"));
+#endif // OS(MACOSX)
+
WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptState);
// Partial implementation of writeValue algorithm:
// https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothgattcharacteristic-writevalue
@@ -193,6 +208,13 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::writeValue(ScriptState* scriptS
ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications(ScriptState* scriptState)
{
+#if OS(MACOSX)
+ // TODO(jlebel): Remove when startNotifications is implemented.
+ return ScriptPromise::rejectWithDOMException(scriptState,
+ DOMException::create(NotSupportedError,
+ "startNotifications is not implemented yet. See https://goo.gl/J6ASzs"));
+#endif // OS(MACOSX)
+
WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptState);
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
@@ -202,6 +224,14 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications(ScriptState*
ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState* scriptState)
{
+#if OS(MACOSX) || OS(ANDROID)
+ // TODO(jlebel): Remove when stopNotifications is implemented.
+ // TODO(scheib): Remove when stopNotifications is implemented.
+ return ScriptPromise::rejectWithDOMException(scriptState,
+ DOMException::create(NotSupportedError,
+ "stopNotifications is not implemented yet. See https://goo.gl/J6ASzs"));
+#endif // OS(MACOSX) || OS(ANDROID)
+
WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptState);
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();

Powered by Google App Engine
This is Rietveld 408576698