Title: [172016] trunk/Source
Revision
172016
Author
[email protected]
Date
2014-08-04 18:04:55 -0700 (Mon, 04 Aug 2014)

Log Message

Check for null frame when processing geolocation authorization request
https://bugs.webkit.org/show_bug.cgi?id=135577
<rdar://problem/17896295>

Patch by Benjamin Poulain <[email protected]> on 2014-08-04
Reviewed by Geoffrey Garen.


Source/WebKit/mac: 
* WebCoreSupport/WebGeolocationClient.mm:
(WebGeolocationClient::requestPermission):

Source/WebKit2: 
I could have put the null check in GeolocationController instead of the WebKit layer,
but that would be a little weird as GeolocationController knows nothing about how
the WebKit layer decides what to do with requests.

* WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
(WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (172015 => 172016)


--- trunk/Source/WebKit/mac/ChangeLog	2014-08-05 00:58:30 UTC (rev 172015)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-08-05 01:04:55 UTC (rev 172016)
@@ -1,3 +1,14 @@
+2014-08-04  Benjamin Poulain  <[email protected]>
+
+        Check for null frame when processing geolocation authorization request
+        https://bugs.webkit.org/show_bug.cgi?id=135577
+        <rdar://problem/17896295>
+
+        Reviewed by Geoffrey Garen.
+
+        * WebCoreSupport/WebGeolocationClient.mm:
+        (WebGeolocationClient::requestPermission):
+
 2014-08-02  Jeremy Jones  <[email protected]>
 
         Support both window and view based video fullscreen.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm (172015 => 172016)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm	2014-08-05 00:58:30 UTC (rev 172015)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm	2014-08-05 01:04:55 UTC (rev 172016)
@@ -112,6 +112,12 @@
 
 #if !PLATFORM(IOS)
     Frame *frame = geolocation->frame();
+
+    if (!frame) {
+        geolocation->setIsAllowed(false);
+        return;
+    }
+
     WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
     WebGeolocationPolicyListener* listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:geolocation];
 

Modified: trunk/Source/WebKit2/ChangeLog (172015 => 172016)


--- trunk/Source/WebKit2/ChangeLog	2014-08-05 00:58:30 UTC (rev 172015)
+++ trunk/Source/WebKit2/ChangeLog	2014-08-05 01:04:55 UTC (rev 172016)
@@ -1,3 +1,18 @@
+2014-08-04  Benjamin Poulain  <[email protected]>
+
+        Check for null frame when processing geolocation authorization request
+        https://bugs.webkit.org/show_bug.cgi?id=135577
+        <rdar://problem/17896295>
+
+        Reviewed by Geoffrey Garen.
+
+        I could have put the null check in GeolocationController instead of the WebKit layer,
+        but that would be a little weird as GeolocationController knows nothing about how
+        the WebKit layer decides what to do with requests.
+
+        * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
+        (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
+
 2014-08-02  Jeremy Jones  <[email protected]>
 
         Support both window and view based video fullscreen.

Modified: trunk/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp (172015 => 172016)


--- trunk/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp	2014-08-05 00:58:30 UTC (rev 172015)
+++ trunk/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp	2014-08-05 01:04:55 UTC (rev 172016)
@@ -55,13 +55,19 @@
 
 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();
-
     WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
     ASSERT(webFrame);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to