diff options
author | Steve Block <steveblock@google.com> | 2009-12-03 12:52:03 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-12-07 13:26:05 +0000 |
commit | 95e7487cbe7ec5c780e8af61f3cea2d90bb4459b (patch) | |
tree | 5d2246b3df41dd594b9b88db2ac46ccde57cae61 /WebCore/page/Geolocation.cpp | |
parent | 6c9687c05aead139d549da6cfcccdfd65d2f4d26 (diff) | |
download | external_webkit-95e7487cbe7ec5c780e8af61f3cea2d90bb4459b.zip external_webkit-95e7487cbe7ec5c780e8af61f3cea2d90bb4459b.tar.gz external_webkit-95e7487cbe7ec5c780e8af61f3cea2d90bb4459b.tar.bz2 |
Fixes a Geolocation bug with cached positions.
When a Geolocation watch calls back with a cached position, it could be cleared in the callback.
This change makes sure the watch still exists after the callback before starting the Geolocation service.
Change-Id: I9a5736f5ce78e1c4bb36659245ffb61b485c4018
Diffstat (limited to 'WebCore/page/Geolocation.cpp')
-rw-r--r-- | WebCore/page/Geolocation.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index 978a1b0..604802f 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -136,6 +136,11 @@ void Geolocation::Watchers::remove(GeoNotifier* notifier) m_notifierToIdMap.remove(iter); } +bool Geolocation::Watchers::contains(GeoNotifier* notifier) const +{ + return m_notifierToIdMap.contains(notifier); +} + void Geolocation::Watchers::clear() { m_idToNotifierMap.clear(); @@ -403,11 +408,13 @@ void Geolocation::requestReturnedCachedPosition(GeoNotifier* notifier) return; } - // Otherwise, start the service to get updates. - if (m_service->startUpdating(notifier->m_options.get())) - notifier->startTimerIfNeeded(); - else - notifier->setFatalError(PositionError::create(PositionError::UNKNOWN_ERROR, "Failed to start Geolocation service")); + // Otherwise, if the watch still exists, start the service to get updates. + if (m_watchers.contains(notifier)) { + if (m_service->startUpdating(notifier->m_options.get())) + notifier->startTimerIfNeeded(); + else + notifier->setFatalError(PositionError::create(PositionError::UNKNOWN_ERROR, "Failed to start Geolocation service")); + } } bool Geolocation::haveSuitableCachedPosition(PositionOptions* options) |