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

Unified Diff: content/child/push_messaging/push_provider.cc

Issue 1133083002: Reject the permissionState promise with NotSupported Exception (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix failing test 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
« no previous file with comments | « content/child/push_messaging/push_provider.h ('k') | content/common/push_messaging_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/push_messaging/push_provider.cc
diff --git a/content/child/push_messaging/push_provider.cc b/content/child/push_messaging/push_provider.cc
index 0d85dee2a393bc26903a7da4a700335e8f46f3f7..40741eb2371d9d9eb8e658c27c62bc49e1310451 100644
--- a/content/child/push_messaging/push_provider.cc
+++ b/content/child/push_messaging/push_provider.cc
@@ -251,13 +251,25 @@ void PushProvider::OnGetPermissionStatusSuccess(
permission_status_callbacks_.Remove(request_id);
}
-void PushProvider::OnGetPermissionStatusError(int request_id) {
+void PushProvider::OnGetPermissionStatusError(
+ int request_id,
+ blink::WebPushError::ErrorType error) {
blink::WebPushPermissionStatusCallbacks* callbacks =
permission_status_callbacks_.Lookup(request_id);
if (!callbacks)
return;
- callbacks->onError();
+ std::string error_message;
+ if (error == blink::WebPushError::ErrorTypeNotSupported) {
+ error_message =
+ "Push subscriptions that don't enable userVisibleOnly are not "
+ "supported.";
+ }
+
+ scoped_ptr<blink::WebPushError> web_error(new blink::WebPushError(
+ error, blink::WebString::fromUTF8(error_message)));
+
+ callbacks->onError(web_error.release());
Avi (use Gerrit) 2015/05/13 15:44:31 This bothers me because the definition of onError
permission_status_callbacks_.Remove(request_id);
}
« no previous file with comments | « content/child/push_messaging/push_provider.h ('k') | content/common/push_messaging_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698