Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: Geolocation regression in WebView2 Canary #4567

Closed
deanmalone opened this issue May 17, 2024 · 2 comments
Closed

[Problem/Bug]: Geolocation regression in WebView2 Canary #4567

deanmalone opened this issue May 17, 2024 · 2 comments
Assignees
Labels
bug Something isn't working by design regression Something used to work but doesn't anymore

Comments

@deanmalone
Copy link

What happened?

In WebView2 Canary the geolocation.watchPosition() is no longer firing location updates. The success callback function is not being called.

Note: It is working fine in Edge Canary.

Browsing to the following webpage demonstrates the issue.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Geolocation test</title>
    <script>
    function getLocation() {
        if (navigator.geolocation) {
            console.log("Geolocation is supported.");
            navigator.geolocation.watchPosition(showPosition);
        } else {
            console.log("Geolocation is not supported.");
        }
    }

    function showPosition(position) {
        console.log("Geolocation position received:", position.coords.latitude, position.coords.longitude);
        document.getElementById("latitude").innerText = position.coords.latitude;
        document.getElementById("longitude").innerText = position.coords.latitude;
    }
    </script>
</head>
<body>
    <button type="button" onclick="getLocation()">Watch geolocation</button>
    <p>Latitude: <text id="latitude"></text></p>
    <p>Longitude: <text id="longitude"></text></p>
</body>
</html>

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

126.0.2589.0

SDK Version

1.0.1722.45

Framework

WPF

Operating System

Windows 11

OS Version

22631.3593

Repro steps

  1. Browse to the html page given in the above description.
  2. Click "Watch geolocation"
  3. Observe the Latitude: and Longitude: fields

Expected: The Latitude and Longitude coordinates are displayed.
Actual: No coordinates are displayed. The showPosition function is never called.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

No response

@deanmalone deanmalone added the bug Something isn't working label May 17, 2024
@github-actions github-actions bot added the regression Something used to work but doesn't anymore label May 17, 2024
@vbryh-msft vbryh-msft assigned liminzhu and unassigned vbryh-msft and lflores-ms May 17, 2024
@liminzhu
Copy link
Member

Thank you for opening the report. The change you're seeing is from a new fix in Canary and it's flowing into Stable 126. The tl;dr of that change is that geolocation is obviously sensitive user information and historically we've been relying on built-in WebView2 per-origin location prompt to gather consent. With WebView2 being an integral part of Windows and the per-origin WebView2 prompt being configurable/suppressible by the hosting app (the intention is to allow the host to customize their consent experience), we felt strongly about tightening the experience that if Windows setting for Location is turned off, geolocation web API would not return location in WebView2. The error code you receive from the API call should reflect that you do not have permission to access location and you can react to the error message as appropriate. Windows also has certain logic in place to very selectively prompt the user about granting location consent, and the app can also handle the error as appropriate further. 

@victorhuangwq
Copy link
Collaborator

@deanmalone I will be closing this issue since it's by design. Feel free to continue the conversation, and we can always reopen the issue if it's deemed to be an issue.

@victorhuangwq victorhuangwq closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working by design regression Something used to work but doesn't anymore
Projects
None yet
Development

No branches or pull requests

5 participants