Index: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
diff --git a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
index 0c794f1ad1e6e7285ee136107d920ff342b95d53..6f4f2ae3bb6d324aa614e3203da9511fe0406f09 100644 |
--- a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
+++ b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
@@ -17,6 +17,7 @@ |
#include "modules/notifications/GetNotificationOptions.h" |
#include "modules/notifications/Notification.h" |
#include "modules/notifications/NotificationOptions.h" |
+#include "modules/vibration/NavigatorVibration.h" |
#include "platform/weborigin/KURL.h" |
#include "public/platform/Platform.h" |
#include "public/platform/WebSerializedOrigin.h" |
@@ -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(), "Slient notification must not specify vibration patterns.")); |
timvolodine
2015/04/13 11:55:19
Slient -> Silent ?
Sanghyun Park
2015/04/13 13:35:08
Thank you I'll fix.
|
+ |
// FIXME: Unify the code path here with the Notification.create() function. |
Vector<char> dataAsWireBytes; |
if (options.hasData()) { |
@@ -89,7 +93,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(), dataAsWireBytes); |
+ WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, NavigatorVibration::sanitizeVibrationPattern(options.vibrate()), options.silent(), dataAsWireBytes); |
WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, void>(resolver); |
SecurityOrigin* origin = executionContext->securityOrigin(); |