diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp index c40cf6681..9b2bb7652 100644 --- a/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp +++ b/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp @@ -32,10 +32,12 @@ #include "WebFrame.h" #include "WebPage.h" #include "WebPageProxyMessages.h" +#include <WebCore/Document.h> #include <WebCore/Frame.h> #include <WebCore/FrameLoader.h> #include <WebCore/Geolocation.h> #include <WebCore/SecurityOrigin.h> +#include <WebCore/SecurityOriginData.h> using namespace WebCore; @@ -54,20 +56,25 @@ GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation* geolocation) { + Frame* frame = geolocation->frame(); + + ASSERT_WITH_MESSAGE(frame, "It is not well understood in which cases the Geolocation is alive after its frame goes away. If you hit this assertion, please add a test covering this case."); + if (!frame) { + geolocation->setIsAllowed(false); + return; + } + uint64_t geolocationID = generateGeolocationID(); m_geolocationToIDMap.set(geolocation, geolocationID); m_idToGeolocationMap.set(geolocationID, geolocation); - Frame* frame = geolocation->frame(); - - WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client()); - WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; + WebFrame* webFrame = WebFrame::fromCoreFrame(*frame); ASSERT(webFrame); - SecurityOrigin* origin = frame->document()->securityOrigin(); + SecurityOrigin& origin = frame->document()->securityOrigin(); - m_page->send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), origin->databaseIdentifier())); + m_page->send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier())); } void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation* geolocation) |