Title: [249207] trunk
Revision
249207
Author
[email protected]
Date
2019-08-28 10:20:00 -0700 (Wed, 28 Aug 2019)

Log Message

geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure
https://bugs.webkit.org/show_bug.cgi?id=201221

Reviewed by Ryosuke Niwa.

Source/WebCore:

geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure,
not POSITION_UNAVAILABLE. Both Gecko and Blink agree on PERMISSION_DENIED.

No new tests, updated existing tests.

* Modules/geolocation/Geolocation.cpp:
(WebCore::Geolocation::startRequest):

LayoutTests:

Update layout tests to reflect behavior change.

* fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt:
* fast/dom/Geolocation/dataURL-getCurrentPosition.html:
* fast/dom/Geolocation/dataURL-watchPosition-expected.txt:
* fast/dom/Geolocation/dataURL-watchPosition.html:
* http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js:
(didReceiveError):
(checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod):
* http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt:
* http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html:
* http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt:
* http/tests/security/sandboxed-iframe-geolocation-watchPosition.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (249206 => 249207)


--- trunk/LayoutTests/ChangeLog	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/ChangeLog	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,3 +1,24 @@
+2019-08-28  Chris Dumez  <[email protected]>
+
+        geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure
+        https://bugs.webkit.org/show_bug.cgi?id=201221
+
+        Reviewed by Ryosuke Niwa.
+
+        Update layout tests to reflect behavior change.
+
+        * fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt:
+        * fast/dom/Geolocation/dataURL-getCurrentPosition.html:
+        * fast/dom/Geolocation/dataURL-watchPosition-expected.txt:
+        * fast/dom/Geolocation/dataURL-watchPosition.html:
+        * http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js:
+        (didReceiveError):
+        (checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod):
+        * http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt:
+        * http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html:
+        * http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt:
+        * http/tests/security/sandboxed-iframe-geolocation-watchPosition.html:
+
 2019-08-28  Alicia Boya García  <[email protected]>
 
         [MSE][GStreamer] WebKitMediaSrc rework

Modified: trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt (249206 => 249207)


--- trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,3 +1,3 @@
-PASS error.code is error.POSITION_UNAVAILABLE.
+PASS error.code is error.PERMISSION_DENIED.
 PASS error.message is "Origin does not have permission to use Geolocation service".
 

Modified: trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition.html (249206 => 249207)


--- trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition.html	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition.html	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html>
 <head>
-<!-- Tests that navigator.geolocation.getCurrentPosition() returns error POSITION_UNAVAILABLE when called from a document with a data URL. -->
+<!-- Tests that navigator.geolocation.getCurrentPosition() returns error PERMISSION_DENIED when called from a document with a data URL. -->
 <script src=""
 <script>
 var PositionUnavailableMockMessage = "Origin does not have permission to use Geolocation service";

Modified: trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition-expected.txt (249206 => 249207)


--- trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition-expected.txt	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition-expected.txt	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,3 +1,3 @@
-PASS error.code is error.POSITION_UNAVAILABLE.
+PASS error.code is error.PERMISSION_DENIED.
 PASS error.message is "Origin does not have permission to use Geolocation service".
 

Modified: trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition.html (249206 => 249207)


--- trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition.html	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition.html	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html>
 <head>
-<!-- Tests that navigator.geolocation.watchPosition() returns error POSITION_UNAVAILABLE when called from a document with a data URL. -->
+<!-- Tests that navigator.geolocation.watchPosition() returns error POSITION_DENIED when called from a document with a data URL. -->
 <script src=""
 <script>
 var PositionUnavailableMockMessage = "Origin does not have permission to use Geolocation service";

Modified: trunk/LayoutTests/http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js (249206 => 249207)


