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

Unified Diff: content/browser/push_messaging/push_messaging_message_filter.cc

Issue 1816123002: Add testing for subscription from service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review comments incorporated and all tests working Created 4 years, 9 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: content/browser/push_messaging/push_messaging_message_filter.cc
diff --git a/content/browser/push_messaging/push_messaging_message_filter.cc b/content/browser/push_messaging/push_messaging_message_filter.cc
index ef75724c1aecc32ee0f7dbcbc9f6f42a13e50fb9..bf83c6b18331d3833e32e6d7b96013c87db3fd27 100644
--- a/content/browser/push_messaging/push_messaging_message_filter.cc
+++ b/content/browser/push_messaging/push_messaging_message_filter.cc
@@ -298,9 +298,17 @@ void PushMessagingMessageFilter::OnSubscribeFromWorker(
}
data.requesting_origin = service_worker_registration->pattern().GetOrigin();
- // If there is a sender_info in the subscription options, it will be used,
- // otherwise the registration sender_info will be used.
- CheckForExistingRegistration(data, options);
+ if (!options.sender_info.empty()) {
+ service_worker_context_->StoreRegistrationUserData(
Michael van Ouwerkerk 2016/03/30 09:50:04 Yikes! Glad we got that one.
harkness 2016/03/30 10:51:49 yup! (although ideally we'd completely remove the
+ service_worker_registration_id, data.requesting_origin,
+ kPushSenderIdServiceWorkerKey, options.sender_info,
+ base::Bind(&PushMessagingMessageFilter::DidPersistSenderInfo,
+ weak_factory_io_to_io_.GetWeakPtr(), data, options));
+ } else {
+ // If there is a sender_info in the subscription options, it will be used,
+ // otherwise the registration sender_info will be used.
+ CheckForExistingRegistration(data, options);
+ }
}
void PushMessagingMessageFilter::DidPersistSenderInfo(

Powered by Google App Engine
This is Rietveld 408576698