diff options
Diffstat (limited to 'WebCore/bindings/js/JSDesktopNotificationsCustom.cpp')
-rw-r--r-- | WebCore/bindings/js/JSDesktopNotificationsCustom.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp index 6c4dfb4..38334b9 100644 --- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp +++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp @@ -47,8 +47,15 @@ namespace WebCore { JSValue JSNotificationCenter::requestPermission(ExecState* exec) { - // Permission request is only valid from page context. ScriptExecutionContext* context = impl()->context(); + + // Make sure that script execution context is valid. + if (!context) { + setDOMException(exec, INVALID_STATE_ERR); + return jsUndefined(); + } + + // Permission request is only valid from page context. if (context->isWorkerContext()) return throwSyntaxError(exec); |