Index: Source/modules/notifications/Notification.cpp |
diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp |
index 4fbf7eb9b9f1481742549890101193ebfc5d26f2..f61571ffe22da3888280c12f1075650bf822ca5f 100644 |
--- a/Source/modules/notifications/Notification.cpp |
+++ b/Source/modules/notifications/Notification.cpp |
@@ -66,6 +66,12 @@ Notification* Notification::create(ExecutionContext* context, const String& titl |
return nullptr; |
} |
+ // The Web Notification constructor may not be used in Service Worker contexts. |
+ if (context->isServiceWorkerGlobalScope()) { |
+ exceptionState.throwTypeError("Illegal constructor."); |
+ return nullptr; |
+ } |
+ |
Notification* notification = new Notification(title, context); |
notification->setBody(options.body()); |