2020-01-29 18:56:11 -08:00
|
|
|
diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h
|
2024-02-22 13:17:33 -08:00
|
|
|
index 137963f1170927ae0262e0dc26ef721d496376f4..41fa27bc4a3da41814a7f326792990df3424e81f 100644
|
2020-01-29 18:56:11 -08:00
|
|
|
--- a/accessible/base/NotificationController.h
|
|
|
|
+++ b/accessible/base/NotificationController.h
|
2023-07-06 12:22:45 -07:00
|
|
|
@@ -244,6 +244,8 @@ class NotificationController final : public EventQueue,
|
2020-01-29 18:56:11 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ bool IsUpdatePendingForJugglerAccessibility() { return IsUpdatePending(); }
|
|
|
|
+
|
|
|
|
protected:
|
|
|
|
virtual ~NotificationController();
|
|
|
|
|
|
|
|
diff --git a/accessible/interfaces/nsIAccessibleDocument.idl b/accessible/interfaces/nsIAccessibleDocument.idl
|
2023-10-10 16:10:40 -07:00
|
|
|
index 1886621c373fe1fd5ff54092afc4c64e9ca9a8fd..a0febf72885410b45227171c63e823eca118cb37 100644
|
2020-01-29 18:56:11 -08:00
|
|
|
--- a/accessible/interfaces/nsIAccessibleDocument.idl
|
|
|
|
+++ b/accessible/interfaces/nsIAccessibleDocument.idl
|
2023-10-10 16:10:40 -07:00
|
|
|
@@ -67,4 +67,9 @@ interface nsIAccessibleDocument : nsISupports
|
2020-01-29 18:56:11 -08:00
|
|
|
* Return the child document accessible at the given index.
|
|
|
|
*/
|
|
|
|
nsIAccessibleDocument getChildDocumentAt(in unsigned long index);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Return whether it is updating.
|
|
|
|
+ */
|
|
|
|
+ readonly attribute boolean isUpdatePendingForJugglerAccessibility;
|
|
|
|
};
|
|
|
|
diff --git a/accessible/xpcom/xpcAccessibleDocument.cpp b/accessible/xpcom/xpcAccessibleDocument.cpp
|
2023-11-14 10:18:18 -08:00
|
|
|
index d616e476b2149de5703077563680905e40db0459..7a8a48d5e7303a298a3e2e9fdf64558b3cdbe654 100644
|
2020-01-29 18:56:11 -08:00
|
|
|
--- a/accessible/xpcom/xpcAccessibleDocument.cpp
|
|
|
|
+++ b/accessible/xpcom/xpcAccessibleDocument.cpp
|
2023-11-14 10:18:18 -08:00
|
|
|
@@ -131,6 +131,13 @@ xpcAccessibleDocument::GetChildDocumentAt(uint32_t aIndex,
|
2023-10-10 16:10:40 -07:00
|
|
|
return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
|
2020-01-29 18:56:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+xpcAccessibleDocument::GetIsUpdatePendingForJugglerAccessibility(bool* updating) {
|
|
|
|
+ NS_ENSURE_ARG_POINTER(updating);
|
|
|
|
+ *updating = Intl()->Controller()->IsUpdatePendingForJugglerAccessibility();
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// xpcAccessibleDocument
|
|
|
|
|
|
|
|
diff --git a/accessible/xpcom/xpcAccessibleDocument.h b/accessible/xpcom/xpcAccessibleDocument.h
|
2023-10-10 16:10:40 -07:00
|
|
|
index 8e9bf2b413585b5a3db9370eee5d57fb6c6716ed..5a3b194b54e3813c89989f13a214c989a409f0f6 100644
|
2020-01-29 18:56:11 -08:00
|
|
|
--- a/accessible/xpcom/xpcAccessibleDocument.h
|
|
|
|
+++ b/accessible/xpcom/xpcAccessibleDocument.h
|
2023-10-10 16:10:40 -07:00
|
|
|
@@ -47,6 +47,8 @@ class xpcAccessibleDocument : public xpcAccessibleHyperText,
|
|
|
|
NS_IMETHOD GetChildDocumentAt(uint32_t aIndex,
|
2020-01-29 18:56:11 -08:00
|
|
|
nsIAccessibleDocument** aDocument) final;
|
|
|
|
|
|
|
|
+ NS_IMETHOD GetIsUpdatePendingForJugglerAccessibility(bool* aUpdating) final;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Return XPCOM wrapper for the internal accessible.
|
|
|
|
*/
|
2020-10-05 10:58:56 -07:00
|
|
|
diff --git a/browser/app/winlauncher/LauncherProcessWin.cpp b/browser/app/winlauncher/LauncherProcessWin.cpp
|
2024-11-13 12:34:49 +01:00
|
|
|
index 8167d2b81c918e02ce757f7f448f22e07c29d140..3ae798880acfd8aa965ae08051f2f81855133711 100644
|
2020-10-05 10:58:56 -07:00
|
|
|
--- a/browser/app/winlauncher/LauncherProcessWin.cpp
|
|
|
|
+++ b/browser/app/winlauncher/LauncherProcessWin.cpp
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -23,6 +23,7 @@
|
2020-10-05 10:58:56 -07:00
|
|
|
#include "mozilla/WinHeaderOnlyUtils.h"
|
|
|
|
#include "nsWindowsHelpers.h"
|
|
|
|
|
|
|
|
+#include <io.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <processthreadsapi.h>
|
|
|
|
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -422,8 +423,18 @@ Maybe<int> LauncherMain(int& argc, wchar_t* argv[],
|
2020-10-05 10:58:56 -07:00
|
|
|
HANDLE stdHandles[] = {::GetStdHandle(STD_INPUT_HANDLE),
|
|
|
|
::GetStdHandle(STD_OUTPUT_HANDLE),
|
|
|
|
::GetStdHandle(STD_ERROR_HANDLE)};
|
|
|
|
-
|
|
|
|
attrs.AddInheritableHandles(stdHandles);
|
|
|
|
+ // Playwright pipe installation.
|
|
|
|
+ bool hasJugglerPipe =
|
2023-01-23 11:29:48 -08:00
|
|
|
+ mozilla::CheckArg(argc, argv, "juggler-pipe", nullptr,
|
2020-10-05 10:58:56 -07:00
|
|
|
+ mozilla::CheckArgFlag::None) == mozilla::ARG_FOUND;
|
browser(firefox): properly initialize debugging pipe on windows (#5514)
browser(firefox): properly initialize debugging pipe on windows
Firefox on Windows has 2 launch modes:
- default: a special "launcher process" is used to start browser as a
sub-process
- non-default: browser process starts right away
Firefox has a logic to detect how successful was the use of the
launcher process to do self-recovery when things go wrong. Namely:
- when attempting to use launcher process, firefox records a timestamp
of the attempt beginning
- once the launcher process successfully launches browser sub-process,
firefox records another timestamp of the completion
On a new launch, firefox checks what timestamps are present. If there's
a timestamp that signifies start of launcher process, but no successful
timestamp, it decides that last "launcher process" use was not
successful and falls back to launching browser right away.
When launching 2 firefox processes right away, the first process
uses attempts to use launcher process and records the first timestamp.
At the same time, the second instance sees the first timestamp and
doesn't see the second timestamp, and falls back to launching browser
right away. Our debugging pipe code, however, does not support
non-launcher-process code path.
This patch adds support for remote debugging pipe in case of
non-launcher-process startup.
Drive-by:
- disable crashreporter altogether
- remove stray dcheck that breaks firefox debug compilation
- disable compilation of firefox update agent
- do not use WIN32_DISTRIB flag unless doing full builds since
it kills incremental compilation
References #4660
2021-02-19 10:32:47 -08:00
|
|
|
+ if (hasJugglerPipe) {
|
2020-10-05 10:58:56 -07:00
|
|
|
+ intptr_t stdio3 = _get_osfhandle(3);
|
|
|
|
+ intptr_t stdio4 = _get_osfhandle(4);
|
|
|
|
+ HANDLE pipeHandles[] = {reinterpret_cast<HANDLE>(stdio3),
|
|
|
|
+ reinterpret_cast<HANDLE>(stdio4)};
|
|
|
|
+ attrs.AddInheritableHandles(pipeHandles);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
DWORD creationFlags = CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT;
|
|
|
|
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/browser/installer/allowed-dupes.mn b/browser/installer/allowed-dupes.mn
|
2024-09-30 05:14:45 -07:00
|
|
|
index 213a99ed433d5219c2b9a64baad82d14cdbcd432..ee4f6484cdfe80899c28a1d9607494e520bfc93d 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/browser/installer/allowed-dupes.mn
|
|
|
|
+++ b/browser/installer/allowed-dupes.mn
|
2024-09-30 05:14:45 -07:00
|
|
|
@@ -67,6 +67,12 @@ browser/features/webcompat@mozilla.org/shims/empty-shim.txt
|
2021-08-11 03:37:57 +03:00
|
|
|
removed-files
|
|
|
|
#endif
|
2020-04-15 17:31:59 -07:00
|
|
|
|
2019-11-18 18:18:28 -08:00
|
|
|
+# Juggler/marionette files
|
|
|
|
+chrome/juggler/content/content/floating-scrollbars.css
|
|
|
|
+browser/chrome/devtools/skin/floating-scrollbars-responsive-design.css
|
|
|
|
+chrome/juggler/content/server/stream-utils.js
|
|
|
|
+chrome/marionette/content/stream-utils.js
|
2020-04-15 17:31:59 -07:00
|
|
|
+
|
2024-09-30 05:14:45 -07:00
|
|
|
# Bug 1606928 - There's no reliable way to connect Top Sites favicons with the favicons in the Search Service
|
|
|
|
browser/chrome/browser/content/activity-stream/data/content/tippytop/favicons/allegro-pl.ico
|
|
|
|
browser/defaults/settings/main/search-config-icons/96327a73-c433-5eb4-a16d-b090cadfb80b
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
|
2025-02-28 13:23:18 +00:00
|
|
|
index 90c2e7a69076df56392f6d14aacadada7f413e89..9ed24d7d690eca04ef07e9715444227ecf32a008 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/browser/installer/package-manifest.in
|
|
|
|
+++ b/browser/installer/package-manifest.in
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -196,6 +196,9 @@
|
2021-07-14 08:26:43 -08:00
|
|
|
@RESPATH@/chrome/remote.manifest
|
2019-11-18 18:18:28 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
+@RESPATH@/chrome/juggler@JAREXT@
|
|
|
|
+@RESPATH@/chrome/juggler.manifest
|
|
|
|
+
|
2022-08-23 15:13:06 -07:00
|
|
|
; [Extensions]
|
|
|
|
@RESPATH@/components/extensions-toolkit.manifest
|
|
|
|
@RESPATH@/browser/components/extensions-browser.manifest
|
2020-01-28 14:03:19 -08:00
|
|
|
diff --git a/devtools/server/socket/websocket-server.js b/devtools/server/socket/websocket-server.js
|
2024-06-14 18:38:09 -07:00
|
|
|
index d49c6fbf1bf83b832795fa674f6b41f223eef812..7ea3540947ff5f61b15f27fbf4b955649f8e9ff9 100644
|
2020-01-28 14:03:19 -08:00
|
|
|
--- a/devtools/server/socket/websocket-server.js
|
|
|
|
+++ b/devtools/server/socket/websocket-server.js
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -134,13 +134,12 @@ function writeHttpResponse(output, response) {
|
2020-01-28 14:03:19 -08:00
|
|
|
* Process the WebSocket handshake headers and return the key to be sent in
|
|
|
|
* Sec-WebSocket-Accept response header.
|
|
|
|
*/
|
|
|
|
-function processRequest({ requestLine, headers }) {
|
|
|
|
+function processRequest({ requestLine, headers }, expectedPath) {
|
|
|
|
const [method, path] = requestLine.split(" ");
|
|
|
|
if (method !== "GET") {
|
|
|
|
throw new Error("The handshake request must use GET method");
|
|
|
|
}
|
|
|
|
-
|
|
|
|
- if (path !== "/") {
|
|
|
|
+ if (path !== expectedPath) {
|
|
|
|
throw new Error("The handshake request has unknown path");
|
|
|
|
}
|
|
|
|
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -190,13 +189,13 @@ function computeKey(key) {
|
2020-01-28 14:03:19 -08:00
|
|
|
/**
|
|
|
|
* Perform the server part of a WebSocket opening handshake on an incoming connection.
|
|
|
|
*/
|
2023-09-11 18:16:33 -07:00
|
|
|
-const serverHandshake = async function (input, output) {
|
|
|
|
+const serverHandshake = async function (input, output, expectedPath) {
|
2020-01-28 14:03:19 -08:00
|
|
|
// Read the request
|
|
|
|
const request = await readHttpRequest(input);
|
|
|
|
|
|
|
|
try {
|
|
|
|
// Check and extract info from the request
|
|
|
|
- const { acceptKey } = processRequest(request);
|
|
|
|
+ const { acceptKey } = processRequest(request, expectedPath);
|
|
|
|
|
|
|
|
// Send response headers
|
|
|
|
await writeHttpResponse(output, [
|
2023-09-11 18:16:33 -07:00
|
|
|
@@ -218,8 +217,8 @@ const serverHandshake = async function (input, output) {
|
2020-01-28 14:03:19 -08:00
|
|
|
* Performs the WebSocket handshake and waits for the WebSocket to open.
|
|
|
|
* Returns Promise with a WebSocket ready to send and receive messages.
|
|
|
|
*/
|
2023-09-11 18:16:33 -07:00
|
|
|
-const accept = async function (transport, input, output) {
|
2020-01-28 14:03:19 -08:00
|
|
|
- await serverHandshake(input, output);
|
2023-09-11 18:16:33 -07:00
|
|
|
+const accept = async function (transport, input, output, expectedPath) {
|
2020-01-28 14:03:19 -08:00
|
|
|
+ await serverHandshake(input, output, expectedPath || "/");
|
|
|
|
|
|
|
|
const transportProvider = {
|
|
|
|
setListener(upgradeListener) {
|
2021-05-18 21:23:12 +02:00
|
|
|
diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index b30dab9ecdee37d7db842acaad30ded30fc326b2..534a89916e34f3d4d960dfcf660c38e2d1000e0c 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/docshell/base/BrowsingContext.cpp
|
|
|
|
+++ b/docshell/base/BrowsingContext.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -106,8 +106,11 @@ struct ParamTraits<mozilla::dom::DisplayMode>
|
2021-05-18 21:23:12 +02:00
|
|
|
|
2024-06-14 18:38:09 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride>
|
|
|
|
- : public mozilla::dom::WebIDLEnumSerializer<
|
|
|
|
- mozilla::dom::PrefersColorSchemeOverride> {};
|
|
|
|
+ : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::PrefersColorSchemeOverride> {};
|
|
|
|
+
|
2021-05-18 21:23:12 +02:00
|
|
|
+template <>
|
|
|
|
+struct ParamTraits<mozilla::dom::PrefersReducedMotionOverride>
|
2024-06-14 18:38:09 -07:00
|
|
|
+ : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::PrefersReducedMotionOverride> {};
|
|
|
|
|
2021-05-18 21:23:12 +02:00
|
|
|
template <>
|
2025-01-22 09:56:34 -08:00
|
|
|
struct ParamTraits<mozilla::dom::ForcedColorsOverride>
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -2887,6 +2890,23 @@ void BrowsingContext::DidSet(FieldIndex<IDX_ForcedColorsOverride>,
|
2022-06-29 04:46:49 -07:00
|
|
|
PresContextAffectingFieldChanged();
|
2021-05-18 21:23:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+void BrowsingContext::DidSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
|
|
|
|
+ dom::PrefersReducedMotionOverride aOldValue) {
|
|
|
|
+ MOZ_ASSERT(IsTop());
|
|
|
|
+ if (PrefersReducedMotionOverride() == aOldValue) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ PreOrderWalk([&](BrowsingContext* aContext) {
|
|
|
|
+ if (nsIDocShell* shell = aContext->GetDocShell()) {
|
|
|
|
+ if (nsPresContext* pc = shell->GetPresContext()) {
|
|
|
|
+ pc->MediaFeatureValuesChanged(
|
|
|
|
+ {MediaFeatureChangeReason::SystemMetricsChange},
|
|
|
|
+ MediaFeatureChangePropagation::JustThisDocument);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void BrowsingContext::DidSet(FieldIndex<IDX_MediumOverride>,
|
|
|
|
nsString&& aOldValue) {
|
|
|
|
MOZ_ASSERT(IsTop());
|
|
|
|
diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index e0310bbed02a805a247e04bdc88ae142bcbe5637..19fe77791b055f7f907a0ab00b03e100a0aac1e8 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/docshell/base/BrowsingContext.h
|
|
|
|
+++ b/docshell/base/BrowsingContext.h
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -203,10 +203,10 @@ struct EmbedderColorSchemes {
|
2022-06-29 04:46:49 -07:00
|
|
|
FIELD(GVInaudibleAutoplayRequestStatus, GVAutoplayRequestStatus) \
|
|
|
|
/* ScreenOrientation-related APIs */ \
|
|
|
|
FIELD(CurrentOrientationAngle, float) \
|
|
|
|
- FIELD(CurrentOrientationType, mozilla::dom::OrientationType) \
|
|
|
|
+ FIELD(CurrentOrientationType, dom::OrientationType) \
|
|
|
|
FIELD(OrientationLock, mozilla::hal::ScreenOrientation) \
|
|
|
|
FIELD(UserAgentOverride, nsString) \
|
|
|
|
- FIELD(TouchEventsOverrideInternal, mozilla::dom::TouchEventsOverride) \
|
|
|
|
+ FIELD(TouchEventsOverrideInternal, dom::TouchEventsOverride) \
|
|
|
|
FIELD(EmbedderElementType, Maybe<nsString>) \
|
|
|
|
FIELD(MessageManagerGroup, nsString) \
|
|
|
|
FIELD(MaxTouchPointsOverride, uint8_t) \
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -246,6 +246,8 @@ struct EmbedderColorSchemes {
|
2022-06-29 04:46:49 -07:00
|
|
|
* <browser> embedder element. */ \
|
2023-01-23 11:29:48 -08:00
|
|
|
FIELD(EmbedderColorSchemes, EmbedderColorSchemes) \
|
2022-06-29 04:46:49 -07:00
|
|
|
FIELD(DisplayMode, dom::DisplayMode) \
|
|
|
|
+ /* playwright addition */ \
|
|
|
|
+ FIELD(PrefersReducedMotionOverride, dom::PrefersReducedMotionOverride) \
|
2021-09-08 16:47:26 +03:00
|
|
|
/* The number of entries added to the session history because of this \
|
|
|
|
* browsing context. */ \
|
2022-06-29 04:46:49 -07:00
|
|
|
FIELD(HistoryEntryCount, uint32_t) \
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -947,6 +949,10 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
2025-01-22 09:56:34 -08:00
|
|
|
return GetForcedColorsOverride();
|
2021-05-18 21:23:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ dom::PrefersReducedMotionOverride PrefersReducedMotionOverride() const {
|
|
|
|
+ return GetPrefersReducedMotionOverride();
|
|
|
|
+ }
|
|
|
|
+
|
2021-10-13 15:49:41 -07:00
|
|
|
bool IsInBFCache() const;
|
2022-06-29 04:46:49 -07:00
|
|
|
|
|
|
|
bool AllowJavascript() const { return GetAllowJavascript(); }
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1128,6 +1134,15 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
2023-06-06 15:08:23 -07:00
|
|
|
void WalkPresContexts(Callback&&);
|
2022-06-29 04:46:49 -07:00
|
|
|
void PresContextAffectingFieldChanged();
|
2021-05-18 21:23:12 +02:00
|
|
|
|
|
|
|
+ bool CanSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
|
|
|
|
+ dom::PrefersReducedMotionOverride, ContentParent*) {
|
|
|
|
+ return IsTop();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void DidSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
|
|
|
|
+ dom::PrefersReducedMotionOverride aOldValue);
|
2021-06-08 16:00:15 -07:00
|
|
|
+
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
|
|
|
void DidSet(FieldIndex<IDX_MediumOverride>, nsString&& aOldValue);
|
|
|
|
|
|
|
|
bool CanSet(FieldIndex<IDX_SuspendMediaWhenInactive>, bool, ContentParent*) {
|
2023-03-21 01:23:12 +00:00
|
|
|
diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index e73d56380ff6802103896bd63d2e11c26c8ee3f5..2ce283bcc4e6690a26a6483b6b50b24093797e45 100644
|
2023-03-21 01:23:12 +00:00
|
|
|
--- a/docshell/base/CanonicalBrowsingContext.cpp
|
|
|
|
+++ b/docshell/base/CanonicalBrowsingContext.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -323,6 +323,8 @@ void CanonicalBrowsingContext::ReplacedBy(
|
2024-09-05 13:44:58 +02:00
|
|
|
txn.SetShouldDelayMediaFromStart(GetShouldDelayMediaFromStart());
|
|
|
|
txn.SetForceOffline(GetForceOffline());
|
2025-01-22 09:56:34 -08:00
|
|
|
txn.SetTopInnerSizeForRFP(GetTopInnerSizeForRFP());
|
2024-09-05 13:44:58 +02:00
|
|
|
+ txn.SetPrefersReducedMotionOverride(GetPrefersReducedMotionOverride());
|
|
|
|
+ txn.SetForcedColorsOverride(GetForcedColorsOverride());
|
|
|
|
|
|
|
|
// Propagate some settings on BrowsingContext replacement so they're not lost
|
|
|
|
// on bfcached navigations. These are important for GeckoView (see bug
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1608,6 +1610,12 @@ void CanonicalBrowsingContext::LoadURI(nsIURI* aURI,
|
2023-03-21 01:23:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ {
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ if (observerService) {
|
2023-06-06 15:08:23 -07:00
|
|
|
+ observerService->NotifyObservers(ToSupports(this), "juggler-navigation-started-browser", NS_ConvertASCIItoUTF16(nsPrintfCString("%" PRIu64, loadState->GetLoadIdentifier())).get());
|
2023-03-21 01:23:12 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
LoadURI(loadState, true);
|
|
|
|
}
|
|
|
|
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 4851148d889bdfc12a4b9a463c05d3fb9f1f593f..9f4e3fd0cdfc66b49b1650a05f4b296603846d84 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/docshell/base/nsDocShell.cpp
|
|
|
|
+++ b/docshell/base/nsDocShell.cpp
|
2020-04-01 14:10:30 -07:00
|
|
|
@@ -15,6 +15,12 @@
|
2020-03-26 16:33:07 -07:00
|
|
|
# include <unistd.h> // for getpid()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
|
|
|
+# include "unicode/locid.h"
|
|
|
|
+#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
|
|
|
+
|
|
|
|
+#include "js/LocaleSensitive.h"
|
|
|
|
+
|
|
|
|
#include "mozilla/ArrayUtils.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/AutoRestore.h"
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -66,6 +72,7 @@
|
2020-03-20 11:14:42 -07:00
|
|
|
#include "mozilla/dom/DocGroup.h"
|
|
|
|
#include "mozilla/dom/Element.h"
|
2024-09-05 13:44:58 +02:00
|
|
|
#include "mozilla/dom/FragmentDirective.h"
|
2020-03-20 11:14:42 -07:00
|
|
|
+#include "mozilla/dom/Geolocation.h"
|
|
|
|
#include "mozilla/dom/HTMLAnchorElement.h"
|
2020-08-06 10:32:50 -07:00
|
|
|
#include "mozilla/dom/HTMLIFrameElement.h"
|
2020-03-20 11:14:42 -07:00
|
|
|
#include "mozilla/dom/PerformanceNavigation.h"
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -90,6 +97,7 @@
|
2020-03-26 16:33:07 -07:00
|
|
|
#include "mozilla/dom/JSWindowActorChild.h"
|
2022-03-29 02:16:04 -06:00
|
|
|
#include "mozilla/dom/DocumentBinding.h"
|
2020-06-09 22:48:10 -07:00
|
|
|
#include "mozilla/ipc/ProtocolUtils.h"
|
2020-03-26 16:33:07 -07:00
|
|
|
+#include "mozilla/dom/WorkerCommon.h"
|
2020-05-07 18:37:15 -07:00
|
|
|
#include "mozilla/net/DocumentChannel.h"
|
2021-07-14 08:26:43 -08:00
|
|
|
#include "mozilla/net/DocumentChannelChild.h"
|
2020-08-12 10:09:20 -07:00
|
|
|
#include "mozilla/net/ParentChannelWrapper.h"
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -113,6 +121,7 @@
|
2024-03-26 15:01:07 -07:00
|
|
|
#include "nsIDocumentViewer.h"
|
2019-11-25 13:56:39 -08:00
|
|
|
#include "mozilla/dom/Document.h"
|
2022-05-31 01:54:36 -06:00
|
|
|
#include "nsHTMLDocument.h"
|
2019-11-25 13:56:39 -08:00
|
|
|
+#include "mozilla/dom/Element.h"
|
|
|
|
#include "nsIDocumentLoaderFactory.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
|
|
|
#include "nsIEditingSession.h"
|
2024-07-29 10:30:28 +02:00
|
|
|
@@ -207,6 +216,7 @@
|
2023-11-14 10:18:18 -08:00
|
|
|
#include "nsGlobalWindowInner.h"
|
|
|
|
#include "nsGlobalWindowOuter.h"
|
2020-03-30 15:05:46 -07:00
|
|
|
#include "nsJSEnvironment.h"
|
|
|
|
+#include "nsJSUtils.h"
|
|
|
|
#include "nsNetCID.h"
|
|
|
|
#include "nsNetUtil.h"
|
|
|
|
#include "nsObjectLoadingContent.h"
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -347,6 +357,13 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
|
2020-08-12 10:09:20 -07:00
|
|
|
mAllowDNSPrefetch(true),
|
2020-05-07 18:37:15 -07:00
|
|
|
mAllowWindowControl(true),
|
2019-11-25 13:56:39 -08:00
|
|
|
mCSSErrorReportingEnabled(false),
|
|
|
|
+ mFileInputInterceptionEnabled(false),
|
2020-04-15 14:41:18 -07:00
|
|
|
+ mOverrideHasFocus(false),
|
2019-11-25 15:26:03 -08:00
|
|
|
+ mBypassCSPEnabled(false),
|
2020-11-05 17:53:22 -08:00
|
|
|
+ mForceActiveState(false),
|
2023-01-23 11:29:48 -08:00
|
|
|
+ mDisallowBFCache(false),
|
2021-05-18 21:23:12 +02:00
|
|
|
+ mReducedMotionOverride(REDUCED_MOTION_OVERRIDE_NONE),
|
2021-06-08 16:00:15 -07:00
|
|
|
+ mForcedColorsOverride(FORCED_COLORS_OVERRIDE_NO_OVERRIDE),
|
2019-11-25 13:56:39 -08:00
|
|
|
mAllowAuth(mItemType == typeContent),
|
|
|
|
mAllowKeywordFixup(false),
|
2021-04-01 18:49:01 -05:00
|
|
|
mDisableMetaRefreshWhenInactive(false),
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -3019,6 +3036,214 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
|
2019-11-25 13:56:39 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2020-03-22 13:51:49 -07:00
|
|
|
+// =============== Juggler Begin =======================
|
|
|
|
+
|
2019-11-25 13:56:39 -08:00
|
|
|
+nsDocShell* nsDocShell::GetRootDocShell() {
|
|
|
|
+ nsCOMPtr<nsIDocShellTreeItem> rootAsItem;
|
|
|
|
+ GetInProcessSameTypeRootTreeItem(getter_AddRefs(rootAsItem));
|
|
|
|
+ nsCOMPtr<nsIDocShell> rootShell = do_QueryInterface(rootAsItem);
|
|
|
|
+ return nsDocShell::Cast(rootShell);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2019-11-25 15:26:03 -08:00
|
|
|
+nsDocShell::GetBypassCSPEnabled(bool* aEnabled) {
|
|
|
|
+ MOZ_ASSERT(aEnabled);
|
|
|
|
+ *aEnabled = mBypassCSPEnabled;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetBypassCSPEnabled(bool aEnabled) {
|
|
|
|
+ mBypassCSPEnabled = aEnabled;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2020-11-05 17:53:22 -08:00
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::GetForceActiveState(bool* aEnabled) {
|
|
|
|
+ MOZ_ASSERT(aEnabled);
|
|
|
|
+ *aEnabled = mForceActiveState;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetForceActiveState(bool aEnabled) {
|
|
|
|
+ mForceActiveState = aEnabled;
|
2020-12-14 15:28:48 -08:00
|
|
|
+ ActivenessMaybeChanged();
|
2020-11-05 17:53:22 -08:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2023-01-23 11:29:48 -08:00
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::GetDisallowBFCache(bool* aEnabled) {
|
|
|
|
+ MOZ_ASSERT(aEnabled);
|
|
|
|
+ *aEnabled = mDisallowBFCache;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetDisallowBFCache(bool aEnabled) {
|
|
|
|
+ mDisallowBFCache = aEnabled;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2019-11-25 15:26:03 -08:00
|
|
|
+bool nsDocShell::IsBypassCSPEnabled() {
|
|
|
|
+ return GetRootDocShell()->mBypassCSPEnabled;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2020-04-15 14:41:18 -07:00
|
|
|
+nsDocShell::GetOverrideHasFocus(bool* aEnabled) {
|
|
|
|
+ MOZ_ASSERT(aEnabled);
|
|
|
|
+ *aEnabled = mOverrideHasFocus;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetOverrideHasFocus(bool aEnabled) {
|
|
|
|
+ mOverrideHasFocus = aEnabled;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool nsDocShell::ShouldOverrideHasFocus() const {
|
|
|
|
+ return mOverrideHasFocus;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2020-03-20 17:03:20 -07:00
|
|
|
+nsDocShell::GetLanguageOverride(nsAString& aLanguageOverride) {
|
2020-03-22 13:51:49 -07:00
|
|
|
+ aLanguageOverride = GetRootDocShell()->mLanguageOverride;
|
2020-03-20 17:03:20 -07:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2020-03-26 16:33:07 -07:00
|
|
|
+
|
|
|
|
+static void SetIcuLocale(const nsAString& aLanguageOverride) {
|
|
|
|
+ icu::Locale locale(NS_LossyConvertUTF16toASCII(aLanguageOverride).get());
|
2024-01-13 00:19:49 +01:00
|
|
|
+ if (icu::Locale::getDefault() != locale) {
|
|
|
|
+ UErrorCode error_code = U_ZERO_ERROR;
|
|
|
|
+ const char* lang = locale.getLanguage();
|
|
|
|
+ if (lang != nullptr && *lang != '\0') {
|
|
|
|
+ icu::Locale::setDefault(locale, error_code);
|
|
|
|
+ } else {
|
|
|
|
+ fprintf(stderr, "SetIcuLocale Failed to set the ICU default locale to %s\n", NS_LossyConvertUTF16toASCII(aLanguageOverride).get());
|
|
|
|
+ }
|
2020-03-26 16:33:07 -07:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ AutoJSAPI jsapi;
|
|
|
|
+ jsapi.Init();
|
|
|
|
+ JSContext* cx = jsapi.cx();
|
|
|
|
+ JS_ResetDefaultLocale(JS_GetRuntime(cx));
|
|
|
|
+
|
|
|
|
+ ResetDefaultLocaleInAllWorkers();
|
|
|
|
+}
|
|
|
|
+
|
2020-03-20 17:03:20 -07:00
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetLanguageOverride(const nsAString& aLanguageOverride) {
|
|
|
|
+ mLanguageOverride = aLanguageOverride;
|
2020-03-26 16:33:07 -07:00
|
|
|
+ SetIcuLocale(aLanguageOverride);
|
2020-03-20 17:03:20 -07:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2020-04-01 14:10:30 -07:00
|
|
|
+nsDocShell::OverrideTimezone(const nsAString& aTimezoneOverride,
|
|
|
|
+ bool* aSuccess) {
|
2020-03-30 15:05:46 -07:00
|
|
|
+ NS_ENSURE_ARG(aSuccess);
|
2020-04-01 14:10:30 -07:00
|
|
|
+ NS_LossyConvertUTF16toASCII timeZoneId(aTimezoneOverride);
|
|
|
|
+ *aSuccess = nsJSUtils::SetTimeZoneOverride(timeZoneId.get());
|
2020-03-30 15:05:46 -07:00
|
|
|
+
|
2020-04-01 14:10:30 -07:00
|
|
|
+ // Set TZ which affects localtime_s().
|
2020-03-30 15:05:46 -07:00
|
|
|
+ auto setTimeZoneEnv = [](const char* value) {
|
|
|
|
+#if defined(_WIN32)
|
|
|
|
+ return _putenv_s("TZ", value) == 0;
|
|
|
|
+#else
|
|
|
|
+ return setenv("TZ", value, true) == 0;
|
|
|
|
+#endif /* _WIN32 */
|
|
|
|
+ };
|
|
|
|
+ if (*aSuccess) {
|
2020-04-01 14:10:30 -07:00
|
|
|
+ *aSuccess = setTimeZoneEnv(timeZoneId.get());
|
|
|
|
+ if (!*aSuccess) {
|
|
|
|
+ fprintf(stderr, "Failed to set 'TZ' to '%s'\n", timeZoneId.get());
|
|
|
|
+ }
|
2020-03-30 15:05:46 -07:00
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2019-11-25 13:56:39 -08:00
|
|
|
+nsDocShell::GetFileInputInterceptionEnabled(bool* aEnabled) {
|
|
|
|
+ MOZ_ASSERT(aEnabled);
|
2020-03-22 13:51:49 -07:00
|
|
|
+ *aEnabled = GetRootDocShell()->mFileInputInterceptionEnabled;
|
2019-11-25 13:56:39 -08:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetFileInputInterceptionEnabled(bool aEnabled) {
|
|
|
|
+ mFileInputInterceptionEnabled = aEnabled;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool nsDocShell::IsFileInputInterceptionEnabled() {
|
|
|
|
+ return GetRootDocShell()->mFileInputInterceptionEnabled;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void nsDocShell::FilePickerShown(mozilla::dom::Element* element) {
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService =
|
|
|
|
+ mozilla::services::GetObserverService();
|
|
|
|
+ observerService->NotifyObservers(
|
|
|
|
+ ToSupports(element), "juggler-file-picker-shown", nullptr);
|
|
|
|
+}
|
2020-03-20 11:14:42 -07:00
|
|
|
+
|
2020-03-22 13:51:49 -07:00
|
|
|
+RefPtr<nsGeolocationService> nsDocShell::GetGeolocationServiceOverride() {
|
|
|
|
+ return GetRootDocShell()->mGeolocationServiceOverride;
|
2020-03-20 11:14:42 -07:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetGeolocationOverride(nsIDOMGeoPosition* aGeolocationOverride) {
|
|
|
|
+ if (aGeolocationOverride) {
|
2020-03-22 13:51:49 -07:00
|
|
|
+ if (!mGeolocationServiceOverride) {
|
|
|
|
+ mGeolocationServiceOverride = new nsGeolocationService();
|
|
|
|
+ mGeolocationServiceOverride->Init();
|
2020-03-20 11:14:42 -07:00
|
|
|
+ }
|
2020-03-22 13:51:49 -07:00
|
|
|
+ mGeolocationServiceOverride->Update(aGeolocationOverride);
|
2020-03-20 11:14:42 -07:00
|
|
|
+ } else {
|
2020-03-22 13:51:49 -07:00
|
|
|
+ mGeolocationServiceOverride = nullptr;
|
2020-03-20 11:14:42 -07:00
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
2020-03-22 13:51:49 -07:00
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2021-05-18 21:23:12 +02:00
|
|
|
+nsDocShell::GetReducedMotionOverride(ReducedMotionOverride* aReducedMotionOverride) {
|
|
|
|
+ *aReducedMotionOverride = GetRootDocShell()->mReducedMotionOverride;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetReducedMotionOverride(ReducedMotionOverride aReducedMotionOverride) {
|
|
|
|
+ mReducedMotionOverride = aReducedMotionOverride;
|
|
|
|
+ RefPtr<nsPresContext> presContext = GetPresContext();
|
|
|
|
+ if (presContext) {
|
|
|
|
+ presContext->MediaFeatureValuesChanged(
|
|
|
|
+ {MediaFeatureChangeReason::SystemMetricsChange},
|
|
|
|
+ MediaFeatureChangePropagation::JustThisDocument);
|
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2021-06-08 16:00:15 -07:00
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::GetForcedColorsOverride(ForcedColorsOverride* aForcedColorsOverride) {
|
|
|
|
+ *aForcedColorsOverride = GetRootDocShell()->mForcedColorsOverride;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetForcedColorsOverride(ForcedColorsOverride aForcedColorsOverride) {
|
|
|
|
+ mForcedColorsOverride = aForcedColorsOverride;
|
|
|
|
+ RefPtr<nsPresContext> presContext = GetPresContext();
|
|
|
|
+ if (presContext) {
|
|
|
|
+ presContext->MediaFeatureValuesChanged(
|
|
|
|
+ {MediaFeatureChangeReason::SystemMetricsChange},
|
|
|
|
+ MediaFeatureChangePropagation::JustThisDocument);
|
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2020-03-22 13:51:49 -07:00
|
|
|
+// =============== Juggler End =======================
|
2019-11-25 13:56:39 -08:00
|
|
|
+
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDocShell::GetIsNavigating(bool* aOut) {
|
|
|
|
*aOut = mIsNavigating;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -4695,7 +4920,7 @@ nsDocShell::GetVisibility(bool* aVisibility) {
|
2020-12-14 15:28:48 -08:00
|
|
|
}
|
2020-11-05 17:53:22 -08:00
|
|
|
|
2020-12-14 15:28:48 -08:00
|
|
|
void nsDocShell::ActivenessMaybeChanged() {
|
2021-08-11 03:37:57 +03:00
|
|
|
- const bool isActive = mBrowsingContext->IsActive();
|
|
|
|
+ const bool isActive = mForceActiveState || mBrowsingContext->IsActive();
|
2020-12-14 15:28:48 -08:00
|
|
|
if (RefPtr<PresShell> presShell = GetPresShell()) {
|
2021-08-11 03:37:57 +03:00
|
|
|
presShell->ActivenessMaybeChanged();
|
2020-12-14 15:28:48 -08:00
|
|
|
}
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -6619,6 +6844,10 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
|
2023-01-23 11:29:48 -08:00
|
|
|
return false; // no entry to save into
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (mDisallowBFCache) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
MOZ_ASSERT(!mozilla::SessionHistoryInParent(),
|
|
|
|
"mOSHE cannot be non-null with SHIP");
|
2024-03-26 15:01:07 -07:00
|
|
|
nsCOMPtr<nsIDocumentViewer> viewer = mOSHE->GetDocumentViewer();
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -8352,6 +8581,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
|
2020-04-15 12:02:08 -07:00
|
|
|
true, // aForceNoOpener
|
|
|
|
getter_AddRefs(newBC));
|
|
|
|
MOZ_ASSERT(!newBC);
|
|
|
|
+ if (rv == NS_OK) {
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ if (observerService) {
|
|
|
|
+ observerService->NotifyObservers(GetAsSupports(this), "juggler-window-open-in-new-context", nullptr);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -9506,6 +9741,16 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
|
2023-03-21 01:23:12 +00:00
|
|
|
nsINetworkPredictor::PREDICT_LOAD, attrs, nullptr);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIRequest> req;
|
|
|
|
+
|
|
|
|
+ // Juggler: report navigation started for non-same-document and non-javascript
|
|
|
|
+ // navigations.
|
|
|
|
+ if (!isJavaScript && !sameDocument) {
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService =
|
|
|
|
+ mozilla::services::GetObserverService();
|
|
|
|
+ if (observerService) {
|
2023-06-06 15:08:23 -07:00
|
|
|
+ observerService->NotifyObservers(GetAsSupports(this), "juggler-navigation-started-renderer", NS_ConvertASCIItoUTF16(nsPrintfCString("%" PRIu64, aLoadState->GetLoadIdentifier())).get());
|
2023-03-21 01:23:12 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
rv = DoURILoad(aLoadState, aCacheKey, getter_AddRefs(req));
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -12708,6 +12953,9 @@ class OnLinkClickEvent : public Runnable {
|
2020-08-06 10:32:50 -07:00
|
|
|
mHandler->OnLinkClickSync(mContent, mLoadState, mNoOpenerImplied,
|
|
|
|
mTriggeringPrincipal);
|
2020-03-05 11:59:29 -08:00
|
|
|
}
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ observerService->NotifyObservers(ToSupports(mContent), "juggler-link-click-sync", nullptr);
|
|
|
|
+
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -12794,6 +13042,8 @@ nsresult nsDocShell::OnLinkClick(
|
|
|
|
|
|
|
|
nsCOMPtr<nsIRunnable> ev = new OnLinkClickEvent(
|
|
|
|
this, aContent, loadState, noOpenerImplied, aTriggeringPrincipal);
|
2020-03-05 11:59:29 -08:00
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ observerService->NotifyObservers(ToSupports(aContent), "juggler-link-click", nullptr);
|
2024-02-22 13:17:33 -08:00
|
|
|
return Dispatch(ev.forget());
|
2020-03-05 11:59:29 -08:00
|
|
|
}
|
|
|
|
|
2019-11-25 13:56:39 -08:00
|
|
|
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index 888741f8490d6f0e885ed0ce73115c16e7bbe821..0958824d57a082fecae6dde1eb568f457c42f443 100644
|
2019-11-25 13:56:39 -08:00
|
|
|
--- a/docshell/base/nsDocShell.h
|
|
|
|
+++ b/docshell/base/nsDocShell.h
|
2024-02-22 13:17:33 -08:00
|
|
|
@@ -15,6 +15,7 @@
|
2020-03-06 18:25:27 -08:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2019-11-25 13:56:39 -08:00
|
|
|
#include "mozilla/WeakPtr.h"
|
|
|
|
#include "mozilla/dom/BrowsingContext.h"
|
|
|
|
+#include "mozilla/dom/Element.h"
|
2020-03-06 18:25:27 -08:00
|
|
|
#include "mozilla/dom/WindowProxyHolder.h"
|
2020-12-14 15:28:48 -08:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCharsetSource.h"
|
2024-02-22 13:17:33 -08:00
|
|
|
@@ -76,6 +77,7 @@ class nsCommandManager;
|
2020-12-14 15:28:48 -08:00
|
|
|
class nsDocShellEditorData;
|
|
|
|
class nsDOMNavigationTiming;
|
|
|
|
class nsDSURIContentListener;
|
|
|
|
+class nsGeolocationService;
|
|
|
|
class nsGlobalWindowOuter;
|
|
|
|
|
|
|
|
class FramingChecker;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -402,6 +404,15 @@ class nsDocShell final : public nsDocLoader,
|
2020-03-24 23:25:17 -07:00
|
|
|
void SetWillChangeProcess() { mWillChangeProcess = true; }
|
2020-10-07 14:12:19 -07:00
|
|
|
bool WillChangeProcess() { return mWillChangeProcess; }
|
2019-11-25 13:56:39 -08:00
|
|
|
|
|
|
|
+ bool IsFileInputInterceptionEnabled();
|
|
|
|
+ void FilePickerShown(mozilla::dom::Element* element);
|
2019-11-25 15:26:03 -08:00
|
|
|
+
|
2020-04-15 14:41:18 -07:00
|
|
|
+ bool ShouldOverrideHasFocus() const;
|
|
|
|
+
|
2019-11-25 15:26:03 -08:00
|
|
|
+ bool IsBypassCSPEnabled();
|
2020-03-20 11:14:42 -07:00
|
|
|
+
|
2020-03-22 13:51:49 -07:00
|
|
|
+ RefPtr<nsGeolocationService> GetGeolocationServiceOverride();
|
2019-11-25 13:56:39 -08:00
|
|
|
+
|
|
|
|
// Create a content viewer within this nsDocShell for the given
|
|
|
|
// `WindowGlobalChild` actor.
|
2024-03-26 15:01:07 -07:00
|
|
|
nsresult CreateDocumentViewerForActor(
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1005,6 +1016,8 @@ class nsDocShell final : public nsDocLoader,
|
2019-11-25 13:56:39 -08:00
|
|
|
|
|
|
|
bool CSSErrorReportingEnabled() const { return mCSSErrorReportingEnabled; }
|
|
|
|
|
|
|
|
+ nsDocShell* GetRootDocShell();
|
|
|
|
+
|
|
|
|
// Handles retrieval of subframe session history for nsDocShell::LoadURI. If a
|
|
|
|
// load is requested in a subframe of the current DocShell, the subframe
|
|
|
|
// loadType may need to reflect the loadType of the parent document, or in
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1282,6 +1295,16 @@ class nsDocShell final : public nsDocLoader,
|
2020-08-12 10:09:20 -07:00
|
|
|
bool mAllowDNSPrefetch : 1;
|
2020-05-07 18:37:15 -07:00
|
|
|
bool mAllowWindowControl : 1;
|
2019-11-25 13:56:39 -08:00
|
|
|
bool mCSSErrorReportingEnabled : 1;
|
|
|
|
+ bool mFileInputInterceptionEnabled: 1;
|
2020-04-15 14:41:18 -07:00
|
|
|
+ bool mOverrideHasFocus : 1;
|
2019-11-25 15:26:03 -08:00
|
|
|
+ bool mBypassCSPEnabled : 1;
|
2020-11-05 17:53:22 -08:00
|
|
|
+ bool mForceActiveState : 1;
|
2023-01-23 11:29:48 -08:00
|
|
|
+ bool mDisallowBFCache : 1;
|
2020-03-20 17:03:20 -07:00
|
|
|
+ nsString mLanguageOverride;
|
2020-03-22 13:51:49 -07:00
|
|
|
+ RefPtr<nsGeolocationService> mGeolocationServiceOverride;
|
2021-05-18 21:23:12 +02:00
|
|
|
+ ReducedMotionOverride mReducedMotionOverride;
|
2021-06-08 16:00:15 -07:00
|
|
|
+ ForcedColorsOverride mForcedColorsOverride;
|
2020-03-22 13:51:49 -07:00
|
|
|
+
|
2019-11-25 13:56:39 -08:00
|
|
|
bool mAllowAuth : 1;
|
|
|
|
bool mAllowKeywordFixup : 1;
|
2021-04-01 18:49:01 -05:00
|
|
|
bool mDisableMetaRefreshWhenInactive : 1;
|
2019-11-25 13:56:39 -08:00
|
|
|
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
|
2025-02-28 13:23:18 +00:00
|
|
|
index 84e821e33e8164829dfee4f05340784e189b90ee..397742551b98d0d9e6fcf94f55efda5ea628b9ac 100644
|
2019-11-25 13:56:39 -08:00
|
|
|
--- a/docshell/base/nsIDocShell.idl
|
|
|
|
+++ b/docshell/base/nsIDocShell.idl
|
2020-03-20 11:14:42 -07:00
|
|
|
@@ -44,6 +44,7 @@ interface nsIURI;
|
|
|
|
interface nsIChannel;
|
|
|
|
interface nsIContentSecurityPolicy;
|
2024-03-26 15:01:07 -07:00
|
|
|
interface nsIDocumentViewer;
|
2020-03-20 11:14:42 -07:00
|
|
|
+interface nsIDOMGeoPosition;
|
|
|
|
interface nsIEditor;
|
|
|
|
interface nsIEditingSession;
|
2021-04-01 18:49:01 -05:00
|
|
|
interface nsIInputStream;
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -719,6 +720,36 @@ interface nsIDocShell : nsIDocShellTreeItem
|
2019-11-25 13:56:39 -08:00
|
|
|
*/
|
2020-01-11 01:20:39 +01:00
|
|
|
void synchronizeLayoutHistoryState();
|
2020-05-07 18:37:15 -07:00
|
|
|
|
2019-11-25 13:56:39 -08:00
|
|
|
+ attribute boolean fileInputInterceptionEnabled;
|
2019-11-25 15:26:03 -08:00
|
|
|
+
|
2020-04-15 14:41:18 -07:00
|
|
|
+ attribute boolean overrideHasFocus;
|
|
|
|
+
|
2019-11-25 15:26:03 -08:00
|
|
|
+ attribute boolean bypassCSPEnabled;
|
2020-03-20 11:14:42 -07:00
|
|
|
+
|
2020-11-05 17:53:22 -08:00
|
|
|
+ attribute boolean forceActiveState;
|
|
|
|
+
|
2023-01-23 11:29:48 -08:00
|
|
|
+ attribute boolean disallowBFCache;
|
|
|
|
+
|
2020-03-20 17:03:20 -07:00
|
|
|
+ attribute AString languageOverride;
|
|
|
|
+
|
2020-03-30 15:05:46 -07:00
|
|
|
+ boolean overrideTimezone(in AString timezoneId);
|
|
|
|
+
|
2021-05-18 21:23:12 +02:00
|
|
|
+ cenum ReducedMotionOverride : 8 {
|
|
|
|
+ REDUCED_MOTION_OVERRIDE_REDUCE,
|
|
|
|
+ REDUCED_MOTION_OVERRIDE_NO_PREFERENCE,
|
|
|
|
+ REDUCED_MOTION_OVERRIDE_NONE, /* This clears the override. */
|
|
|
|
+ };
|
|
|
|
+ [infallible] attribute nsIDocShell_ReducedMotionOverride reducedMotionOverride;
|
|
|
|
+
|
2021-06-08 16:00:15 -07:00
|
|
|
+ cenum ForcedColorsOverride : 8 {
|
|
|
|
+ FORCED_COLORS_OVERRIDE_ACTIVE,
|
|
|
|
+ FORCED_COLORS_OVERRIDE_NONE,
|
|
|
|
+ FORCED_COLORS_OVERRIDE_NO_OVERRIDE, /* This clears the override. */
|
|
|
|
+ };
|
|
|
|
+ [infallible] attribute nsIDocShell_ForcedColorsOverride forcedColorsOverride;
|
|
|
|
+
|
2020-03-20 11:14:42 -07:00
|
|
|
+ void setGeolocationOverride(in nsIDOMGeoPosition position);
|
2020-05-07 18:37:15 -07:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* This attempts to save any applicable layout history state (like
|
|
|
|
* scroll position) in the nsISHEntry. This is normally done
|
2019-11-25 15:26:03 -08:00
|
|
|
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 8680bd4e64abc48233b5babb3b4123fea0e76f3b..44ea1267771cd925df74c716cc26d7ab51b2b985 100644
|
2019-11-25 15:26:03 -08:00
|
|
|
--- a/dom/base/Document.cpp
|
|
|
|
+++ b/dom/base/Document.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -3741,6 +3741,9 @@ void Document::SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages) {
|
2019-11-25 15:26:03 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Document::ApplySettingsFromCSP(bool aSpeculative) {
|
|
|
|
+ if (mDocumentContainer && mDocumentContainer->IsBypassCSPEnabled())
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (!aSpeculative) {
|
|
|
|
// 1) apply settings from regular CSP
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -3798,6 +3801,11 @@ nsresult Document::InitCSP(nsIChannel* aChannel) {
|
2022-05-02 21:46:05 -06:00
|
|
|
MOZ_ASSERT(!mScriptGlobalObject,
|
|
|
|
"CSP must be initialized before mScriptGlobalObject is set!");
|
2019-11-25 15:26:03 -08:00
|
|
|
|
|
|
|
+ nsCOMPtr<nsIDocShell> shell(mDocumentContainer);
|
|
|
|
+ if (shell && nsDocShell::Cast(shell)->IsBypassCSPEnabled()) {
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// If this is a data document - no need to set CSP.
|
|
|
|
if (mLoadedAsData) {
|
|
|
|
return NS_OK;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -4605,6 +4613,10 @@ bool Document::HasFocus(ErrorResult& rv) const {
|
2020-04-15 14:41:18 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (IsActive() && mDocumentContainer->ShouldOverrideHasFocus()) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
2021-08-11 03:37:57 +03:00
|
|
|
if (!fm->IsInActiveWindow(bc)) {
|
|
|
|
return false;
|
|
|
|
}
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -19488,6 +19500,35 @@ ColorScheme Document::PreferredColorScheme(IgnoreRFP aIgnoreRFP) const {
|
2024-02-22 13:17:33 -08:00
|
|
|
return PreferenceSheet::PrefsFor(*this).mColorScheme;
|
2021-05-18 21:23:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+bool Document::PrefersReducedMotion() const {
|
|
|
|
+ auto* docShell = static_cast<nsDocShell*>(GetDocShell());
|
|
|
|
+ nsIDocShell::ReducedMotionOverride reducedMotion;
|
|
|
|
+ if (docShell && docShell->GetReducedMotionOverride(&reducedMotion) == NS_OK &&
|
|
|
|
+ reducedMotion != nsIDocShell::REDUCED_MOTION_OVERRIDE_NONE) {
|
|
|
|
+ switch (reducedMotion) {
|
|
|
|
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_REDUCE:
|
|
|
|
+ return true;
|
|
|
|
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_NO_PREFERENCE:
|
|
|
|
+ return false;
|
|
|
|
+ case nsIDocShell::REDUCED_MOTION_OVERRIDE_NONE:
|
|
|
|
+ break;
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (auto* bc = GetBrowsingContext()) {
|
|
|
|
+ switch (bc->Top()->PrefersReducedMotionOverride()) {
|
|
|
|
+ case dom::PrefersReducedMotionOverride::Reduce:
|
|
|
|
+ return true;
|
|
|
|
+ case dom::PrefersReducedMotionOverride::No_preference:
|
|
|
|
+ return false;
|
|
|
|
+ case dom::PrefersReducedMotionOverride::None:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
|
|
|
|
+}
|
|
|
|
+
|
2021-12-07 11:53:17 -08:00
|
|
|
bool Document::HasRecentlyStartedForegroundLoads() {
|
|
|
|
if (!sLoadingForegroundTopLevelContentDocument) {
|
|
|
|
return false;
|
2021-05-18 21:23:12 +02:00
|
|
|
diff --git a/dom/base/Document.h b/dom/base/Document.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index ee5800c51cacc7ac3517c03274ed4e0a35e57f9f..91a8ea64eb40dc0e642e8ab515b78c93e11d7d5a 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/dom/base/Document.h
|
|
|
|
+++ b/dom/base/Document.h
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -4123,6 +4123,8 @@ class Document : public nsINode,
|
2021-12-07 11:53:17 -08:00
|
|
|
// color-scheme meta tag.
|
|
|
|
ColorScheme DefaultColorScheme() const;
|
2021-05-18 21:23:12 +02:00
|
|
|
|
|
|
|
+ bool PrefersReducedMotion() const;
|
|
|
|
+
|
2021-12-07 11:53:17 -08:00
|
|
|
static bool HasRecentlyStartedForegroundLoads();
|
|
|
|
|
|
|
|
static bool AutomaticStorageAccessPermissionCanBeGranted(
|
2020-03-20 17:03:20 -07:00
|
|
|
diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 0f159ad09a2a4b8962307b9f20abf30323377a36..e0cbb3f1f8af42825696d7152eb9993ab3802f90 100644
|
2020-03-20 17:03:20 -07:00
|
|
|
--- a/dom/base/Navigator.cpp
|
|
|
|
+++ b/dom/base/Navigator.cpp
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -344,14 +344,18 @@ void Navigator::GetAppName(nsAString& aAppName) const {
|
2020-05-07 18:37:15 -07:00
|
|
|
* for more detail.
|
2020-03-20 17:03:20 -07:00
|
|
|
*/
|
|
|
|
/* static */
|
|
|
|
-void Navigator::GetAcceptLanguages(nsTArray<nsString>& aLanguages) {
|
|
|
|
+void Navigator::GetAcceptLanguages(const nsString* aLanguageOverride, nsTArray<nsString>& aLanguages) {
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
|
|
|
|
aLanguages.Clear();
|
|
|
|
|
|
|
|
// E.g. "de-de, en-us,en".
|
|
|
|
nsAutoString acceptLang;
|
|
|
|
- Preferences::GetLocalizedString("intl.accept_languages", acceptLang);
|
|
|
|
+ if (aLanguageOverride && aLanguageOverride->Length())
|
|
|
|
+ acceptLang = *aLanguageOverride;
|
|
|
|
+ else
|
|
|
|
+ Preferences::GetLocalizedString("intl.accept_languages", acceptLang);
|
|
|
|
+
|
|
|
|
|
|
|
|
// Split values on commas.
|
2021-02-01 15:50:11 -08:00
|
|
|
for (nsDependentSubstring lang :
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -403,7 +407,13 @@ void Navigator::GetLanguage(nsAString& aLanguage) {
|
2020-03-20 17:03:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Navigator::GetLanguages(nsTArray<nsString>& aLanguages) {
|
|
|
|
- GetAcceptLanguages(aLanguages);
|
2022-06-29 13:47:45 -07:00
|
|
|
+ if (mWindow && mWindow->GetDocShell()) {
|
|
|
|
+ nsString languageOverride;
|
|
|
|
+ mWindow->GetDocShell()->GetLanguageOverride(languageOverride);
|
|
|
|
+ GetAcceptLanguages(&languageOverride, aLanguages);
|
|
|
|
+ } else {
|
|
|
|
+ GetAcceptLanguages(nullptr, aLanguages);
|
|
|
|
+ }
|
2020-03-20 17:03:20 -07:00
|
|
|
|
2020-05-07 18:37:15 -07:00
|
|
|
// The returned value is cached by the binding code. The window listens to the
|
2020-03-20 17:03:20 -07:00
|
|
|
// accept languages change and will clear the cache when needed. It has to
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -2298,7 +2308,8 @@ bool Navigator::Webdriver() {
|
2024-07-29 10:30:28 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- return false;
|
|
|
|
+ // Playwright is automating the browser, so we should pretend to be a webdriver
|
|
|
|
+ return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
AutoplayPolicy Navigator::GetAutoplayPolicy(AutoplayPolicyMediaType aType) {
|
2020-03-20 17:03:20 -07:00
|
|
|
diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h
|
2024-09-30 05:14:45 -07:00
|
|
|
index 6abf6cef230c97815f17f6b7abf9f1b1de274a6f..46ead1f32e0d710b5b32e61dff72a4f772d5421e 100644
|
2020-03-20 17:03:20 -07:00
|
|
|
--- a/dom/base/Navigator.h
|
|
|
|
+++ b/dom/base/Navigator.h
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -218,7 +218,7 @@ class Navigator final : public nsISupports, public nsWrapperCache {
|
2020-03-20 17:03:20 -07:00
|
|
|
|
|
|
|
StorageManager* Storage();
|
|
|
|
|
|
|
|
- static void GetAcceptLanguages(nsTArray<nsString>& aLanguages);
|
|
|
|
+ static void GetAcceptLanguages(const nsString* aLanguageOverride, nsTArray<nsString>& aLanguages);
|
|
|
|
|
|
|
|
dom::MediaCapabilities* MediaCapabilities();
|
|
|
|
dom::MediaSession* MediaSession();
|
2020-10-13 12:24:11 -07:00
|
|
|
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 13ba7fa81c67f41e419a13c74f9c382193e0eb27..f438d58b594e1434d090eecc89accc66b9f62fcd 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/base/nsContentUtils.cpp
|
|
|
|
+++ b/dom/base/nsContentUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -8773,7 +8773,8 @@ nsresult nsContentUtils::SendMouseEvent(
|
2020-10-13 12:24:11 -07:00
|
|
|
bool aIgnoreRootScrollFrame, float aPressure,
|
|
|
|
unsigned short aInputSourceArg, uint32_t aIdentifier, bool aToWindow,
|
2021-08-11 03:37:57 +03:00
|
|
|
PreventDefaultResult* aPreventDefault, bool aIsDOMEventSynthesized,
|
2020-10-13 12:24:11 -07:00
|
|
|
- bool aIsWidgetEventSynthesized) {
|
|
|
|
+ bool aIsWidgetEventSynthesized,
|
2023-06-06 15:08:23 -07:00
|
|
|
+ bool convertToPointer, uint32_t aJugglerEventId) {
|
2020-10-13 12:24:11 -07:00
|
|
|
nsPoint offset;
|
|
|
|
nsCOMPtr<nsIWidget> widget = GetWidget(aPresShell, &offset);
|
|
|
|
if (!widget) return NS_ERROR_FAILURE;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -8781,6 +8782,7 @@ nsresult nsContentUtils::SendMouseEvent(
|
2023-01-23 11:29:48 -08:00
|
|
|
EventMessage msg;
|
|
|
|
Maybe<WidgetMouseEvent::ExitFrom> exitFrom;
|
|
|
|
bool contextMenuKey = false;
|
2024-09-30 05:14:45 -07:00
|
|
|
+ bool isPWDragEventMessage = false;
|
2023-01-23 11:29:48 -08:00
|
|
|
if (aType.EqualsLiteral("mousedown")) {
|
|
|
|
msg = eMouseDown;
|
|
|
|
} else if (aType.EqualsLiteral("mouseup")) {
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -8806,6 +8808,12 @@ nsresult nsContentUtils::SendMouseEvent(
|
2023-01-23 11:29:48 -08:00
|
|
|
msg = eMouseHitTest;
|
|
|
|
} else if (aType.EqualsLiteral("MozMouseExploreByTouch")) {
|
|
|
|
msg = eMouseExploreByTouch;
|
|
|
|
+ } else if (aType.EqualsLiteral("dragover")) {
|
|
|
|
+ msg = eDragOver;
|
2024-09-30 05:14:45 -07:00
|
|
|
+ isPWDragEventMessage = true;
|
2023-01-23 11:29:48 -08:00
|
|
|
+ } else if (aType.EqualsLiteral("drop")) {
|
|
|
|
+ msg = eDrop;
|
2024-09-30 05:14:45 -07:00
|
|
|
+ isPWDragEventMessage = true;
|
2023-01-23 11:29:48 -08:00
|
|
|
} else {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -8816,7 +8824,14 @@ nsresult nsContentUtils::SendMouseEvent(
|
2023-01-23 11:29:48 -08:00
|
|
|
|
2024-09-30 05:14:45 -07:00
|
|
|
Maybe<WidgetPointerEvent> pointerEvent;
|
|
|
|
Maybe<WidgetMouseEvent> mouseEvent;
|
|
|
|
- if (IsPointerEventMessage(msg)) {
|
|
|
|
+ Maybe<WidgetDragEvent> pwDragEvent;
|
|
|
|
+
|
|
|
|
+ if (isPWDragEventMessage) {
|
|
|
|
+ pwDragEvent.emplace(true, msg, widget);
|
|
|
|
+ pwDragEvent->mReason = aIsWidgetEventSynthesized
|
2023-01-23 11:29:48 -08:00
|
|
|
+ ? WidgetMouseEvent::eSynthesized
|
|
|
|
+ : WidgetMouseEvent::eReal;
|
2024-09-30 05:14:45 -07:00
|
|
|
+ } else if (IsPointerEventMessage(msg)) {
|
|
|
|
MOZ_ASSERT(!aIsWidgetEventSynthesized,
|
|
|
|
"The event shouldn't be dispatched as a synthesized event");
|
|
|
|
if (MOZ_UNLIKELY(aIsWidgetEventSynthesized)) {
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -8835,8 +8850,11 @@ nsresult nsContentUtils::SendMouseEvent(
|
2024-09-30 05:14:45 -07:00
|
|
|
contextMenuKey ? WidgetMouseEvent::eContextMenuKey
|
|
|
|
: WidgetMouseEvent::eNormal);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
WidgetMouseEvent& mouseOrPointerEvent =
|
|
|
|
+ pwDragEvent.isSome() ? pwDragEvent.ref() :
|
|
|
|
pointerEvent.isSome() ? pointerEvent.ref() : mouseEvent.ref();
|
|
|
|
+
|
|
|
|
mouseOrPointerEvent.pointerId = aIdentifier;
|
|
|
|
mouseOrPointerEvent.mModifiers = GetWidgetModifiers(aModifiers);
|
|
|
|
mouseOrPointerEvent.mButton = aButton;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -8849,6 +8867,8 @@ nsresult nsContentUtils::SendMouseEvent(
|
2024-09-30 05:14:45 -07:00
|
|
|
mouseOrPointerEvent.mClickCount = aClickCount;
|
|
|
|
mouseOrPointerEvent.mFlags.mIsSynthesizedForTests = aIsDOMEventSynthesized;
|
|
|
|
mouseOrPointerEvent.mExitFrom = exitFrom;
|
|
|
|
+ mouseOrPointerEvent.mJugglerEventId = aJugglerEventId;
|
|
|
|
+ mouseOrPointerEvent.convertToPointer = convertToPointer;
|
2020-10-13 12:24:11 -07:00
|
|
|
|
|
|
|
nsPresContext* presContext = aPresShell->GetPresContext();
|
|
|
|
if (!presContext) return NS_ERROR_FAILURE;
|
|
|
|
diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index a1efe3efc7f48f9ff8e2b1a1a50e5dd7bf81f263..caf55fa9dae74ce4ce9ad0369c8cfc8eea061778 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/base/nsContentUtils.h
|
|
|
|
+++ b/dom/base/nsContentUtils.h
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -3033,7 +3033,8 @@ class nsContentUtils {
|
2020-10-13 12:24:11 -07:00
|
|
|
int32_t aModifiers, bool aIgnoreRootScrollFrame, float aPressure,
|
|
|
|
unsigned short aInputSourceArg, uint32_t aIdentifier, bool aToWindow,
|
2021-08-11 03:37:57 +03:00
|
|
|
mozilla::PreventDefaultResult* aPreventDefault,
|
|
|
|
- bool aIsDOMEventSynthesized, bool aIsWidgetEventSynthesized);
|
|
|
|
+ bool aIsDOMEventSynthesized, bool aIsWidgetEventSynthesized,
|
2023-06-06 15:08:23 -07:00
|
|
|
+ bool convertToPointer = true, uint32_t aJugglerEventId = 0);
|
2020-10-13 12:24:11 -07:00
|
|
|
|
|
|
|
static void FirePageShowEventForFrameLoaderSwap(
|
|
|
|
nsIDocShellTreeItem* aItem,
|
|
|
|
diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index aae46b9bd2e7756fc025c0597db221c579cac679..5e8ae13a9d1747312cd7df9d80cbb1677530465c 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/base/nsDOMWindowUtils.cpp
|
|
|
|
+++ b/dom/base/nsDOMWindowUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -686,6 +686,26 @@ nsDOMWindowUtils::GetPresShellId(uint32_t* aPresShellId) {
|
2023-06-06 15:08:23 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static uint32_t sJugglerEventId = 1000;
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDOMWindowUtils::JugglerSendMouseEvent(
|
|
|
|
+ const nsAString& aType, float aX, float aY, int32_t aButton,
|
|
|
|
+ int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame,
|
|
|
|
+ float aPressure, unsigned short aInputSourceArg,
|
|
|
|
+ bool aIsDOMEventSynthesized, bool aIsWidgetEventSynthesized,
|
|
|
|
+ int32_t aButtons, uint32_t aIdentifier, bool aDisablePointerEvent,
|
|
|
|
+ uint32_t* aJugglerEventId) {
|
|
|
|
+ *aJugglerEventId = ++sJugglerEventId;
|
|
|
|
+ return SendMouseEventCommon(
|
|
|
|
+ aType, aX, aY, aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame,
|
|
|
|
+ aPressure, aInputSourceArg,
|
|
|
|
+ aIdentifier, false,
|
|
|
|
+ nullptr, aIsDOMEventSynthesized,
|
|
|
|
+ aIsWidgetEventSynthesized,
|
|
|
|
+ aButtons, !aDisablePointerEvent, *aJugglerEventId);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMWindowUtils::SendMouseEvent(
|
|
|
|
const nsAString& aType, float aX, float aY, int32_t aButton,
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -700,7 +720,7 @@ nsDOMWindowUtils::SendMouseEvent(
|
2020-10-13 12:24:11 -07:00
|
|
|
aOptionalArgCount >= 7 ? aIdentifier : DEFAULT_MOUSE_POINTER_ID, false,
|
|
|
|
aPreventDefault, aOptionalArgCount >= 4 ? aIsDOMEventSynthesized : true,
|
|
|
|
aOptionalArgCount >= 5 ? aIsWidgetEventSynthesized : false,
|
|
|
|
- aOptionalArgCount >= 6 ? aButtons : MOUSE_BUTTONS_NOT_SPECIFIED);
|
2023-06-06 15:08:23 -07:00
|
|
|
+ aOptionalArgCount >= 6 ? aButtons : MOUSE_BUTTONS_NOT_SPECIFIED, true, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -718,7 +738,7 @@ nsDOMWindowUtils::SendMouseEventToWindow(
|
2023-06-06 15:08:23 -07:00
|
|
|
aOptionalArgCount >= 7 ? aIdentifier : DEFAULT_MOUSE_POINTER_ID, true,
|
|
|
|
nullptr, aOptionalArgCount >= 4 ? aIsDOMEventSynthesized : true,
|
|
|
|
aOptionalArgCount >= 5 ? aIsWidgetEventSynthesized : false,
|
|
|
|
- aOptionalArgCount >= 6 ? aButtons : MOUSE_BUTTONS_NOT_SPECIFIED);
|
|
|
|
+ aOptionalArgCount >= 6 ? aButtons : MOUSE_BUTTONS_NOT_SPECIFIED, 0);
|
2020-10-13 12:24:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -727,13 +747,13 @@ nsDOMWindowUtils::SendMouseEventCommon(
|
2020-10-13 12:24:11 -07:00
|
|
|
int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame,
|
|
|
|
float aPressure, unsigned short aInputSourceArg, uint32_t aPointerId,
|
|
|
|
bool aToWindow, bool* aPreventDefault, bool aIsDOMEventSynthesized,
|
|
|
|
- bool aIsWidgetEventSynthesized, int32_t aButtons) {
|
2023-06-06 15:08:23 -07:00
|
|
|
+ bool aIsWidgetEventSynthesized, int32_t aButtons, bool aConvertToPointer, uint32_t aJugglerEventId) {
|
2020-10-13 12:24:11 -07:00
|
|
|
RefPtr<PresShell> presShell = GetPresShell();
|
2021-08-11 03:37:57 +03:00
|
|
|
PreventDefaultResult preventDefaultResult;
|
|
|
|
nsresult rv = nsContentUtils::SendMouseEvent(
|
2020-10-13 12:24:11 -07:00
|
|
|
presShell, aType, aX, aY, aButton, aButtons, aClickCount, aModifiers,
|
|
|
|
aIgnoreRootScrollFrame, aPressure, aInputSourceArg, aPointerId, aToWindow,
|
2021-08-11 03:37:57 +03:00
|
|
|
- &preventDefaultResult, aIsDOMEventSynthesized, aIsWidgetEventSynthesized);
|
2023-06-06 15:08:23 -07:00
|
|
|
+ &preventDefaultResult, aIsDOMEventSynthesized, aIsWidgetEventSynthesized, aConvertToPointer, aJugglerEventId);
|
2020-10-13 12:24:11 -07:00
|
|
|
|
2021-08-11 03:37:57 +03:00
|
|
|
if (aPreventDefault) {
|
|
|
|
*aPreventDefault = preventDefaultResult != PreventDefaultResult::No;
|
2020-10-13 12:24:11 -07:00
|
|
|
diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h
|
2024-09-30 05:14:45 -07:00
|
|
|
index 47ff326b202266b1d7d6af8bdfb72776df8a6a93..b8e084b0c788c46345b1455b8257f1719c851404 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/base/nsDOMWindowUtils.h
|
|
|
|
+++ b/dom/base/nsDOMWindowUtils.h
|
|
|
|
@@ -93,7 +93,7 @@ class nsDOMWindowUtils final : public nsIDOMWindowUtils,
|
|
|
|
int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame,
|
|
|
|
float aPressure, unsigned short aInputSourceArg, uint32_t aIdentifier,
|
|
|
|
bool aToWindow, bool* aPreventDefault, bool aIsDOMEventSynthesized,
|
|
|
|
- bool aIsWidgetEventSynthesized, int32_t aButtons);
|
2023-06-06 15:08:23 -07:00
|
|
|
+ bool aIsWidgetEventSynthesized, int32_t aButtons, bool aConvertToPointer = true, uint32_t aJugglerEventId = 0);
|
2020-10-13 12:24:11 -07:00
|
|
|
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult SendTouchEventCommon(
|
2020-07-20 16:47:27 -07:00
|
|
|
diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 54cf5e2647a8fa097481e972e0ab67928b2abc8b..37ff283278cebc0e058b0345a157036283847de8 100644
|
2020-07-20 16:47:27 -07:00
|
|
|
--- a/dom/base/nsFocusManager.cpp
|
|
|
|
+++ b/dom/base/nsFocusManager.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1712,6 +1712,10 @@ Maybe<uint64_t> nsFocusManager::SetFocusInner(Element* aNewContent,
|
2020-10-16 01:28:13 -07:00
|
|
|
(GetActiveBrowsingContext() == newRootBrowsingContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // In Playwright, we want to send focus events even if the element
|
|
|
|
+ // isn't actually in the active window.
|
|
|
|
+ isElementInActiveWindow = true;
|
|
|
|
+
|
|
|
|
// Exit fullscreen if a website focuses another window
|
|
|
|
if (StaticPrefs::full_screen_api_exit_on_windowRaise() &&
|
2023-06-06 15:08:23 -07:00
|
|
|
!isElementInActiveWindow && (aFlags & FLAG_RAISE)) {
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -2297,6 +2301,7 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear,
|
2024-06-14 18:38:09 -07:00
|
|
|
bool aIsLeavingDocument, bool aAdjustWidget,
|
|
|
|
bool aRemainActive, Element* aElementToFocus,
|
|
|
|
uint64_t aActionId) {
|
|
|
|
+
|
|
|
|
LOGFOCUS(("<<Blur begin actionid: %" PRIu64 ">>", aActionId));
|
|
|
|
|
|
|
|
// hold a reference to the focused content, which may be null
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -2343,6 +2348,11 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear,
|
2024-06-14 18:38:09 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Playwright: emulate focused page by never bluring when leaving document.
|
|
|
|
+ if (XRE_IsContentProcess() && aIsLeavingDocument && docShell && nsDocShell::Cast(docShell)->ShouldOverrideHasFocus()) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Keep a ref to presShell since dispatching the DOM event may cause
|
|
|
|
// the document to be destroyed.
|
|
|
|
RefPtr<PresShell> presShell = docShell->GetPresShell();
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -3020,7 +3030,9 @@ void nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow,
|
2020-07-20 16:47:27 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (sTestMode) {
|
|
|
|
+ // In Playwright, we still want to execte the embedder functions
|
|
|
|
+ // to actually show / focus windows.
|
|
|
|
+ if (false && sTestMode) {
|
|
|
|
// In test mode, emulate raising the window. WindowRaised takes
|
|
|
|
// care of lowering the present active window. This happens in
|
|
|
|
// a separate runnable to avoid touching multiple windows in
|
2020-03-26 18:42:21 -07:00
|
|
|
diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index d8ba9e36c98197a7dd7e1b0781f2477c451fc5fd..f3b5b0417ed9433678c7379d304de263c7bc1f80 100644
|
2020-03-26 18:42:21 -07:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.cpp
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.cpp
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -2516,10 +2516,16 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
|
2020-07-01 13:28:13 -07:00
|
|
|
}();
|
|
|
|
|
|
|
|
if (!isContentAboutBlankInChromeDocshell) {
|
|
|
|
- newInnerWindow->mHasNotifiedGlobalCreated = true;
|
|
|
|
- nsContentUtils::AddScriptRunner(NewRunnableMethod(
|
|
|
|
- "nsGlobalWindowOuter::DispatchDOMWindowCreated", this,
|
|
|
|
- &nsGlobalWindowOuter::DispatchDOMWindowCreated));
|
|
|
|
+ if (!newInnerWindow->mHasNotifiedGlobalCreated) {
|
|
|
|
+ newInnerWindow->mHasNotifiedGlobalCreated = true;
|
|
|
|
+ nsContentUtils::AddScriptRunner(NewRunnableMethod(
|
|
|
|
+ "nsGlobalWindowOuter::DispatchDOMWindowCreated", this,
|
|
|
|
+ &nsGlobalWindowOuter::DispatchDOMWindowCreated));
|
|
|
|
+ } else if (!reUseInnerWindow) {
|
|
|
|
+ nsContentUtils::AddScriptRunner(NewRunnableMethod(
|
|
|
|
+ "nsGlobalWindowOuter::JugglerDispatchDOMWindowReused", this,
|
|
|
|
+ &nsGlobalWindowOuter::JugglerDispatchDOMWindowReused));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -2639,6 +2645,19 @@ void nsGlobalWindowOuter::DispatchDOMWindowCreated() {
|
2020-07-01 13:28:13 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void nsGlobalWindowOuter::JugglerDispatchDOMWindowReused() {
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService =
|
|
|
|
+ mozilla::services::GetObserverService();
|
|
|
|
+ if (observerService && mDoc) {
|
|
|
|
+ nsIPrincipal* principal = mDoc->NodePrincipal();
|
|
|
|
+ if (!principal->IsSystemPrincipal()) {
|
|
|
|
+ observerService->NotifyObservers(static_cast<nsIDOMWindow*>(this),
|
|
|
|
+ "juggler-dom-window-reused",
|
|
|
|
+ nullptr);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
2020-10-28 14:47:14 -07:00
|
|
|
void nsGlobalWindowOuter::ClearStatus() { SetStatusOuter(u""_ns); }
|
2020-07-01 13:28:13 -07:00
|
|
|
|
|
|
|
void nsGlobalWindowOuter::SetDocShell(nsDocShell* aDocShell) {
|
|
|
|
diff --git a/dom/base/nsGlobalWindowOuter.h b/dom/base/nsGlobalWindowOuter.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index d4347e7a508742986f634e97394a9e3dd435d170..5088520537c8c5c6cc79c1dffd91a68de09f27eb 100644
|
2020-07-01 13:28:13 -07:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.h
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.h
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -317,6 +317,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
|
2020-07-01 13:28:13 -07:00
|
|
|
|
|
|
|
// Outer windows only.
|
|
|
|
void DispatchDOMWindowCreated();
|
|
|
|
+ void JugglerDispatchDOMWindowReused();
|
|
|
|
|
|
|
|
// Outer windows only.
|
|
|
|
virtual void EnsureSizeAndPositionUpToDate() override;
|
2020-04-13 11:31:02 -07:00
|
|
|
diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 855ba87b5b6db67d7dd207cb54001190c494c61a..f96eb49056dafcbd0ca244dac6d1d4a38e7819ce 100644
|
2020-04-13 11:31:02 -07:00
|
|
|
--- a/dom/base/nsINode.cpp
|
|
|
|
+++ b/dom/base/nsINode.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1438,6 +1438,61 @@ void nsINode::GetBoxQuadsFromWindowOrigin(const BoxQuadOptions& aOptions,
|
2020-04-13 11:31:02 -07:00
|
|
|
mozilla::GetBoxQuadsFromWindowOrigin(this, aOptions, aResult, aRv);
|
|
|
|
}
|
|
|
|
|
2022-08-01 14:40:23 -07:00
|
|
|
+static nsIFrame* GetFirstFrame(nsINode* aNode) {
|
|
|
|
+ if (!aNode->IsContent())
|
|
|
|
+ return nullptr;
|
|
|
|
+ nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame(FlushType::Frames);
|
|
|
|
+ if (!frame) {
|
|
|
|
+ FlattenedChildIterator iter(aNode->AsContent());
|
|
|
|
+ for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
|
|
|
+ frame = child->GetPrimaryFrame(FlushType::Frames);
|
|
|
|
+ if (frame) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return frame;
|
|
|
|
+}
|
|
|
|
+
|
2020-04-13 11:31:02 -07:00
|
|
|
+void nsINode::ScrollRectIntoViewIfNeeded(int32_t x, int32_t y,
|
|
|
|
+ int32_t w, int32_t h,
|
|
|
|
+ ErrorResult& aRv) {
|
|
|
|
+ aRv = NS_ERROR_UNEXPECTED;
|
|
|
|
+ nsCOMPtr<Document> document = OwnerDoc();
|
|
|
|
+ if (!document) {
|
2020-06-16 21:38:32 -07:00
|
|
|
+ return aRv.ThrowNotFoundError("Node is detached from document");
|
2020-04-13 11:31:02 -07:00
|
|
|
+ }
|
|
|
|
+ PresShell* presShell = document->GetPresShell();
|
|
|
|
+ if (!presShell) {
|
2020-06-16 21:38:32 -07:00
|
|
|
+ return aRv.ThrowNotFoundError("Node is detached from document");
|
2020-04-13 11:31:02 -07:00
|
|
|
+ }
|
2022-08-01 14:40:23 -07:00
|
|
|
+ nsIFrame* primaryFrame = GetFirstFrame(this);
|
2020-06-16 21:38:32 -07:00
|
|
|
+ if (!primaryFrame) {
|
|
|
|
+ return aRv.ThrowNotFoundError("Node does not have a layout object");
|
2020-04-13 11:31:02 -07:00
|
|
|
+ }
|
2022-08-01 14:40:23 -07:00
|
|
|
+ aRv = NS_OK;
|
2020-04-13 11:31:02 -07:00
|
|
|
+ nsRect rect;
|
|
|
|
+ if (x == -1 && y == -1 && w == -1 && h == -1) {
|
|
|
|
+ rect = primaryFrame->GetRectRelativeToSelf();
|
|
|
|
+ } else {
|
|
|
|
+ rect = nsRect(nsPresContext::CSSPixelsToAppUnits(x),
|
|
|
|
+ nsPresContext::CSSPixelsToAppUnits(y),
|
|
|
|
+ nsPresContext::CSSPixelsToAppUnits(w),
|
|
|
|
+ nsPresContext::CSSPixelsToAppUnits(h));
|
|
|
|
+ }
|
2023-03-21 01:23:12 +00:00
|
|
|
+ presShell->ScrollFrameIntoView(
|
|
|
|
+ primaryFrame, Some(rect),
|
2023-06-06 15:08:23 -07:00
|
|
|
+ ScrollAxis(WhereToScroll::Center, WhenToScroll::IfNotFullyVisible),
|
|
|
|
+ ScrollAxis(WhereToScroll::Center, WhenToScroll::IfNotFullyVisible),
|
2020-04-13 11:31:02 -07:00
|
|
|
+ ScrollFlags::ScrollOverflowHidden);
|
2020-04-14 16:24:36 -07:00
|
|
|
+ // If a _visual_ scroll update is pending, cancel it; otherwise, it will
|
|
|
|
+ // clobber next scroll (e.g. subsequent window.scrollTo(0, 0) wlll break).
|
|
|
|
+ if (presShell->GetPendingVisualScrollUpdate()) {
|
|
|
|
+ presShell->AcknowledgePendingVisualScrollUpdate();
|
|
|
|
+ presShell->ClearPendingVisualScrollUpdate();
|
|
|
|
+ }
|
2020-04-13 11:31:02 -07:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
already_AddRefed<DOMQuad> nsINode::ConvertQuadFromNode(
|
|
|
|
DOMQuad& aQuad, const GeometryNode& aFrom,
|
|
|
|
const ConvertCoordinateOptions& aOptions, CallerType aCallerType,
|
|
|
|
diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index e1fb6c2aeb67ab600b668b342bee0c716427d116..55e573dce8ad4d34542f89b9179a1da14f45d1bc 100644
|
2020-04-13 11:31:02 -07:00
|
|
|
--- a/dom/base/nsINode.h
|
|
|
|
+++ b/dom/base/nsINode.h
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -2356,6 +2356,10 @@ class nsINode : public mozilla::dom::EventTarget {
|
2020-04-13 11:31:02 -07:00
|
|
|
nsTArray<RefPtr<DOMQuad>>& aResult,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
+ void ScrollRectIntoViewIfNeeded(int32_t x, int32_t y,
|
|
|
|
+ int32_t w, int32_t h,
|
|
|
|
+ ErrorResult& aRv);
|
|
|
|
+
|
|
|
|
already_AddRefed<DOMQuad> ConvertQuadFromNode(
|
|
|
|
DOMQuad& aQuad, const TextOrElementOrDocument& aFrom,
|
|
|
|
const ConvertCoordinateOptions& aOptions, CallerType aCallerType,
|
2020-04-01 14:10:30 -07:00
|
|
|
diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index bf7eb34da03c0958de688deecb53b407d430f645..a2ec3b1b7e86f72bee38d890c0834abfe4be8637 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/dom/base/nsJSUtils.cpp
|
|
|
|
+++ b/dom/base/nsJSUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -149,6 +149,11 @@ bool nsJSUtils::GetEnvironmentChainForElement(JSContext* aCx, Element* aElement,
|
2020-04-01 14:10:30 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
+/* static */
|
|
|
|
+bool nsJSUtils::SetTimeZoneOverride(const char* timezoneId) {
|
|
|
|
+ return JS::SetTimeZoneOverride(timezoneId);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/* static */
|
|
|
|
void nsJSUtils::ResetTimeZone() { JS::ResetTimeZone(); }
|
|
|
|
|
|
|
|
diff --git a/dom/base/nsJSUtils.h b/dom/base/nsJSUtils.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index f32e21752d5013bf143eb45391ab9218debab08e..83763d2354dade2f8d2b7930ba18ae91c55133ad 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/dom/base/nsJSUtils.h
|
|
|
|
+++ b/dom/base/nsJSUtils.h
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -75,6 +75,7 @@ class nsJSUtils {
|
|
|
|
mozilla::dom::Element* aElement,
|
|
|
|
JS::EnvironmentChain& aEnvChain);
|
2020-04-01 14:10:30 -07:00
|
|
|
|
|
|
|
+ static bool SetTimeZoneOverride(const char* timezoneId);
|
|
|
|
static void ResetTimeZone();
|
|
|
|
|
|
|
|
static bool DumpEnabled();
|
2021-05-18 21:23:12 +02:00
|
|
|
diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl
|
2025-01-22 09:56:34 -08:00
|
|
|
index 28e8d8cb9c61ff8362b2d191d47c3630d2cb0b34..0058e60aaab21f8003bbe1bf3f271c63ed78f29a 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/dom/chrome-webidl/BrowsingContext.webidl
|
|
|
|
+++ b/dom/chrome-webidl/BrowsingContext.webidl
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -61,6 +61,15 @@ enum ForcedColorsOverride {
|
|
|
|
"active",
|
2021-05-18 21:23:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * CSS prefers-reduced-motion values.
|
|
|
|
+ */
|
|
|
|
+enum PrefersReducedMotionOverride {
|
|
|
|
+ "none",
|
|
|
|
+ "reduce",
|
|
|
|
+ "no-preference",
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Allowed overrides of platform/pref default behaviour for touch events.
|
|
|
|
*/
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -220,6 +229,9 @@ interface BrowsingContext {
|
|
|
|
// Forced-colors simulation, for DevTools
|
|
|
|
[SetterThrows] attribute ForcedColorsOverride forcedColorsOverride;
|
2021-05-18 21:23:12 +02:00
|
|
|
|
|
|
|
+ // Reduced-Motion simulation, for DevTools.
|
|
|
|
+ [SetterThrows] attribute PrefersReducedMotionOverride prefersReducedMotionOverride;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* A unique identifier for the browser element that is hosting this
|
|
|
|
* BrowsingContext tree. Every BrowsingContext in the element's tree will
|
2020-03-20 11:14:42 -07:00
|
|
|
diff --git a/dom/geolocation/Geolocation.cpp b/dom/geolocation/Geolocation.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 6a624e4c0f5fb8ffff06419a29f6e6acc6108773..370625634f7846d0545ec7ee964d7fa1a15b3ac0 100644
|
2020-03-20 11:14:42 -07:00
|
|
|
--- a/dom/geolocation/Geolocation.cpp
|
|
|
|
+++ b/dom/geolocation/Geolocation.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -29,6 +29,7 @@
|
2020-03-24 23:25:17 -07:00
|
|
|
#include "nsComponentManagerUtils.h"
|
|
|
|
#include "nsContentPermissionHelper.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
+#include "nsDocShell.h"
|
2023-11-14 10:18:18 -08:00
|
|
|
#include "nsGlobalWindowInner.h"
|
2020-03-24 23:25:17 -07:00
|
|
|
#include "mozilla/dom/Document.h"
|
|
|
|
#include "nsINamed.h"
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -429,10 +430,8 @@ nsGeolocationRequest::Allow(JS::Handle<JS::Value> aChoices) {
|
2020-03-20 11:14:42 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
- RefPtr<nsGeolocationService> gs =
|
|
|
|
- nsGeolocationService::GetGeolocationService();
|
|
|
|
-
|
|
|
|
- bool canUseCache = false;
|
|
|
|
+ nsGeolocationService* gs = mLocator->GetGeolocationService();
|
|
|
|
+ bool canUseCache = gs != nsGeolocationService::sService.get();
|
|
|
|
CachedPositionAndAccuracy lastPosition = gs->GetCachedPosition();
|
|
|
|
if (lastPosition.position) {
|
2022-01-18 04:16:04 -07:00
|
|
|
EpochTimeStamp cachedPositionTime_ms;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -640,8 +639,7 @@ void nsGeolocationRequest::Shutdown() {
|
2020-03-20 11:14:42 -07:00
|
|
|
// If there are no other high accuracy requests, the geolocation service will
|
|
|
|
// notify the provider to switch to the default accuracy.
|
|
|
|
if (mOptions && mOptions->mEnableHighAccuracy) {
|
|
|
|
- RefPtr<nsGeolocationService> gs =
|
|
|
|
- nsGeolocationService::GetGeolocationService();
|
|
|
|
+ nsGeolocationService* gs = mLocator ? mLocator->GetGeolocationService() : nullptr;
|
|
|
|
if (gs) {
|
|
|
|
gs->UpdateAccuracy();
|
|
|
|
}
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -958,8 +956,14 @@ void nsGeolocationService::StopDevice() {
|
2020-03-20 11:14:42 -07:00
|
|
|
StaticRefPtr<nsGeolocationService> nsGeolocationService::sService;
|
|
|
|
|
|
|
|
already_AddRefed<nsGeolocationService>
|
|
|
|
-nsGeolocationService::GetGeolocationService() {
|
|
|
|
+nsGeolocationService::GetGeolocationService(nsDocShell* docShell) {
|
|
|
|
RefPtr<nsGeolocationService> result;
|
|
|
|
+ if (docShell) {
|
2020-03-22 13:51:49 -07:00
|
|
|
+ result = docShell->GetGeolocationServiceOverride();
|
2020-03-20 11:14:42 -07:00
|
|
|
+ if (result)
|
|
|
|
+ return result.forget();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (nsGeolocationService::sService) {
|
|
|
|
result = nsGeolocationService::sService;
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1051,7 +1055,9 @@ nsresult Geolocation::Init(nsPIDOMWindowInner* aContentDom) {
|
2020-03-20 11:14:42 -07:00
|
|
|
// If no aContentDom was passed into us, we are being used
|
|
|
|
// by chrome/c++ and have no mOwner, no mPrincipal, and no need
|
|
|
|
// to prompt.
|
|
|
|
- mService = nsGeolocationService::GetGeolocationService();
|
|
|
|
+ nsCOMPtr<Document> doc = aContentDom ? aContentDom->GetDoc() : nullptr;
|
|
|
|
+ mService = nsGeolocationService::GetGeolocationService(
|
|
|
|
+ doc ? static_cast<nsDocShell*>(doc->GetDocShell()) : nullptr);
|
|
|
|
if (mService) {
|
|
|
|
mService->AddLocator(this);
|
|
|
|
}
|
|
|
|
diff --git a/dom/geolocation/Geolocation.h b/dom/geolocation/Geolocation.h
|
2025-01-22 09:56:34 -08:00
|
|
|
index 992de29b5d2d09c19e55ebb2502215ec9d05a171..cdc20567b693283b0fd5a5923f7ea54210bd1712 100644
|
2020-03-20 11:14:42 -07:00
|
|
|
--- a/dom/geolocation/Geolocation.h
|
|
|
|
+++ b/dom/geolocation/Geolocation.h
|
2020-12-14 15:28:48 -08:00
|
|
|
@@ -31,6 +31,7 @@
|
|
|
|
|
|
|
|
#include "nsIGeolocationProvider.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
+#include "nsDocShell.h"
|
|
|
|
|
|
|
|
class nsGeolocationService;
|
|
|
|
class nsGeolocationRequest;
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -51,13 +52,14 @@ struct CachedPositionAndAccuracy {
|
2020-12-14 15:28:48 -08:00
|
|
|
bool isHighAccuracy;
|
|
|
|
};
|
|
|
|
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Singleton that manages the geolocation provider
|
|
|
|
*/
|
2020-03-20 11:14:42 -07:00
|
|
|
class nsGeolocationService final : public nsIGeolocationUpdate,
|
|
|
|
public nsIObserver {
|
|
|
|
public:
|
|
|
|
- static already_AddRefed<nsGeolocationService> GetGeolocationService();
|
|
|
|
+ static already_AddRefed<nsGeolocationService> GetGeolocationService(nsDocShell* docShell = nullptr);
|
|
|
|
static mozilla::StaticRefPtr<nsGeolocationService> sService;
|
|
|
|
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -189,6 +191,8 @@ class Geolocation final : public nsIGeolocationUpdate, public nsWrapperCache {
|
|
|
|
BrowsingContext* aBrowsingContext,
|
|
|
|
geolocation::ParentRequestResolver&& aResolver);
|
2020-03-20 11:14:42 -07:00
|
|
|
|
|
|
|
+ nsGeolocationService* GetGeolocationService() { return mService; };
|
|
|
|
+
|
|
|
|
private:
|
|
|
|
~Geolocation();
|
|
|
|
|
2019-11-25 13:56:39 -08:00
|
|
|
diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 4b6686880b9fca9bb7c08e850918a4c0f15dac88..825a006b05947ede8ffdfefa4cd12dd5663fb98f 100644
|
2019-11-25 13:56:39 -08:00
|
|
|
--- a/dom/html/HTMLInputElement.cpp
|
|
|
|
+++ b/dom/html/HTMLInputElement.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -62,6 +62,7 @@
|
2019-11-25 13:56:39 -08:00
|
|
|
#include "mozilla/dom/Document.h"
|
2023-04-24 21:28:08 +00:00
|
|
|
#include "mozilla/dom/HTMLDataListElement.h"
|
|
|
|
#include "mozilla/dom/HTMLOptionElement.h"
|
2019-11-25 13:56:39 -08:00
|
|
|
+#include "nsDocShell.h"
|
|
|
|
#include "nsIFrame.h"
|
2024-11-13 12:34:49 +01:00
|
|
|
#include "nsRangeFrame.h"
|
|
|
|
#include "nsError.h"
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -789,6 +790,13 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
|
2019-11-25 13:56:39 -08:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2024-06-14 18:38:09 -07:00
|
|
|
+ nsCOMPtr<nsPIDOMWindowOuter> win = doc->GetWindow();
|
|
|
|
+ nsDocShell* docShell = win ? static_cast<nsDocShell*>(win->GetDocShell()) : nullptr;
|
2019-11-25 13:56:39 -08:00
|
|
|
+ if (docShell && docShell->IsFileInputInterceptionEnabled()) {
|
|
|
|
+ docShell->FilePickerShown(this);
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
+
|
2024-09-30 05:14:45 -07:00
|
|
|
if (IsPickerBlocked(doc)) {
|
2019-11-25 13:56:39 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2020-10-13 12:24:11 -07:00
|
|
|
diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl
|
2025-02-28 13:23:18 +00:00
|
|
|
index b4d065ff3197404f92e099afea9a0dcb4ff79bf1..59448d3c4f1054a8a1c8cb415f36fdeb2983040d 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
|
|
|
|
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
|
2024-09-30 05:14:45 -07:00
|
|
|
@@ -374,6 +374,26 @@ interface nsIDOMWindowUtils : nsISupports {
|
2020-10-13 12:24:11 -07:00
|
|
|
[optional] in long aButtons,
|
2023-06-06 15:08:23 -07:00
|
|
|
[optional] in unsigned long aIdentifier);
|
2020-10-13 12:24:11 -07:00
|
|
|
|
2023-06-06 15:08:23 -07:00
|
|
|
+ /**
|
|
|
|
+ * Playwright: a separate method to dispatch mouse event with a
|
|
|
|
+ * specific `jugglerEventId`.
|
|
|
|
+ */
|
|
|
|
+ [can_run_script]
|
|
|
|
+ unsigned long jugglerSendMouseEvent(in AString aType,
|
|
|
|
+ in float aX,
|
|
|
|
+ in float aY,
|
|
|
|
+ in long aButton,
|
|
|
|
+ in long aClickCount,
|
|
|
|
+ in long aModifiers,
|
|
|
|
+ in boolean aIgnoreRootScrollFrame,
|
|
|
|
+ in float aPressure,
|
|
|
|
+ in unsigned short aInputSourceArg,
|
|
|
|
+ in boolean aIsDOMEventSynthesized,
|
|
|
|
+ in boolean aIsWidgetEventSynthesized,
|
|
|
|
+ in long aButtons,
|
|
|
|
+ in unsigned long aIdentifier,
|
|
|
|
+ in boolean aDisablePointerEvent);
|
|
|
|
+
|
2020-10-13 12:24:11 -07:00
|
|
|
/** Synthesize a touch event. The event types supported are:
|
|
|
|
* touchstart, touchend, touchmove, and touchcancel
|
2023-06-06 15:08:23 -07:00
|
|
|
*
|
|
|
|
diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 067e8551685497a8d7681296bbb7d7eae1d7587b..5667fbbfff99b77992eac181304093d8afbff367 100644
|
2023-06-06 15:08:23 -07:00
|
|
|
--- a/dom/ipc/BrowserChild.cpp
|
|
|
|
+++ b/dom/ipc/BrowserChild.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1674,6 +1674,21 @@ void BrowserChild::HandleRealMouseButtonEvent(const WidgetMouseEvent& aEvent,
|
2023-06-06 15:08:23 -07:00
|
|
|
if (postLayerization) {
|
|
|
|
postLayerization->Register();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Playwright: notify content that mouse event has been received and handled.
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService =
|
|
|
|
+ mozilla::services::GetObserverService();
|
|
|
|
+ if (observerService && aEvent.mJugglerEventId) {
|
|
|
|
+ if (aEvent.mMessage == eMouseUp) {
|
|
|
|
+ observerService->NotifyObservers(nullptr, "juggler-mouse-event-hit-renderer", NS_ConvertASCIItoUTF16(nsPrintfCString("mouseup %" PRIu32, aEvent.mJugglerEventId)).get());
|
|
|
|
+ } else if (aEvent.mMessage == eMouseDown) {
|
|
|
|
+ observerService->NotifyObservers(nullptr, "juggler-mouse-event-hit-renderer", NS_ConvertASCIItoUTF16(nsPrintfCString("mousedown %" PRIu32, aEvent.mJugglerEventId)).get());
|
|
|
|
+ } else if (aEvent.mMessage == eMouseMove) {
|
|
|
|
+ observerService->NotifyObservers(nullptr, "juggler-mouse-event-hit-renderer", NS_ConvertASCIItoUTF16(nsPrintfCString("mousemove %" PRIu32, aEvent.mJugglerEventId)).get());
|
|
|
|
+ } else if (aEvent.mMessage == eContextMenu) {
|
|
|
|
+ observerService->NotifyObservers(nullptr, "juggler-mouse-event-hit-renderer", NS_ConvertASCIItoUTF16(nsPrintfCString("contextmenu %" PRIu32, aEvent.mJugglerEventId)).get());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult BrowserChild::RecvNormalPriorityRealMouseButtonEvent(
|
|
|
|
diff --git a/dom/ipc/CoalescedMouseData.cpp b/dom/ipc/CoalescedMouseData.cpp
|
|
|
|
index 5aa445d2e0a6169e57c44569974d557b3baf7064..671f71979b407f0ca17c66f13805e851ba30479e 100644
|
|
|
|
--- a/dom/ipc/CoalescedMouseData.cpp
|
|
|
|
+++ b/dom/ipc/CoalescedMouseData.cpp
|
|
|
|
@@ -67,6 +67,9 @@ bool CoalescedMouseData::CanCoalesce(const WidgetMouseEvent& aEvent,
|
|
|
|
mCoalescedInputEvent->pointerId == aEvent.pointerId &&
|
|
|
|
mCoalescedInputEvent->mButton == aEvent.mButton &&
|
|
|
|
mCoalescedInputEvent->mButtons == aEvent.mButtons && mGuid == aGuid &&
|
|
|
|
+ // `mJugglerEventId` is 0 for non-juggler events and a unique number for
|
|
|
|
+ // juggler-emitted events.
|
|
|
|
+ mCoalescedInputEvent->mJugglerEventId == aEvent.mJugglerEventId &&
|
|
|
|
mInputBlockId == aInputBlockId);
|
|
|
|
}
|
|
|
|
|
2020-07-27 16:22:02 -07:00
|
|
|
diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.cc b/dom/media/systemservices/video_engine/desktop_capture_impl.cc
|
2025-01-22 09:56:34 -08:00
|
|
|
index c43a1b3b245101c974742c5e50f54857e538bbfb..c07a568da3342cbf2af07471fa6959cb242b9a4e 100644
|
2020-07-27 16:22:02 -07:00
|
|
|
--- a/dom/media/systemservices/video_engine/desktop_capture_impl.cc
|
|
|
|
+++ b/dom/media/systemservices/video_engine/desktop_capture_impl.cc
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -52,9 +52,10 @@ namespace webrtc {
|
2020-07-27 16:22:02 -07:00
|
|
|
|
2024-09-05 13:44:58 +02:00
|
|
|
DesktopCaptureImpl* DesktopCaptureImpl::Create(const int32_t aModuleId,
|
2023-05-18 00:50:43 +00:00
|
|
|
const char* aUniqueId,
|
|
|
|
- const CaptureDeviceType aType) {
|
|
|
|
+ const CaptureDeviceType aType,
|
|
|
|
+ bool aCaptureCursor) {
|
|
|
|
return new rtc::RefCountedObject<DesktopCaptureImpl>(aModuleId, aUniqueId,
|
|
|
|
- aType);
|
|
|
|
+ aType, aCaptureCursor);
|
2020-07-27 16:22:02 -07:00
|
|
|
}
|
|
|
|
|
2025-01-22 09:56:34 -08:00
|
|
|
static DesktopCaptureOptions CreateDesktopCaptureOptions() {
|
|
|
|
@@ -155,8 +156,10 @@ static std::unique_ptr<DesktopCapturer> CreateTabCapturer(
|
2023-09-11 18:16:33 -07:00
|
|
|
|
|
|
|
static std::unique_ptr<DesktopCapturer> CreateDesktopCapturerAndThread(
|
|
|
|
CaptureDeviceType aDeviceType, DesktopCapturer::SourceId aSourceId,
|
|
|
|
- nsIThread** aOutThread) {
|
|
|
|
+ nsIThread** aOutThread, bool aCaptureCursor) {
|
|
|
|
DesktopCaptureOptions options = CreateDesktopCaptureOptions();
|
2025-01-22 09:56:34 -08:00
|
|
|
+ if (aCaptureCursor)
|
|
|
|
+ options.set_prefer_cursor_embedded(aCaptureCursor);
|
|
|
|
auto ensureThread = [&]() {
|
|
|
|
if (*aOutThread) {
|
|
|
|
return *aOutThread;
|
|
|
|
@@ -253,7 +256,8 @@ static std::unique_ptr<DesktopCapturer> CreateDesktopCapturerAndThread(
|
2020-07-27 16:22:02 -07:00
|
|
|
}
|
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
DesktopCaptureImpl::DesktopCaptureImpl(const int32_t aId, const char* aUniqueId,
|
|
|
|
- const CaptureDeviceType aType)
|
|
|
|
+ const CaptureDeviceType aType,
|
|
|
|
+ bool aCaptureCursor)
|
|
|
|
: mModuleId(aId),
|
|
|
|
mTrackingId(mozilla::TrackingId(CaptureEngineToTrackingSourceStr([&] {
|
|
|
|
switch (aType) {
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -270,6 +274,7 @@ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t aId, const char* aUniqueId,
|
2023-09-11 18:16:33 -07:00
|
|
|
aId)),
|
2023-08-10 14:41:33 -07:00
|
|
|
mDeviceUniqueId(aUniqueId),
|
2023-05-18 00:50:43 +00:00
|
|
|
mDeviceType(aType),
|
|
|
|
+ capture_cursor_(aCaptureCursor),
|
2023-09-11 18:16:33 -07:00
|
|
|
mControlThread(mozilla::GetCurrentSerialEventTarget()),
|
2023-08-10 14:41:33 -07:00
|
|
|
mNextFrameMinimumTime(Timestamp::Zero()),
|
2023-06-06 15:08:23 -07:00
|
|
|
mCallbacks("DesktopCaptureImpl::mCallbacks") {}
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -294,6 +299,19 @@ void DesktopCaptureImpl::DeRegisterCaptureDataCallback(
|
2021-05-06 19:11:42 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void DesktopCaptureImpl::RegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) {
|
2023-05-18 00:50:43 +00:00
|
|
|
+ rtc::CritScope lock(&mApiCs);
|
2021-05-06 19:11:42 -07:00
|
|
|
+ _rawFrameCallbacks.insert(rawFrameCallback);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DesktopCaptureImpl::DeRegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) {
|
2023-05-18 00:50:43 +00:00
|
|
|
+ rtc::CritScope lock(&mApiCs);
|
2021-05-06 19:11:42 -07:00
|
|
|
+ auto it = _rawFrameCallbacks.find(rawFrameCallback);
|
|
|
|
+ if (it != _rawFrameCallbacks.end()) {
|
|
|
|
+ _rawFrameCallbacks.erase(it);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int32_t DesktopCaptureImpl::StopCaptureIfAllClientsClose() {
|
2023-05-18 00:50:43 +00:00
|
|
|
{
|
|
|
|
auto callbacks = mCallbacks.Lock();
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -333,7 +351,7 @@ int32_t DesktopCaptureImpl::StartCapture(
|
2023-09-11 18:16:33 -07:00
|
|
|
|
|
|
|
DesktopCapturer::SourceId sourceId = std::stoi(mDeviceUniqueId);
|
|
|
|
std::unique_ptr capturer = CreateDesktopCapturerAndThread(
|
|
|
|
- mDeviceType, sourceId, getter_AddRefs(mCaptureThread));
|
|
|
|
+ mDeviceType, sourceId, getter_AddRefs(mCaptureThread), capture_cursor_);
|
|
|
|
|
|
|
|
MOZ_ASSERT(!capturer == !mCaptureThread);
|
|
|
|
if (!capturer) {
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -441,6 +459,15 @@ void DesktopCaptureImpl::OnCaptureResult(DesktopCapturer::Result aResult,
|
2023-05-18 00:50:43 +00:00
|
|
|
frameInfo.height = aFrame->size().height();
|
2021-05-06 19:11:42 -07:00
|
|
|
frameInfo.videoType = VideoType::kARGB;
|
|
|
|
|
|
|
|
+ size_t videoFrameStride =
|
|
|
|
+ frameInfo.width * DesktopFrame::kBytesPerPixel;
|
2022-08-04 18:52:30 -07:00
|
|
|
+ {
|
2023-05-18 00:50:43 +00:00
|
|
|
+ rtc::CritScope cs(&mApiCs);
|
2022-08-04 18:52:30 -07:00
|
|
|
+ for (auto rawFrameCallback : _rawFrameCallbacks) {
|
|
|
|
+ rawFrameCallback->OnRawFrame(videoFrame, videoFrameStride, frameInfo);
|
|
|
|
+ }
|
2021-05-06 19:11:42 -07:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
size_t videoFrameLength =
|
|
|
|
frameInfo.width * frameInfo.height * DesktopFrame::kBytesPerPixel;
|
2023-06-06 15:08:23 -07:00
|
|
|
|
2020-07-27 16:22:02 -07:00
|
|
|
diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.h b/dom/media/systemservices/video_engine/desktop_capture_impl.h
|
2025-01-22 09:56:34 -08:00
|
|
|
index a76b7de569db1cb42728a5514fb80e5c46e0344e..3d61ad8d3aa4a7eaf96957dcd680e1e1ee8abdf4 100644
|
2020-07-27 16:22:02 -07:00
|
|
|
--- a/dom/media/systemservices/video_engine/desktop_capture_impl.h
|
|
|
|
+++ b/dom/media/systemservices/video_engine/desktop_capture_impl.h
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -26,6 +26,7 @@
|
|
|
|
#include "api/video/video_sink_interface.h"
|
2023-06-06 15:08:23 -07:00
|
|
|
#include "modules/desktop_capture/desktop_capturer.h"
|
|
|
|
#include "modules/video_capture/video_capture.h"
|
|
|
|
+#include "rtc_base/deprecated/recursive_critical_section.h"
|
2025-01-22 09:56:34 -08:00
|
|
|
#include "mozilla/DataMutex.h"
|
|
|
|
#include "mozilla/Maybe.h"
|
|
|
|
#include "mozilla/TimeStamp.h"
|
|
|
|
@@ -42,17 +43,44 @@ namespace webrtc {
|
2021-05-06 19:11:42 -07:00
|
|
|
|
|
|
|
class VideoCaptureEncodeInterface;
|
|
|
|
|
|
|
|
+class RawFrameCallback {
|
|
|
|
+ public:
|
|
|
|
+ virtual ~RawFrameCallback() {}
|
|
|
|
+
|
|
|
|
+ virtual void OnRawFrame(uint8_t* videoFrame, size_t videoFrameLength, const VideoCaptureCapability& frameInfo) = 0;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+class VideoCaptureModuleEx : public VideoCaptureModule {
|
|
|
|
+ public:
|
|
|
|
+ virtual ~VideoCaptureModuleEx() {}
|
|
|
|
+
|
|
|
|
+ virtual void RegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) = 0;
|
|
|
|
+ virtual void DeRegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) = 0;
|
2024-09-05 13:44:58 +02:00
|
|
|
+ int32_t StartCaptureCounted(const VideoCaptureCapability& aCapability) {
|
|
|
|
+ ++capture_counter_;
|
|
|
|
+ return capture_counter_ == 1 ? StartCapture(aCapability) : 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int32_t StopCaptureCounted() {
|
|
|
|
+ --capture_counter_;
|
|
|
|
+ return capture_counter_ == 0 ? StopCapture() : 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private:
|
|
|
|
+ int32_t capture_counter_ = 0;
|
2021-05-06 19:11:42 -07:00
|
|
|
+};
|
|
|
|
+
|
2025-01-22 09:56:34 -08:00
|
|
|
// Reuses the video engine pipeline for screen sharing.
|
2021-05-06 19:11:42 -07:00
|
|
|
// As with video, DesktopCaptureImpl is a proxy for screen sharing
|
|
|
|
// and follows the video pipeline design
|
|
|
|
class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
2022-01-18 04:16:04 -07:00
|
|
|
- public VideoCaptureModule {
|
|
|
|
+ public VideoCaptureModuleEx {
|
2021-05-06 19:11:42 -07:00
|
|
|
public:
|
2020-07-27 16:22:02 -07:00
|
|
|
/* Create a screen capture modules object
|
|
|
|
*/
|
2024-09-05 13:44:58 +02:00
|
|
|
static DesktopCaptureImpl* Create(
|
2023-05-18 00:50:43 +00:00
|
|
|
const int32_t aModuleId, const char* aUniqueId,
|
|
|
|
- const mozilla::camera::CaptureDeviceType aType);
|
|
|
|
+ const mozilla::camera::CaptureDeviceType aType, bool aCaptureCursor = true);
|
|
|
|
|
|
|
|
[[nodiscard]] static std::shared_ptr<VideoCaptureModule::DeviceInfo>
|
|
|
|
CreateDeviceInfo(const int32_t aId,
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -66,6 +94,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
2021-05-06 19:11:42 -07:00
|
|
|
void DeRegisterCaptureDataCallback(
|
2023-05-18 00:50:43 +00:00
|
|
|
rtc::VideoSinkInterface<VideoFrame>* aCallback) override;
|
2021-05-06 19:11:42 -07:00
|
|
|
int32_t StopCaptureIfAllClientsClose() override;
|
|
|
|
+ void RegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) override;
|
|
|
|
+ void DeRegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) override;
|
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
int32_t SetCaptureRotation(VideoRotation aRotation) override;
|
|
|
|
bool SetApplyRotation(bool aEnable) override;
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -89,7 +119,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
2020-07-27 16:22:02 -07:00
|
|
|
|
|
|
|
protected:
|
2023-05-18 00:50:43 +00:00
|
|
|
DesktopCaptureImpl(const int32_t aId, const char* aUniqueId,
|
|
|
|
- const mozilla::camera::CaptureDeviceType aType);
|
|
|
|
+ const mozilla::camera::CaptureDeviceType aType,
|
|
|
|
+ bool aCaptureCusor);
|
2020-07-27 16:22:02 -07:00
|
|
|
virtual ~DesktopCaptureImpl();
|
2021-05-06 19:11:42 -07:00
|
|
|
|
2023-06-06 15:08:23 -07:00
|
|
|
private:
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -98,6 +129,9 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
2023-09-11 18:16:33 -07:00
|
|
|
void InitOnThread(std::unique_ptr<DesktopCapturer> aCapturer, int aFramerate);
|
2025-01-22 09:56:34 -08:00
|
|
|
void UpdateOnThread(int aFramerate);
|
2023-06-06 15:08:23 -07:00
|
|
|
void ShutdownOnThread();
|
2023-05-18 00:50:43 +00:00
|
|
|
+
|
2023-06-06 15:08:23 -07:00
|
|
|
+ rtc::RecursiveCriticalSection mApiCs;
|
|
|
|
+ std::set<RawFrameCallback*> _rawFrameCallbacks;
|
2023-05-18 00:50:43 +00:00
|
|
|
// DesktopCapturer::Callback interface.
|
2023-06-06 15:08:23 -07:00
|
|
|
void OnCaptureResult(DesktopCapturer::Result aResult,
|
|
|
|
std::unique_ptr<DesktopFrame> aFrame) override;
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -105,6 +139,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
2023-09-11 18:16:33 -07:00
|
|
|
// Notifies all mCallbacks of OnFrame(). mCaptureThread only.
|
|
|
|
void NotifyOnFrame(const VideoFrame& aFrame);
|
|
|
|
|
2020-07-27 16:22:02 -07:00
|
|
|
+ bool capture_cursor_ = true;
|
2023-09-11 18:16:33 -07:00
|
|
|
+
|
|
|
|
// Control thread on which the public API is called.
|
|
|
|
const nsCOMPtr<nsISerialEventTarget> mControlThread;
|
|
|
|
// Set in StartCapture.
|
2020-01-16 11:52:23 -08:00
|
|
|
diff --git a/dom/script/ScriptSettings.cpp b/dom/script/ScriptSettings.cpp
|
2024-02-22 13:17:33 -08:00
|
|
|
index 3b39538e51840cd9b1685b2efd2ff2e9ec83608a..c7bf4f2d53b58bbacb22b3ebebf6f3fc9b5e445f 100644
|
2020-01-16 11:52:23 -08:00
|
|
|
--- a/dom/script/ScriptSettings.cpp
|
|
|
|
+++ b/dom/script/ScriptSettings.cpp
|
2022-06-29 04:46:49 -07:00
|
|
|
@@ -150,6 +150,30 @@ ScriptSettingsStackEntry::~ScriptSettingsStackEntry() {
|
2020-01-16 11:52:23 -08:00
|
|
|
MOZ_ASSERT_IF(mGlobalObject, mGlobalObject->HasJSGlobal());
|
|
|
|
}
|
|
|
|
|
|
|
|
+static nsIGlobalObject* UnwrapSandboxGlobal(nsIGlobalObject* global) {
|
|
|
|
+ if (!global)
|
|
|
|
+ return global;
|
|
|
|
+ JSObject* globalObject = global->GetGlobalJSObject();
|
|
|
|
+ if (!globalObject)
|
|
|
|
+ return global;
|
|
|
|
+ JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
|
|
|
+ if (!cx)
|
|
|
|
+ return global;
|
|
|
|
+ JS::Rooted<JSObject*> proto(cx);
|
|
|
|
+ JS::RootedObject rootedGlobal(cx, globalObject);
|
|
|
|
+ if (!JS_GetPrototype(cx, rootedGlobal, &proto))
|
|
|
|
+ return global;
|
|
|
|
+ if (!proto || !xpc::IsSandboxPrototypeProxy(proto))
|
|
|
|
+ return global;
|
|
|
|
+ // If this is a sandbox associated with a DOMWindow via a
|
|
|
|
+ // sandboxPrototype, use that DOMWindow. This supports GreaseMonkey
|
|
|
|
+ // and JetPack content scripts.
|
|
|
|
+ proto = js::CheckedUnwrapDynamic(proto, cx, /* stopAtWindowProxy = */ false);
|
|
|
|
+ if (!proto)
|
|
|
|
+ return global;
|
|
|
|
+ return xpc::WindowGlobalOrNull(proto);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
// If the entry or incumbent global ends up being something that the subject
|
|
|
|
// principal doesn't subsume, we don't want to use it. This never happens on
|
|
|
|
// the web, but can happen with asymmetric privilege relationships (i.e.
|
2022-06-29 04:46:49 -07:00
|
|
|
@@ -177,7 +201,7 @@ static nsIGlobalObject* ClampToSubject(nsIGlobalObject* aGlobalOrNull) {
|
2020-01-16 11:52:23 -08:00
|
|
|
NS_ENSURE_TRUE(globalPrin, GetCurrentGlobal());
|
|
|
|
if (!nsContentUtils::SubjectPrincipalOrSystemIfNativeCaller()
|
|
|
|
->SubsumesConsideringDomain(globalPrin)) {
|
|
|
|
- return GetCurrentGlobal();
|
|
|
|
+ return UnwrapSandboxGlobal(GetCurrentGlobal());
|
|
|
|
}
|
|
|
|
|
|
|
|
return aGlobalOrNull;
|
2019-11-25 15:26:03 -08:00
|
|
|
diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 8c4364190dadd1a58bfd99e2c0dae1524a4e2c0c..ffadb3b4665a804320724b5a12e09cb29ef31498 100644
|
2019-11-25 15:26:03 -08:00
|
|
|
--- a/dom/security/nsCSPUtils.cpp
|
|
|
|
+++ b/dom/security/nsCSPUtils.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -23,6 +23,7 @@
|
2023-10-10 16:10:40 -07:00
|
|
|
#include "nsSandboxFlags.h"
|
|
|
|
#include "nsServiceManagerUtils.h"
|
|
|
|
#include "nsWhitespaceTokenizer.h"
|
|
|
|
+#include "nsDocShell.h"
|
|
|
|
|
2024-09-05 13:44:58 +02:00
|
|
|
#include "mozilla/Assertions.h"
|
2023-10-10 16:10:40 -07:00
|
|
|
#include "mozilla/Components.h"
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -134,6 +135,11 @@ void CSP_ApplyMetaCSPToDoc(mozilla::dom::Document& aDoc,
|
2019-11-25 15:26:03 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (aDoc.GetDocShell() &&
|
|
|
|
+ nsDocShell::Cast(aDoc.GetDocShell())->IsBypassCSPEnabled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
nsAutoString policyStr(
|
|
|
|
nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(
|
|
|
|
aPolicyStr));
|
2020-04-13 11:31:02 -07:00
|
|
|
diff --git a/dom/webidl/GeometryUtils.webidl b/dom/webidl/GeometryUtils.webidl
|
2025-02-28 13:23:18 +00:00
|
|
|
index aee376e971ae01ac1e512c3920b115bfaf06afa8..1701311534bf77e6cd9bafc0e3a283610476aa8f 100644
|
2020-04-13 11:31:02 -07:00
|
|
|
--- a/dom/webidl/GeometryUtils.webidl
|
|
|
|
+++ b/dom/webidl/GeometryUtils.webidl
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -17,6 +17,8 @@ dictionary GeometryUtilsOptions {
|
2022-08-01 14:40:23 -07:00
|
|
|
boolean createFramesForSuppressedWhitespace = true;
|
2025-02-28 13:23:18 +00:00
|
|
|
[ChromeOnly]
|
|
|
|
boolean flush = true;
|
2022-08-01 14:40:23 -07:00
|
|
|
+ [ChromeOnly]
|
|
|
|
+ boolean recurseWhenNoFrame = false;
|
|
|
|
};
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
dictionary BoxQuadOptions : GeometryUtilsOptions {
|
|
|
|
@@ -35,6 +37,9 @@ interface mixin GeometryUtils {
|
2020-04-13 11:31:02 -07:00
|
|
|
[Throws, Func="nsINode::HasBoxQuadsSupport", NeedsCallerType]
|
|
|
|
sequence<DOMQuad> getBoxQuads(optional BoxQuadOptions options = {});
|
|
|
|
|
|
|
|
+ [ChromeOnly, Throws, Func="nsINode::HasBoxQuadsSupport"]
|
2023-01-23 11:29:48 -08:00
|
|
|
+ undefined scrollRectIntoViewIfNeeded(long x, long y, long w, long h);
|
2020-04-13 11:31:02 -07:00
|
|
|
+
|
|
|
|
/* getBoxQuadsFromWindowOrigin is similar to getBoxQuads, but the
|
|
|
|
* returned quads are further translated relative to the window
|
|
|
|
* origin -- which is not the layout origin. Further translation
|
2020-03-20 17:03:20 -07:00
|
|
|
diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 996b5699166711901ff0d11fe64352b6c9c97d1e..5b08ea6145e6052058a55d6a678fd7539f70baa1 100644
|
2020-03-20 17:03:20 -07:00
|
|
|
--- a/dom/workers/RuntimeService.cpp
|
|
|
|
+++ b/dom/workers/RuntimeService.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1005,7 +1005,7 @@ void PrefLanguagesChanged(const char* /* aPrefName */, void* /* aClosure */) {
|
2020-03-20 17:03:20 -07:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
|
|
|
nsTArray<nsString> languages;
|
|
|
|
- Navigator::GetAcceptLanguages(languages);
|
|
|
|
+ Navigator::GetAcceptLanguages(nullptr, languages);
|
|
|
|
|
|
|
|
RuntimeService* runtime = RuntimeService::GetService();
|
|
|
|
if (runtime) {
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1193,8 +1193,7 @@ bool RuntimeService::RegisterWorker(WorkerPrivate& aWorkerPrivate) {
|
2020-03-20 17:03:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// The navigator overridden properties should have already been read.
|
|
|
|
-
|
|
|
|
- Navigator::GetAcceptLanguages(mNavigatorProperties.mLanguages);
|
|
|
|
+ Navigator::GetAcceptLanguages(nullptr, mNavigatorProperties.mLanguages);
|
|
|
|
mNavigatorPropertiesLoaded = true;
|
|
|
|
}
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1815,6 +1814,13 @@ void RuntimeService::PropagateStorageAccessPermissionGranted(
|
2020-03-26 16:33:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void RuntimeService::ResetDefaultLocaleInAllWorkers() {
|
|
|
|
+ AssertIsOnMainThread();
|
2020-08-12 10:09:20 -07:00
|
|
|
+ BroadcastAllWorkers([](auto& worker) {
|
|
|
|
+ worker.ResetDefaultLocale();
|
|
|
|
+ });
|
2020-03-26 16:33:07 -07:00
|
|
|
+}
|
|
|
|
+
|
2022-06-29 04:46:49 -07:00
|
|
|
template <typename Func>
|
|
|
|
void RuntimeService::BroadcastAllWorkers(const Func& aFunc) {
|
2020-03-26 16:33:07 -07:00
|
|
|
AssertIsOnMainThread();
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -2340,6 +2346,14 @@ void PropagateStorageAccessPermissionGrantedToWorkers(
|
2020-03-26 16:33:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void ResetDefaultLocaleInAllWorkers() {
|
|
|
|
+ AssertIsOnMainThread();
|
|
|
|
+ RuntimeService* runtime = RuntimeService::GetService();
|
|
|
|
+ if (runtime) {
|
|
|
|
+ runtime->ResetDefaultLocaleInAllWorkers();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
WorkerPrivate* GetWorkerPrivateFromContext(JSContext* aCx) {
|
|
|
|
MOZ_ASSERT(!NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(aCx);
|
|
|
|
diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h
|
2024-09-30 05:14:45 -07:00
|
|
|
index 534bbe9ec4f0261189eb3322c1229c1eb5d8802e..6aa99b64fdbbff3704602e944b129879fbdf8c15 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/RuntimeService.h
|
|
|
|
+++ b/dom/workers/RuntimeService.h
|
2024-09-30 05:14:45 -07:00
|
|
|
@@ -112,6 +112,8 @@ class RuntimeService final : public nsIObserver {
|
2020-08-06 10:32:50 -07:00
|
|
|
void PropagateStorageAccessPermissionGranted(
|
|
|
|
const nsPIDOMWindowInner& aWindow);
|
2020-03-26 16:33:07 -07:00
|
|
|
|
|
|
|
+ void ResetDefaultLocaleInAllWorkers();
|
|
|
|
+
|
|
|
|
const NavigatorProperties& GetNavigatorProperties() const {
|
|
|
|
return mNavigatorProperties;
|
|
|
|
}
|
|
|
|
diff --git a/dom/workers/WorkerCommon.h b/dom/workers/WorkerCommon.h
|
2024-09-30 05:14:45 -07:00
|
|
|
index 58894a8361c7ef1dddd481ca5877a209a8b8ff5c..c481d40d79b6397b7f1d571bd9f6ae5c0a946217 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/WorkerCommon.h
|
|
|
|
+++ b/dom/workers/WorkerCommon.h
|
2024-09-30 05:14:45 -07:00
|
|
|
@@ -47,6 +47,8 @@ void ResumeWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
2020-08-06 10:32:50 -07:00
|
|
|
void PropagateStorageAccessPermissionGrantedToWorkers(
|
|
|
|
const nsPIDOMWindowInner& aWindow);
|
2020-03-26 16:33:07 -07:00
|
|
|
|
|
|
|
+void ResetDefaultLocaleInAllWorkers();
|
|
|
|
+
|
|
|
|
// All of these are implemented in WorkerScope.cpp
|
|
|
|
|
|
|
|
bool IsWorkerGlobal(JSObject* global);
|
|
|
|
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 0076a8463fa9ff05b32edfe21462987610432b5d..9f810c9728b7d7caf9fbeb3e24346c219326637d 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/WorkerPrivate.cpp
|
|
|
|
+++ b/dom/workers/WorkerPrivate.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -736,6 +736,18 @@ class UpdateContextOptionsRunnable final : public WorkerControlRunnable {
|
2020-03-26 16:33:07 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
+class ResetDefaultLocaleRunnable final : public WorkerControlRunnable {
|
|
|
|
+ public:
|
|
|
|
+ explicit ResetDefaultLocaleRunnable(WorkerPrivate* aWorkerPrivate)
|
2024-09-05 13:44:58 +02:00
|
|
|
+ : WorkerControlRunnable("ResetDefaultLocaleRunnable") {}
|
2020-03-26 16:33:07 -07:00
|
|
|
+
|
|
|
|
+ virtual bool WorkerRun(JSContext* aCx,
|
|
|
|
+ WorkerPrivate* aWorkerPrivate) override {
|
|
|
|
+ aWorkerPrivate->ResetDefaultLocaleInternal(aCx);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
2024-09-05 13:44:58 +02:00
|
|
|
class UpdateLanguagesRunnable final : public WorkerThreadRunnable {
|
2020-03-26 16:33:07 -07:00
|
|
|
nsTArray<nsString> mLanguages;
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -2149,6 +2161,16 @@ void WorkerPrivate::UpdateContextOptions(
|
2020-03-26 16:33:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void WorkerPrivate::ResetDefaultLocale() {
|
|
|
|
+ AssertIsOnParentThread();
|
|
|
|
+
|
|
|
|
+ RefPtr<ResetDefaultLocaleRunnable> runnable =
|
|
|
|
+ new ResetDefaultLocaleRunnable(this);
|
2024-09-05 13:44:58 +02:00
|
|
|
+ if (!runnable->Dispatch(this)) {
|
2020-03-26 16:33:07 -07:00
|
|
|
+ NS_WARNING("Failed to reset default locale in worker!");
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void WorkerPrivate::UpdateLanguages(const nsTArray<nsString>& aLanguages) {
|
|
|
|
AssertIsOnParentThread();
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -5833,6 +5855,15 @@ void WorkerPrivate::UpdateContextOptionsInternal(
|
2020-03-26 16:33:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void WorkerPrivate::ResetDefaultLocaleInternal(JSContext* aCx) {
|
|
|
|
+ JS_ResetDefaultLocale(JS_GetRuntime(aCx));
|
2020-08-12 10:09:20 -07:00
|
|
|
+ auto data = mWorkerThreadAccessible.Access();
|
2020-03-26 16:33:07 -07:00
|
|
|
+
|
|
|
|
+ for (uint32_t index = 0; index < data->mChildWorkers.Length(); index++) {
|
|
|
|
+ data->mChildWorkers[index]->ResetDefaultLocale();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void WorkerPrivate::UpdateLanguagesInternal(
|
|
|
|
const nsTArray<nsString>& aLanguages) {
|
|
|
|
WorkerGlobalScope* globalScope = GlobalScope();
|
|
|
|
diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index c2ade467934d08587d4e3589b310c6302534d699..414814c03180b50d218ad84a0db262fff19f78a7 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/WorkerPrivate.h
|
|
|
|
+++ b/dom/workers/WorkerPrivate.h
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -443,6 +443,8 @@ class WorkerPrivate final
|
2020-03-26 16:33:07 -07:00
|
|
|
void UpdateContextOptionsInternal(JSContext* aCx,
|
|
|
|
const JS::ContextOptions& aContextOptions);
|
|
|
|
|
|
|
|
+ void ResetDefaultLocaleInternal(JSContext* aCx);
|
|
|
|
+
|
|
|
|
void UpdateLanguagesInternal(const nsTArray<nsString>& aLanguages);
|
|
|
|
|
|
|
|
void UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, JSGCParamKey key,
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1086,6 +1088,8 @@ class WorkerPrivate final
|
2020-03-26 16:33:07 -07:00
|
|
|
|
|
|
|
void UpdateContextOptions(const JS::ContextOptions& aContextOptions);
|
|
|
|
|
|
|
|
+ void ResetDefaultLocale();
|
|
|
|
+
|
|
|
|
void UpdateLanguages(const nsTArray<nsString>& aLanguages);
|
|
|
|
|
2020-05-07 18:37:15 -07:00
|
|
|
void UpdateJSWorkerMemoryParameter(JSGCParamKey key, Maybe<uint32_t> value);
|
2021-11-04 11:26:20 -07:00
|
|
|
diff --git a/intl/components/src/TimeZone.cpp b/intl/components/src/TimeZone.cpp
|
2023-10-10 16:10:40 -07:00
|
|
|
index 7a069ef0c59895cf1f8dc35d612f1494c9c9f1ef..5b09dfdcc5323def65c35b0696141b44eef9dcda 100644
|
2021-11-04 11:26:20 -07:00
|
|
|
--- a/intl/components/src/TimeZone.cpp
|
|
|
|
+++ b/intl/components/src/TimeZone.cpp
|
|
|
|
@@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
namespace mozilla::intl {
|
|
|
|
|
|
|
|
+
|
|
|
|
/* static */
|
|
|
|
Result<UniquePtr<TimeZone>, ICUError> TimeZone::TryCreate(
|
|
|
|
Maybe<Span<const char16_t>> aTimeZoneOverride) {
|
2023-10-10 16:10:40 -07:00
|
|
|
@@ -318,6 +319,13 @@ static ICUResult SetDefaultTimeZone(TimeZoneIdentifierVector& timeZone) {
|
2021-11-04 11:26:20 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+bool TimeZone::IsValidTimeZoneId(const char* timeZoneId) {
|
|
|
|
+ // Validate timezone id.
|
|
|
|
+ mozilla::UniquePtr<icu::TimeZone> timeZone(icu::TimeZone::createTimeZone(
|
|
|
|
+ icu::UnicodeString(timeZoneId, -1, US_INV)));
|
|
|
|
+ return timeZone && *timeZone != icu::TimeZone::getUnknown();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
Result<bool, ICUError> TimeZone::SetDefaultTimeZone(
|
|
|
|
Span<const char> aTimeZone) {
|
|
|
|
#if MOZ_INTL_USE_ICU_CPP_TIMEZONE
|
|
|
|
diff --git a/intl/components/src/TimeZone.h b/intl/components/src/TimeZone.h
|
2024-07-29 10:30:28 +02:00
|
|
|
index 89770839ae108b5f3462a7f20684fdb72c4ab2fb..a7e40d6b7c33c234b41e586eac573ba4ce3a7d18 100644
|
2021-11-04 11:26:20 -07:00
|
|
|
--- a/intl/components/src/TimeZone.h
|
|
|
|
+++ b/intl/components/src/TimeZone.h
|
2024-07-29 10:30:28 +02:00
|
|
|
@@ -191,6 +191,8 @@ class TimeZone final {
|
2021-11-04 11:26:20 -07:00
|
|
|
return FillBufferWithICUCall(aBuffer, ucal_getHostTimeZone);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ static bool IsValidTimeZoneId(const char* timeZoneId);
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Set the default time zone.
|
|
|
|
*/
|
2020-04-01 14:10:30 -07:00
|
|
|
diff --git a/js/public/Date.h b/js/public/Date.h
|
2024-03-26 15:01:07 -07:00
|
|
|
index 523e84c8c93f4221701f90f2e8ee146ec8e1adbd..98d5b1176e5378431b859a2dbd4d4e778d236e78 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/js/public/Date.h
|
|
|
|
+++ b/js/public/Date.h
|
2024-03-26 15:01:07 -07:00
|
|
|
@@ -55,6 +55,8 @@ namespace JS {
|
2020-04-01 14:10:30 -07:00
|
|
|
*/
|
|
|
|
extern JS_PUBLIC_API void ResetTimeZone();
|
|
|
|
|
|
|
|
+extern JS_PUBLIC_API bool SetTimeZoneOverride(const char* timezoneId);
|
|
|
|
+
|
|
|
|
class ClippedTime;
|
|
|
|
inline ClippedTime TimeClip(double time);
|
|
|
|
|
2020-03-25 16:28:33 -07:00
|
|
|
diff --git a/js/src/debugger/Object.cpp b/js/src/debugger/Object.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
index 880e716c24464c93283410417f8e69d6d233d105..6e046fbd2e643dace5ad7796740253df3ddf2cbe 100644
|
2020-03-25 16:28:33 -07:00
|
|
|
--- a/js/src/debugger/Object.cpp
|
|
|
|
+++ b/js/src/debugger/Object.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -2474,7 +2474,11 @@ Maybe<Completion> DebuggerObject::call(JSContext* cx,
|
2020-03-25 16:28:33 -07:00
|
|
|
invokeArgs[i].set(args2[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Disable CSP for the scope of the call.
|
|
|
|
+ const JSSecurityCallbacks* securityCallbacks = JS_GetSecurityCallbacks(cx);
|
|
|
|
+ JS_SetSecurityCallbacks(cx, nullptr);
|
|
|
|
ok = js::Call(cx, calleev, thisv, invokeArgs, &result);
|
|
|
|
+ JS_SetSecurityCallbacks(cx, securityCallbacks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 14:10:30 -07:00
|
|
|
diff --git a/js/src/vm/DateTime.cpp b/js/src/vm/DateTime.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index cf63b124f39223a1a42c322dcc0ad108947d54f5..9e3a7b757cbad57ee6cfe2254d0355f62f7c8662 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/js/src/vm/DateTime.cpp
|
|
|
|
+++ b/js/src/vm/DateTime.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -185,6 +185,11 @@ void js::DateTimeInfo::internalResetTimeZone(ResetTimeZoneMode mode) {
|
2020-04-01 14:10:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-04 11:26:20 -07:00
|
|
|
+void js::DateTimeInfo::internalSetTimeZoneOverride(std::string timeZone) {
|
2020-04-01 14:10:30 -07:00
|
|
|
+ timeZoneOverride_ = std::move(timeZone);
|
|
|
|
+ internalResetTimeZone(ResetTimeZoneMode::ResetEvenIfOffsetUnchanged);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void js::DateTimeInfo::updateTimeZone() {
|
|
|
|
MOZ_ASSERT(timeZoneStatus_ != TimeZoneStatus::Valid);
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -528,10 +533,24 @@ void js::ResetTimeZoneInternal(ResetTimeZoneMode mode) {
|
2020-04-01 14:10:30 -07:00
|
|
|
js::DateTimeInfo::resetTimeZone(mode);
|
|
|
|
}
|
|
|
|
|
2021-11-04 11:26:20 -07:00
|
|
|
+void js::SetTimeZoneOverrideInternal(std::string timeZone) {
|
2020-04-01 14:10:30 -07:00
|
|
|
+ auto guard = js::DateTimeInfo::instance->lock();
|
2021-11-04 11:26:20 -07:00
|
|
|
+ guard->internalSetTimeZoneOverride(timeZone);
|
2020-04-01 14:10:30 -07:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
JS_PUBLIC_API void JS::ResetTimeZone() {
|
|
|
|
js::ResetTimeZoneInternal(js::ResetTimeZoneMode::ResetEvenIfOffsetUnchanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
+JS_PUBLIC_API bool JS::SetTimeZoneOverride(const char* timeZoneId) {
|
2021-11-04 11:26:20 -07:00
|
|
|
+ if (!mozilla::intl::TimeZone::IsValidTimeZoneId(timeZoneId)) {
|
2020-04-01 14:10:30 -07:00
|
|
|
+ fprintf(stderr, "Invalid timezone id: %s\n", timeZoneId);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
2021-11-04 11:26:20 -07:00
|
|
|
+ js::SetTimeZoneOverrideInternal(std::string(timeZoneId));
|
2020-04-01 14:10:30 -07:00
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
2021-11-04 11:26:20 -07:00
|
|
|
#if JS_HAS_INTL_API
|
|
|
|
# if defined(XP_WIN)
|
|
|
|
static bool IsOlsonCompatibleWindowsTimeZoneId(std::string_view tz) {
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -749,6 +768,15 @@ static bool ReadTimeZoneLink(std::string_view tz,
|
2020-04-01 14:10:30 -07:00
|
|
|
|
|
|
|
void js::DateTimeInfo::internalResyncICUDefaultTimeZone() {
|
2021-11-04 11:26:20 -07:00
|
|
|
#if JS_HAS_INTL_API
|
|
|
|
+ if (!timeZoneOverride_.empty()) {
|
|
|
|
+ mozilla::Span<const char> tzid = mozilla::Span(timeZoneOverride_.data(), timeZoneOverride_.length());
|
2021-12-15 08:31:33 -08:00
|
|
|
+ auto result = mozilla::intl::TimeZone::SetDefaultTimeZone(tzid);
|
|
|
|
+ if (result.isErr()) {
|
|
|
|
+ fprintf(stderr, "ERROR: failed to setup default time zone\n");
|
|
|
|
+ }
|
2020-04-01 14:10:30 -07:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
2023-07-06 12:22:45 -07:00
|
|
|
// In the future we should not be setting a default ICU time zone at all,
|
|
|
|
// instead all accesses should go through the appropriate DateTimeInfo
|
|
|
|
// instance depending on the resist fingerprinting status. For now we return
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -760,7 +788,6 @@ void js::DateTimeInfo::internalResyncICUDefaultTimeZone() {
|
2023-07-06 12:22:45 -07:00
|
|
|
|
2021-11-04 11:26:20 -07:00
|
|
|
if (const char* tzenv = std::getenv("TZ")) {
|
|
|
|
std::string_view tz(tzenv);
|
|
|
|
-
|
|
|
|
mozilla::Span<const char> tzid;
|
2020-04-01 14:10:30 -07:00
|
|
|
|
2021-11-04 11:26:20 -07:00
|
|
|
# if defined(XP_WIN)
|
2020-04-01 14:10:30 -07:00
|
|
|
diff --git a/js/src/vm/DateTime.h b/js/src/vm/DateTime.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index e3cf82daa3749664aa8ced7e6553b8c6434dfec8..b45b49c4f3bbf12853c4afb12de21d99ac88d77b 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/js/src/vm/DateTime.h
|
|
|
|
+++ b/js/src/vm/DateTime.h
|
2023-07-06 12:22:45 -07:00
|
|
|
@@ -65,6 +65,8 @@ enum class ResetTimeZoneMode : bool {
|
2020-04-01 14:10:30 -07:00
|
|
|
*/
|
|
|
|
extern void ResetTimeZoneInternal(ResetTimeZoneMode mode);
|
|
|
|
|
2021-11-04 11:26:20 -07:00
|
|
|
+extern void SetTimeZoneOverrideInternal(std::string timeZone);
|
2020-04-01 14:10:30 -07:00
|
|
|
+
|
|
|
|
/**
|
2023-07-06 12:22:45 -07:00
|
|
|
* Stores date/time information, particularly concerning the current local
|
|
|
|
* time zone, and implements a small cache for daylight saving time offset
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -253,6 +255,7 @@ class DateTimeInfo {
|
2023-07-06 12:22:45 -07:00
|
|
|
private:
|
|
|
|
// The method below should only be called via js::ResetTimeZoneInternal().
|
2020-04-01 14:10:30 -07:00
|
|
|
friend void js::ResetTimeZoneInternal(ResetTimeZoneMode);
|
2021-11-04 11:26:20 -07:00
|
|
|
+ friend void js::SetTimeZoneOverrideInternal(std::string);
|
2020-04-01 14:10:30 -07:00
|
|
|
|
|
|
|
static void resetTimeZone(ResetTimeZoneMode mode) {
|
2023-07-06 12:22:45 -07:00
|
|
|
{
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -352,6 +355,8 @@ class DateTimeInfo {
|
2020-04-01 14:10:30 -07:00
|
|
|
JS::UniqueChars locale_;
|
|
|
|
JS::UniqueTwoByteChars standardName_;
|
|
|
|
JS::UniqueTwoByteChars daylightSavingsName_;
|
|
|
|
+
|
2021-11-04 11:26:20 -07:00
|
|
|
+ std::string timeZoneOverride_;
|
2020-04-01 14:10:30 -07:00
|
|
|
#else
|
|
|
|
// Restrict the data-time range to the minimum required time_t range as
|
|
|
|
// specified in POSIX. Most operating systems support 64-bit time_t
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -367,6 +372,8 @@ class DateTimeInfo {
|
2020-04-01 14:10:30 -07:00
|
|
|
|
|
|
|
void internalResetTimeZone(ResetTimeZoneMode mode);
|
|
|
|
|
2021-11-04 11:26:20 -07:00
|
|
|
+ void internalSetTimeZoneOverride(std::string timeZone);
|
2020-04-01 14:10:30 -07:00
|
|
|
+
|
|
|
|
void updateTimeZone();
|
|
|
|
|
|
|
|
void internalResyncICUDefaultTimeZone();
|
2022-08-01 14:40:23 -07:00
|
|
|
diff --git a/layout/base/GeometryUtils.cpp b/layout/base/GeometryUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 4bfd336ddcbee8004ac538ca7b7d8216d04a61c3..cd22351c4aeacea8afc9828972222aca1b3063bf 100644
|
2022-08-01 14:40:23 -07:00
|
|
|
--- a/layout/base/GeometryUtils.cpp
|
|
|
|
+++ b/layout/base/GeometryUtils.cpp
|
|
|
|
@@ -23,6 +23,7 @@
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
#include "nsCSSFrameConstructor.h"
|
|
|
|
#include "nsLayoutUtils.h"
|
|
|
|
+#include "ChildIterator.h"
|
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -265,10 +266,27 @@ static bool CheckFramesInSameTopLevelBrowsingContext(nsIFrame* aFrame1,
|
2022-08-01 14:40:23 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2025-02-28 13:23:18 +00:00
|
|
|
+static nsIFrame* GetFrameForNodeRecursive(nsINode* aNode,
|
|
|
|
+ const GeometryUtilsOptions& aOptions,
|
2022-08-01 14:40:23 -07:00
|
|
|
+ bool aRecurseWhenNoFrame) {
|
2025-02-28 13:23:18 +00:00
|
|
|
+ nsIFrame* frame = GetFrameForNode(aNode, aOptions);
|
2022-08-01 14:40:23 -07:00
|
|
|
+ if (!frame && aRecurseWhenNoFrame && aNode->IsContent()) {
|
|
|
|
+ dom::FlattenedChildIterator iter(aNode->AsContent());
|
|
|
|
+ for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
2025-02-28 13:23:18 +00:00
|
|
|
+ frame = GetFrameForNodeRecursive(child, aOptions, aRecurseWhenNoFrame);
|
2022-08-01 14:40:23 -07:00
|
|
|
+ if (frame) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return frame;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void GetBoxQuads(nsINode* aNode, const dom::BoxQuadOptions& aOptions,
|
2025-02-28 13:23:18 +00:00
|
|
|
nsTArray<RefPtr<DOMQuad>>& aResult, CallerType aCallerType,
|
2022-08-01 14:40:23 -07:00
|
|
|
ErrorResult& aRv) {
|
2025-02-28 13:23:18 +00:00
|
|
|
- nsIFrame* frame = GetFrameForNode(aNode, aOptions);
|
|
|
|
+ nsIFrame* frame =
|
|
|
|
+ GetFrameForNodeRecursive(aNode, aOptions, aOptions.mRecurseWhenNoFrame);
|
2022-08-01 14:40:23 -07:00
|
|
|
if (!frame) {
|
|
|
|
// No boxes to return
|
|
|
|
return;
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -281,7 +299,8 @@ void GetBoxQuads(nsINode* aNode, const dom::BoxQuadOptions& aOptions,
|
|
|
|
// EnsureFrameForTextNode call. We need to get the first frame again
|
2022-08-01 14:40:23 -07:00
|
|
|
// when that happens and re-check it.
|
|
|
|
if (!weakFrame.IsAlive()) {
|
2025-02-28 13:23:18 +00:00
|
|
|
- frame = GetFrameForNode(aNode, aOptions);
|
|
|
|
+ frame =
|
|
|
|
+ GetFrameForNodeRecursive(aNode, aOptions, aOptions.mRecurseWhenNoFrame);
|
2022-08-01 14:40:23 -07:00
|
|
|
if (!frame) {
|
|
|
|
// No boxes to return
|
|
|
|
return;
|
2022-06-02 09:04:04 -07:00
|
|
|
diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index c533494e49d59904b839ea770475ec726c4c897e..1da4eeb774dadb4e3463cbeb17d857ccb6ef76ea 100644
|
2022-06-02 09:04:04 -07:00
|
|
|
--- a/layout/base/PresShell.cpp
|
|
|
|
+++ b/layout/base/PresShell.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -11278,7 +11278,9 @@ bool PresShell::ComputeActiveness() const {
|
2022-06-02 09:04:04 -07:00
|
|
|
if (!browserChild->IsVisible()) {
|
|
|
|
MOZ_LOG(gLog, LogLevel::Debug,
|
|
|
|
(" > BrowserChild %p is not visible", browserChild));
|
2024-01-13 00:19:49 +01:00
|
|
|
- return false;
|
2022-06-02 09:04:04 -07:00
|
|
|
+ bool isActive;
|
|
|
|
+ root->GetDocShell()->GetForceActiveState(&isActive);
|
2024-01-13 00:19:49 +01:00
|
|
|
+ return isActive;
|
2022-06-02 09:04:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// If the browser is visible but just due to be preserving layers
|
2024-07-29 10:30:28 +02:00
|
|
|
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 1fba8697d48f35e20a69ff861f5da9689c6d6769..77d0de76f346c0563d9b74b667c8400e26a98694 100644
|
2024-07-29 10:30:28 +02:00
|
|
|
--- a/layout/base/nsLayoutUtils.cpp
|
|
|
|
+++ b/layout/base/nsLayoutUtils.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -708,6 +708,10 @@ bool nsLayoutUtils::AllowZoomingForDocument(
|
2024-07-29 10:30:28 +02:00
|
|
|
!aDocument->GetPresShell()->AsyncPanZoomEnabled()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /* Playwright: disable zooming as we don't support meta viewport tag */
|
|
|
|
+ if (1 == 1) return false;
|
|
|
|
+
|
|
|
|
// True if we allow zooming for all documents on this platform, or if we are
|
|
|
|
// in RDM.
|
|
|
|
BrowsingContext* bc = aDocument->GetBrowsingContext();
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -9709,6 +9713,9 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont,
|
2024-07-29 10:30:28 +02:00
|
|
|
|
|
|
|
/* static */
|
|
|
|
bool nsLayoutUtils::ShouldHandleMetaViewport(const Document* aDocument) {
|
|
|
|
+ /* Playwright: disable meta viewport handling since we don't require one */
|
|
|
|
+ if (1 == 1) return false;
|
|
|
|
+
|
|
|
|
BrowsingContext* bc = aDocument->GetBrowsingContext();
|
|
|
|
return StaticPrefs::dom_meta_viewport_enabled() || (bc && bc->InRDMPane());
|
|
|
|
}
|
2021-06-08 16:00:15 -07:00
|
|
|
diff --git a/layout/style/GeckoBindings.h b/layout/style/GeckoBindings.h
|
2025-01-22 09:56:34 -08:00
|
|
|
index acb5b24776c8591933d1abcbcc7b254cf2ceb4e4..191ddd1f43bd704294727555c3d5137d69c1460c 100644
|
2021-06-08 16:00:15 -07:00
|
|
|
--- a/layout/style/GeckoBindings.h
|
|
|
|
+++ b/layout/style/GeckoBindings.h
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -593,6 +593,7 @@ float Gecko_MediaFeatures_GetResolution(const mozilla::dom::Document*);
|
2021-06-08 16:00:15 -07:00
|
|
|
bool Gecko_MediaFeatures_PrefersReducedMotion(const mozilla::dom::Document*);
|
2023-07-06 12:22:45 -07:00
|
|
|
bool Gecko_MediaFeatures_PrefersReducedTransparency(
|
|
|
|
const mozilla::dom::Document*);
|
2021-06-08 16:00:15 -07:00
|
|
|
+bool Gecko_MediaFeatures_ForcedColors(const mozilla::dom::Document*);
|
|
|
|
mozilla::StylePrefersContrast Gecko_MediaFeatures_PrefersContrast(
|
|
|
|
const mozilla::dom::Document*);
|
|
|
|
mozilla::StylePrefersColorScheme Gecko_MediaFeatures_PrefersColorScheme(
|
2021-05-18 21:23:12 +02:00
|
|
|
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index ca382a3cfba8ce5839890d6e4cb3cf9789287e3b..b1f1b579d7609c6ab93cc0bc52417ea54ab4aeed 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/layout/style/nsMediaFeatures.cpp
|
|
|
|
+++ b/layout/style/nsMediaFeatures.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -264,11 +264,7 @@ bool Gecko_MediaFeatures_MatchesPlatform(StylePlatform aPlatform) {
|
2021-05-18 21:23:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Gecko_MediaFeatures_PrefersReducedMotion(const Document* aDocument) {
|
2023-08-10 14:41:33 -07:00
|
|
|
- if (aDocument->ShouldResistFingerprinting(
|
|
|
|
- RFPTarget::CSSPrefersReducedMotion)) {
|
2021-05-18 21:23:12 +02:00
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
|
|
|
|
+ return aDocument->PrefersReducedMotion();
|
|
|
|
}
|
|
|
|
|
2023-07-06 12:22:45 -07:00
|
|
|
bool Gecko_MediaFeatures_PrefersReducedTransparency(const Document* aDocument) {
|
2023-09-11 18:16:33 -07:00
|
|
|
diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 06acdc629c2b6ee0e29c50d8edc5a96d343b1ef2..6c263edf54117fd9cbf4a77abc396f1238730880 100644
|
2023-09-11 18:16:33 -07:00
|
|
|
--- a/netwerk/base/LoadInfo.cpp
|
|
|
|
+++ b/netwerk/base/LoadInfo.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -696,7 +696,8 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
|
2024-02-22 13:17:33 -08:00
|
|
|
rhs.mHasInjectedCookieForCookieBannerHandling),
|
2025-02-28 13:23:18 +00:00
|
|
|
mSchemelessInput(rhs.mSchemelessInput),
|
2025-01-22 09:56:34 -08:00
|
|
|
mHttpsUpgradeTelemetry(rhs.mHttpsUpgradeTelemetry),
|
|
|
|
- mIsNewWindowTarget(rhs.mIsNewWindowTarget) {
|
|
|
|
+ mIsNewWindowTarget(rhs.mIsNewWindowTarget),
|
2024-02-22 13:17:33 -08:00
|
|
|
+ mJugglerLoadIdentifier(rhs.mJugglerLoadIdentifier) {
|
|
|
|
}
|
2023-09-11 18:16:33 -07:00
|
|
|
|
|
|
|
LoadInfo::LoadInfo(
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -2515,4 +2516,16 @@ LoadInfo::SetSkipHTTPSUpgrade(bool aSkipHTTPSUpgrade) {
|
2023-09-11 18:16:33 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+LoadInfo::GetJugglerLoadIdentifier(uint64_t* aResult) {
|
|
|
|
+ *aResult = mJugglerLoadIdentifier;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+LoadInfo::SetJugglerLoadIdentifier(uint64_t aID) {
|
|
|
|
+ mJugglerLoadIdentifier = aID;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
} // namespace mozilla::net
|
|
|
|
diff --git a/netwerk/base/LoadInfo.h b/netwerk/base/LoadInfo.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index c78602f6b46c983aa4d96c5727ebbaf7e2c7d984..e292766a0f34306ea1101be4ecd8848764726bad 100644
|
2023-09-11 18:16:33 -07:00
|
|
|
--- a/netwerk/base/LoadInfo.h
|
|
|
|
+++ b/netwerk/base/LoadInfo.h
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -423,6 +423,8 @@ class LoadInfo final : public nsILoadInfo {
|
2025-01-22 09:56:34 -08:00
|
|
|
|
|
|
|
bool mIsNewWindowTarget = false;
|
|
|
|
bool mSkipHTTPSUpgrade = false;
|
2023-09-11 18:16:33 -07:00
|
|
|
+
|
|
|
|
+ uint64_t mJugglerLoadIdentifier = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// This is exposed solely for testing purposes and should not be used outside of
|
|
|
|
diff --git a/netwerk/base/TRRLoadInfo.cpp b/netwerk/base/TRRLoadInfo.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 5984a0a196615cca5544de052874cbb163a8233b..3617816a06651ae65c214ebd5f0affedc4d11390 100644
|
2023-09-11 18:16:33 -07:00
|
|
|
--- a/netwerk/base/TRRLoadInfo.cpp
|
|
|
|
+++ b/netwerk/base/TRRLoadInfo.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -936,5 +936,15 @@ TRRLoadInfo::GetFetchDestination(nsACString& aDestination) {
|
2023-09-11 18:16:33 -07:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+TRRLoadInfo::GetJugglerLoadIdentifier(uint64_t* aResult) {
|
|
|
|
+ return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+TRRLoadInfo::SetJugglerLoadIdentifier(uint64_t aResult) {
|
|
|
|
+ return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
diff --git a/netwerk/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl
|
2025-02-28 13:23:18 +00:00
|
|
|
index 50dfc8767a99eef5e8748d648995f3cd7cc81a73..32a171eac26376144482bc7d90e8662a0e719f47 100644
|
2023-09-11 18:16:33 -07:00
|
|
|
--- a/netwerk/base/nsILoadInfo.idl
|
|
|
|
+++ b/netwerk/base/nsILoadInfo.idl
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1616,4 +1616,6 @@ interface nsILoadInfo : nsISupports
|
2025-01-22 09:56:34 -08:00
|
|
|
* When true, this load will never be upgraded to HTTPS.
|
2023-09-11 18:16:33 -07:00
|
|
|
*/
|
2025-01-22 09:56:34 -08:00
|
|
|
[infallible] attribute boolean skipHTTPSUpgrade;
|
|
|
|
+
|
2023-09-11 18:16:33 -07:00
|
|
|
+ [infallible] attribute unsigned long long jugglerLoadIdentifier;
|
|
|
|
};
|
2020-11-13 14:56:27 -08:00
|
|
|
diff --git a/netwerk/base/nsINetworkInterceptController.idl b/netwerk/base/nsINetworkInterceptController.idl
|
2024-09-05 13:44:58 +02:00
|
|
|
index 7f91d2df6f8bb4020c75c132dc8f6bf26625fa1e..ba6569f4be8fc54ec96ee44d5de45a0904c077ba 100644
|
2020-11-13 14:56:27 -08:00
|
|
|
--- a/netwerk/base/nsINetworkInterceptController.idl
|
|
|
|
+++ b/netwerk/base/nsINetworkInterceptController.idl
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -59,6 +59,7 @@ interface nsIInterceptedChannel : nsISupports
|
|
|
|
* results in the resulting client not being controlled.
|
2020-11-13 14:56:27 -08:00
|
|
|
*/
|
2021-08-11 03:37:57 +03:00
|
|
|
void resetInterception(in boolean bypass);
|
2020-11-13 14:56:27 -08:00
|
|
|
+ void resetInterceptionWithURI(in nsIURI aURI);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the status and reason for the forthcoming synthesized response.
|
2023-09-11 18:16:33 -07:00
|
|
|
diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 8b392845d07f50dddf016770836107614b6b9753..b0817d1b660dbb2dd856daf30ec9ec0fcb3d2aeb 100644
|
2023-09-11 18:16:33 -07:00
|
|
|
--- a/netwerk/ipc/DocumentLoadListener.cpp
|
|
|
|
+++ b/netwerk/ipc/DocumentLoadListener.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -172,6 +172,7 @@ static auto CreateDocumentLoadInfo(CanonicalBrowsingContext* aBrowsingContext,
|
2024-09-30 05:14:45 -07:00
|
|
|
loadInfo->SetTextDirectiveUserActivation(
|
|
|
|
aLoadState->GetTextDirectiveUserActivation());
|
2023-09-11 18:16:33 -07:00
|
|
|
loadInfo->SetIsMetaRefresh(aLoadState->IsMetaRefresh());
|
|
|
|
+ loadInfo->SetJugglerLoadIdentifier(aLoadState->GetLoadIdentifier());
|
|
|
|
|
|
|
|
return loadInfo.forget();
|
|
|
|
}
|
2020-11-13 14:56:27 -08:00
|
|
|
diff --git a/netwerk/protocol/http/InterceptedHttpChannel.cpp b/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index b7c129dcc21cb5d5478765f6aa06ed047aee6de0..6f3881c002c5f6d3e48865d253515ffd4d24bcf6 100644
|
2020-11-13 14:56:27 -08:00
|
|
|
--- a/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
|
|
|
+++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -726,6 +726,14 @@ NS_IMPL_ISUPPORTS(ResetInterceptionHeaderVisitor, nsIHttpHeaderVisitor)
|
2023-01-23 11:29:48 -08:00
|
|
|
|
|
|
|
} // anonymous namespace
|
2020-11-13 14:56:27 -08:00
|
|
|
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+InterceptedHttpChannel::ResetInterceptionWithURI(nsIURI* aURI) {
|
|
|
|
+ if (aURI) {
|
|
|
|
+ mURI = aURI;
|
|
|
|
+ }
|
2021-08-11 03:37:57 +03:00
|
|
|
+ return ResetInterception(true);
|
2020-11-13 14:56:27 -08:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
NS_IMETHODIMP
|
2021-08-11 03:37:57 +03:00
|
|
|
InterceptedHttpChannel::ResetInterception(bool aBypass) {
|
2023-01-23 11:29:48 -08:00
|
|
|
INTERCEPTED_LOG(("InterceptedHttpChannel::ResetInterception [%p] bypass: %s",
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -1139,11 +1147,18 @@ InterceptedHttpChannel::OnStartRequest(nsIRequest* aRequest) {
|
2023-03-21 01:23:12 +00:00
|
|
|
GetCallback(mProgressSink);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Playwright: main requests in firefox do not have loading principal.
|
|
|
|
+ // As they are intercepted by Playwright, they don't have
|
|
|
|
+ // serviceWorkerTainting as well.
|
|
|
|
+ // Thus these asserts are wrong for Playwright world.
|
|
|
|
+ // Note: these checks were added in https://github.com/mozilla/gecko-dev/commit/92e2cdde79c11510c3e4192e1b6264d00398ed95
|
|
|
|
+ /*
|
|
|
|
MOZ_ASSERT_IF(!mLoadInfo->GetServiceWorkerTaintingSynthesized(),
|
|
|
|
mLoadInfo->GetLoadingPrincipal());
|
|
|
|
// No need to do ORB checks if these conditions hold.
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(mLoadInfo->GetServiceWorkerTaintingSynthesized() ||
|
|
|
|
mLoadInfo->GetLoadingPrincipal()->IsSystemPrincipal());
|
|
|
|
+ */
|
|
|
|
|
|
|
|
if (mPump && mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) {
|
|
|
|
mPump->PeekStream(CallTypeSniffers, static_cast<nsIChannel*>(this));
|
2020-03-05 17:20:07 -08:00
|
|
|
diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
index d05b06c3f9ddba3b40d5969730474eaf0d843cb1..9b2cc35c504e1044ac681c62c107f8feb6c16938 100644
|
2020-03-05 17:20:07 -08:00
|
|
|
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
|
|
|
|
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1334,6 +1334,10 @@ void nsHtml5TreeOpExecutor::UpdateReferrerInfoFromMeta(
|
2022-05-02 21:46:05 -06:00
|
|
|
void nsHtml5TreeOpExecutor::AddSpeculationCSP(const nsAString& aCSP) {
|
2020-03-05 17:20:07 -08:00
|
|
|
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
|
|
|
|
|
|
|
+ if (mDocShell && static_cast<nsDocShell*>(mDocShell.get())->IsBypassCSPEnabled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsIContentSecurityPolicy> preloadCsp = mDocument->GetPreloadCsp();
|
|
|
|
if (!preloadCsp) {
|
|
|
|
diff --git a/security/manager/ssl/nsCertOverrideService.cpp b/security/manager/ssl/nsCertOverrideService.cpp
|
2024-11-13 12:34:49 +01:00
|
|
|
index b2e328e7c7d7a89be34b84fd176c306a3620c77c..54f24b213bcdc78c702e15d4d45a3943bc082281 100644
|
2020-03-05 17:20:07 -08:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.cpp
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.cpp
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -439,7 +439,12 @@ nsCertOverrideService::HasMatchingOverride(
|
2020-03-31 17:32:50 -07:00
|
|
|
bool disableAllSecurityCheck = false;
|
|
|
|
{
|
|
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
- disableAllSecurityCheck = mDisableAllSecurityCheck;
|
2021-08-11 03:37:57 +03:00
|
|
|
+ if (aOriginAttributes.mUserContextId) {
|
2020-03-31 17:32:50 -07:00
|
|
|
+ disableAllSecurityCheck = mUserContextIdsWithDisabledSecurityChecks.has(
|
2021-08-11 03:37:57 +03:00
|
|
|
+ aOriginAttributes.mUserContextId);
|
2020-03-31 17:32:50 -07:00
|
|
|
+ } else {
|
|
|
|
+ disableAllSecurityCheck = mDisableAllSecurityCheck;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
if (disableAllSecurityCheck) {
|
2023-01-23 11:29:48 -08:00
|
|
|
*aIsTemporary = false;
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -651,14 +656,24 @@ static bool IsDebugger() {
|
2020-03-31 17:32:50 -07:00
|
|
|
|
2020-03-05 17:20:07 -08:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCertOverrideService::
|
2020-03-31 17:32:50 -07:00
|
|
|
- SetDisableAllSecurityChecksAndLetAttackersInterceptMyData(bool aDisable) {
|
2020-03-05 17:20:07 -08:00
|
|
|
- if (!(PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR") || IsDebugger())) {
|
2020-03-31 17:32:50 -07:00
|
|
|
+ SetDisableAllSecurityChecksAndLetAttackersInterceptMyData(
|
|
|
|
+ bool aDisable, uint32_t aUserContextId) {
|
2020-03-05 17:20:07 -08:00
|
|
|
+ if (false /* juggler hacks */ && !(PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR") || IsDebugger())) {
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
2021-08-11 03:37:57 +03:00
|
|
|
{
|
|
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
- mDisableAllSecurityCheck = aDisable;
|
|
|
|
+ if (aUserContextId) {
|
|
|
|
+ if (aDisable) {
|
|
|
|
+ mozilla::Unused << mUserContextIdsWithDisabledSecurityChecks.put(aUserContextId);
|
|
|
|
+ } else {
|
|
|
|
+ mUserContextIdsWithDisabledSecurityChecks.remove(aUserContextId);
|
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
2020-03-31 17:32:50 -07:00
|
|
|
+ } else {
|
2021-08-11 03:37:57 +03:00
|
|
|
+ mDisableAllSecurityCheck = aDisable;
|
2020-03-31 17:32:50 -07:00
|
|
|
+ }
|
2021-08-11 03:37:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsINSSComponent> nss(do_GetService(PSM_COMPONENT_CONTRACTID));
|
2020-03-31 17:32:50 -07:00
|
|
|
diff --git a/security/manager/ssl/nsCertOverrideService.h b/security/manager/ssl/nsCertOverrideService.h
|
2023-09-11 18:16:33 -07:00
|
|
|
index 21cff56300db6490cf9649aa62099cb5525749b3..ce9a7fc16c2d5980be166e0f4ab9a25df300ca2f 100644
|
2020-03-31 17:32:50 -07:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.h
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.h
|
2023-09-11 18:16:33 -07:00
|
|
|
@@ -118,6 +118,7 @@ class nsCertOverrideService final : public nsICertOverrideService,
|
2022-07-05 08:20:01 -07:00
|
|
|
|
|
|
|
mozilla::Mutex mMutex;
|
2023-01-23 11:29:48 -08:00
|
|
|
bool mDisableAllSecurityCheck MOZ_GUARDED_BY(mMutex);
|
|
|
|
+ mozilla::HashSet<uint32_t> mUserContextIdsWithDisabledSecurityChecks MOZ_GUARDED_BY(mMutex);
|
|
|
|
nsCOMPtr<nsIFile> mSettingsFile MOZ_GUARDED_BY(mMutex);
|
|
|
|
nsTHashtable<nsCertOverrideEntry> mSettingsTable MOZ_GUARDED_BY(mMutex);
|
2022-07-05 08:20:01 -07:00
|
|
|
|
2020-03-31 17:32:50 -07:00
|
|
|
diff --git a/security/manager/ssl/nsICertOverrideService.idl b/security/manager/ssl/nsICertOverrideService.idl
|
2023-09-11 18:16:33 -07:00
|
|
|
index 6dfd07d6b676a99993408921de8dea9d561f201d..e3c6794363cd6336effbeac83a179f3796dd71b0 100644
|
2020-03-31 17:32:50 -07:00
|
|
|
--- a/security/manager/ssl/nsICertOverrideService.idl
|
|
|
|
+++ b/security/manager/ssl/nsICertOverrideService.idl
|
2023-09-11 18:16:33 -07:00
|
|
|
@@ -137,7 +137,9 @@ interface nsICertOverrideService : nsISupports {
|
2020-03-31 17:32:50 -07:00
|
|
|
* @param aDisable If true, disable all security check and make
|
|
|
|
* hasMatchingOverride always return true.
|
|
|
|
*/
|
|
|
|
- void setDisableAllSecurityChecksAndLetAttackersInterceptMyData(in boolean aDisable);
|
|
|
|
+ void setDisableAllSecurityChecksAndLetAttackersInterceptMyData(
|
|
|
|
+ in boolean aDisable,
|
|
|
|
+ [optional] in uint32_t aUserContextId);
|
2021-08-11 03:37:57 +03:00
|
|
|
|
|
|
|
readonly attribute boolean securityCheckDisabled;
|
2020-03-31 17:32:50 -07:00
|
|
|
};
|
2023-08-10 14:41:33 -07:00
|
|
|
diff --git a/services/settings/Utils.sys.mjs b/services/settings/Utils.sys.mjs
|
2025-01-22 09:56:34 -08:00
|
|
|
index 12fef6cde815a9301944c399a58f27a7e4c4d5d7..0f7f06d1002a089547d1b15d7d8ddf264f28b529 100644
|
2023-08-10 14:41:33 -07:00
|
|
|
--- a/services/settings/Utils.sys.mjs
|
|
|
|
+++ b/services/settings/Utils.sys.mjs
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -97,7 +97,7 @@ const _cdnURLs = {};
|
2022-05-02 21:46:05 -06:00
|
|
|
|
2023-08-10 14:41:33 -07:00
|
|
|
export var Utils = {
|
2022-05-02 21:46:05 -06:00
|
|
|
get SERVER_URL() {
|
2022-07-29 05:47:00 -07:00
|
|
|
- return lazy.allowServerURLOverride
|
|
|
|
+ return true || lazy.allowServerURLOverride
|
|
|
|
? lazy.gServerURL
|
2022-07-05 08:20:01 -07:00
|
|
|
: AppConstants.REMOTE_SETTINGS_SERVER_URL;
|
2022-05-02 21:46:05 -06:00
|
|
|
},
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -110,6 +110,9 @@ export var Utils = {
|
2024-04-29 17:03:40 -07:00
|
|
|
log,
|
|
|
|
|
|
|
|
get shouldSkipRemoteActivityDueToTests() {
|
|
|
|
+ // Playwright does not set Cu.isInAutomation, hence we just return true
|
|
|
|
+ // here in order to disable the remote activity.
|
|
|
|
+ return true;
|
|
|
|
return (
|
|
|
|
(lazy.isRunningTests || Cu.isInAutomation) &&
|
|
|
|
this.SERVER_URL == "data:,#remote-settings-dummy/v1"
|
2020-09-30 00:36:46 -07:00
|
|
|
diff --git a/toolkit/components/browser/nsIWebBrowserChrome.idl b/toolkit/components/browser/nsIWebBrowserChrome.idl
|
2024-09-30 05:14:45 -07:00
|
|
|
index 75555352b8a15a50e4a21e34fc8ede4e9246c7cc..72855a404effa42b6c55cd0c2fcb8bdd6c2b3f9f 100644
|
2020-09-30 00:36:46 -07:00
|
|
|
--- a/toolkit/components/browser/nsIWebBrowserChrome.idl
|
|
|
|
+++ b/toolkit/components/browser/nsIWebBrowserChrome.idl
|
2024-03-26 15:01:07 -07:00
|
|
|
@@ -74,6 +74,9 @@ interface nsIWebBrowserChrome : nsISupports
|
2020-09-30 00:36:46 -07:00
|
|
|
// Whether this window should use out-of-process cross-origin subframes.
|
2024-03-26 15:01:07 -07:00
|
|
|
const unsigned long CHROME_FISSION_WINDOW = 1 << 21;
|
2020-09-30 00:36:46 -07:00
|
|
|
|
|
|
|
+ // Whether this window has "width" or "height" defined in features
|
|
|
|
+ const unsigned long JUGGLER_WINDOW_EXPLICIT_SIZE = 0x00400000;
|
|
|
|
+
|
|
|
|
// Prevents new window animations on MacOS and Windows. Currently
|
|
|
|
// ignored for Linux.
|
2024-03-26 15:01:07 -07:00
|
|
|
const unsigned long CHROME_SUPPRESS_ANIMATION = 1 << 24;
|
2023-01-23 11:29:48 -08:00
|
|
|
diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
|
2025-02-28 13:23:18 +00:00
|
|
|
index 8b975a8b11bcf2eabbb7fa51a431ff99ff69a5bc..0eeb5924c43a21b8561dd4b68fa89228ddcbc708 100644
|
2023-01-23 11:29:48 -08:00
|
|
|
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
|
|
|
|
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
|
2023-11-14 10:18:18 -08:00
|
|
|
@@ -108,6 +108,12 @@ EnterprisePoliciesManager.prototype = {
|
2021-08-25 10:26:20 -04:00
|
|
|
Services.prefs.clearUserPref(PREF_POLICIES_APPLIED);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Playwright: Disable enterprise policies
|
|
|
|
+ if (true) {
|
|
|
|
+ this.status = Ci.nsIEnterprisePolicies.INACTIVE;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
let provider = this._chooseProvider();
|
|
|
|
|
|
|
|
if (provider.failed) {
|
2024-09-05 13:44:58 +02:00
|
|
|
diff --git a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 77496e700eebbf286e8c5175ea1f77f8576fde1f..3d13e9b316284eaef5d4c82087117020ca8aba71 100644
|
2024-09-05 13:44:58 +02:00
|
|
|
--- a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp
|
|
|
|
+++ b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -488,7 +488,7 @@ void PopulateLanguages() {
|
2024-09-05 13:44:58 +02:00
|
|
|
// sufficient to only collect this information as the other properties are
|
|
|
|
// just reformats of Navigator::GetAcceptLanguages.
|
|
|
|
nsTArray<nsString> languages;
|
|
|
|
- dom::Navigator::GetAcceptLanguages(languages);
|
|
|
|
+ dom::Navigator::GetAcceptLanguages(nullptr, languages);
|
|
|
|
nsCString output = "["_ns;
|
|
|
|
|
|
|
|
for (const auto& language : languages) {
|
2020-03-24 20:51:21 -07:00
|
|
|
diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 9297e5eacd65658289dda764ad39e182c22d192b..15926f106850637a5bbd27e56834dc5c82791250 100644
|
2020-03-24 20:51:21 -07:00
|
|
|
--- a/toolkit/components/startup/nsAppStartup.cpp
|
|
|
|
+++ b/toolkit/components/startup/nsAppStartup.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -365,7 +365,7 @@ nsAppStartup::Quit(uint32_t aMode, int aExitCode, bool* aUserAllowedQuit) {
|
2020-03-24 20:51:21 -07:00
|
|
|
nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
|
|
|
|
nsCOMPtr<nsIWindowMediator> mediator(
|
|
|
|
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
|
|
|
|
- if (mediator) {
|
|
|
|
+ if (ferocity != eForceQuit && mediator) {
|
|
|
|
mediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator));
|
|
|
|
if (windowEnumerator) {
|
|
|
|
bool more;
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
index 654903fadb709be976b72f36f155e23bc0622152..815b3dc24c9fda6b1db6c4666ac68904c87ac0ab 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
|
|
|
|
+++ b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -174,8 +174,8 @@ nsBrowserStatusFilter::OnStateChange(nsIWebProgress* aWebProgress,
|
2019-11-18 18:18:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
-nsBrowserStatusFilter::OnProgressChange(nsIWebProgress* aWebProgress,
|
|
|
|
- nsIRequest* aRequest,
|
|
|
|
+nsBrowserStatusFilter::OnProgressChange(nsIWebProgress *aWebProgress,
|
|
|
|
+ nsIRequest *aRequest,
|
|
|
|
int32_t aCurSelfProgress,
|
|
|
|
int32_t aMaxSelfProgress,
|
|
|
|
int32_t aCurTotalProgress,
|
2020-09-30 00:36:46 -07:00
|
|
|
diff --git a/toolkit/components/windowwatcher/nsWindowWatcher.cpp b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
index 585a957fd8a1467dc262bd1ca2058584fd8762c9..16ad38c3b7d753c386e091af700d1bebd4c59e3e 100644
|
2020-09-30 00:36:46 -07:00
|
|
|
--- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
|
|
|
+++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1875,7 +1875,11 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForContent(
|
2020-09-30 00:36:46 -07:00
|
|
|
|
2022-01-18 04:16:04 -07:00
|
|
|
// Open a minimal popup.
|
|
|
|
*aIsPopupRequested = true;
|
|
|
|
- return nsIWebBrowserChrome::CHROME_MINIMAL_POPUP;
|
|
|
|
+ uint32_t chromeFlags = 0;
|
2020-09-30 00:36:46 -07:00
|
|
|
+ if (aFeatures.Exists("width") || aFeatures.Exists("height")) {
|
|
|
|
+ chromeFlags |= nsIWebBrowserChrome::JUGGLER_WINDOW_EXPLICIT_SIZE;
|
|
|
|
+ }
|
2022-01-18 04:16:04 -07:00
|
|
|
+ return chromeFlags | nsIWebBrowserChrome::CHROME_MINIMAL_POPUP;
|
2020-09-30 00:36:46 -07:00
|
|
|
}
|
|
|
|
|
2022-01-18 04:16:04 -07:00
|
|
|
/**
|
2023-07-06 12:22:45 -07:00
|
|
|
diff --git a/toolkit/mozapps/update/UpdateService.sys.mjs b/toolkit/mozapps/update/UpdateService.sys.mjs
|
2025-02-28 13:23:18 +00:00
|
|
|
index eeec31f4d77de0f9622692eeb761392ed54b90ad..8907773fb6212f4e9cc184f87b840c91a0db67b6 100644
|
2023-07-06 12:22:45 -07:00
|
|
|
--- a/toolkit/mozapps/update/UpdateService.sys.mjs
|
|
|
|
+++ b/toolkit/mozapps/update/UpdateService.sys.mjs
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -3811,6 +3811,8 @@ export class UpdateService {
|
2024-09-05 13:44:58 +02:00
|
|
|
}
|
2020-03-22 23:52:59 -07:00
|
|
|
|
2021-07-14 08:26:43 -08:00
|
|
|
get disabledForTesting() {
|
2023-07-06 12:22:45 -07:00
|
|
|
+ /* playwright */
|
2022-06-29 04:46:49 -07:00
|
|
|
+ return true;
|
2024-09-05 13:44:58 +02:00
|
|
|
return lazy.UpdateServiceStub.updateDisabledForTesting;
|
|
|
|
}
|
|
|
|
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
|
2025-02-28 13:23:18 +00:00
|
|
|
index c50b7f3932e18da9fad4b673e353974a001e78c4..708e0d75594ddcd62276d4e08c4bd5c64d7f0698 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/toolkit/toolkit.mozbuild
|
|
|
|
+++ b/toolkit/toolkit.mozbuild
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -152,6 +152,7 @@ if CONFIG["ENABLE_WEBDRIVER"]:
|
2024-03-26 15:01:07 -07:00
|
|
|
"/remote",
|
|
|
|
"/testing/firefox-ui",
|
|
|
|
"/testing/marionette",
|
|
|
|
+ "/juggler",
|
|
|
|
"/toolkit/components/telemetry/tests/marionette",
|
2019-11-18 18:18:28 -08:00
|
|
|
]
|
|
|
|
|
2025-01-22 09:56:34 -08:00
|
|
|
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index 795fc8669cc6f03a57139745f58963ffefe5aeff..46651bb0b53be9a522e1deb90140bf386a9f8b51 100644
|
2025-01-22 09:56:34 -08:00
|
|
|
--- a/toolkit/xre/nsAppRunner.cpp
|
|
|
|
+++ b/toolkit/xre/nsAppRunner.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -5633,7 +5633,10 @@ nsresult XREMain::XRE_mainRun() {
|
2025-01-22 09:56:34 -08:00
|
|
|
|
|
|
|
if (!AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
|
|
|
|
#ifdef XP_MACOSX
|
|
|
|
- if (!BackgroundTasks::IsBackgroundTaskMode()) {
|
|
|
|
+# if defined(MOZ_BACKGROUNDTASKS)
|
|
|
|
+ if (!BackgroundTasks::IsBackgroundTaskMode())
|
|
|
|
+# endif // defined(MOZ_BACKGROUNDTASKS)
|
|
|
|
+ {
|
|
|
|
rv = appStartup->CreateHiddenWindow();
|
|
|
|
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
|
|
|
}
|
browser(firefox): properly initialize debugging pipe on windows (#5514)
browser(firefox): properly initialize debugging pipe on windows
Firefox on Windows has 2 launch modes:
- default: a special "launcher process" is used to start browser as a
sub-process
- non-default: browser process starts right away
Firefox has a logic to detect how successful was the use of the
launcher process to do self-recovery when things go wrong. Namely:
- when attempting to use launcher process, firefox records a timestamp
of the attempt beginning
- once the launcher process successfully launches browser sub-process,
firefox records another timestamp of the completion
On a new launch, firefox checks what timestamps are present. If there's
a timestamp that signifies start of launcher process, but no successful
timestamp, it decides that last "launcher process" use was not
successful and falls back to launching browser right away.
When launching 2 firefox processes right away, the first process
uses attempts to use launcher process and records the first timestamp.
At the same time, the second instance sees the first timestamp and
doesn't see the second timestamp, and falls back to launching browser
right away. Our debugging pipe code, however, does not support
non-launcher-process code path.
This patch adds support for remote debugging pipe in case of
non-launcher-process startup.
Drive-by:
- disable crashreporter altogether
- remove stray dcheck that breaks firefox debug compilation
- disable compilation of firefox update agent
- do not use WIN32_DISTRIB flag unless doing full builds since
it kills incremental compilation
References #4660
2021-02-19 10:32:47 -08:00
|
|
|
diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp
|
2024-07-29 10:30:28 +02:00
|
|
|
index 7eb9e1104682d4eb47060654f43a1efa8b2a6bb2..a8315d6decf654b5302bea5beeea34140c300ded 100644
|
browser(firefox): properly initialize debugging pipe on windows (#5514)
browser(firefox): properly initialize debugging pipe on windows
Firefox on Windows has 2 launch modes:
- default: a special "launcher process" is used to start browser as a
sub-process
- non-default: browser process starts right away
Firefox has a logic to detect how successful was the use of the
launcher process to do self-recovery when things go wrong. Namely:
- when attempting to use launcher process, firefox records a timestamp
of the attempt beginning
- once the launcher process successfully launches browser sub-process,
firefox records another timestamp of the completion
On a new launch, firefox checks what timestamps are present. If there's
a timestamp that signifies start of launcher process, but no successful
timestamp, it decides that last "launcher process" use was not
successful and falls back to launching browser right away.
When launching 2 firefox processes right away, the first process
uses attempts to use launcher process and records the first timestamp.
At the same time, the second instance sees the first timestamp and
doesn't see the second timestamp, and falls back to launching browser
right away. Our debugging pipe code, however, does not support
non-launcher-process code path.
This patch adds support for remote debugging pipe in case of
non-launcher-process startup.
Drive-by:
- disable crashreporter altogether
- remove stray dcheck that breaks firefox debug compilation
- disable compilation of firefox update agent
- do not use WIN32_DISTRIB flag unless doing full builds since
it kills incremental compilation
References #4660
2021-02-19 10:32:47 -08:00
|
|
|
--- a/toolkit/xre/nsWindowsWMain.cpp
|
|
|
|
+++ b/toolkit/xre/nsWindowsWMain.cpp
|
2023-11-14 10:18:18 -08:00
|
|
|
@@ -14,8 +14,10 @@
|
browser(firefox): properly initialize debugging pipe on windows (#5514)
browser(firefox): properly initialize debugging pipe on windows
Firefox on Windows has 2 launch modes:
- default: a special "launcher process" is used to start browser as a
sub-process
- non-default: browser process starts right away
Firefox has a logic to detect how successful was the use of the
launcher process to do self-recovery when things go wrong. Namely:
- when attempting to use launcher process, firefox records a timestamp
of the attempt beginning
- once the launcher process successfully launches browser sub-process,
firefox records another timestamp of the completion
On a new launch, firefox checks what timestamps are present. If there's
a timestamp that signifies start of launcher process, but no successful
timestamp, it decides that last "launcher process" use was not
successful and falls back to launching browser right away.
When launching 2 firefox processes right away, the first process
uses attempts to use launcher process and records the first timestamp.
At the same time, the second instance sees the first timestamp and
doesn't see the second timestamp, and falls back to launching browser
right away. Our debugging pipe code, however, does not support
non-launcher-process code path.
This patch adds support for remote debugging pipe in case of
non-launcher-process startup.
Drive-by:
- disable crashreporter altogether
- remove stray dcheck that breaks firefox debug compilation
- disable compilation of firefox update agent
- do not use WIN32_DISTRIB flag unless doing full builds since
it kills incremental compilation
References #4660
2021-02-19 10:32:47 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "mozilla/Char16.h"
|
|
|
|
+#include "mozilla/CmdLineAndEnvUtils.h"
|
|
|
|
#include "nsUTF8Utils.h"
|
|
|
|
|
|
|
|
+#include <io.h>
|
|
|
|
#include <windows.h>
|
|
|
|
|
2023-11-14 10:18:18 -08:00
|
|
|
#ifdef __MINGW32__
|
2024-07-29 10:30:28 +02:00
|
|
|
@@ -114,6 +116,19 @@ static void FreeAllocStrings(int argc, char** argv) {
|
|
|
|
int wmain(int argc, WCHAR** argv) {
|
browser(firefox): properly initialize debugging pipe on windows (#5514)
browser(firefox): properly initialize debugging pipe on windows
Firefox on Windows has 2 launch modes:
- default: a special "launcher process" is used to start browser as a
sub-process
- non-default: browser process starts right away
Firefox has a logic to detect how successful was the use of the
launcher process to do self-recovery when things go wrong. Namely:
- when attempting to use launcher process, firefox records a timestamp
of the attempt beginning
- once the launcher process successfully launches browser sub-process,
firefox records another timestamp of the completion
On a new launch, firefox checks what timestamps are present. If there's
a timestamp that signifies start of launcher process, but no successful
timestamp, it decides that last "launcher process" use was not
successful and falls back to launching browser right away.
When launching 2 firefox processes right away, the first process
uses attempts to use launcher process and records the first timestamp.
At the same time, the second instance sees the first timestamp and
doesn't see the second timestamp, and falls back to launching browser
right away. Our debugging pipe code, however, does not support
non-launcher-process code path.
This patch adds support for remote debugging pipe in case of
non-launcher-process startup.
Drive-by:
- disable crashreporter altogether
- remove stray dcheck that breaks firefox debug compilation
- disable compilation of firefox update agent
- do not use WIN32_DISTRIB flag unless doing full builds since
it kills incremental compilation
References #4660
2021-02-19 10:32:47 -08:00
|
|
|
SanitizeEnvironmentVariables();
|
|
|
|
SetDllDirectoryW(L"");
|
|
|
|
+ bool hasJugglerPipe =
|
2023-01-23 11:29:48 -08:00
|
|
|
+ mozilla::CheckArg(argc, argv, "juggler-pipe", nullptr,
|
browser(firefox): properly initialize debugging pipe on windows (#5514)
browser(firefox): properly initialize debugging pipe on windows
Firefox on Windows has 2 launch modes:
- default: a special "launcher process" is used to start browser as a
sub-process
- non-default: browser process starts right away
Firefox has a logic to detect how successful was the use of the
launcher process to do self-recovery when things go wrong. Namely:
- when attempting to use launcher process, firefox records a timestamp
of the attempt beginning
- once the launcher process successfully launches browser sub-process,
firefox records another timestamp of the completion
On a new launch, firefox checks what timestamps are present. If there's
a timestamp that signifies start of launcher process, but no successful
timestamp, it decides that last "launcher process" use was not
successful and falls back to launching browser right away.
When launching 2 firefox processes right away, the first process
uses attempts to use launcher process and records the first timestamp.
At the same time, the second instance sees the first timestamp and
doesn't see the second timestamp, and falls back to launching browser
right away. Our debugging pipe code, however, does not support
non-launcher-process code path.
This patch adds support for remote debugging pipe in case of
non-launcher-process startup.
Drive-by:
- disable crashreporter altogether
- remove stray dcheck that breaks firefox debug compilation
- disable compilation of firefox update agent
- do not use WIN32_DISTRIB flag unless doing full builds since
it kills incremental compilation
References #4660
2021-02-19 10:32:47 -08:00
|
|
|
+ mozilla::CheckArgFlag::None) == mozilla::ARG_FOUND;
|
|
|
|
+ if (hasJugglerPipe && !mozilla::EnvHasValue("PW_PIPE_READ")) {
|
|
|
|
+ intptr_t stdio3 = _get_osfhandle(3);
|
|
|
|
+ intptr_t stdio4 = _get_osfhandle(4);
|
|
|
|
+ CHAR stdio3str[20];
|
|
|
|
+ CHAR stdio4str[20];
|
|
|
|
+ itoa(stdio3, stdio3str, 10);
|
|
|
|
+ itoa(stdio4, stdio4str, 10);
|
|
|
|
+ SetEnvironmentVariableA("PW_PIPE_READ", stdio3str);
|
|
|
|
+ SetEnvironmentVariableA("PW_PIPE_WRITE", stdio4str);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// Only run this code if LauncherProcessWin.h was included beforehand, thus
|
|
|
|
// signalling that the hosting process should support launcher mode.
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index e5cc386651e192710b61858ab5625c97a02b92da..e560ad4fef232a26ce1e1b244f4ccea05f4aea71 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/uriloader/base/nsDocLoader.cpp
|
|
|
|
+++ b/uriloader/base/nsDocLoader.cpp
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -812,6 +812,12 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout,
|
2024-03-26 15:01:07 -07:00
|
|
|
("DocLoader:%p: Firing load event for document.open\n",
|
|
|
|
this));
|
|
|
|
|
|
|
|
+ nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
|
|
+ if (os) {
|
|
|
|
+ nsIPrincipal* principal = doc->NodePrincipal();
|
|
|
|
+ if (!principal->IsSystemPrincipal())
|
|
|
|
+ os->NotifyObservers(ToSupports(doc), "juggler-document-open-loaded", nullptr);
|
|
|
|
+ }
|
|
|
|
// This is a very cut-down version of
|
|
|
|
// nsDocumentViewer::LoadComplete that doesn't do various things
|
|
|
|
// that are not relevant here because this wasn't an actual
|
2020-04-06 23:34:30 -07:00
|
|
|
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index c4dc15918032a34d8be9f1cda94a9375466980f6..20756dc9166f9665d408cd007e9df55b5937b73c 100644
|
2020-04-06 23:34:30 -07:00
|
|
|
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
|
|
|
|
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -112,6 +112,7 @@
|
2020-04-06 23:34:30 -07:00
|
|
|
|
|
|
|
#include "mozilla/Components.h"
|
|
|
|
#include "mozilla/ClearOnShutdown.h"
|
|
|
|
+#include "mozilla/ErrorNames.h"
|
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
#include "mozilla/ipc/URIUtils.h"
|
|
|
|
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -864,6 +865,12 @@ NS_IMETHODIMP nsExternalHelperAppService::ApplyDecodingForExtension(
|
2020-04-06 23:34:30 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
+NS_IMETHODIMP nsExternalHelperAppService::SetDownloadInterceptor(
|
|
|
|
+ nsIDownloadInterceptor* interceptor) {
|
|
|
|
+ mInterceptor = interceptor;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
nsresult nsExternalHelperAppService::GetFileTokenForPath(
|
|
|
|
const char16_t* aPlatformAppPath, nsIFile** aFile) {
|
|
|
|
nsDependentString platformAppPath(aPlatformAppPath);
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1485,7 +1492,12 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel* aChannel) {
|
2020-04-06 23:34:30 -07:00
|
|
|
// Strip off the ".part" from mTempLeafName
|
2025-02-28 13:23:18 +00:00
|
|
|
mTempLeafName.Truncate(mTempLeafName.Length() - std::size(".part") + 1);
|
2020-04-06 23:34:30 -07:00
|
|
|
|
|
|
|
+ return CreateSaverForTempFile();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+nsresult nsExternalAppHandler::CreateSaverForTempFile() {
|
|
|
|
MOZ_ASSERT(!mSaver, "Output file initialization called more than once!");
|
|
|
|
+ nsresult rv;
|
|
|
|
mSaver =
|
|
|
|
do_CreateInstance(NS_BACKGROUNDFILESAVERSTREAMLISTENER_CONTRACTID, &rv);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1671,7 +1683,36 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
2020-04-06 23:34:30 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
- rv = SetUpTempFile(aChannel);
|
|
|
|
+ bool isIntercepted = false;
|
|
|
|
+ nsCOMPtr<nsIDownloadInterceptor> interceptor = mExtProtSvc->mInterceptor;
|
|
|
|
+ if (interceptor) {
|
|
|
|
+ nsCOMPtr<nsIFile> fileToUse;
|
2020-04-23 14:26:00 -07:00
|
|
|
+ rv = interceptor->InterceptDownloadRequest(this, request, mBrowsingContext, getter_AddRefs(fileToUse), &isIntercepted);
|
2020-04-06 23:34:30 -07:00
|
|
|
+ if (!NS_SUCCEEDED(rv)) {
|
|
|
|
+ LOG((" failed to call nsIDowloadInterceptor.interceptDownloadRequest"));
|
|
|
|
+ return rv;
|
|
|
|
+ }
|
|
|
|
+ if (isIntercepted) {
|
|
|
|
+ LOG((" request interceped by nsIDowloadInterceptor"));
|
|
|
|
+ if (fileToUse) {
|
|
|
|
+ mTempFile = fileToUse;
|
|
|
|
+ rv = mTempFile->GetLeafName(mTempLeafName);
|
|
|
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+ } else {
|
|
|
|
+ Cancel(NS_BINDING_ABORTED);
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Temp file is the final destination when download is intercepted. In that
|
|
|
|
+ // case we only need to create saver (and not create transfer later). Not creating
|
|
|
|
+ // mTransfer also cuts off all downloads handling logic in the js compoenents and
|
|
|
|
+ // browser UI.
|
|
|
|
+ if (isIntercepted)
|
|
|
|
+ rv = CreateSaverForTempFile();
|
|
|
|
+ else
|
|
|
|
+ rv = SetUpTempFile(aChannel);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
nsresult transferError = rv;
|
|
|
|
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -1732,6 +1773,9 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
2020-08-12 10:09:20 -07:00
|
|
|
|
2021-12-07 11:53:17 -08:00
|
|
|
bool alwaysAsk = true;
|
|
|
|
mMimeInfo->GetAlwaysAskBeforeHandling(&alwaysAsk);
|
2020-04-06 23:34:30 -07:00
|
|
|
+ if (isIntercepted) {
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
if (alwaysAsk) {
|
|
|
|
// But we *don't* ask if this mimeInfo didn't come from
|
|
|
|
// our user configuration datastore and the user has said
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -2248,6 +2292,16 @@ nsExternalAppHandler::OnSaveComplete(nsIBackgroundFileSaver* aSaver,
|
2020-04-06 23:34:30 -07:00
|
|
|
NotifyTransfer(aStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (!mCanceled) {
|
|
|
|
+ nsCOMPtr<nsIDownloadInterceptor> interceptor = mExtProtSvc->mInterceptor;
|
|
|
|
+ if (interceptor) {
|
|
|
|
+ nsCString noError;
|
|
|
|
+ nsresult rv = interceptor->OnDownloadComplete(this, noError);
|
|
|
|
+ MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed to call nsIDowloadInterceptor.OnDownloadComplete");
|
2020-07-02 10:43:04 -07:00
|
|
|
+ Unused << rv;
|
2020-04-06 23:34:30 -07:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -2731,6 +2785,15 @@ NS_IMETHODIMP nsExternalAppHandler::Cancel(nsresult aReason) {
|
2020-04-06 23:34:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ nsCOMPtr<nsIDownloadInterceptor> interceptor = mExtProtSvc->mInterceptor;
|
|
|
|
+ if (interceptor) {
|
|
|
|
+ nsCString errorName;
|
|
|
|
+ GetErrorName(aReason, errorName);
|
|
|
|
+ nsresult rv = interceptor->OnDownloadComplete(this, errorName);
|
|
|
|
+ MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed notify nsIDowloadInterceptor about cancel");
|
2020-07-02 10:43:04 -07:00
|
|
|
+ Unused << rv;
|
2020-04-06 23:34:30 -07:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Break our reference cycle with the helper app dialog (set up in
|
|
|
|
// OnStartRequest)
|
|
|
|
mDialog = nullptr;
|
|
|
|
diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h
|
2025-01-22 09:56:34 -08:00
|
|
|
index 2dd4ff87bda3e0ba395cca168c42b37db1713ddf..83e8a3d328e325b3f50f593c9ea71692f9c7d401 100644
|
2020-04-06 23:34:30 -07:00
|
|
|
--- a/uriloader/exthandler/nsExternalHelperAppService.h
|
|
|
|
+++ b/uriloader/exthandler/nsExternalHelperAppService.h
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -258,6 +258,8 @@ class nsExternalHelperAppService : public nsIExternalHelperAppService,
|
2020-04-06 23:34:30 -07:00
|
|
|
mozilla::dom::BrowsingContext* aContentContext, bool aForceSave,
|
|
|
|
nsIInterfaceRequestor* aWindowContext,
|
|
|
|
nsIStreamListener** aStreamListener);
|
|
|
|
+
|
|
|
|
+ nsCOMPtr<nsIDownloadInterceptor> mInterceptor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -455,6 +457,9 @@ class nsExternalAppHandler final : public nsIStreamListener,
|
2020-04-06 23:34:30 -07:00
|
|
|
* Upon successful return, both mTempFile and mSaver will be valid.
|
|
|
|
*/
|
|
|
|
nsresult SetUpTempFile(nsIChannel* aChannel);
|
|
|
|
+
|
|
|
|
+ nsresult CreateSaverForTempFile();
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* When we download a helper app, we are going to retarget all load
|
|
|
|
* notifications into our own docloader and load group instead of
|
|
|
|
diff --git a/uriloader/exthandler/nsIExternalHelperAppService.idl b/uriloader/exthandler/nsIExternalHelperAppService.idl
|
2024-11-13 12:34:49 +01:00
|
|
|
index 53ea934dd4876e4b491b724385c8fbf7d00ee6cd..0b7b88c853b21ce778d8e87fea0a2bfe839ad412 100644
|
2020-04-06 23:34:30 -07:00
|
|
|
--- a/uriloader/exthandler/nsIExternalHelperAppService.idl
|
|
|
|
+++ b/uriloader/exthandler/nsIExternalHelperAppService.idl
|
2023-11-14 10:18:18 -08:00
|
|
|
@@ -6,8 +6,11 @@
|
2020-04-06 23:34:30 -07:00
|
|
|
|
|
|
|
#include "nsICancelable.idl"
|
|
|
|
|
2020-04-23 14:26:00 -07:00
|
|
|
+webidl BrowsingContext;
|
2020-04-06 23:34:30 -07:00
|
|
|
+interface nsIHelperAppLauncher;
|
|
|
|
interface nsIURI;
|
2023-11-14 10:18:18 -08:00
|
|
|
interface nsIChannel;
|
|
|
|
+interface nsIRequest;
|
2020-04-06 23:34:30 -07:00
|
|
|
interface nsIStreamListener;
|
2023-11-14 10:18:18 -08:00
|
|
|
interface nsIFile;
|
|
|
|
interface nsIMIMEInfo;
|
|
|
|
@@ -15,6 +18,17 @@ interface nsIWebProgressListener2;
|
2020-10-07 14:12:19 -07:00
|
|
|
interface nsIInterfaceRequestor;
|
|
|
|
webidl BrowsingContext;
|
2020-04-06 23:34:30 -07:00
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Interceptor interface used by Juggler.
|
|
|
|
+ */
|
|
|
|
+[scriptable, uuid(9a20e9b0-75d0-11ea-bc55-0242ac130003)]
|
|
|
|
+interface nsIDownloadInterceptor : nsISupports
|
|
|
|
+{
|
2024-07-29 10:30:28 +02:00
|
|
|
+ boolean interceptDownloadRequest(in nsIHelperAppLauncher aHandler, in nsIRequest aRequest, in BrowsingContext aBrowsingContext, out nsIFile file);
|
2020-04-06 23:34:30 -07:00
|
|
|
+
|
|
|
|
+ void onDownloadComplete(in nsIHelperAppLauncher aHandler, in ACString aErrorName);
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* The external helper app service is used for finding and launching
|
|
|
|
* platform specific external applications for a given mime content type.
|
2024-11-13 12:34:49 +01:00
|
|
|
@@ -87,6 +101,8 @@ interface nsIExternalHelperAppService : nsISupports
|
|
|
|
* `DownloadIntegration.sys.mjs`, which is implemented on all platforms.
|
|
|
|
*/
|
|
|
|
nsIFile getPreferredDownloadsDirectory();
|
|
|
|
+
|
2020-04-06 23:34:30 -07:00
|
|
|
+ void setDownloadInterceptor(in nsIDownloadInterceptor interceptor);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-07-15 09:37:08 -07:00
|
|
|
diff --git a/widget/InProcessCompositorWidget.cpp b/widget/InProcessCompositorWidget.cpp
|
2022-01-18 04:16:04 -07:00
|
|
|
index 1c25e9d9a101233f71e92288a0f93125b81ac1c5..22cf67b0f6e3ddd2b3ed725a314ba6a9896abd1c 100644
|
2020-07-15 09:37:08 -07:00
|
|
|
--- a/widget/InProcessCompositorWidget.cpp
|
|
|
|
+++ b/widget/InProcessCompositorWidget.cpp
|
2020-12-17 21:02:01 -08:00
|
|
|
@@ -4,7 +4,10 @@
|
2020-07-15 09:37:08 -07:00
|
|
|
|
|
|
|
#include "InProcessCompositorWidget.h"
|
|
|
|
|
|
|
|
+#include "HeadlessCompositorWidget.h"
|
|
|
|
+#include "HeadlessWidget.h"
|
|
|
|
#include "mozilla/VsyncDispatcher.h"
|
2020-12-17 21:02:01 -08:00
|
|
|
+#include "mozilla/widget/PlatformWidgetTypes.h"
|
2020-07-15 09:37:08 -07:00
|
|
|
#include "nsBaseWidget.h"
|
|
|
|
|
2022-01-18 04:16:04 -07:00
|
|
|
namespace mozilla {
|
|
|
|
@@ -23,6 +26,12 @@ RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
|
2021-04-01 18:49:01 -05:00
|
|
|
// do it after the static_cast.
|
|
|
|
nsBaseWidget* widget = static_cast<nsBaseWidget*>(aWidget);
|
|
|
|
MOZ_RELEASE_ASSERT(widget);
|
2020-07-15 09:37:08 -07:00
|
|
|
+ if (aInitData.type() ==
|
|
|
|
+ CompositorWidgetInitData::THeadlessCompositorWidgetInitData) {
|
|
|
|
+ return new HeadlessCompositorWidget(
|
|
|
|
+ aInitData.get_HeadlessCompositorWidgetInitData(), aOptions,
|
|
|
|
+ static_cast<HeadlessWidget*>(aWidget));
|
|
|
|
+ }
|
2022-01-18 04:16:04 -07:00
|
|
|
return new InProcessCompositorWidget(aOptions, widget);
|
|
|
|
}
|
|
|
|
#endif
|
2023-06-06 15:08:23 -07:00
|
|
|
diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index c4e510441cf6329b2ad898034fbe39fa1a701ad4..e34d797ee3e3f2985e6d4472afce133e97a0caa4 100644
|
2023-06-06 15:08:23 -07:00
|
|
|
--- a/widget/MouseEvents.h
|
|
|
|
+++ b/widget/MouseEvents.h
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -363,6 +363,9 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
2023-06-06 15:08:23 -07:00
|
|
|
// Otherwise, this must be 0.
|
2024-09-30 05:14:45 -07:00
|
|
|
uint32_t mClickCount = 0;
|
2023-06-06 15:08:23 -07:00
|
|
|
|
|
|
|
+ // Unique event ID
|
2024-09-30 05:14:45 -07:00
|
|
|
+ uint32_t mJugglerEventId = 0;
|
2023-06-06 15:08:23 -07:00
|
|
|
+
|
|
|
|
// Whether the event should ignore scroll frame bounds during dispatch.
|
2024-09-30 05:14:45 -07:00
|
|
|
bool mIgnoreRootScrollFrame = false;
|
2023-06-06 15:08:23 -07:00
|
|
|
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -386,6 +389,7 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
2024-09-30 05:14:45 -07:00
|
|
|
mContextMenuTrigger = aEvent.mContextMenuTrigger;
|
2023-06-06 15:08:23 -07:00
|
|
|
mExitFrom = aEvent.mExitFrom;
|
|
|
|
mClickCount = aEvent.mClickCount;
|
|
|
|
+ mJugglerEventId = aEvent.mJugglerEventId;
|
|
|
|
mIgnoreRootScrollFrame = aEvent.mIgnoreRootScrollFrame;
|
2025-01-22 09:56:34 -08:00
|
|
|
mIgnoreCapturingContent = aEvent.mIgnoreCapturingContent;
|
2023-06-06 15:08:23 -07:00
|
|
|
mClickEventPrevented = aEvent.mClickEventPrevented;
|
2021-04-01 11:27:44 -07:00
|
|
|
diff --git a/widget/cocoa/NativeKeyBindings.mm b/widget/cocoa/NativeKeyBindings.mm
|
2024-01-13 00:19:49 +01:00
|
|
|
index e4bdf715e2fb899e97a5bfeb2e147127460d6047..3554f919480278b7353617481c7ce8050630a1aa 100644
|
2021-04-01 11:27:44 -07:00
|
|
|
--- a/widget/cocoa/NativeKeyBindings.mm
|
|
|
|
+++ b/widget/cocoa/NativeKeyBindings.mm
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -528,6 +528,13 @@
|
2021-04-01 11:27:44 -07:00
|
|
|
break;
|
|
|
|
case KEY_NAME_INDEX_ArrowLeft:
|
|
|
|
if (aEvent.IsAlt()) {
|
|
|
|
+ if (aEvent.IsMeta() || aEvent.IsControl())
|
|
|
|
+ break;
|
|
|
|
+ instance->AppendEditCommandsForSelector(
|
|
|
|
+ !aEvent.IsShift()
|
|
|
|
+ ? ToObjcSelectorPtr(@selector(moveWordLeft:))
|
|
|
|
+ : ToObjcSelectorPtr(@selector(moveWordLeftAndModifySelection:)),
|
|
|
|
+ aCommands);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (aEvent.IsMeta() || (aEvent.IsControl() && aEvent.IsShift())) {
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -550,6 +557,13 @@
|
2021-04-01 11:27:44 -07:00
|
|
|
break;
|
|
|
|
case KEY_NAME_INDEX_ArrowRight:
|
|
|
|
if (aEvent.IsAlt()) {
|
|
|
|
+ if (aEvent.IsMeta() || aEvent.IsControl())
|
|
|
|
+ break;
|
|
|
|
+ instance->AppendEditCommandsForSelector(
|
|
|
|
+ !aEvent.IsShift()
|
|
|
|
+ ? ToObjcSelectorPtr(@selector(moveWordRight:))
|
|
|
|
+ : ToObjcSelectorPtr(@selector(moveWordRightAndModifySelection:)),
|
|
|
|
+ aCommands);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (aEvent.IsMeta() || (aEvent.IsControl() && aEvent.IsShift())) {
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -572,6 +586,10 @@
|
2021-04-01 11:27:44 -07:00
|
|
|
break;
|
|
|
|
case KEY_NAME_INDEX_ArrowUp:
|
|
|
|
if (aEvent.IsControl()) {
|
|
|
|
+ if (aEvent.IsMeta() || aEvent.IsAlt())
|
|
|
|
+ break;
|
|
|
|
+ instance->AppendEditCommandsForSelector(
|
|
|
|
+ ToObjcSelectorPtr(@selector(scrollPageUp:)), aCommands);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (aEvent.IsMeta()) {
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -582,7 +600,7 @@
|
2021-04-01 11:27:44 -07:00
|
|
|
!aEvent.IsShift()
|
|
|
|
? ToObjcSelectorPtr(@selector(moveToBeginningOfDocument:))
|
2024-01-13 00:19:49 +01:00
|
|
|
: ToObjcSelectorPtr(
|
|
|
|
- @selector(moveToBegginingOfDocumentAndModifySelection:)),
|
|
|
|
+ @selector(moveToBeginningOfDocumentAndModifySelection:)),
|
2021-04-01 11:27:44 -07:00
|
|
|
aCommands);
|
|
|
|
break;
|
|
|
|
}
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -609,6 +627,10 @@
|
2021-04-01 11:27:44 -07:00
|
|
|
break;
|
|
|
|
case KEY_NAME_INDEX_ArrowDown:
|
|
|
|
if (aEvent.IsControl()) {
|
|
|
|
+ if (aEvent.IsMeta() || aEvent.IsAlt())
|
|
|
|
+ break;
|
|
|
|
+ instance->AppendEditCommandsForSelector(
|
|
|
|
+ ToObjcSelectorPtr(@selector(scrollPageDown:)), aCommands);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (aEvent.IsMeta()) {
|
2025-01-22 09:56:34 -08:00
|
|
|
diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index ad56ab325bb3b3c348259f852453eec1190d892b..272731c25d19e83a2da988ec3176e5227dc4da5b 100644
|
2025-01-22 09:56:34 -08:00
|
|
|
--- a/widget/gtk/nsFilePicker.cpp
|
|
|
|
+++ b/widget/gtk/nsFilePicker.cpp
|
|
|
|
@@ -21,6 +21,7 @@
|
|
|
|
#include "mozilla/Components.h"
|
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
#include "mozilla/dom/Promise.h"
|
|
|
|
+#include "gfxPlatform.h"
|
|
|
|
|
|
|
|
#include "nsArrayEnumerator.h"
|
|
|
|
#include "nsEnumeratorUtils.h"
|
2020-07-14 11:20:36 -07:00
|
|
|
diff --git a/widget/headless/HeadlessCompositorWidget.cpp b/widget/headless/HeadlessCompositorWidget.cpp
|
2023-08-10 14:41:33 -07:00
|
|
|
index bb4ee9175e66dc40de1871a7f91368fe309494a3..747625e3869882300bfbc18b184db5151dd90c1a 100644
|
2020-07-14 11:20:36 -07:00
|
|
|
--- a/widget/headless/HeadlessCompositorWidget.cpp
|
|
|
|
+++ b/widget/headless/HeadlessCompositorWidget.cpp
|
|
|
|
@@ -3,6 +3,7 @@
|
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
+#include "mozilla/layers/CompositorThread.h"
|
|
|
|
#include "mozilla/widget/PlatformWidgetTypes.h"
|
|
|
|
#include "HeadlessCompositorWidget.h"
|
|
|
|
#include "VsyncDispatcher.h"
|
2023-08-10 14:41:33 -07:00
|
|
|
@@ -15,9 +16,32 @@ HeadlessCompositorWidget::HeadlessCompositorWidget(
|
|
|
|
const layers::CompositorOptions& aOptions, HeadlessWidget* aWindow)
|
2023-04-24 21:28:08 +00:00
|
|
|
: CompositorWidget(aOptions),
|
|
|
|
mWidget(aWindow),
|
2023-08-10 14:41:33 -07:00
|
|
|
+ mMon("snapshotListener"),
|
2023-04-24 21:28:08 +00:00
|
|
|
mClientSize(LayoutDeviceIntSize(aInitData.InitialClientSize()),
|
2023-08-10 14:41:33 -07:00
|
|
|
"HeadlessCompositorWidget::mClientSize") {}
|
|
|
|
|
2020-07-14 11:20:36 -07:00
|
|
|
+void HeadlessCompositorWidget::SetSnapshotListener(HeadlessWidget::SnapshotListener&& listener) {
|
|
|
|
+ MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
+
|
2021-12-13 21:23:25 -08:00
|
|
|
+ ReentrantMonitorAutoEnter lock(mMon);
|
2020-07-14 11:20:36 -07:00
|
|
|
+ mSnapshotListener = std::move(listener);
|
2021-12-13 21:23:25 -08:00
|
|
|
+ layers::CompositorThread()->Dispatch(NewRunnableMethod(
|
|
|
|
+ "HeadlessCompositorWidget::PeriodicSnapshot", this,
|
|
|
|
+ &HeadlessCompositorWidget::PeriodicSnapshot
|
|
|
|
+ ));
|
2020-07-14 11:20:36 -07:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+already_AddRefed<gfx::DrawTarget> HeadlessCompositorWidget::StartRemoteDrawingInRegion(
|
2021-04-01 18:49:01 -05:00
|
|
|
+ const LayoutDeviceIntRegion& aInvalidRegion,
|
|
|
|
+ layers::BufferMode* aBufferMode) {
|
2020-07-14 11:20:36 -07:00
|
|
|
+ if (!mDrawTarget)
|
|
|
|
+ return nullptr;
|
|
|
|
+
|
|
|
|
+ *aBufferMode = layers::BufferMode::BUFFER_NONE;
|
|
|
|
+ RefPtr<gfx::DrawTarget> result = mDrawTarget;
|
|
|
|
+ return result.forget();
|
|
|
|
+}
|
2023-08-10 14:41:33 -07:00
|
|
|
+
|
2020-07-14 11:20:36 -07:00
|
|
|
void HeadlessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
|
|
|
|
if (RefPtr<CompositorVsyncDispatcher> cvd =
|
2023-08-10 14:41:33 -07:00
|
|
|
mWidget->GetCompositorVsyncDispatcher()) {
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -31,6 +55,59 @@ void HeadlessCompositorWidget::NotifyClientSizeChanged(
|
2020-07-14 11:20:36 -07:00
|
|
|
const LayoutDeviceIntSize& aClientSize) {
|
2023-04-24 21:28:08 +00:00
|
|
|
auto size = mClientSize.Lock();
|
|
|
|
*size = aClientSize;
|
2020-07-20 14:24:52 -07:00
|
|
|
+ layers::CompositorThread()->Dispatch(NewRunnableMethod<LayoutDeviceIntSize>(
|
|
|
|
+ "HeadlessCompositorWidget::UpdateDrawTarget", this,
|
|
|
|
+ &HeadlessCompositorWidget::UpdateDrawTarget,
|
|
|
|
+ aClientSize));
|
2020-07-14 11:20:36 -07:00
|
|
|
+}
|
|
|
|
+
|
2020-07-20 14:24:52 -07:00
|
|
|
+void HeadlessCompositorWidget::UpdateDrawTarget(const LayoutDeviceIntSize& aClientSize) {
|
|
|
|
+ MOZ_ASSERT(NS_IsInCompositorThread());
|
|
|
|
+ if (aClientSize.IsEmpty()) {
|
2020-07-14 11:20:36 -07:00
|
|
|
+ mDrawTarget = nullptr;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
2020-07-20 14:24:52 -07:00
|
|
|
+ RefPtr<gfx::DrawTarget> old = std::move(mDrawTarget);
|
2020-07-14 11:20:36 -07:00
|
|
|
+ gfx::SurfaceFormat format = gfx::SurfaceFormat::B8G8R8A8;
|
2020-07-20 14:24:52 -07:00
|
|
|
+ gfx::IntSize size = aClientSize.ToUnknownSize();
|
2020-07-14 11:20:36 -07:00
|
|
|
+ mDrawTarget = mozilla::gfx::Factory::CreateDrawTarget(
|
|
|
|
+ mozilla::gfx::BackendType::SKIA, size, format);
|
2020-07-20 14:24:52 -07:00
|
|
|
+ if (old) {
|
|
|
|
+ RefPtr<gfx::SourceSurface> snapshot = old->Snapshot();
|
|
|
|
+ if (snapshot)
|
|
|
|
+ mDrawTarget->CopySurface(snapshot.get(), old->GetRect(), gfx::IntPoint(0, 0));
|
|
|
|
+ }
|
2020-07-15 09:37:08 -07:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void HeadlessCompositorWidget::PeriodicSnapshot() {
|
2021-12-13 21:23:25 -08:00
|
|
|
+ ReentrantMonitorAutoEnter lock(mMon);
|
2020-08-04 17:58:57 -07:00
|
|
|
+ if (!mSnapshotListener)
|
2020-07-15 09:37:08 -07:00
|
|
|
+ return;
|
|
|
|
+
|
2020-08-04 17:58:57 -07:00
|
|
|
+ TakeSnapshot();
|
|
|
|
+ NS_DelayedDispatchToCurrentThread(NewRunnableMethod(
|
|
|
|
+ "HeadlessCompositorWidget::PeriodicSnapshot", this,
|
|
|
|
+ &HeadlessCompositorWidget::PeriodicSnapshot), 40);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void HeadlessCompositorWidget::TakeSnapshot() {
|
|
|
|
+ if (!mDrawTarget)
|
2020-07-15 09:37:08 -07:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ RefPtr<gfx::SourceSurface> snapshot = mDrawTarget->Snapshot();
|
|
|
|
+ if (!snapshot) {
|
|
|
|
+ fprintf(stderr, "Failed to get snapshot of draw target\n");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ RefPtr<gfx::DataSourceSurface> dataSurface = snapshot->GetDataSurface();
|
|
|
|
+ if (!dataSurface) {
|
|
|
|
+ fprintf(stderr, "Failed to get data surface from snapshot\n");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mSnapshotListener(std::move(dataSurface));
|
2020-07-14 11:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
LayoutDeviceIntSize HeadlessCompositorWidget::GetClientSize() {
|
|
|
|
diff --git a/widget/headless/HeadlessCompositorWidget.h b/widget/headless/HeadlessCompositorWidget.h
|
2023-04-24 21:28:08 +00:00
|
|
|
index facd2bc65afab8ec1aa322faa20a67464964dfb9..d6dea95472bec6006411753c3dfdab2e3659171f 100644
|
2020-07-14 11:20:36 -07:00
|
|
|
--- a/widget/headless/HeadlessCompositorWidget.h
|
|
|
|
+++ b/widget/headless/HeadlessCompositorWidget.h
|
2021-12-13 21:23:25 -08:00
|
|
|
@@ -6,6 +6,7 @@
|
|
|
|
#ifndef widget_headless_HeadlessCompositorWidget_h
|
|
|
|
#define widget_headless_HeadlessCompositorWidget_h
|
|
|
|
|
|
|
|
+#include "mozilla/ReentrantMonitor.h"
|
|
|
|
#include "mozilla/widget/CompositorWidget.h"
|
|
|
|
|
|
|
|
#include "HeadlessWidget.h"
|
|
|
|
@@ -23,8 +24,12 @@ class HeadlessCompositorWidget final : public CompositorWidget,
|
2020-07-14 11:20:36 -07:00
|
|
|
HeadlessWidget* aWindow);
|
|
|
|
|
|
|
|
void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize);
|
|
|
|
+ void SetSnapshotListener(HeadlessWidget::SnapshotListener&& listener);
|
|
|
|
|
|
|
|
// CompositorWidget Overrides
|
|
|
|
+ already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
|
2021-04-01 18:49:01 -05:00
|
|
|
+ const LayoutDeviceIntRegion& aInvalidRegion,
|
|
|
|
+ layers::BufferMode* aBufferMode) override;
|
|
|
|
|
2020-07-14 11:20:36 -07:00
|
|
|
uintptr_t GetWidgetKey() override;
|
|
|
|
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -42,10 +47,18 @@ class HeadlessCompositorWidget final : public CompositorWidget,
|
2020-07-14 11:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2020-07-20 14:24:52 -07:00
|
|
|
+ void UpdateDrawTarget(const LayoutDeviceIntSize& aClientSize);
|
2020-07-15 09:37:08 -07:00
|
|
|
+ void PeriodicSnapshot();
|
2020-08-04 17:58:57 -07:00
|
|
|
+ void TakeSnapshot();
|
2020-07-14 11:20:36 -07:00
|
|
|
+
|
|
|
|
HeadlessWidget* mWidget;
|
2021-12-13 21:23:25 -08:00
|
|
|
+ mozilla::ReentrantMonitor mMon;
|
2020-07-14 11:20:36 -07:00
|
|
|
|
2023-04-24 21:28:08 +00:00
|
|
|
// See GtkCompositorWidget for the justification for this mutex.
|
|
|
|
DataMutex<LayoutDeviceIntSize> mClientSize;
|
2020-07-14 11:20:36 -07:00
|
|
|
+
|
|
|
|
+ HeadlessWidget::SnapshotListener mSnapshotListener;
|
|
|
|
+ RefPtr<gfx::DrawTarget> mDrawTarget;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widget
|
|
|
|
diff --git a/widget/headless/HeadlessWidget.cpp b/widget/headless/HeadlessWidget.cpp
|
2025-02-28 13:23:18 +00:00
|
|
|
index b8b3f6a09f3fd480f67c28a2d3c6daa960946324..8b9ea637e18c404254ca8a72dabf860452699096 100644
|
2020-07-14 11:20:36 -07:00
|
|
|
--- a/widget/headless/HeadlessWidget.cpp
|
|
|
|
+++ b/widget/headless/HeadlessWidget.cpp
|
2023-07-06 12:22:45 -07:00
|
|
|
@@ -111,6 +111,8 @@ void HeadlessWidget::Destroy() {
|
2020-07-15 09:37:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ SetSnapshotListener(nullptr);
|
|
|
|
+
|
|
|
|
nsBaseWidget::OnDestroy();
|
|
|
|
|
|
|
|
nsBaseWidget::Destroy();
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -591,5 +593,14 @@ nsresult HeadlessWidget::SynthesizeNativeTouchpadPan(
|
2020-07-14 11:20:36 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2023-01-23 11:29:48 -08:00
|
|
|
|
2020-07-14 11:20:36 -07:00
|
|
|
+void HeadlessWidget::SetSnapshotListener(SnapshotListener&& listener) {
|
|
|
|
+ if (!mCompositorWidget) {
|
2020-08-04 17:38:46 -07:00
|
|
|
+ if (listener)
|
|
|
|
+ fprintf(stderr, "Trying to set SnapshotListener without compositor widget\n");
|
2020-07-14 11:20:36 -07:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ mCompositorWidget->SetSnapshotListener(std::move(listener));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
diff --git a/widget/headless/HeadlessWidget.h b/widget/headless/HeadlessWidget.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index f07f7284495cf5e48409866aaef6fd4d529568be..daefaa8f58c3c8392ce229c814807bc5fff77dc7 100644
|
2020-07-14 11:20:36 -07:00
|
|
|
--- a/widget/headless/HeadlessWidget.h
|
|
|
|
+++ b/widget/headless/HeadlessWidget.h
|
2025-02-28 13:23:18 +00:00
|
|
|
@@ -136,6 +136,9 @@ class HeadlessWidget : public nsBaseWidget {
|
|
|
|
int32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2020-07-14 11:20:36 -07:00
|
|
|
|
|
|
|
+ using SnapshotListener = std::function<void(RefPtr<gfx::DataSourceSurface>&&)>;
|
|
|
|
+ void SetSnapshotListener(SnapshotListener&& listener);
|
|
|
|
+
|
|
|
|
private:
|
|
|
|
~HeadlessWidget();
|
|
|
|
bool mEnabled;
|
2023-06-06 15:08:23 -07:00
|
|
|
diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h
|
2025-02-28 13:23:18 +00:00
|
|
|
index a1f48167403f5bfb30a66809ec3e64bea468fa05..eac7fccf3493e162629918462294456e6ee6b6e1 100644
|
2023-06-06 15:08:23 -07:00
|
|
|
--- a/widget/nsGUIEventIPC.h
|
|
|
|
+++ b/widget/nsGUIEventIPC.h
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -244,6 +244,7 @@ struct ParamTraits<mozilla::WidgetMouseEvent> {
|
2023-06-06 15:08:23 -07:00
|
|
|
aParam.mExitFrom.value()));
|
|
|
|
}
|
|
|
|
WriteParam(aWriter, aParam.mClickCount);
|
|
|
|
+ WriteParam(aWriter, aParam.mJugglerEventId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(MessageReader* aReader, paramType* aResult) {
|
2025-01-22 09:56:34 -08:00
|
|
|
@@ -268,6 +269,7 @@ struct ParamTraits<mozilla::WidgetMouseEvent> {
|
2023-06-06 15:08:23 -07:00
|
|
|
aResult->mExitFrom = Some(static_cast<paramType::ExitFrom>(exitFrom));
|
|
|
|
}
|
|
|
|
rv = rv && ReadParam(aReader, &aResult->mClickCount);
|
|
|
|
+ rv = rv && ReadParam(aReader, &aResult->mJugglerEventId);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
};
|
2020-10-13 12:24:11 -07:00
|
|
|
diff --git a/xpcom/reflect/xptinfo/xptinfo.h b/xpcom/reflect/xptinfo/xptinfo.h
|
2024-09-05 13:44:58 +02:00
|
|
|
index 787d30d881adedd57d2025ca57bff4bc6c57e803..ae1a0172c960ab16919133485722d2ae0cdbcbd4 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/xpcom/reflect/xptinfo/xptinfo.h
|
|
|
|
+++ b/xpcom/reflect/xptinfo/xptinfo.h
|
2024-09-05 13:44:58 +02:00
|
|
|
@@ -505,7 +505,7 @@ static_assert(sizeof(nsXPTMethodInfo) == 8, "wrong size");
|
2020-10-13 12:24:11 -07:00
|
|
|
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
|
|
|
|
# define PARAM_BUFFER_COUNT 18
|
|
|
|
#else
|
|
|
|
-# define PARAM_BUFFER_COUNT 14
|
|
|
|
+# define PARAM_BUFFER_COUNT 15
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|