| Index: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
|
| diff --git a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
|
| index f902a7aa3534d3a84e8774574f02148d590bd773..c2d2301fce6ec0d3632bac1d7d2502eb2aed80b7 100644
|
| --- a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
|
| +++ b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
|
| @@ -60,8 +60,8 @@ 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(), "Silent notifications must not specify vibration patterns."));
|
| + if ((options.hasSound() || options.hasVibrate()) && options.silent())
|
| + return ScriptPromise::reject(scriptState, V8ThrowException::createTypeError(scriptState->isolate(), "Silent notifications must not specify sound or vibration patterns."));
|
|
|
| // FIXME: Unify the code path here with the Notification.create() function.
|
| Vector<char> dataAsWireBytes;
|
| @@ -85,9 +85,16 @@ ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptSta
|
| iconUrl = KURL();
|
| }
|
|
|
| + KURL soundUrl;
|
| + if (options.hasSound() && !options.sound().isEmpty()) {
|
| + soundUrl = executionContext->completeURL(options.sound());
|
| + if (!soundUrl.isValid())
|
| + soundUrl = KURL();
|
| + }
|
| +
|
| 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);
|
| + WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, soundUrl, vibrate, options.silent(), dataAsWireBytes);
|
| WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, void>(resolver);
|
|
|
| SecurityOrigin* origin = executionContext->securityOrigin();
|
|
|