Title: [136764] trunk/Source/WebKit/blackberry
Revision
136764
Author
[email protected]
Date
2012-12-05 14:46:56 -0800 (Wed, 05 Dec 2012)

Log Message

[BlackBerry] Geolocation prompts won't respond to the correct geolocation object if the user opens two pages and respond in the reversed order
https://bugs.webkit.org/show_bug.cgi?id=104162

PR 257505
Patch by Otto Derek Cheung <[email protected]> on 2012-12-05
Reviewed by Yong Li.

GeolocationClientBlackBerry will register itself to GeolocationHandler when it has
a pending request. When browser responds with WebPageClientImpl::setAllowGeolocation,
we go through the list and let all the pending GeolocationListeners know that a certain
origin has been aceepted/denied.

* WebCoreSupport/GeolocationClientBlackBerry.cpp:
(GeolocationClientBlackBerry::geolocationDestroyed):
(GeolocationClientBlackBerry::requestPermission):
(GeolocationClientBlackBerry::cancelPermissionRequest):
(GeolocationClientBlackBerry::onPermission):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (136763 => 136764)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-12-05 22:38:48 UTC (rev 136763)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-12-05 22:46:56 UTC (rev 136764)
@@ -1,3 +1,22 @@
+2012-12-05  Otto Derek Cheung  <[email protected]>
+
+        [BlackBerry] Geolocation prompts won't respond to the correct geolocation object if the user opens two pages and respond in the reversed order
+        https://bugs.webkit.org/show_bug.cgi?id=104162
+
+        PR 257505
+        Reviewed by Yong Li.
+
+        GeolocationClientBlackBerry will register itself to GeolocationHandler when it has
+        a pending request. When browser responds with WebPageClientImpl::setAllowGeolocation,
+        we go through the list and let all the pending GeolocationListeners know that a certain
+        origin has been aceepted/denied.
+
+        * WebCoreSupport/GeolocationClientBlackBerry.cpp:
+        (GeolocationClientBlackBerry::geolocationDestroyed):
+        (GeolocationClientBlackBerry::requestPermission):
+        (GeolocationClientBlackBerry::cancelPermissionRequest):
+        (GeolocationClientBlackBerry::onPermission):
+
 2012-12-05  Jakob Petsovits  <[email protected]>
 
         [BlackBerry] Better crash fix for resetting tiles on a backingstore takeover.

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp (136763 => 136764)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp	2012-12-05 22:38:48 UTC (rev 136763)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp	2012-12-05 22:46:56 UTC (rev 136764)
@@ -39,6 +39,8 @@
 
 void GeolocationClientBlackBerry::geolocationDestroyed()
 {
+    BlackBerry::Platform::GeolocationHandler::instance()->unregisterFromPermissionTracking(this);
+
     delete this;
 }
 
@@ -87,6 +89,10 @@
         return;
     }
 
+    // Register the listener with the GeolocationHandler to receive permissions.
+    if (m_geolocationRequestMap.isEmpty())
+        BlackBerry::Platform::GeolocationHandler::instance()->registerPermissionTracking(this);
+
     // Add this geolocation permission request to our request map.
     Vector<RefPtr<Geolocation> > geoRequestsForOrigin;
     HashMap<String, Vector<RefPtr<Geolocation> > >::AddResult result = m_geolocationRequestMap.add(origin, geoRequestsForOrigin);
@@ -125,6 +131,9 @@
         }
     }
 
+    if (m_geolocationRequestMap.isEmpty())
+        BlackBerry::Platform::GeolocationHandler::instance()->unregisterFromPermissionTracking(this);
+
     m_webPagePrivate->m_client->cancelGeolocationPermission();
 }
 
@@ -153,6 +162,9 @@
     for (size_t i = 0; i < numberOfGeolocations; ++i)
         pendingPermissionGeolocation[i]->setIsAllowed(isAllowed);
     m_geolocationRequestMap.remove(origin);
+
+    if (m_geolocationRequestMap.isEmpty())
+        BlackBerry::Platform::GeolocationHandler::instance()->unregisterFromPermissionTracking(this);
 }
 
 void GeolocationClientBlackBerry::setEnableHighAccuracy(bool newAccuracy)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to