Title: [136969] trunk/Source/WebKit/blackberry
Revision
136969
Author
[email protected]
Date
2012-12-07 12:22:35 -0800 (Fri, 07 Dec 2012)

Log Message

[BlackBerry] GeolocationClientBB should show file system path in prompts when host is not avaliable
https://bugs.webkit.org/show_bug.cgi?id=103785

PR 247656

Patch by Otto Derek Cheung <[email protected]> on 2012-12-07
Reviewed by Rob Buis.

Adding a special case for origins with protocol "file". We will use the filepath as
an origin when asking for geolocation permission.

If the origin is unique (ie. from a sandboxed iframe), we will fail the location request
right away.

* WebCoreSupport/GeolocationClientBlackBerry.cpp:
(getOrigin):
(GeolocationClientBlackBerry::requestPermission):
(GeolocationClientBlackBerry::cancelPermissionRequest):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (136968 => 136969)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-12-07 19:34:59 UTC (rev 136968)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-12-07 20:22:35 UTC (rev 136969)
@@ -1,3 +1,23 @@
+2012-12-07  Otto Derek Cheung  <[email protected]>
+
+        [BlackBerry] GeolocationClientBB should show file system path in prompts when host is not avaliable
+        https://bugs.webkit.org/show_bug.cgi?id=103785
+
+        PR 247656
+
+        Reviewed by Rob Buis.
+
+        Adding a special case for origins with protocol "file". We will use the filepath as
+        an origin when asking for geolocation permission.
+
+        If the origin is unique (ie. from a sandboxed iframe), we will fail the location request
+        right away.
+
+        * WebCoreSupport/GeolocationClientBlackBerry.cpp:
+        (getOrigin):
+        (GeolocationClientBlackBerry::requestPermission):
+        (GeolocationClientBlackBerry::cancelPermissionRequest):
+
 2012-12-07  Mike Lattanzio  <[email protected]>
 
         [BlackBerry] Update BlackBerry Port to use new Graphics::createBuffer BufferType enum values.

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp (136968 => 136969)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp	2012-12-07 19:34:59 UTC (rev 136968)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/GeolocationClientBlackBerry.cpp	2012-12-07 20:22:35 UTC (rev 136969)
@@ -30,6 +30,20 @@
 
 using namespace WebCore;
 
+static String getOrigin(Frame* frame) 
+{
+    String origin; 
+    SecurityOrigin* securityOrigin = frame->document()->securityOrigin();
+
+    // Special case for file.
+    if (securityOrigin->protocol() == "file")
+        origin = securityOrigin->fileSystemPath();
+    else
+        origin = securityOrigin->toString();
+
+    return origin;
+}
+
 GeolocationClientBlackBerry::GeolocationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate)
     : m_webPagePrivate(webPagePrivate)
     , m_accuracy(false)
@@ -69,14 +83,17 @@
     if (!frame)
         return;
 
-    // FIXME: The geolocation setting for WebSettings is always true. Nothing ever toggles that setting.
     if (!m_webPagePrivate->m_webSettings->isGeolocationEnabled()) {
         location->setIsAllowed(false);
         return;
     }
 
-    const String origin = frame->document()->securityOrigin()->toString();
+    const String origin = getOrigin(frame);
 
+    // Special case for documents with the isUnique flag on. (ie. sandboxed iframes)
+    if (origin == "null")
+        location->setIsAllowed(false);
+
     // Check global location setting, if it is off then we request an infobar that invokes a location settings card.
     // If it's on, then we request an infobar that allows the site to have permission to use geolocation.
     if (!BlackBerry::Platform::GeolocationHandler::instance()->isGlobalServiceActive()) {
@@ -109,7 +126,7 @@
     if (!frame)
         return;
 
-    const String origin = frame->document()->securityOrigin()->toString();
+    const String origin = getOrigin(frame);
 
     // Remove the geolocation from the pending permission map.
     HashMap<String, Vector<RefPtr<Geolocation> > >::iterator it = m_geolocationRequestMap.find(origin);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to