--- trunk/LayoutTests/http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js	2019-08-28 17:20:00 UTC (rev 249207)
@@ -19,10 +19,10 @@
 
     function didReceiveError(error)
     {
-        if (error.code === error.POSITION_UNAVAILABLE)
-            logMessage("PASS error.code is error.POSITION_UNAVAILABLE.");
+        if (error.code === error.PERMISSION_DENIED)
+            logMessage("PASS error.code is error.PERMISSION_DENIED.");
         else
-            logMessage("FAIL error.code should be " + error.POSITION_UNAVAILABLE + ". Was " + error.code + ".");
+            logMessage("FAIL error.code should be " + error.PERMISSION_DENIED + ". Was " + error.code + ".");
 
         if (error.message === expectedPositionUnavailableErrorMessage)
             logMessage('PASS error.message is "' + expectedPositionUnavailableErrorMessage + '".');

Modified: trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt (249206 => 249207)


--- trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,4 +1,4 @@
-Tests that navigator.geolocation.getCurrentPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.
+Tests that navigator.geolocation.getCurrentPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.
 
 
 
@@ -5,6 +5,6 @@
 --------
 Frame: '<!--frame1-->'
 --------
-PASS error.code is error.POSITION_UNAVAILABLE.
+PASS error.code is error.PERMISSION_DENIED.
 PASS error.message is "Origin does not have permission to use Geolocation service".
 

Modified: trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html (249206 => 249207)


--- trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html	2019-08-28 17:20:00 UTC (rev 249207)
@@ -10,7 +10,7 @@
 </script>
 </head>
 <body>
-<p>Tests that navigator.geolocation.getCurrentPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.</p>
+<p>Tests that navigator.geolocation.getCurrentPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.</p>
 <iframe src="" sandbox="allow-scripts" width="100%" height="300"></iframe>
 </body>
 </html>

Modified: trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt (249206 => 249207)


--- trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,4 +1,4 @@
-Tests that navigator.geolocation.watchPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.
+Tests that navigator.geolocation.watchPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.
 
 
 
@@ -5,6 +5,6 @@
 --------
 Frame: '<!--frame1-->'
 --------
-PASS error.code is error.POSITION_UNAVAILABLE.
+PASS error.code is error.PERMISSION_DENIED.
 PASS error.message is "Origin does not have permission to use Geolocation service".
 

Modified: trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html (249206 => 249207)


--- trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html	2019-08-28 17:20:00 UTC (rev 249207)
@@ -10,7 +10,7 @@
 </script>
 </head>
 <body>
-<p>Tests that navigator.geolocation.watchPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.</p>
+<p>Tests that navigator.geolocation.watchPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.</p>
 <iframe src="" sandbox="allow-scripts" width="100%" height="300"></iframe>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (249206 => 249207)


--- trunk/Source/WebCore/ChangeLog	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/Source/WebCore/ChangeLog	2019-08-28 17:20:00 UTC (rev 249207)
@@ -1,3 +1,18 @@
+2019-08-28  Chris Dumez  <[email protected]>
+
+        geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure
+        https://bugs.webkit.org/show_bug.cgi?id=201221
+
+        Reviewed by Ryosuke Niwa.
+
+        geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure,
+        not POSITION_UNAVAILABLE. Both Gecko and Blink agree on PERMISSION_DENIED.
+
+        No new tests, updated existing tests.
+
+        * Modules/geolocation/Geolocation.cpp:
+        (WebCore::Geolocation::startRequest):
+
 2019-08-28  Alicia Boya García  <[email protected]>
 
         [MSE][GStreamer] WebKitMediaSrc rework

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (249206 => 249207)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2019-08-28 17:14:27 UTC (rev 249206)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2019-08-28 17:20:00 UTC (rev 249207)
@@ -372,7 +372,7 @@
 void Geolocation::startRequest(GeoNotifier* notifier)
 {
     if (shouldBlockGeolocationRequests()) {
-        notifier->setFatalError(GeolocationPositionError::create(GeolocationPositionError::POSITION_UNAVAILABLE, originCannotRequestGeolocationErrorMessage));
+        notifier->setFatalError(GeolocationPositionError::create(GeolocationPositionError::PERMISSION_DENIED, originCannotRequestGeolocationErrorMessage));
         return;
     }
     document()->setGeolocationAccessed();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to