summaryrefslogtreecommitdiffstats
path: root/WebCore/page/Geolocation.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-08-06 18:48:53 +0100
committerSteve Block <steveblock@google.com>2009-08-07 15:07:19 +0100
commit00bd0fc337f03c8595ccae3a2d3d56c6d8e97cc9 (patch)
tree130302b8c7706cb70541ba043d141d8e02889490 /WebCore/page/Geolocation.cpp
parent0c9108c0f832d34e6468bf1b3ed4132053c6a0f3 (diff)
downloadexternal_webkit-00bd0fc337f03c8595ccae3a2d3d56c6d8e97cc9.zip
external_webkit-00bd0fc337f03c8595ccae3a2d3d56c6d8e97cc9.tar.gz
external_webkit-00bd0fc337f03c8595ccae3a2d3d56c6d8e97cc9.tar.bz2
Fixes WebKit bug 26993.
Makes sure that if the Geolocation permissions request to the chrome is implemented synchronously, watches are called back only once.
Diffstat (limited to 'WebCore/page/Geolocation.cpp')
-rw-r--r--WebCore/page/Geolocation.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index 86a7f16..8bfa093 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -140,7 +140,7 @@ void Geolocation::setIsAllowed(bool allowed)
if (isAllowed()) {
startTimers();
- geolocationServicePositionChanged(m_service.get());
+ makeSuccessCallbacks();
} else {
WTF::RefPtr<WebCore::PositionError> error = WebCore::PositionError::create(PositionError::PERMISSION_DENIED, "User disallowed GeoLocation");
handleError(error.get());
@@ -264,17 +264,30 @@ void Geolocation::requestPermission()
m_allowGeolocation = InProgress;
}
-void Geolocation::geolocationServicePositionChanged(GeolocationService* service)
+void Geolocation::geolocationServicePositionChanged(GeolocationService*)
{
- ASSERT(service->lastPosition());
-
- requestPermission();
- if (!isAllowed())
+ ASSERT(m_service->lastPosition());
+
+ if (!isAllowed()) {
+ // requestPermission() will ask the chrome for permission. This may be
+ // implemented synchronously or asynchronously. In both cases,
+ // makeSucessCallbacks() will be called if permission is granted, so
+ // there's nothing more to do here.
+ requestPermission();
return;
-
- sendPositionToOneShots(service->lastPosition());
- sendPositionToWatchers(service->lastPosition());
-
+ }
+
+ makeSuccessCallbacks();
+}
+
+void Geolocation::makeSuccessCallbacks()
+{
+ ASSERT(m_service->lastPosition());
+ ASSERT(isAllowed());
+
+ sendPositionToOneShots(m_service->lastPosition());
+ sendPositionToWatchers(m_service->lastPosition());
+
m_oneShots.clear();
if (!hasListeners())