Files
tubestation/dom/geolocation/moz.build
David P fee08bba92 Bug 1900225: Part 3 - Implement system geolocation permission UX on Windows r=win-reviewers,gstoll
This implements PresentSystemSettings, LocationIsPermittedHint and
SystemWillPromptForPermissionHint for Windows.  The Windows APIs are not always
available -- some are currently only available in Windows 11 Canary builds
(slated for September release).  In the event that APIs are not available, this
should do nothing.  At present, this is detailed here:

https://learn.microsoft.com/en-us/windows/win32/nativewifi/wi-fi-access-location-changes

There are two issues that this is intended to handle:

1. The system will display a one-time (or so) dialog to the user when Firefox
requests geolocation but doesn't have permission.  For that case, we inform the
user that they will be asked to grant location permission again.  This system
dialog is only presented in versions of Windows that support all of the relevant
APIs.
2. We open system settings to the right page and post a cancelable modal dialog
on the tab if the user grants geolocation to the page but geolocation permission
isn't currently granted in the OS.  This case will not happen if case #1 did.
Unfortunately, we can't get information about the permission status without a
location request on old versions of Windows, so this also does nothing unless
the recent APIs are supported (in this case, AppCapability::CheckAccess).

This work is necessitated not only by the new (occasional) system dialog but
also by Microsoft's plans to block wifi scanning if geolocation isn't available.
We have used wifi scanning as part of a fallback when system geolocation isn't
available -- that approach is no longer viable here.  A user would confusingly
get repeated errors or very poor results (e.g. IP lookup results) without
information as to why, if that happened.  This is what happens in the current
Windows Canary build if system geolocation is turned off.  The fallback remains
useful on other platforms, although Linux is in flux (but it is not in the
scope of this bug).

Differential Revision: https://phabricator.services.mozilla.com/D216474
2024-08-27 22:47:32 +00:00

84 lines
2.1 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
with Files("**"):
BUG_COMPONENT = ("Core", "DOM: Geolocation")
with Files("GeolocationSystemWin.cpp"):
BUG_COMPONENT = ("Core", "Widget: Win32")
EXPORTS += [
"nsGeoPositionIPCSerialiser.h",
]
EXPORTS.mozilla.dom += [
"Geolocation.h",
"GeolocationCoordinates.h",
"GeolocationIPCUtils.h",
"GeolocationPosition.h",
"GeolocationPositionError.h",
"GeolocationSystem.h",
]
SOURCES += [
"Geolocation.cpp",
"GeolocationCoordinates.cpp",
"GeolocationPosition.cpp",
"GeolocationPositionError.cpp",
]
UNIFIED_SOURCES += [
"MLSFallback.cpp",
]
# MinGW is missing the headers needed to build the Windows Geolocation System
# Permission UI so it uses the platform-agnostic version.
if (
CONFIG["OS_TARGET"] == "WINNT"
and CONFIG["CC_TYPE"] == "clang-cl"
and CONFIG["MOZ_BUILD_APP"] == "browser"
):
UNIFIED_SOURCES += [
"GeolocationSystemWin.cpp",
]
EXTRA_JS_MODULES += [
"GeolocationUIUtilsWin.sys.mjs",
]
XPCOM_MANIFESTS += [
"components.conf",
]
XPIDL_SOURCES += ["nsIGeolocationUIUtilsWin.idl"]
XPIDL_MODULE = "dom_geolocation"
else:
UNIFIED_SOURCES += [
"GeolocationSystem.cpp",
]
include("/ipc/chromium/chromium-config.mozbuild")
FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [
"/dom/base",
"/dom/ipc",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
LOCAL_INCLUDES += [
"/dom/system/android",
]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
LOCAL_INCLUDES += [
"/dom/system/mac",
]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
LOCAL_INCLUDES += [
"/dom/system/windows/location",
]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG["MOZ_ENABLE_DBUS"]:
LOCAL_INCLUDES += ["/dom/system/linux"]
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]