Index: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
diff --git a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
index 2b8c1d8f4d99be5683cae40045e7cdb77380f57a..2b60f279a2b06f88152fc3943ddb4db6465bbc24 100644 |
--- a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
+++ b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
@@ -22,6 +22,7 @@ |
#include "public/platform/WebSerializedOrigin.h" |
#include "public/platform/modules/notifications/WebNotificationData.h" |
#include "public/platform/modules/notifications/WebNotificationManager.h" |
+#include "public/platform/modules/notifications/WebNotificationVibrationData.h" |
namespace blink { |
namespace { |
@@ -66,6 +67,9 @@ ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptSta |
if (Notification::checkPermission(executionContext) != WebNotificationPermissionAllowed) |
return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "No notification permission has been granted for this origin.")); |
+ if (options.hasVibrate() && options.silent()) |
+ return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "If options's silent is true, options's vibrate should not be presented.")); |
+ |
// FIXME: Unify the code path here with the Notification.create() function. |
String dataAsWireString; |
if (options.hasData()) { |
@@ -88,7 +92,7 @@ ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptSta |
} |
WebNotificationData::Direction dir = options.dir() == "rtl" ? WebNotificationData::DirectionRightToLeft : WebNotificationData::DirectionLeftToRight; |
- WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, options.silent(), dataAsWireString); |
+ WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, Notification::convertFromVibrationData(options.vibrate()), options.silent(), dataAsWireString); |
WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, void>(resolver); |
SecurityOrigin* origin = executionContext->securityOrigin(); |