diff options
Diffstat (limited to 'Source/WebCore/page/Geolocation.cpp')
-rw-r--r-- | Source/WebCore/page/Geolocation.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/Source/WebCore/page/Geolocation.cpp b/Source/WebCore/page/Geolocation.cpp index 354dde3..f0dd76a 100644 --- a/Source/WebCore/page/Geolocation.cpp +++ b/Source/WebCore/page/Geolocation.cpp @@ -231,19 +231,35 @@ Geolocation::Geolocation(Frame* frame) Geolocation::~Geolocation() { + ASSERT(m_allowGeolocation != InProgress); + ASSERT(!m_frame); } -void Geolocation::disconnectFrame() +Page* Geolocation::page() const +{ + return m_frame ? m_frame->page() : 0; +} + +void Geolocation::reset() { - if (m_frame && m_frame->page() && m_allowGeolocation == InProgress) { + Page* page = this->page(); + if (page && m_allowGeolocation == InProgress) { #if ENABLE(CLIENT_BASED_GEOLOCATION) - m_frame->page()->geolocationController()->cancelPermissionRequest(this); + page->geolocationController()->cancelPermissionRequest(this); #else - m_frame->page()->chrome()->cancelGeolocationPermissionRequestForFrame(m_frame, this); + page->chrome()->cancelGeolocationPermissionRequestForFrame(m_frame, this); #endif } + // The frame may be moving to a new page and we want to get the permissions from the new page's client. + m_allowGeolocation = Unknown; cancelAllRequests(); stopUpdating(); +} + +void Geolocation::disconnectFrame() +{ + // Once we are disconnected from the Frame, it is no longer possible to perform any operations. + reset(); if (m_frame && m_frame->document()) m_frame->document()->setUsingGeolocation(false); m_frame = 0; @@ -252,10 +268,7 @@ void Geolocation::disconnectFrame() Geoposition* Geolocation::lastPosition() { #if ENABLE(CLIENT_BASED_GEOLOCATION) - if (!m_frame) - return 0; - - Page* page = m_frame->page(); + Page* page = this->page(); if (!page) return 0; @@ -594,10 +607,7 @@ void Geolocation::requestPermission() if (m_allowGeolocation > Unknown) return; - if (!m_frame) - return; - - Page* page = m_frame->page(); + Page* page = this->page(); if (!page) return; @@ -691,10 +701,7 @@ void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service) bool Geolocation::startUpdating(GeoNotifier* notifier) { #if ENABLE(CLIENT_BASED_GEOLOCATION) - if (!m_frame) - return false; - - Page* page = m_frame->page(); + Page* page = this->page(); if (!page) return false; @@ -720,10 +727,7 @@ bool Geolocation::startUpdating(GeoNotifier* notifier) void Geolocation::stopUpdating() { #if ENABLE(CLIENT_BASED_GEOLOCATION) - if (!m_frame) - return; - - Page* page = m_frame->page(); + Page* page = this->page(); if (!page) return; @@ -764,6 +768,8 @@ namespace WebCore { void Geolocation::clearWatch(int) {} +void Geolocation::reset() {} + void Geolocation::disconnectFrame() {} Geolocation::Geolocation(Frame*) {} |