Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1878)

Unified Diff: Source/modules/push_messaging/PushPermissionStatusCallbacks.cpp

Issue 1130233003: Reject the permissionState promise with NotSupported Exception (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/push_messaging/PushPermissionStatusCallbacks.cpp
diff --git a/Source/modules/push_messaging/PushPermissionStatusCallbacks.cpp b/Source/modules/push_messaging/PushPermissionStatusCallbacks.cpp
index ef7ac77799efdf0a3e8ea2dba67aea3abcd0b1a8..ca924726227642612d278cace5cf2e8cdf497de4 100644
--- a/Source/modules/push_messaging/PushPermissionStatusCallbacks.cpp
+++ b/Source/modules/push_messaging/PushPermissionStatusCallbacks.cpp
@@ -6,7 +6,7 @@
#include "modules/push_messaging/PushPermissionStatusCallbacks.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
-#include "core/dom/ExceptionCode.h"
+#include "modules/push_messaging/PushError.h"
#include "wtf/text/WTFString.h"
namespace blink {
@@ -25,6 +25,16 @@ void PushPermissionStatusCallbacks::onSuccess(WebPushPermissionStatus* status)
m_resolver->resolve(permissionString(*status));
}
+void PushPermissionStatusCallbacks::onError(WebPushError* error)
+{
+ if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped()) {
+ PushError::dispose(error);
+ return;
+ }
+
+ m_resolver->reject(PushError::take(m_resolver.get(), error));
+}
+
void PushPermissionStatusCallbacks::onError()
{
m_resolver->reject();
« no previous file with comments | « Source/modules/push_messaging/PushPermissionStatusCallbacks.h ('k') | public/platform/modules/push_messaging/WebPushError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698