diff --git a/third_party/blink/renderer/modules/geolocation/geolocation.cc b/third_party/blink/renderer/modules/geolocation/geolocation.cc index 854280a0b439cc..2e77b50548c6c8 100644 --- a/third_party/blink/renderer/modules/geolocation/geolocation.cc +++ b/third_party/blink/renderer/modules/geolocation/geolocation.cc @@ -512,7 +512,13 @@ void Geolocation::OnPositionUpdated( } void Geolocation::PageVisibilityChanged() { - UpdateGeolocationConnection(nullptr); + for (auto& notifier : *one_shots_) + UpdateGeolocationConnection(notifier); + + HeapVector> watchers; + watchers_->CopyNotifiersToVector(watchers); + for (auto& notifier : watchers) + UpdateGeolocationConnection(notifier); } bool Geolocation::HasPendingActivity() const { diff --git a/third_party/blink/web_tests/wpt_internal/geolocation-api/getCurrentPosition_visibility.https.html b/third_party/blink/web_tests/wpt_internal/geolocation-api/getCurrentPosition_visibility.https.html new file mode 100644 index 00000000000000..42decf89702e0e --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/geolocation-api/getCurrentPosition_visibility.https.html @@ -0,0 +1,42 @@ + + +Geolocation Test: getCurrentPosition returns after visibilityState changes + + + + + + +

Clear all Geolocation permissions before running this test. If prompted for permission, please allow.

+
+ +