Closed Bug 1861609 Opened 1 year ago Closed 1 year ago

Google Maps does not have permission to use your location on MacOS

Categories

(Core :: DOM: Geolocation, enhancement)

Desktop
macOS
enhancement

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox123 --- verified
firefox124 --- verified

People

(Reporter: mossop, Assigned: handyman)

Details

Attachments

(2 files)

Whenever I try to use My Location or something in Google Maps it pops up a banner saying "Google Maps does not have permission to use your location.". Then when I look in the permissions drop-down it shows that "Access your location" is allowed and was last accessed a few seconds ago. It has been like this for quite a while.

This is Firefox Nightly running on macOS 14 (though it was certainly behaving this way on previous versions of the OS too).

happens to me too on stable release.

The severity field is not set for this bug.
:farre, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(afarre)

I'm not entirely certain that this has got to do with the implementation of DOM: Geolocation, but maybe more with how permissions are displayed.

:mconley, I'm just reaching for someone with immense frontend knowledge here. Do you happen to have an idea?

Flags: needinfo?(afarre) → needinfo?(mconley)

I'm not entirely certain that this has got to do with the implementation of DOM: Geolocation, but maybe more with how permissions are displayed.

Hm, tell me more about this theory. I was able to reproduce, and just traced through what occurs here on the front-end. With the geolocation permission having been previously granted to the site, the permission request comes up through BrowserGlue here, and a prompt is created. The prompt, however, tells us that the permission is already granted for the site, and calls allow on the underlying request.

I don't have a binary build available for me to check, but I presume we then eventually enter here in the content process after some IPC shenanigans, and actually allow the request.

I suspect what's actually happening here isn't a Firefox bug, but a Google Maps bug. I suspect Google Maps isn't correctly handling the case where the browser client (despite having permission from the user) cannot get a location fix from the OS. My suspicion is bolstered by the fact that I can reproduce this issue using Opera (see screenshot).

Flags: needinfo?(mconley)

Ah. Turns out I had not given permission to Firefox to get the location from macOS. Perhaps there is some way we should flag this to the user?

The OS is supposed to pop up a permission dialogue the first time the browser tries to use geolocation, but maybe if you fail to pick something it kind of ends up in a weird state?

Severity: -- → S2
OS: Unspecified → macOS
Summary: Google Maps does not have permission to use your location → Google Maps does not have permission to use your location on MacOS

(In reply to Andrew McCreight [:mccr8] from comment #7)

The OS is supposed to pop up a permission dialogue the first time the browser tries to use geolocation, but maybe if you fail to pick something it kind of ends up in a weird state?

It's entirely possible it did the first time and I denied it. This would probably have been quite some time ago. When I went into the system settings the location setting for Nightly was off.

Gian-Carlo, we're thinking ghat this is an OS issue, where it becomes confusing if you've denied permission to use geolocation previously. It's still in this component but we should look into why our graceful fallback isn't working and what we could do to improve the weird state situation.

Severity: S2 → N/A
Type: defect → enhancement
Flags: needinfo?(gpascutto)

I'm being needinfo-ed here but I don't see a question. Given that the severity was reset, I'm completely unclear what you are expecting.

Flags: needinfo?(gpascutto) → needinfo?(afarre)

Quick experimentation suggests to me that geolocation isn't working at all on Mac when "Enable Location Services" is turned off in MacOS system permissions. When MacOS (or any platform) reports that geolocation is turned off (see CoreLocationLocationProvider), we try to fall back to doing a lookup on MLS/GLS (using the NetworkGeolocationProvider), which provides location based on characteristics of the local wifi environment . But we're getting rejection for every attempt. Without doing proper debugging, I believe this is us aborting geolocation when the user has blocked the permission, instead of falling back to MLS/GLS. (You can see the "Failed to acquire position" message in the browser console.) On Windows, we consider our doorhanger to be permission enough, so we allow MLS/GLS when the user has blocked geolocation in Windows settings. FYI, Windows will be blocking access needed for the fallback in this case in the next year, so we are putting together a plan to handle that. It will hopefully involve opening the right system settings for the user to toggle the system geolocation permission. We could remove the code above that aborts before trying MLS/GLS but that's not guaranteed to work. Otherwise, something like the plan for Windows might be warranted.

Just to be clear on STR:

  1. Make sure "Enable Location Services" is turned off in MacOS system preferences
  2. Launch Firefox
  3. Go to https://www.google.com/maps or use the MDN geolocation example or a similar site. Ignore any Fx doorhangers asking for location. If you have previously granted geolocation permission to the site with "do not ask again" then you will have to undo that first.
  4. Click the "Show Your Location" button
  5. Allow location access in the doorhanger that appears

Actual result: The web page reports that the location is blocked
Expected result: The web page shows the MLS/GLS-obtained location

Removing the error check enables me to get geolocation on my MacBook Pro with system location disabled, but the results are less accurate than they are on my Windows machine that is also using the fallback (by about 1/8 mi) for unknown reasons. The cause may just be less-accurate wifi scanning, although the difference seems extreme for that.

Build: https://treeherder.mozilla.org/jobs?repo=try&group_state=expanded&selectedTaskRun=BrWrZdRpSum-BX11OmhtfQ.0&revision=3c4a3208f02ed4ebd8c388a8fa7c8796bbce301a

Flags: needinfo?(afarre)
Assignee: nobody → davidp99

FWIW I hit this error today on my new Mac and it was only because of this bug that I understood what was happening and went to find out where the set the permission in the OS. Apparently I had location services disabled for everything. I'm not sure what happened.

That makes the point that we do the fallback silently and the results are inherently lower quality than the system geolocation results -- it would be nice to find a way to let the user know this is happening.

Pushed by daparks@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/98cba9e72d8c Allow Mac to use our geolocation fallback when system geolocation is disabled r=mccr8
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

I have reproduced this issue in Release v122.0 and confirmed the fix in Beta v123.0b5 and Nightly v124.0a1 in MacOS 11. When the location is turned off in MacOS settings, the location is still provided in Google Maps "on characteristics of the local wifi environment".

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Hardware: Unspecified → Desktop
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: