- Revision
- 132440
- Author
- [email protected]
- Date
- 2012-10-24 19:01:16 -0700 (Wed, 24 Oct 2012)
Log Message
[BlackBerry] Geolocation is segfaulting
https://bugs.webkit.org/show_bug.cgi?id=100305
Patch by Otto Derek Cheung <[email protected]> on 2012-10-24
Reviewed by Rob Buis.
We weren't wrapping the Geolocation object in a RefPtr when we call setIsAllowed in
GeolocationClientBlackBerry::onPermission.
This patch also removes all references of the Geolocation object in WebPageClientImpl.
One RefPtr<Geolocation> is used to store the reference of the WebCore object on our port.
We don't need a mapping between origin -> context of Geolocation because in our port,
one WebPage.cpp contains one GeolocationController only.
* Api/WebPageClient.h:
* WebCoreSupport/GeolocationClientBlackBerry.cpp:
(frameOrigin):
(GeolocationClientBlackBerry::requestPermission):
(GeolocationClientBlackBerry::cancelPermissionRequest):
(GeolocationClientBlackBerry::onPermission):
* WebCoreSupport/GeolocationClientBlackBerry.h:
(GeolocationClientBlackBerry):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (132439 => 132440)
--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-10-25 01:44:05 UTC (rev 132439)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-10-25 02:01:16 UTC (rev 132440)
@@ -157,8 +157,8 @@
virtual void cursorChanged(Platform::CursorType, const char* url, int x, int y) = 0;
- virtual void requestGeolocationPermission(Platform::GeoTrackerListener*, void* context, const char* origin, unsigned originLength) = 0;
- virtual void cancelGeolocationPermission(Platform::GeoTrackerListener*, void* context) = 0;
+ virtual void requestGeolocationPermission(Platform::GeoTrackerListener*, const BlackBerry::Platform::String& origin) = 0;
+ virtual void cancelGeolocationPermission() = 0;
virtual Platform::NetworkStreamFactory* networkStreamFactory() = 0;
virtual void handleStringPattern(const unsigned short* pattern, unsigned length) = 0;
Modified: trunk/Source/WebKit/blackberry/ChangeLog (132439 => 132440)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-10-25 01:44:05 UTC (rev 132439)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-10-25 02:01:16 UTC (rev 132440)
@@ -1,3 +1,28 @@
+2012-10-24 Otto Derek Cheung <[email protected]>
+
+ [BlackBerry] Geolocation is segfaulting
+ https://bugs.webkit.org/show_bug.cgi?id=100305
+
+ Reviewed by Rob Buis.
+
+ We weren't wrapping the Geolocation object in a RefPtr when we call setIsAllowed in
+ GeolocationClientBlackBerry::onPermission.
+
+ This patch also removes all references of the Geolocation object in WebPageClientImpl.
+ One RefPtr<Geolocation> is used to store the reference of the WebCore object on our port.
+
+ We don't need a mapping between origin -> context of Geolocation because in our port,
+ one WebPage.cpp contains one GeolocationController only.
+
+ * Api/WebPageClient.h:
+ * WebCoreSupport/GeolocationClientBlackBerry.cpp:
+ (frameOrigin):
+ (GeolocationClientBlackBerry::requestPermission):
+ (GeolocationClientBlackBerry::cancelPermissionRequest):
+ (GeolocationClientBlackBerry::onPermission):
+ * WebCoreSupport/GeolocationClientBlackBerry.h:
+ (GeolocationClientBlackBerry):
+
2012-10-24 Jacky Jiang <[email protected]>
[BlackBerry][Fullscreen] Roll out changes to fullscreen which rely on viewport size change [Part II]
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp (132439 => 132440)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp 2012-10-25 01:44:05 UTC (rev 132439)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp 2012-10-25 02:01:16 UTC (rev 132440)
@@ -26,14 +26,15 @@
#include "Page.h"
#include "WebPage_p.h"
+#include <BlackBerryPlatformString.h>
+
using namespace WebCore;
-static CString frameOrigin(Frame* frame)
+static const BlackBerry::Platform::String frameOrigin(Frame* frame)
{
DOMWindow* window = frame->document()->domWindow();
SecurityOrigin* origin = window->document()->securityOrigin();
- CString latinOrigin = origin->toString().latin1();
- return latinOrigin;
+ return BlackBerry::Platform::String(origin->toString().utf8().data());
}
GeolocationClientBlackBerry::GeolocationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate)
@@ -74,15 +75,22 @@
Frame* frame = location->frame();
if (!frame)
return;
- m_webPagePrivate->m_page->chrome()->client()->requestGeolocationPermissionForFrame(frame, location);
+ if (!m_webPagePrivate->m_webSettings->isGeolocationEnabled()) {
+ location->setIsAllowed(false);
+ return;
+ }
+ DOMWindow* window = frame->document()->domWindow();
+ if (!window)
+ return;
+
+ const BlackBerry::Platform::String origin = frameOrigin(frame);
+ m_pendingPermissionGeolocation = location;
+ m_webPagePrivate->m_client->requestGeolocationPermission(this, origin);
}
void GeolocationClientBlackBerry::cancelPermissionRequest(Geolocation* location)
{
- Frame* frame = location->frame();
- if (!frame)
- return;
- m_webPagePrivate->m_page->chrome()->client()->cancelGeolocationPermissionRequestForFrame(frame, location);
+ m_webPagePrivate->m_client->cancelGeolocationPermission();
}
void GeolocationClientBlackBerry::onLocationUpdate(double timestamp, double latitude, double longitude, double accuracy, double altitude, bool altitudeValid,
@@ -99,10 +107,10 @@
GeolocationController::from(m_webPagePrivate->m_page)->errorOccurred(error.get());
}
-void GeolocationClientBlackBerry::onPermission(void* context, bool isAllowed)
+void GeolocationClientBlackBerry::onPermission(bool isAllowed)
{
- Geolocation* position = static_cast<Geolocation*>(context);
- position->setIsAllowed(isAllowed);
+ if (m_pendingPermissionGeolocation)
+ m_pendingPermissionGeolocation->setIsAllowed(isAllowed);
}
void GeolocationClientBlackBerry::setEnableHighAccuracy(bool newAccuracy)
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.h (132439 => 132440)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.h 2012-10-25 01:44:05 UTC (rev 132439)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.h 2012-10-25 02:01:16 UTC (rev 132440)
@@ -47,12 +47,13 @@
virtual void onLocationUpdate(double timestamp, double latitude, double longitude, double accuracy, double altitude, bool altitudeValid, double altitudeAccuracy,
bool altitudeAccuracyValid, double speed, bool speedValid, double heading, bool headingValid);
virtual void onLocationError(const char* error);
- virtual void onPermission(void* context, bool isAllowed);
+ virtual void onPermission(bool isAllowed);
BlackBerry::Platform::GeoTracker* tracker() const { return m_tracker; }
private:
BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
BlackBerry::Platform::GeoTracker* m_tracker;
+ RefPtr<Geolocation> m_pendingPermissionGeolocation;
RefPtr<GeolocationPosition> m_lastPosition;
bool m_accuracy;
};