⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249207 in webkit


Ignore:
Timestamp:
Aug 28, 2019, 10:20:00 AM (7 years ago)
Author:
Chris Dumez
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:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249205 r249207  
     12019-08-28  Chris Dumez  <cdumez@apple.com>
     2
     3        geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure
     4        https://bugs.webkit.org/show_bug.cgi?id=201221
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Update layout tests to reflect behavior change.
     9
     10        * fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt:
     11        * fast/dom/Geolocation/dataURL-getCurrentPosition.html:
     12        * fast/dom/Geolocation/dataURL-watchPosition-expected.txt:
     13        * fast/dom/Geolocation/dataURL-watchPosition.html:
     14        * http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js:
     15        (didReceiveError):
     16        (checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod):
     17        * http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt:
     18        * http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html:
     19        * http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt:
     20        * http/tests/security/sandboxed-iframe-geolocation-watchPosition.html:
     21
    1222019-08-28  Alicia Boya García  <aboya@igalia.com>
    223
  • trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt

    r195075 r249207  
    1 PASS error.code is error.POSITION_UNAVAILABLE.
     1PASS error.code is error.PERMISSION_DENIED.
    22PASS error.message is "Origin does not have permission to use Geolocation service".
    33
  • trunk/LayoutTests/fast/dom/Geolocation/dataURL-getCurrentPosition.html

    r195075 r249207  
    22<html>
    33<head>
    4 <!-- Tests that navigator.geolocation.getCurrentPosition() returns error POSITION_UNAVAILABLE when called from a document with a data URL. -->
     4<!-- Tests that navigator.geolocation.getCurrentPosition() returns error PERMISSION_DENIED when called from a document with a data URL. -->
    55<script src="../../../http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js"></script>
    66<script>
  • trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition-expected.txt

    r195075 r249207  
    1 PASS error.code is error.POSITION_UNAVAILABLE.
     1PASS error.code is error.PERMISSION_DENIED.
    22PASS error.message is "Origin does not have permission to use Geolocation service".
    33
  • trunk/LayoutTests/fast/dom/Geolocation/dataURL-watchPosition.html

    r195075 r249207  
    22<html>
    33<head>
    4 <!-- Tests that navigator.geolocation.watchPosition() returns error POSITION_UNAVAILABLE when called from a document with a data URL. -->
     4<!-- Tests that navigator.geolocation.watchPosition() returns error POSITION_DENIED when called from a document with a data URL. -->
    55<script src="../../../http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js"></script>
    66<script>
  • trunk/LayoutTests/http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js

    r195075 r249207  
    2020    function didReceiveError(error)
    2121    {
    22         if (error.code === error.POSITION_UNAVAILABLE)
    23             logMessage("PASS error.code is error.POSITION_UNAVAILABLE.");
     22        if (error.code === error.PERMISSION_DENIED)
     23            logMessage("PASS error.code is error.PERMISSION_DENIED.");
    2424        else
    25             logMessage("FAIL error.code should be " + error.POSITION_UNAVAILABLE + ". Was " + error.code + ".");
     25            logMessage("FAIL error.code should be " + error.PERMISSION_DENIED + ". Was " + error.code + ".");
    2626
    2727        if (error.message === expectedPositionUnavailableErrorMessage)
  • trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt

    r231450 r249207  
    1 Tests that navigator.geolocation.getCurrentPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.
     1Tests that navigator.geolocation.getCurrentPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.
    22
    33
     
    66Frame: '<!--frame1-->'
    77--------
    8 PASS error.code is error.POSITION_UNAVAILABLE.
     8PASS error.code is error.PERMISSION_DENIED.
    99PASS error.message is "Origin does not have permission to use Geolocation service".
    1010
  • trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html

    r201423 r249207  
    1111</head>
    1212<body>
    13 <p>Tests that navigator.geolocation.getCurrentPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.</p>
     13<p>Tests that navigator.geolocation.getCurrentPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.</p>
    1414<iframe src="https://127.0.0.1:8443/security/resources/sandboxed-iframe-geolocation-getCurrentPosition.html" sandbox="allow-scripts" width="100%" height="300"></iframe>
    1515</body>
  • trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt

    r231450 r249207  
    1 Tests that navigator.geolocation.watchPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.
     1Tests that navigator.geolocation.watchPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.
    22
    33
     
    66Frame: '<!--frame1-->'
    77--------
    8 PASS error.code is error.POSITION_UNAVAILABLE.
     8PASS error.code is error.PERMISSION_DENIED.
    99PASS error.message is "Origin does not have permission to use Geolocation service".
    1010
  • trunk/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition.html

    r201423 r249207  
    1111</head>
    1212<body>
    13 <p>Tests that navigator.geolocation.watchPosition() returns error POSITION_UNAVAILABLE when called from a document in a sandboxed iframe.</p>
     13<p>Tests that navigator.geolocation.watchPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.</p>
    1414<iframe src="https://127.0.0.1:8443/security/resources/sandboxed-iframe-geolocation-watchPosition.html" sandbox="allow-scripts" width="100%" height="300"></iframe>
    1515</body>
  • trunk/Source/WebCore/ChangeLog

    r249205 r249207  
     12019-08-28  Chris Dumez  <cdumez@apple.com>
     2
     3        geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure
     4        https://bugs.webkit.org/show_bug.cgi?id=201221
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        geolocation.watchPosition() / getCurrentPosition() should return PERMISSION_DENIED when context is not secure,
     9        not POSITION_UNAVAILABLE. Both Gecko and Blink agree on PERMISSION_DENIED.
     10
     11        No new tests, updated existing tests.
     12
     13        * Modules/geolocation/Geolocation.cpp:
     14        (WebCore::Geolocation::startRequest):
     15
    1162019-08-28  Alicia Boya García  <aboya@igalia.com>
    217
  • trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp

    r249066 r249207  
    373373{
    374374    if (shouldBlockGeolocationRequests()) {
    375         notifier->setFatalError(GeolocationPositionError::create(GeolocationPositionError::POSITION_UNAVAILABLE, originCannotRequestGeolocationErrorMessage));
     375        notifier->setFatalError(GeolocationPositionError::create(GeolocationPositionError::PERMISSION_DENIED, originCannotRequestGeolocationErrorMessage));
    376376        return;
    377377    }
Note: See TracChangeset for help on using the changeset viewer.