Index: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
diff --git a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
index 9d689190d02ecd4f52d676f1ddfacd701867bc88..9d28a9ad1819a203b261772f81ba5b115a33b5ad 100644 |
--- a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
+++ b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp |
@@ -73,6 +73,11 @@ ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptSta |
data->toWireBytes(dataAsWireBytes); |
} |
+ for (NotificationAction action : options.actions()) { |
Peter Beverloo
2015/07/31 15:38:49
const&
johnme
2015/07/31 16:08:52
Done.
|
+ if (action.title().isEmpty()) |
+ return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "Notification action titles must not be empty.")); |
+ } |
+ |
RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState); |
ScriptPromise promise = resolver->promise(); |
@@ -87,7 +92,9 @@ ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptSta |
WebNotificationData::Direction dir = options.dir() == "rtl" ? WebNotificationData::DirectionRightToLeft : WebNotificationData::DirectionLeftToRight; |
NavigatorVibration::VibrationPattern vibrate = NavigatorVibration::sanitizeVibrationPattern(options.vibrate()); |
- WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, vibrate, options.silent(), dataAsWireBytes); |
+ WebVector<WebNotificationAction> webActions; |
+ Notification::actionsToWebActions(options.actions(), &webActions); |
+ WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, vibrate, options.silent(), dataAsWireBytes, webActions); |
WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, void>(resolver); |
SecurityOrigin* origin = executionContext->securityOrigin(); |