summaryrefslogtreecommitdiffstats
path: root/WebCore/page/Geolocation.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-06 10:57:53 +0100
committerSteve Block <steveblock@google.com>2009-10-06 10:57:53 +0100
commit0c7394a4459ba850766d303b4307add7189cf5f3 (patch)
treee7c0cd92fb4bc31a6ed2bd91448aa3630bdfc8c3 /WebCore/page/Geolocation.cpp
parent2097884b9e1630c3855a8580f84a308163e085e7 (diff)
downloadexternal_webkit-0c7394a4459ba850766d303b4307add7189cf5f3.zip
external_webkit-0c7394a4459ba850766d303b4307add7189cf5f3.tar.gz
external_webkit-0c7394a4459ba850766d303b4307add7189cf5f3.tar.bz2
Fixes a WebKit bug where ongoing Geolocation requests are not stopped when the page is unloaded.
This fixes bug http://b/issue?id=2164673 Change-Id: I68a615c0b82bcee2a4a61dc0433a4f9321780ad1
Diffstat (limited to 'WebCore/page/Geolocation.cpp')
-rw-r--r--WebCore/page/Geolocation.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index d7e0cc3..38411ce 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -30,6 +30,7 @@
#include "Chrome.h"
#include "CurrentTime.h"
#include "Document.h"
+#include "EventNames.h"
#include "Frame.h"
#include "Page.h"
#include "SQLiteDatabase.h"
@@ -249,6 +250,15 @@ Geolocation::Geolocation(Frame* frame)
return;
ASSERT(m_frame->document());
m_frame->document()->setUsingGeolocation(true);
+
+ if (m_frame->domWindow())
+ m_frame->domWindow()->addEventListener(eventNames().unloadEvent, this, false);
+}
+
+Geolocation::~Geolocation()
+{
+ if (m_frame && m_frame->domWindow())
+ m_frame->domWindow()->removeEventListener(eventNames().unloadEvent, this, false);
}
void Geolocation::disconnectFrame()
@@ -552,6 +562,16 @@ void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service)
handleError(service->lastError());
}
+void Geolocation::handleEvent(Event* event, bool)
+{
+ ASSERT_UNUSED(event, event->type() == eventTypes().unloadEvent);
+ // Cancel any ongoing requests on page unload. This is required to release
+ // references to JS callbacks in the page, to allow the frame to be cleaned up
+ // by WebKit.
+ m_oneShots.clear();
+ m_watchers.clear();
+}
+
void Geolocation::setDatabasePath(String databasePath)
{
CachedPositionManager::setDatabasePath(databasePath);