Make permission request for geolocation check page
authorJihye Kang <jye.kang@samsung.com>
Mon, 14 Oct 2013 06:39:38 +0000 (15:39 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 14 Oct 2013 12:06:51 +0000 (12:06 +0000)
[Title] Make permission request for geolocation check page
[Issue#] P131011-01895
[Problem] Force close occurs while doing stress test on Cineday app
[Cause] Invalid page on GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision is referenced.
[Solution] Check validity of the page before call WKGeolocationPermissionAllow and Deny.
Also null check of m_page on didReceiveGeolocationPermissionDecision.

Change-Id: I25abaf0958a7559b81433c4fcd49e5c0a4c0e04f

Source/WebKit2/UIProcess/API/efl/ewk_geolocation.cpp
Source/WebKit2/UIProcess/API/efl/ewk_geolocation_private.h
Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp
Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp

index 2200f9f..58c580c 100644 (file)
@@ -21,6 +21,7 @@
 #include "ewk_geolocation.h"
 
 #if ENABLE(TIZEN_GEOLOCATION)
+#include "EwkViewImpl.h"
 #include "WKAPICast.h"
 #include "WKGeolocationManager.h"
 #include "WKGeolocationPermissionRequest.h"
@@ -38,14 +39,14 @@ using namespace WebKit;
 
 struct _Ewk_Geolocation_Permission_Request {
     WKRetainPtr<WKGeolocationPermissionRequestRef> requestRef;
-    Evas_Object* ewkView;
+    WKPageRef page;
     Ewk_Security_Origin* origin;
     bool isDecided;
     bool isSuspended;
 
-    _Ewk_Geolocation_Permission_Request(Evas_Object* ewkView, WKRetainPtr<WKGeolocationPermissionRequestRef> geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
+    _Ewk_Geolocation_Permission_Request(WKPageRef pageRef, WKRetainPtr<WKGeolocationPermissionRequestRef> geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
         : requestRef(geolocationPermissionRequestRef)
-        , ewkView(ewkView)
+        , page(pageRef)
         , isDecided(false)
         , isSuspended(false)
     {
@@ -58,9 +59,9 @@ struct _Ewk_Geolocation_Permission_Request {
     }
 };
 
-Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(Evas_Object* ewkView, WKGeolocationPermissionRequestRef geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
+Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(WKPageRef pageRef, WKGeolocationPermissionRequestRef geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
 {
-    return new Ewk_Geolocation_Permission_Request(ewkView, geolocationPermissionRequestRef, originRef);
+    return new Ewk_Geolocation_Permission_Request(pageRef, geolocationPermissionRequestRef, originRef);
 }
 
 void ewkGeolocationDeletePermissionRequestList(Eina_List* requestList)
@@ -101,9 +102,11 @@ Eina_Bool ewk_geolocation_permission_request_set(Ewk_Geolocation_Permission_Requ
 
     permissionRequest->isDecided = true;
 
-    allow ? WKGeolocationPermissionRequestAllow(permissionRequest->requestRef.get()) : WKGeolocationPermissionRequestDeny(permissionRequest->requestRef.get());
-
-    ewkViewDeleteGeolocationPermission(permissionRequest->ewkView, permissionRequest);
+    Evas_Object* ewkView = const_cast<Evas_Object*>(EwkViewImpl::viewFromPageViewMap(permissionRequest->page));
+    if (ewkView) {
+        allow ? WKGeolocationPermissionRequestAllow(permissionRequest->requestRef.get()) : WKGeolocationPermissionRequestDeny(permissionRequest->requestRef.get());
+        ewkViewDeleteGeolocationPermission(ewkView, permissionRequest);
+    }
     delete permissionRequest;
 
     return true;
index 8fe92d0..a94511c 100755 (executable)
@@ -33,7 +33,7 @@
 
 typedef struct _Ewk_Geolocation_Permission_Data Ewk_Geolocation_Permission_Data;
 
-Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(Evas_Object* ewkView, WKGeolocationPermissionRequestRef, WKSecurityOriginRef);
+Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(WKPageRef, WKGeolocationPermissionRequestRef, WKSecurityOriginRef);
 void ewkGeolocationDeletePermissionRequestList(Eina_List* requestList);
 bool ewkGeolocationIsPermissionRequestSuspended(const Ewk_Geolocation_Permission_Request*);
 bool ewkGeolocationIsPermissionRequestDecided(const Ewk_Geolocation_Permission_Request*);
index 71beaf5..cf3147a 100644 (file)
@@ -56,6 +56,11 @@ PassRefPtr<GeolocationPermissionRequestProxy> GeolocationPermissionRequestManage
 
 void GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
 {
+#if ENABLE(TIZEN_GEOLOCATION)
+    if (!m_page)
+        return;
+#endif
+
     if (!m_page->isValid())
         return;
 
index 6dd40c5..6427950 100755 (executable)
@@ -193,11 +193,11 @@ bool PageUIClientEfl::runOpenPanel(WKPageRef, WKFrameRef, WKOpenPanelParametersR
     return ewkViewRunOpenPanel(toPageUIClientEfl(clientInfo)->m_viewImpl->view(), parameters, listener);
 }
 
-void PageUIClientEfl::decidePolicyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo)
+void PageUIClientEfl::decidePolicyForGeolocationPermissionRequest(WKPageRef page, WKFrameRef, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo)
 {
 #if ENABLE(TIZEN_GEOLOCATION)
     Evas_Object* ewkView = toPageUIClientEfl(clientInfo)->m_viewImpl->view();
-    Ewk_Geolocation_Permission_Request* geolocationPermissionRequest = ewkGeolocationCreatePermissionRequest(ewkView, permissionRequest, origin);
+    Ewk_Geolocation_Permission_Request* geolocationPermissionRequest = ewkGeolocationCreatePermissionRequest(page, permissionRequest, origin);
     ewkViewRequestGeolocationPermission(ewkView, geolocationPermissionRequest);
 
     if(!ewkGeolocationIsPermissionRequestSuspended(geolocationPermissionRequest))