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

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: Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f2eb5178b48d33544df0f4c4de21894cc37aacc6 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,19 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications(ScriptState*
ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState* scriptState)
{
+#if OS(MACOSX)
scheib 2016/05/02 17:12:28 Merge these instead of duplicating the code: if OS
+ // TODO(jlebel): 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)
+#if OS(ANDROID)
+ // 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(ANDROID)
+
WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptState);
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698