| Index: Source/modules/notifications/Notification.cpp
|
| diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
|
| index 0b06e7432c57bf49d97dadededf07bbe52f831c7..4fbf7eb9b9f1481742549890101193ebfc5d26f2 100644
|
| --- a/Source/modules/notifications/Notification.cpp
|
| +++ b/Source/modules/notifications/Notification.cpp
|
| @@ -40,6 +40,7 @@
|
| #include "core/frame/UseCounter.h"
|
| #include "modules/notifications/NotificationOptions.h"
|
| #include "modules/notifications/NotificationPermissionClient.h"
|
| +#include "platform/RuntimeEnabledFeatures.h"
|
| #include "platform/UserGestureIndicator.h"
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebSerializedOrigin.h"
|
| @@ -56,8 +57,15 @@ WebNotificationManager* notificationManager()
|
|
|
| } // namespace
|
|
|
| -Notification* Notification::create(ExecutionContext* context, const String& title, const NotificationOptions& options)
|
| +Notification* Notification::create(ExecutionContext* context, const String& title, const NotificationOptions& options, ExceptionState& exceptionState)
|
| {
|
| + // The Web Notification constructor may be disabled through a runtime feature. The
|
| + // behavior of the constructor is changing, but not completely agreed upon yet.
|
| + if (!RuntimeEnabledFeatures::notificationConstructorEnabled()) {
|
| + exceptionState.throwTypeError("Illegal constructor. Use ServiceWorkerRegistration.showNotification() instead.");
|
| + return nullptr;
|
| + }
|
| +
|
| Notification* notification = new Notification(title, context);
|
|
|
| notification->setBody(options.body());
|
|
|