|
Push API: Validate storage before returning cached subscriptions
For desktop users whose GCM Store was reset before
93ec793ac69a542b2213297737178a55d069fd0d
( https://codereview.chromium.org/2473813002), or whose GCM Store was
reset after that patch but who encountered a race condition (e.g. around
browser shutdown) that prevented PushMessagingServiceImpl::OnStoreReset
from deleting affected subscriptions, it was possible to get into a
nasty state where PushManager.getSubscription() and
PushManager.subscribe() would both keep returning the old push
subscriptions cached by the Service Worker database, even though they
were no longer valid (resetting the GCM Store changed Chrome desktop's
device ID, so it's impossible for any messages to be delivered to the
old subscriptions).
It was also possible for the PushMessagingAppIdentifier map to get out
of sync with the Service Worker database (on both Android and desktop).
This patch makes PushManager.getSubscription() & PushManager.subscribe()
both validate that subscriptions are properly stored across all four
databases that could get out of sync:
- the Service Worker database
- the PushMessagingAppIdentifier map
- the GCM Store (on desktop only)
- the GCMKeyStore
(they don't check against the GCM server, since they must work offline)
and if an inconsistency is detected, it will be automatically resolved
by unsubscribing the invalid subscription (then re-subscribing, in the
case of PushManager.subscribe()).
BUG= 661660
Review-Url: https://codereview.chromium.org/2697793004
Cr-Commit-Position: refs/heads/master@{#461501}
Committed: https://chromium.googlesource.com/chromium/src/+/6576ecf83ab56518daa1274dfa354aee84c8696b
Total comments: 26
Total comments: 7
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+810 lines, -220 lines) |
Patch |
|
M |
chrome/browser/push_messaging/push_messaging_app_identifier.h
|
View
|
1
2
3
|
1 chunk |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/push_messaging/push_messaging_app_identifier.cc
|
View
|
1
2
|
1 chunk |
+22 lines, -3 lines |
0 comments
|
Download
|
|
M |
chrome/browser/push_messaging/push_messaging_browsertest.cc
|
View
|
1
2
3
|
7 chunks |
+130 lines, -2 lines |
0 comments
|
Download
|
|
M |
chrome/browser/push_messaging/push_messaging_service_impl.h
|
View
|
1
2
3
|
2 chunks |
+14 lines, -7 lines |
0 comments
|
Download
|
|
M |
chrome/browser/push_messaging/push_messaging_service_impl.cc
|
View
|
1
2
3
|
2 chunks |
+41 lines, -11 lines |
0 comments
|
Download
|
|
M |
chrome/test/data/push_messaging/push_test.js
|
View
|
|
1 chunk |
+2 lines, -5 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/crypto/gcm_encryption_provider.h
|
View
|
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/fake_gcm_client.h
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/fake_gcm_client.cc
|
View
|
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/fake_gcm_driver.h
|
View
|
|
1 chunk |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/fake_gcm_driver.cc
|
View
|
|
2 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_client.h
|
View
|
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_client_impl.h
|
View
|
1
2
3
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_client_impl.cc
|
View
|
1
2
3
|
2 chunks |
+36 lines, -3 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_driver.h
|
View
|
1
2
3
|
4 chunks |
+38 lines, -19 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_driver.cc
|
View
|
1
2
3
|
1 chunk |
+0 lines, -6 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_driver_android.h
|
View
|
1
2
3
4
5
|
2 chunks |
+6 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_driver_android.cc
|
View
|
|
2 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_driver_desktop.h
|
View
|
|
3 chunks |
+15 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/gcm_driver_desktop.cc
|
View
|
1
2
|
5 chunks |
+98 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h
|
View
|
|
1 chunk |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
|
View
|
|
1 chunk |
+10 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/instance_id/instance_id.h
|
View
|
|
2 chunks |
+19 lines, -11 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/instance_id/instance_id_android.h
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/instance_id/instance_id_android.cc
|
View
|
|
1 chunk |
+9 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/instance_id/instance_id_impl.h
|
View
|
|
2 chunks |
+8 lines, -0 lines |
0 comments
|
Download
|
|
M |
components/gcm_driver/instance_id/instance_id_impl.cc
|
View
|
|
1 chunk |
+30 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/browser/push_messaging/push_messaging_manager.h
|
View
|
1
2
3
4
|
3 chunks |
+4 lines, -13 lines |
0 comments
|
Download
|
|
M |
content/browser/push_messaging/push_messaging_manager.cc
|
View
|
1
2
3
|
17 chunks |
+166 lines, -82 lines |
0 comments
|
Download
|
|
M |
content/child/push_messaging/push_provider.cc
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
content/common/push_messaging.mojom
|
View
|
1
2
|
2 chunks |
+11 lines, -4 lines |
0 comments
|
Download
|
|
M |
content/common/push_messaging_param_traits.cc
|
View
|
1
2
3
4
|
2 chunks |
+9 lines, -3 lines |
0 comments
|
Download
|
|
M |
content/public/browser/push_messaging_service.h
|
View
|
|
2 chunks |
+22 lines, -19 lines |
0 comments
|
Download
|
|
M |
content/public/common/push_messaging_status.h
|
View
|
1
|
3 chunks |
+19 lines, -6 lines |
0 comments
|
Download
|
|
M |
content/public/common/push_messaging_status.cc
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/shell/browser/layout_test/layout_test_push_messaging_service.h
|
View
|
|
1 chunk |
+17 lines, -18 lines |
0 comments
|
Download
|
|
M |
content/shell/browser/layout_test/layout_test_push_messaging_service.cc
|
View
|
|
4 chunks |
+7 lines, -5 lines |
0 comments
|
Download
|
|
M |
tools/metrics/histograms/histograms.xml
|
View
|
1
2
3
4
5
|
2 chunks |
+4 lines, -1 line |
0 comments
|
Download
|
Dependent Patchsets:
Total messages: 21 (9 generated)
|