2020-01-29 18:56:11 -08:00
|
|
|
diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h
|
2023-01-23 11:29:48 -08:00
|
|
|
index 2f0428b53d5e1fc4fd97cbc6c0619edbe425e7bd..8e72e1b3d0f69ab613eb95bc1d4676dcaec5c6a9 100644
|
2020-01-29 18:56:11 -08:00
|
|
|
--- a/accessible/base/NotificationController.h
|
|
|
|
+++ b/accessible/base/NotificationController.h
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -245,6 +245,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
|
|
|
|
index a91df31c96afda66f478a5a38eaa4352039c2a0b..ee777c1746284027fb3aa2f1686f8082af9d89ee 100644
|
|
|
|
--- a/accessible/interfaces/nsIAccessibleDocument.idl
|
|
|
|
+++ b/accessible/interfaces/nsIAccessibleDocument.idl
|
|
|
|
@@ -72,4 +72,9 @@ interface nsIAccessibleDocument : nsISupports
|
|
|
|
* 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
|
2022-07-29 05:47:00 -07:00
|
|
|
index 1ddd5c8372c2742a8dc4e7a8156c084aaf2442fc..7e3aa30c20d8b2fcae5c12d293ca7772ecd28657 100644
|
2020-01-29 18:56:11 -08:00
|
|
|
--- a/accessible/xpcom/xpcAccessibleDocument.cpp
|
|
|
|
+++ b/accessible/xpcom/xpcAccessibleDocument.cpp
|
2022-07-29 05:47:00 -07:00
|
|
|
@@ -143,6 +143,15 @@ xpcAccessibleDocument::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) {
|
2020-01-29 18:56:11 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+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
|
2022-05-02 21:46:05 -06:00
|
|
|
index 416a1c5497c97ed80cc0f37d72545e36f7e36b4c..b81983cf7153378260a21f6af225e3493f8f30dc 100644
|
2020-01-29 18:56:11 -08:00
|
|
|
--- a/accessible/xpcom/xpcAccessibleDocument.h
|
|
|
|
+++ b/accessible/xpcom/xpcAccessibleDocument.h
|
|
|
|
@@ -48,6 +48,8 @@ class xpcAccessibleDocument : public xpcAccessibleHyperText,
|
|
|
|
nsIAccessibleDocument** aDocument) final;
|
|
|
|
NS_IMETHOD GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) 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
|
2023-04-24 21:28:08 +00:00
|
|
|
index 33b8ed52bff98c2216c16d47840fcd55907c414b..5a0320b4ad87055280c4fba4deb0cdc9b7557c50 100644
|
2020-10-05 10:58:56 -07:00
|
|
|
--- a/browser/app/winlauncher/LauncherProcessWin.cpp
|
|
|
|
+++ b/browser/app/winlauncher/LauncherProcessWin.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -24,6 +24,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>
|
|
|
|
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -430,8 +431,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
|
2023-01-23 11:29:48 -08:00
|
|
|
index 6ab29ba31e937e1c5bb1208a9a2508ff0496fd02..7989da51c5368fa80cc66cccdfc018a9b3fb2f38 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/browser/installer/allowed-dupes.mn
|
|
|
|
+++ b/browser/installer/allowed-dupes.mn
|
2023-01-23 11:29:48 -08: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
|
|
|
+
|
2019-11-18 18:18:28 -08:00
|
|
|
#ifdef MOZ_EME_WIN32_ARTIFACT
|
|
|
|
gmp-clearkey/0.1/manifest.json
|
|
|
|
i686/gmp-clearkey/0.1/manifest.json
|
|
|
|
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
|
2023-01-23 11:29:48 -08:00
|
|
|
index 9229a0bd0e041815331aaf2973afda22c007423d..3ce0e453d4124d110e11877f5bbade776d11cfd4 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/browser/installer/package-manifest.in
|
|
|
|
+++ b/browser/installer/package-manifest.in
|
2023-01-23 11:29:48 -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
|
2023-01-23 11:29:48 -08:00
|
|
|
index a32156978aacd7c8cbe9001250bfa1516dbc360f..ff03ff48b505ef8a9117671bf21e8b0e8214ec1f 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.
|
|
|
|
*/
|
|
|
|
-const serverHandshake = async function(input, output) {
|
|
|
|
+const serverHandshake = async function(input, output, expectedPath) {
|
|
|
|
// 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-01-23 11:29:48 -08: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.
|
|
|
|
*/
|
|
|
|
-const accept = async function(transport, input, output) {
|
|
|
|
- await serverHandshake(input, output);
|
|
|
|
+const accept = async function(transport, input, output, expectedPath) {
|
|
|
|
+ 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
|
2023-04-24 21:28:08 +00:00
|
|
|
index e5e8720e90716f96af982d99b4c83ec74715ed26..74c858d6e05081e08a34a98fd517ffd1487dcf12 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/docshell/base/BrowsingContext.cpp
|
|
|
|
+++ b/docshell/base/BrowsingContext.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -112,6 +112,20 @@ struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride>
|
2021-05-18 21:23:12 +02:00
|
|
|
mozilla::dom::PrefersColorSchemeOverride::None,
|
|
|
|
mozilla::dom::PrefersColorSchemeOverride::EndGuard_> {};
|
|
|
|
|
|
|
|
+template <>
|
|
|
|
+struct ParamTraits<mozilla::dom::PrefersReducedMotionOverride>
|
|
|
|
+ : public ContiguousEnumSerializer<
|
|
|
|
+ mozilla::dom::PrefersReducedMotionOverride,
|
|
|
|
+ mozilla::dom::PrefersReducedMotionOverride::None,
|
|
|
|
+ mozilla::dom::PrefersReducedMotionOverride::EndGuard_> {};
|
2021-06-08 16:00:15 -07:00
|
|
|
+
|
|
|
|
+template <>
|
|
|
|
+struct ParamTraits<mozilla::dom::ForcedColorsOverride>
|
|
|
|
+ : public ContiguousEnumSerializer<
|
|
|
|
+ mozilla::dom::ForcedColorsOverride,
|
|
|
|
+ mozilla::dom::ForcedColorsOverride::None,
|
|
|
|
+ mozilla::dom::ForcedColorsOverride::EndGuard_> {};
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
|
|
|
|
: public ContiguousEnumSerializer<
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -2838,6 +2852,40 @@ void BrowsingContext::DidSet(FieldIndex<IDX_PrefersColorSchemeOverride>,
|
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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+}
|
2021-06-08 16:00:15 -07:00
|
|
|
+
|
|
|
|
+void BrowsingContext::DidSet(FieldIndex<IDX_ForcedColorsOverride>,
|
|
|
|
+ dom::ForcedColorsOverride aOldValue) {
|
|
|
|
+ MOZ_ASSERT(IsTop());
|
|
|
|
+ if (ForcedColorsOverride() == aOldValue) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ PreOrderWalk([&](BrowsingContext* aContext) {
|
|
|
|
+ if (nsIDocShell* shell = aContext->GetDocShell()) {
|
|
|
|
+ if (nsPresContext* pc = shell->GetPresContext()) {
|
|
|
|
+ pc->MediaFeatureValuesChanged(
|
|
|
|
+ {MediaFeatureChangeReason::SystemMetricsChange},
|
|
|
|
+ MediaFeatureChangePropagation::JustThisDocument);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+}
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
|
|
|
void BrowsingContext::DidSet(FieldIndex<IDX_MediumOverride>,
|
|
|
|
nsString&& aOldValue) {
|
|
|
|
MOZ_ASSERT(IsTop());
|
|
|
|
diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h
|
2023-03-21 01:23:12 +00:00
|
|
|
index 8d32d0f5a37396eb18aa217bcac887f131df9fa2..86eca6ab834829283454d1565d1a72116dfb9554 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/docshell/base/BrowsingContext.h
|
|
|
|
+++ b/docshell/base/BrowsingContext.h
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -190,10 +190,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) \
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -231,6 +231,10 @@ 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) \
|
|
|
|
+ /* playwright addition */ \
|
|
|
|
+ FIELD(ForcedColorsOverride, dom::ForcedColorsOverride) \
|
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) \
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -343,6 +347,10 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|
|
|
|
|
|
|
bool IsOwnedByProcess() const;
|
|
|
|
|
|
|
|
+ uint64_t JugglerCurrentLoadIdentifier() const {
|
|
|
|
+ return GetCurrentLoadIdentifier() ? GetCurrentLoadIdentifier().value() : 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
bool CanHaveRemoteOuterProxies() const {
|
|
|
|
return !mIsInProcess || mDanglingRemoteOuterProxies;
|
|
|
|
}
|
|
|
|
@@ -922,6 +930,14 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
2021-05-18 21:23:12 +02:00
|
|
|
return GetPrefersColorSchemeOverride();
|
|
|
|
}
|
|
|
|
|
|
|
|
+ dom::PrefersReducedMotionOverride PrefersReducedMotionOverride() const {
|
|
|
|
+ return GetPrefersReducedMotionOverride();
|
|
|
|
+ }
|
2021-06-08 16:00:15 -07:00
|
|
|
+
|
|
|
|
+ dom::ForcedColorsOverride ForcedColorsOverride() const {
|
|
|
|
+ return GetForcedColorsOverride();
|
|
|
|
+ }
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
2021-10-13 15:49:41 -07:00
|
|
|
bool IsInBFCache() const;
|
2022-06-29 04:46:49 -07:00
|
|
|
|
|
|
|
bool AllowJavascript() const { return GetAllowJavascript(); }
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1079,6 +1095,23 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
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
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bool CanSet(FieldIndex<IDX_ForcedColorsOverride>,
|
|
|
|
+ dom::ForcedColorsOverride, ContentParent*) {
|
|
|
|
+ return IsTop();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void DidSet(FieldIndex<IDX_ForcedColorsOverride>,
|
|
|
|
+ dom::ForcedColorsOverride aOldValue);
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 50863b8b4948166b63ef88eeef640bc27d5489c5..4e73297034a0f6909c4df6ff83d4453ce61f7ae6 100644
|
2023-03-21 01:23:12 +00:00
|
|
|
--- a/docshell/base/CanonicalBrowsingContext.cpp
|
|
|
|
+++ b/docshell/base/CanonicalBrowsingContext.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -1435,6 +1435,12 @@ void CanonicalBrowsingContext::LoadURI(const nsAString& aURI,
|
2023-03-21 01:23:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ {
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ if (observerService) {
|
|
|
|
+ observerService->NotifyObservers(ToSupports(this), "juggler-navigation-started-browser", NS_ConvertASCIItoUTF16(nsPrintfCString("%llu", loadState->GetLoadIdentifier())).get());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
LoadURI(loadState, true);
|
|
|
|
}
|
|
|
|
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
index b0f1edf389703f650287ffd7b8320df8835836b5..319291099cca4d77490c429dc8cf4e9735a6fe3c 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"
|
2022-03-04 03:22:28 -07:00
|
|
|
@@ -65,6 +71,7 @@
|
2020-03-20 11:14:42 -07:00
|
|
|
#include "mozilla/dom/ContentFrameMessageManager.h"
|
|
|
|
#include "mozilla/dom/DocGroup.h"
|
|
|
|
#include "mozilla/dom/Element.h"
|
|
|
|
+#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"
|
2022-03-29 02:16:04 -06: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"
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -113,6 +121,7 @@
|
2019-11-25 13:56:39 -08:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#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"
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -207,6 +216,7 @@
|
2022-01-18 04:16:04 -07:00
|
|
|
#include "nsFocusManager.h"
|
2020-03-30 15:05:46 -07:00
|
|
|
#include "nsGlobalWindow.h"
|
|
|
|
#include "nsJSEnvironment.h"
|
|
|
|
+#include "nsJSUtils.h"
|
|
|
|
#include "nsNetCID.h"
|
|
|
|
#include "nsNetUtil.h"
|
|
|
|
#include "nsObjectLoadingContent.h"
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -349,6 +359,14 @@ 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),
|
2020-03-22 13:51:49 -07:00
|
|
|
+ mOnlineOverride(nsIDocShell::ONLINE_OVERRIDE_NONE),
|
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),
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -3246,6 +3264,234 @@ 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());
|
|
|
|
+ if (icu::Locale::getDefault() == locale)
|
|
|
|
+ return;
|
|
|
|
+ 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());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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
|
|
|
|
+nsDocShell::GetOnlineOverride(OnlineOverride* aOnlineOverride) {
|
|
|
|
+ *aOnlineOverride = GetRootDocShell()->mOnlineOverride;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetOnlineOverride(OnlineOverride aOnlineOverride) {
|
|
|
|
+ // We don't have a way to verify this coming from Javascript, so this check is
|
|
|
|
+ // still needed.
|
|
|
|
+ if (!(aOnlineOverride == ONLINE_OVERRIDE_NONE ||
|
|
|
|
+ aOnlineOverride == ONLINE_OVERRIDE_ONLINE ||
|
|
|
|
+ aOnlineOverride == ONLINE_OVERRIDE_OFFLINE)) {
|
|
|
|
+ return NS_ERROR_INVALID_ARG;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mOnlineOverride = aOnlineOverride;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2020-07-28 13:46:37 -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;
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -4909,7 +5155,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
|
|
|
}
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -6854,6 +7100,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");
|
|
|
|
nsCOMPtr<nsIContentViewer> viewer = mOSHE->GetContentViewer();
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -8626,6 +8876,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;
|
|
|
|
}
|
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -9656,6 +9912,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) {
|
|
|
|
+ observerService->NotifyObservers(GetAsSupports(this), "juggler-navigation-started-renderer", NS_ConvertASCIItoUTF16(nsPrintfCString("%llu", aLoadState->GetLoadIdentifier())).get());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
rv = DoURILoad(aLoadState, aCacheKey, getter_AddRefs(req));
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -12820,6 +13086,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;
|
|
|
|
}
|
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -12899,6 +13168,8 @@ nsresult nsDocShell::OnLinkClick(
|
2020-08-06 10:32:50 -07:00
|
|
|
nsCOMPtr<nsIRunnable> ev =
|
|
|
|
new OnLinkClickEvent(this, aContent, loadState, noOpenerImplied,
|
|
|
|
aIsTrusted, aTriggeringPrincipal);
|
2020-03-05 11:59:29 -08:00
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ observerService->NotifyObservers(ToSupports(aContent), "juggler-link-click", nullptr);
|
2020-05-07 18:37:15 -07:00
|
|
|
return Dispatch(TaskCategory::UI, 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
|
2023-01-23 11:29:48 -08:00
|
|
|
index 293bfeee6e0779d15dd6ef60fc06f9969f70f003..a0481717f5f7b5ceb0301b7311c27b5631c258ee 100644
|
2019-11-25 13:56:39 -08:00
|
|
|
--- a/docshell/base/nsDocShell.h
|
|
|
|
+++ b/docshell/base/nsDocShell.h
|
2021-07-14 08:26:43 -08:00
|
|
|
@@ -16,6 +16,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"
|
2022-08-23 15:13:06 -07:00
|
|
|
@@ -77,6 +78,7 @@ class nsCommandManager;
|
2020-12-14 15:28:48 -08:00
|
|
|
class nsDocShellEditorData;
|
|
|
|
class nsDOMNavigationTiming;
|
|
|
|
class nsDSURIContentListener;
|
|
|
|
+class nsGeolocationService;
|
|
|
|
class nsGlobalWindowOuter;
|
|
|
|
|
|
|
|
class FramingChecker;
|
2022-08-23 15:13:06 -07:00
|
|
|
@@ -409,6 +411,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.
|
|
|
|
nsresult CreateContentViewerForActor(
|
2022-08-23 15:13:06 -07:00
|
|
|
@@ -1028,6 +1039,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
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -1313,6 +1326,17 @@ 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;
|
|
|
|
+ OnlineOverride mOnlineOverride;
|
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
|
2023-01-23 11:29:48 -08:00
|
|
|
index 6b85ddd842a6d2e29f86047017b78b2007b99867..f530ab61ac26cb7c94c8ccd07d11aa90c5148212 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 nsIContentViewer;
|
|
|
|
interface nsIContentSecurityPolicy;
|
|
|
|
+interface nsIDOMGeoPosition;
|
|
|
|
interface nsIEditor;
|
|
|
|
interface nsIEditingSession;
|
2021-04-01 18:49:01 -05:00
|
|
|
interface nsIInputStream;
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -803,6 +804,43 @@ 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);
|
|
|
|
+
|
2020-03-22 13:51:49 -07:00
|
|
|
+ cenum OnlineOverride: 8 {
|
|
|
|
+ ONLINE_OVERRIDE_NONE = 0,
|
|
|
|
+ ONLINE_OVERRIDE_ONLINE = 1,
|
|
|
|
+ ONLINE_OVERRIDE_OFFLINE = 2,
|
|
|
|
+ };
|
|
|
|
+ [infallible] attribute nsIDocShell_OnlineOverride onlineOverride;
|
|
|
|
+
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 6afeefcd0d916c116822e5a5f725403b4577f196..168445a80b3fe05a93e36cd3218a7de3c650d2a3 100644
|
2019-11-25 15:26:03 -08:00
|
|
|
--- a/dom/base/Document.cpp
|
|
|
|
+++ b/dom/base/Document.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -3675,6 +3675,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
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -3732,6 +3735,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;
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -4549,6 +4557,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;
|
|
|
|
}
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -17926,6 +17938,71 @@ ColorScheme Document::PreferredColorScheme(IgnoreRFP aIgnoreRFP) const {
|
2021-12-07 11:53:17 -08:00
|
|
|
return LookAndFeel::PreferredColorSchemeForContent();
|
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:
|
|
|
|
+ case dom::PrefersReducedMotionOverride::EndGuard_:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2023-03-21 01:23:12 +00:00
|
|
|
+ if (ShouldResistFingerprinting()) {
|
2021-05-18 21:23:12 +02:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
|
|
|
|
+}
|
2021-06-08 16:00:15 -07:00
|
|
|
+
|
|
|
|
+bool Document::ForcedColors() const {
|
|
|
|
+ auto* docShell = static_cast<nsDocShell*>(GetDocShell());
|
|
|
|
+ nsIDocShell::ForcedColorsOverride forcedColors;
|
|
|
|
+ if (docShell && docShell->GetForcedColorsOverride(&forcedColors) == NS_OK) {
|
|
|
|
+ switch (forcedColors) {
|
|
|
|
+ case nsIDocShell::FORCED_COLORS_OVERRIDE_ACTIVE:
|
|
|
|
+ return true;
|
|
|
|
+ case nsIDocShell::FORCED_COLORS_OVERRIDE_NONE:
|
|
|
|
+ return false;
|
|
|
|
+ case nsIDocShell::FORCED_COLORS_OVERRIDE_NO_OVERRIDE:
|
|
|
|
+ break;
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (auto* bc = GetBrowsingContext()) {
|
|
|
|
+ switch (bc->Top()->ForcedColorsOverride()) {
|
|
|
|
+ case dom::ForcedColorsOverride::Active:
|
|
|
|
+ return true;
|
|
|
|
+ case dom::ForcedColorsOverride::None:
|
|
|
|
+ return false;
|
|
|
|
+ case dom::ForcedColorsOverride::No_override:
|
|
|
|
+ case dom::ForcedColorsOverride::EndGuard_:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (mIsBeingUsedAsImage) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return !PreferenceSheet::PrefsFor(*this).mUseDocumentColors;
|
|
|
|
+}
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 0a6be5aaa858277422fa67656deb8f39152bc24d..0108c385e3e7f34b48bd0992b1779007fc7f49fc 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/dom/base/Document.h
|
|
|
|
+++ b/dom/base/Document.h
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -4062,6 +4062,9 @@ 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-06-08 16:00:15 -07:00
|
|
|
+ bool ForcedColors() const;
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
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
|
2023-04-24 21:28:08 +00:00
|
|
|
index aebd8fb26596e0f701cc2173bd60d827e987e992..8fc5bdd912c9cf71fbd6541c5ae1189f56bb6bef 100644
|
2020-03-20 17:03:20 -07:00
|
|
|
--- a/dom/base/Navigator.cpp
|
|
|
|
+++ b/dom/base/Navigator.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -331,14 +331,18 @@ void Navigator::GetAppName(nsAString& aAppName, CallerType aCallerType) 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 :
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -390,7 +394,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
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -569,7 +579,13 @@ bool Navigator::CookieEnabled() {
|
2020-03-22 13:51:49 -07:00
|
|
|
return granted;
|
|
|
|
}
|
|
|
|
|
|
|
|
-bool Navigator::OnLine() { return !NS_IsOffline(); }
|
|
|
|
+bool Navigator::OnLine() {
|
|
|
|
+ nsDocShell* docShell = static_cast<nsDocShell*>(GetDocShell());
|
|
|
|
+ nsIDocShell::OnlineOverride onlineOverride;
|
|
|
|
+ if (!docShell || docShell->GetOnlineOverride(&onlineOverride) != NS_OK || onlineOverride == nsIDocShell::ONLINE_OVERRIDE_NONE)
|
|
|
|
+ return !NS_IsOffline();
|
|
|
|
+ return onlineOverride == nsIDocShell::ONLINE_OVERRIDE_ONLINE;
|
|
|
|
+}
|
|
|
|
|
|
|
|
void Navigator::GetBuildID(nsAString& aBuildID, CallerType aCallerType,
|
|
|
|
ErrorResult& aRv) const {
|
2020-03-20 17:03:20 -07:00
|
|
|
diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h
|
2023-04-24 21:28:08 +00:00
|
|
|
index 9f6b85ecfac7196cc57c1b1979313403a41d4a6c..0fe045f38c36eb0284bb7c1fb6d3346378f4ae07 100644
|
2020-03-20 17:03:20 -07:00
|
|
|
--- a/dom/base/Navigator.h
|
|
|
|
+++ b/dom/base/Navigator.h
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -217,7 +217,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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 66838dc517687e7583dfaa3c06a2dfe62afb4c5f..75f3326be1c4d9d828f548dc22ce8ad969bca2fd 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/base/nsContentUtils.cpp
|
|
|
|
+++ b/dom/base/nsContentUtils.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -8382,7 +8382,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,
|
|
|
|
+ bool convertToPointer) {
|
|
|
|
nsPoint offset;
|
|
|
|
nsCOMPtr<nsIWidget> widget = GetWidget(aPresShell, &offset);
|
|
|
|
if (!widget) return NS_ERROR_FAILURE;
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -8390,6 +8391,7 @@ nsresult nsContentUtils::SendMouseEvent(
|
2023-01-23 11:29:48 -08:00
|
|
|
EventMessage msg;
|
|
|
|
Maybe<WidgetMouseEvent::ExitFrom> exitFrom;
|
|
|
|
bool contextMenuKey = false;
|
|
|
|
+ bool isDragEvent = false;
|
|
|
|
if (aType.EqualsLiteral("mousedown")) {
|
|
|
|
msg = eMouseDown;
|
|
|
|
} else if (aType.EqualsLiteral("mouseup")) {
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -8414,6 +8416,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;
|
|
|
|
+ isDragEvent = true;
|
|
|
|
+ } else if (aType.EqualsLiteral("drop")) {
|
|
|
|
+ msg = eDrop;
|
|
|
|
+ isDragEvent = true;
|
|
|
|
} else {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -8422,12 +8430,21 @@ nsresult nsContentUtils::SendMouseEvent(
|
2023-01-23 11:29:48 -08:00
|
|
|
aInputSourceArg = MouseEvent_Binding::MOZ_SOURCE_MOUSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
- WidgetMouseEvent event(true, msg, widget,
|
|
|
|
+ std::unique_ptr<WidgetMouseEvent> eventOwner;
|
|
|
|
+ if (isDragEvent) {
|
|
|
|
+ eventOwner.reset(new WidgetDragEvent(true, msg, widget));
|
|
|
|
+ eventOwner->mReason = aIsWidgetEventSynthesized
|
|
|
|
+ ? WidgetMouseEvent::eSynthesized
|
|
|
|
+ : WidgetMouseEvent::eReal;
|
|
|
|
+ } else {
|
|
|
|
+ eventOwner.reset(new WidgetMouseEvent(true, msg, widget,
|
|
|
|
aIsWidgetEventSynthesized
|
|
|
|
? WidgetMouseEvent::eSynthesized
|
|
|
|
: WidgetMouseEvent::eReal,
|
|
|
|
contextMenuKey ? WidgetMouseEvent::eContextMenuKey
|
|
|
|
- : WidgetMouseEvent::eNormal);
|
|
|
|
+ : WidgetMouseEvent::eNormal));
|
|
|
|
+ }
|
|
|
|
+ WidgetMouseEvent& event = *eventOwner.get();
|
|
|
|
event.pointerId = aIdentifier;
|
|
|
|
event.mModifiers = GetWidgetModifiers(aModifiers);
|
|
|
|
event.mButton = aButton;
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -8440,6 +8457,7 @@ nsresult nsContentUtils::SendMouseEvent(
|
|
|
|
event.mClickCount = aClickCount;
|
2020-10-13 12:24:11 -07:00
|
|
|
event.mFlags.mIsSynthesizedForTests = aIsDOMEventSynthesized;
|
|
|
|
event.mExitFrom = exitFrom;
|
|
|
|
+ event.convertToPointer = convertToPointer;
|
|
|
|
|
|
|
|
nsPresContext* presContext = aPresShell->GetPresContext();
|
|
|
|
if (!presContext) return NS_ERROR_FAILURE;
|
|
|
|
diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h
|
2023-05-18 00:50:43 +00:00
|
|
|
index 10bb61f8f0ddba2f8460ccab5e23bea32df32857..b4c4f394cd8a71c57820d3cb562225910e1ba8d1 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/base/nsContentUtils.h
|
|
|
|
+++ b/dom/base/nsContentUtils.h
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -2911,7 +2911,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,
|
|
|
|
+ bool convertToPointer = true);
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 0997ef3c1092b536d4462d60f81f09425d0537aa..9d4fd3f96e9565c2b824c404654a06d1ad473f1b 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/base/nsDOMWindowUtils.cpp
|
|
|
|
+++ b/dom/base/nsDOMWindowUtils.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -683,7 +683,7 @@ nsDOMWindowUtils::SendMouseEvent(
|
2020-10-13 12:24:11 -07:00
|
|
|
int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame,
|
|
|
|
float aPressure, unsigned short aInputSourceArg,
|
|
|
|
bool aIsDOMEventSynthesized, bool aIsWidgetEventSynthesized,
|
|
|
|
- int32_t aButtons, uint32_t aIdentifier, uint8_t aOptionalArgCount,
|
|
|
|
+ int32_t aButtons, uint32_t aIdentifier, bool aDisablePointerEvent, uint8_t aOptionalArgCount,
|
|
|
|
bool* aPreventDefault) {
|
|
|
|
return SendMouseEventCommon(
|
|
|
|
aType, aX, aY, aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame,
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -691,7 +691,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);
|
|
|
|
+ aOptionalArgCount >= 6 ? aButtons : MOUSE_BUTTONS_NOT_SPECIFIED, !aDisablePointerEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -718,13 +718,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) {
|
|
|
|
+ bool aIsWidgetEventSynthesized, int32_t aButtons, bool aConvertToPointer) {
|
|
|
|
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);
|
|
|
|
+ &preventDefaultResult, aIsDOMEventSynthesized, aIsWidgetEventSynthesized, aConvertToPointer);
|
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
|
2023-03-21 01:23:12 +00:00
|
|
|
index 63968c9b7a4e418e4c0de6e7a75fa215a36a9105..4dcec26021e74ada0757b4686bd0782858995a4b 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);
|
|
|
|
+ bool aIsWidgetEventSynthesized, int32_t aButtons, bool aConvertToPointer = true);
|
|
|
|
|
|
|
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 7257629014b442de98176a313e2e51d1633b57a0..c3d647e663786acff4af2a340bb28e17dd4178ed 100644
|
2020-07-20 16:47:27 -07:00
|
|
|
--- a/dom/base/nsFocusManager.cpp
|
|
|
|
+++ b/dom/base/nsFocusManager.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -1633,6 +1633,10 @@ void nsFocusManager::SetFocusInner(Element* aNewContent, int32_t aFlags,
|
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() &&
|
2021-07-14 08:26:43 -08:00
|
|
|
!isElementInActiveWindow && (aFlags & FLAG_RAISE) &&
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -2944,7 +2948,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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 7a5df6943c7652d33f2b4ed773679fd6062023b5..c69fa9ed09ab132187917c4e3cead5647fc5ac68 100644
|
2020-03-26 18:42:21 -07:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.cpp
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -2481,7 +2481,7 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
|
2020-07-01 13:28:13 -07:00
|
|
|
&nsGlobalWindowInner::FireOnNewGlobalObject));
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (newInnerWindow && !newInnerWindow->mHasNotifiedGlobalCreated && mDoc) {
|
|
|
|
+ if (newInnerWindow && mDoc) {
|
|
|
|
// We should probably notify. However if this is the, arguably bad,
|
|
|
|
// situation when we're creating a temporary non-chrome-about-blank
|
|
|
|
// document in a chrome docshell, don't notify just yet. Instead wait
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -2500,10 +2500,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));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -2624,6 +2630,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) {
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -3744,6 +3763,14 @@ Maybe<CSSIntSize> nsGlobalWindowOuter::GetRDMDeviceSize(
|
2020-03-26 18:42:21 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ if (topInProcessContentDoc) {
|
|
|
|
+ nsIDocShell* docShell = topInProcessContentDoc->GetDocShell();
|
|
|
|
+ if (docShell && docShell->GetDeviceSizeIsPageSize()) {
|
|
|
|
+ nsPresContext* presContext = docShell->GetPresContext();
|
|
|
|
+ if (presContext)
|
|
|
|
+ return Some(CSSPixel::FromAppUnitsRounded(presContext->GetVisibleArea().Size()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
return Nothing();
|
|
|
|
}
|
|
|
|
|
2020-07-01 13:28:13 -07:00
|
|
|
diff --git a/dom/base/nsGlobalWindowOuter.h b/dom/base/nsGlobalWindowOuter.h
|
2023-04-24 21:28:08 +00:00
|
|
|
index 5d2a162dce39170b66595de3f99d83afedfae287..a98c01bb6ce1971e41c0398900bf8060542663c9 100644
|
2020-07-01 13:28:13 -07:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.h
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.h
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -333,6 +333,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
|
2023-03-21 01:23:12 +00:00
|
|
|
index 524ae260f708d5d3f6a7582984a57043eff679f2..503f1718527ef677ed9fef3f53e4dcc3f576aa34 100644
|
2020-04-13 11:31:02 -07:00
|
|
|
--- a/dom/base/nsINode.cpp
|
|
|
|
+++ b/dom/base/nsINode.cpp
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1331,6 +1331,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),
|
|
|
|
+ ScrollAxis(WhereToScroll::Center, WhenToScroll::Always),
|
|
|
|
+ ScrollAxis(WhereToScroll::Center, WhenToScroll::Always),
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index dfce140014c8a1009c3300a9a54871431f260d2e..f5e299613365ee9044ff1c688478172607318886 100644
|
2020-04-13 11:31:02 -07:00
|
|
|
--- a/dom/base/nsINode.h
|
|
|
|
+++ b/dom/base/nsINode.h
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -2146,6 +2146,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
|
2022-08-23 15:13:06 -07:00
|
|
|
index 1da84501bf3ce25b932ec3693f247cdb1a4fdf21..2305a1730e18ba7293a41772b9b7495b5aa66210 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/dom/base/nsJSUtils.cpp
|
|
|
|
+++ b/dom/base/nsJSUtils.cpp
|
2022-05-31 01:54:36 -06:00
|
|
|
@@ -169,6 +169,11 @@ bool nsJSUtils::GetScopeChainForElement(
|
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
|
2022-05-31 01:54:36 -06:00
|
|
|
index 85a21e459305f556933f4dc0fa7441d8f9ed95a9..d7cb86479ba2ed06542307349d6d86dfd026d55d 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/dom/base/nsJSUtils.h
|
|
|
|
+++ b/dom/base/nsJSUtils.h
|
2022-05-31 01:54:36 -06:00
|
|
|
@@ -78,6 +78,7 @@ class nsJSUtils {
|
2020-04-01 14:10:30 -07:00
|
|
|
JSContext* aCx, mozilla::dom::Element* aElement,
|
|
|
|
JS::MutableHandleVector<JSObject*> aScopeChain);
|
|
|
|
|
|
|
|
+ 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
|
2023-04-24 21:28:08 +00:00
|
|
|
index 590ad9e2fd6f1457150a39aa2979bebcc991c5ed..e35107c8f5cc64aa97c80cf1a2e11e601deab23d 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/dom/chrome-webidl/BrowsingContext.webidl
|
|
|
|
+++ b/dom/chrome-webidl/BrowsingContext.webidl
|
2021-06-08 16:00:15 -07:00
|
|
|
@@ -52,6 +52,24 @@ enum PrefersColorSchemeOverride {
|
2021-05-18 21:23:12 +02:00
|
|
|
"dark",
|
|
|
|
};
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * CSS prefers-reduced-motion values.
|
|
|
|
+ */
|
|
|
|
+enum PrefersReducedMotionOverride {
|
|
|
|
+ "none",
|
|
|
|
+ "reduce",
|
|
|
|
+ "no-preference",
|
|
|
|
+};
|
2021-06-08 16:00:15 -07:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * CSS forced-colors values.
|
|
|
|
+ */
|
|
|
|
+enum ForcedColorsOverride {
|
|
|
|
+ "none",
|
|
|
|
+ "active",
|
|
|
|
+ "no-override", /* This clears the override. */
|
|
|
|
+};
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Allowed overrides of platform/pref default behaviour for touch events.
|
|
|
|
*/
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -188,6 +206,12 @@ interface BrowsingContext {
|
2021-05-18 21:23:12 +02:00
|
|
|
// Color-scheme simulation, for DevTools.
|
|
|
|
[SetterThrows] attribute PrefersColorSchemeOverride prefersColorSchemeOverride;
|
|
|
|
|
|
|
|
+ // Reduced-Motion simulation, for DevTools.
|
|
|
|
+ [SetterThrows] attribute PrefersReducedMotionOverride prefersReducedMotionOverride;
|
2021-06-08 16:00:15 -07:00
|
|
|
+
|
|
|
|
+ // Forced-Colors simulation, for DevTools.
|
|
|
|
+ [SetterThrows] attribute ForcedColorsOverride forcedColorsOverride;
|
2021-05-18 21:23:12 +02:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* A unique identifier for the browser element that is hosting this
|
|
|
|
* BrowsingContext tree. Every BrowsingContext in the element's tree will
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -246,6 +270,8 @@ interface BrowsingContext {
|
2023-03-21 01:23:12 +00:00
|
|
|
undefined resetLocationChangeRateLimit();
|
|
|
|
|
|
|
|
readonly attribute long childOffset;
|
|
|
|
+
|
|
|
|
+ readonly attribute unsigned long long jugglerCurrentLoadIdentifier;
|
|
|
|
};
|
|
|
|
|
|
|
|
BrowsingContext includes LoadContextMixin;
|
2020-03-20 11:14:42 -07:00
|
|
|
diff --git a/dom/geolocation/Geolocation.cpp b/dom/geolocation/Geolocation.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
index ff6fe276e3f5a19e3e22d98c4a38222880797d99..96157d17485534f97a4e39675ee77808ac495bfe 100644
|
2020-03-20 11:14:42 -07:00
|
|
|
--- a/dom/geolocation/Geolocation.cpp
|
|
|
|
+++ b/dom/geolocation/Geolocation.cpp
|
2020-03-24 23:25:17 -07:00
|
|
|
@@ -23,6 +23,7 @@
|
|
|
|
#include "nsComponentManagerUtils.h"
|
|
|
|
#include "nsContentPermissionHelper.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
+#include "nsDocShell.h"
|
|
|
|
#include "nsGlobalWindow.h"
|
|
|
|
#include "mozilla/dom/Document.h"
|
|
|
|
#include "nsINamed.h"
|
2022-07-29 05:47:00 -07:00
|
|
|
@@ -260,10 +261,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;
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -441,8 +440,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();
|
|
|
|
}
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -732,8 +730,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;
|
|
|
|
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -825,7 +829,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
|
2023-01-23 11:29:48 -08:00
|
|
|
index 7e1af00d05fbafa2d828e2c7e4dcc5c82d115f5b..e85af9718d064e4d2865bc944e9d4ba1efb9a5d7 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;
|
2022-07-05 08:20:01 -07:00
|
|
|
@@ -48,13 +49,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
|
2022-07-05 08:20:01 -07:00
|
|
|
@@ -179,6 +181,8 @@ class Geolocation final : public nsIGeolocationUpdate, public nsWrapperCache {
|
2020-03-20 11:14:42 -07:00
|
|
|
// null.
|
|
|
|
static already_AddRefed<Geolocation> NonWindowSingleton();
|
|
|
|
|
|
|
|
+ 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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 84d72bb7c49d8e87e953441c9c842e2ba14016fd..f8cc70d6a5c3932d167627a8c2945113d9c6c31c 100644
|
2019-11-25 13:56:39 -08:00
|
|
|
--- a/dom/html/HTMLInputElement.cpp
|
|
|
|
+++ b/dom/html/HTMLInputElement.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -57,6 +57,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 "nsIFormControlFrame.h"
|
|
|
|
#include "nsITextControlFrame.h"
|
|
|
|
#include "nsIFrame.h"
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -778,6 +779,12 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
|
2019-11-25 13:56:39 -08:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ nsDocShell* docShell = static_cast<nsDocShell*>(win->GetDocShell());
|
|
|
|
+ if (docShell && docShell->IsFileInputInterceptionEnabled()) {
|
|
|
|
+ docShell->FilePickerShown(this);
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
+
|
2020-12-14 15:28:48 -08:00
|
|
|
if (IsPopupBlocked(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
|
2023-03-21 01:23:12 +00:00
|
|
|
index 89338882e70f7954d5f728406302c8bfc88ab3af..30bef01638db72293ea093ecb572b71bb88f9528 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
|
|
|
|
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
|
2022-08-23 15:13:06 -07:00
|
|
|
@@ -372,7 +372,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
2020-10-13 12:24:11 -07:00
|
|
|
[optional] in boolean aIsDOMEventSynthesized,
|
|
|
|
[optional] in boolean aIsWidgetEventSynthesized,
|
|
|
|
[optional] in long aButtons,
|
|
|
|
- [optional] in unsigned long aIdentifier);
|
|
|
|
+ [optional] in unsigned long aIdentifier,
|
|
|
|
+ [optional] in boolean aDisablePointerEvent);
|
|
|
|
|
|
|
|
/** Synthesize a touch event. The event types supported are:
|
|
|
|
* touchstart, touchend, touchmove, and touchcancel
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 5eddb4acb3b464e8a743c8b139231c537b364696..b1660d7497cf6b12892200dd8e2b37db745b8941 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
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -129,11 +129,12 @@ int32_t ScreenDeviceInfoImpl::GetOrientation(const char* aDeviceUniqueIdUTF8,
|
2021-05-06 19:11:42 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2020-07-27 16:22:02 -07:00
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
-VideoCaptureModule* DesktopCaptureImpl::Create(const int32_t aModuleId,
|
|
|
|
+VideoCaptureModuleEx* DesktopCaptureImpl::Create(const int32_t aModuleId,
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
int32_t WindowDeviceInfoImpl::Init() {
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -429,8 +430,12 @@ int32_t DesktopCaptureImpl::LazyInitDesktopCapturer() {
|
|
|
|
DesktopCapturer::SourceId sourceId = atoi(mDeviceUniqueId.c_str());
|
|
|
|
windowCapturer->SelectSource(sourceId);
|
2020-07-27 16:22:02 -07:00
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
- mCapturer = std::make_unique<DesktopAndCursorComposer>(
|
|
|
|
- std::move(windowCapturer), options);
|
2020-07-27 16:22:02 -07:00
|
|
|
+ if (capture_cursor_) {
|
2023-05-18 00:50:43 +00:00
|
|
|
+ mCapturer = std::make_unique<DesktopAndCursorComposer>(
|
|
|
|
+ std::move(windowCapturer), options);
|
2020-07-27 16:22:02 -07:00
|
|
|
+ } else {
|
2023-05-18 00:50:43 +00:00
|
|
|
+ mCapturer = std::move(windowCapturer);
|
2020-07-27 16:22:02 -07:00
|
|
|
+ }
|
2023-05-18 00:50:43 +00:00
|
|
|
} else if (mDeviceType == CaptureDeviceType::Browser) {
|
2020-08-12 10:09:20 -07:00
|
|
|
// XXX We don't capture cursors, so avoid the extra indirection layer. We
|
|
|
|
// could also pass null for the pMouseCursorMonitor.
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -446,7 +451,8 @@ int32_t DesktopCaptureImpl::LazyInitDesktopCapturer() {
|
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) {
|
|
|
|
@@ -463,6 +469,7 @@ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t aId, const char* aUniqueId,
|
|
|
|
aId)),
|
|
|
|
mDeviceUniqueId(aUniqueId),
|
|
|
|
mDeviceType(aType),
|
|
|
|
+ capture_cursor_(aCaptureCursor),
|
|
|
|
mTimeEvent(EventWrapper::Create()),
|
|
|
|
mLastFrameTimeMs(rtc::TimeMillis()),
|
|
|
|
mRunning(false),
|
|
|
|
@@ -494,6 +501,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();
|
|
|
|
@@ -679,6 +699,15 @@ void DesktopCaptureImpl::OnCaptureResult(DesktopCapturer::Result aResult,
|
|
|
|
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;
|
2022-01-18 04:16:04 -07:00
|
|
|
IncomingFrame(videoFrame, videoFrameLength,
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index fbbba4b8cd3c4aa93ae4c5f3f34ca78e926a16a7..57a1a7e560e5b862ef0fe18922b25a4b76ec2b88 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
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -48,6 +48,21 @@ 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;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
// simulate deviceInfo interface for video engine, bridge screen/application and
|
|
|
|
// real screen/application device info
|
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -160,13 +175,13 @@ class BrowserDeviceInfoImpl : public VideoCaptureModule::DeviceInfo {
|
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
|
|
|
|
*/
|
2023-05-18 00:50:43 +00:00
|
|
|
- static VideoCaptureModule* Create(
|
|
|
|
+ static VideoCaptureModuleEx* Create(
|
|
|
|
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,
|
|
|
|
@@ -178,6 +193,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;
|
|
|
|
@@ -198,7 +215,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();
|
2023-05-18 00:50:43 +00:00
|
|
|
int32_t DeliverCapturedFrame(webrtc::VideoFrame& aCaptureFrame);
|
2022-01-18 04:16:04 -07:00
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -215,6 +233,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|
|
|
void LazyInitCaptureThread();
|
|
|
|
int32_t LazyInitDesktopCapturer();
|
2021-05-06 19:11:42 -07:00
|
|
|
|
|
|
|
+ std::set<RawFrameCallback*> _rawFrameCallbacks;
|
2023-05-18 00:50:43 +00:00
|
|
|
+
|
|
|
|
// DesktopCapturer::Callback interface.
|
|
|
|
void OnCaptureResult(DesktopCapturer::Result result,
|
|
|
|
std::unique_ptr<DesktopFrame> frame) override;
|
|
|
|
@@ -231,6 +251,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|
|
|
std::atomic<uint32_t> mMaxFPSNeeded = {0};
|
|
|
|
// Set in StartCapture.
|
|
|
|
VideoCaptureCapability mRequestedCapability;
|
2020-07-27 16:22:02 -07:00
|
|
|
+ bool capture_cursor_ = true;
|
|
|
|
// This is created on the main thread and accessed on both the main thread
|
|
|
|
// and the capturer thread. It is created prior to the capturer thread
|
|
|
|
// starting and is destroyed after it is stopped.
|
2020-01-16 11:52:23 -08:00
|
|
|
diff --git a/dom/script/ScriptSettings.cpp b/dom/script/ScriptSettings.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
index 1f2d92bcb5d989bf9ecc044f8c51006f991b0007..9cf5dd885e658e0fe5e7ab75e7fc1f97a8d214b8 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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 5f9156ce2e70eb64653db72eb9dd1afddcec5633..af9efd55cf62b06ba9291bdc3af6819cc75be105 100644
|
2019-11-25 15:26:03 -08:00
|
|
|
--- a/dom/security/nsCSPUtils.cpp
|
|
|
|
+++ b/dom/security/nsCSPUtils.cpp
|
2021-03-02 18:52:19 -08:00
|
|
|
@@ -127,6 +127,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
|
2023-01-23 11:29:48 -08:00
|
|
|
index 2f71b284ee5f7e11f117c447834b48355784448c..2640bd57123c2b03bf4b06a2419cd020ba95f155 100644
|
2020-04-13 11:31:02 -07:00
|
|
|
--- a/dom/webidl/GeometryUtils.webidl
|
|
|
|
+++ b/dom/webidl/GeometryUtils.webidl
|
2022-08-01 14:40:23 -07:00
|
|
|
@@ -16,6 +16,8 @@ dictionary BoxQuadOptions {
|
|
|
|
GeometryNode relativeTo;
|
|
|
|
[ChromeOnly]
|
|
|
|
boolean createFramesForSuppressedWhitespace = true;
|
|
|
|
+ [ChromeOnly]
|
|
|
|
+ boolean recurseWhenNoFrame = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary ConvertCoordinateOptions {
|
|
|
|
@@ -27,6 +29,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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 3cc7ccebd23b1136e6360ed40c30353de2f43022..aad9ee4a96ec874fe81f32e131c86c7ebf6c5652 100644
|
2020-03-20 17:03:20 -07:00
|
|
|
--- a/dom/workers/RuntimeService.cpp
|
|
|
|
+++ b/dom/workers/RuntimeService.cpp
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -983,7 +983,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) {
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1185,8 +1185,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;
|
|
|
|
}
|
|
|
|
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1784,6 +1783,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();
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -2211,6 +2217,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
|
2023-01-23 11:29:48 -08:00
|
|
|
index d1a44a19e865fb76cf2b7bfe5e1fbd9c64ec0465..1a44fee6508ea0ef3f48700b83b1185565778cc8 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/RuntimeService.h
|
|
|
|
+++ b/dom/workers/RuntimeService.h
|
2022-07-05 08:20:01 -07:00
|
|
|
@@ -110,6 +110,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
|
2022-07-05 08:20:01 -07:00
|
|
|
index d10dabb5c5ff8e17851edf2bd2efc08e74584d8e..53c4070c5fde43b27fb8fbfdcf4c23d8af57fba3 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/WorkerCommon.h
|
|
|
|
+++ b/dom/workers/WorkerCommon.h
|
2022-07-05 08:20:01 -07:00
|
|
|
@@ -44,6 +44,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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 835017a4d681611c4c73d48a04f776ca042b2abc..5f281c8e07e0b53cede0f2f088822c62b1277ddf 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/WorkerPrivate.cpp
|
|
|
|
+++ b/dom/workers/WorkerPrivate.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -702,6 +702,18 @@ class UpdateContextOptionsRunnable final : public WorkerControlRunnable {
|
2020-03-26 16:33:07 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
+class ResetDefaultLocaleRunnable final : public WorkerControlRunnable {
|
|
|
|
+ public:
|
|
|
|
+ explicit ResetDefaultLocaleRunnable(WorkerPrivate* aWorkerPrivate)
|
|
|
|
+ : WorkerControlRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount) {}
|
|
|
|
+
|
|
|
|
+ virtual bool WorkerRun(JSContext* aCx,
|
|
|
|
+ WorkerPrivate* aWorkerPrivate) override {
|
|
|
|
+ aWorkerPrivate->ResetDefaultLocaleInternal(aCx);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
class UpdateLanguagesRunnable final : public WorkerRunnable {
|
|
|
|
nsTArray<nsString> mLanguages;
|
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -1973,6 +1985,16 @@ void WorkerPrivate::UpdateContextOptions(
|
2020-03-26 16:33:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void WorkerPrivate::ResetDefaultLocale() {
|
|
|
|
+ AssertIsOnParentThread();
|
|
|
|
+
|
|
|
|
+ RefPtr<ResetDefaultLocaleRunnable> runnable =
|
|
|
|
+ new ResetDefaultLocaleRunnable(this);
|
|
|
|
+ if (!runnable->Dispatch()) {
|
|
|
|
+ NS_WARNING("Failed to reset default locale in worker!");
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void WorkerPrivate::UpdateLanguages(const nsTArray<nsString>& aLanguages) {
|
|
|
|
AssertIsOnParentThread();
|
|
|
|
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -5290,6 +5312,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
|
2023-05-18 00:50:43 +00:00
|
|
|
index a3d28933a02e7d147f7b217cb7753036e8c503cf..a7f081c8869a52d16e91d86ed159310dd7a9fda5 100644
|
2020-03-26 16:33:07 -07:00
|
|
|
--- a/dom/workers/WorkerPrivate.h
|
|
|
|
+++ b/dom/workers/WorkerPrivate.h
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -340,6 +340,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,
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -961,6 +963,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
|
2022-06-29 04:46:49 -07:00
|
|
|
index 145dd3f07112c2390325de50f8eae674484adfe6..8cb3787e1b6bb25c6a58f1d910ae7dbc440d9ace 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) {
|
2022-06-29 04:46:49 -07:00
|
|
|
@@ -239,6 +240,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
|
2021-12-07 11:53:17 -08:00
|
|
|
index 180092bd3fc0b70462cc6ba67e72946e4c4c7604..bcaecb9fcd7b630c75289581a887cc6894733168 100644
|
2021-11-04 11:26:20 -07:00
|
|
|
--- a/intl/components/src/TimeZone.h
|
|
|
|
+++ b/intl/components/src/TimeZone.h
|
|
|
|
@@ -154,6 +154,8 @@ class TimeZone final {
|
|
|
|
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
|
2023-03-21 01:23:12 +00:00
|
|
|
index cd641a54d9f968b4f5ac62aff701576e63a29439..27067c68a74a5578b8b5e6bbef3a4b4876897eb1 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/js/public/Date.h
|
|
|
|
+++ b/js/public/Date.h
|
2021-04-01 18:49:01 -05:00
|
|
|
@@ -53,6 +53,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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 56c846794236da09f818e123afdcd43cd2956625..e4c543eaa84bc69677c2833f2bc1127f48a20e07 100644
|
2020-03-25 16:28:33 -07:00
|
|
|
--- a/js/src/debugger/Object.cpp
|
|
|
|
+++ b/js/src/debugger/Object.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -2382,7 +2382,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
|
2023-03-21 01:23:12 +00:00
|
|
|
index cb3d1288c8b3f40fbcb40429381306c230960d76..7ec3f6c4e6d037aadd798f891ecfca0b5a83678a 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/js/src/vm/DateTime.cpp
|
|
|
|
+++ b/js/src/vm/DateTime.cpp
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -179,6 +179,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);
|
|
|
|
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -510,10 +515,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) {
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -735,9 +754,17 @@ void js::ResyncICUDefaultTimeZone() {
|
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;
|
|
|
|
+ }
|
|
|
|
+
|
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
|
2023-01-23 11:29:48 -08:00
|
|
|
index b70e4e0ae25947daed0079334956b8cabd5c52b7..38750b81cf82749d5cc6aaa72aa037bc466468f4 100644
|
2020-04-01 14:10:30 -07:00
|
|
|
--- a/js/src/vm/DateTime.h
|
|
|
|
+++ b/js/src/vm/DateTime.h
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -62,6 +62,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
|
|
|
+
|
|
|
|
/**
|
|
|
|
* ICU's default time zone, used for various date/time formatting operations
|
|
|
|
* that include the local time in the representation, is allowed to go stale
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -201,6 +203,7 @@ class DateTimeInfo {
|
2020-04-01 14:10:30 -07:00
|
|
|
// and js::ResyncICUDefaultTimeZone().
|
|
|
|
friend void js::ResetTimeZoneInternal(ResetTimeZoneMode);
|
|
|
|
friend void js::ResyncICUDefaultTimeZone();
|
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) {
|
|
|
|
auto guard = instance->lock();
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -292,6 +295,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
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -307,6 +312,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
|
|
|
|
index dac899f7558b26d6848da8b98ed8a93555c8751a..2a07d67fa1c2840b25085566e84dc3b2d9b789cf 100644
|
|
|
|
--- 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;
|
|
|
|
@@ -261,11 +262,27 @@ static bool CheckFramesInSameTopLevelBrowsingContext(nsIFrame* aFrame1,
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static nsIFrame* GetFrameForNode(nsINode* aNode,
|
|
|
|
+ bool aCreateFramesForSuppressedWhitespace,
|
|
|
|
+ bool aRecurseWhenNoFrame) {
|
|
|
|
+ nsIFrame* frame = GetFrameForNode(aNode, aCreateFramesForSuppressedWhitespace);
|
|
|
|
+ if (!frame && aRecurseWhenNoFrame && aNode->IsContent()) {
|
|
|
|
+ dom::FlattenedChildIterator iter(aNode->AsContent());
|
|
|
|
+ for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
|
|
|
+ frame = GetFrameForNode(child, aCreateFramesForSuppressedWhitespace, aRecurseWhenNoFrame);
|
|
|
|
+ if (frame) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return frame;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void GetBoxQuads(nsINode* aNode, const dom::BoxQuadOptions& aOptions,
|
|
|
|
nsTArray<RefPtr<DOMQuad> >& aResult, CallerType aCallerType,
|
|
|
|
ErrorResult& aRv) {
|
|
|
|
nsIFrame* frame =
|
|
|
|
- GetFrameForNode(aNode, aOptions.mCreateFramesForSuppressedWhitespace);
|
|
|
|
+ GetFrameForNode(aNode, aOptions.mCreateFramesForSuppressedWhitespace, aOptions.mRecurseWhenNoFrame);
|
|
|
|
if (!frame) {
|
|
|
|
// No boxes to return
|
|
|
|
return;
|
|
|
|
@@ -280,7 +297,7 @@ void GetBoxQuads(nsINode* aNode, const dom::BoxQuadOptions& aOptions,
|
|
|
|
// when that happens and re-check it.
|
|
|
|
if (!weakFrame.IsAlive()) {
|
|
|
|
frame =
|
|
|
|
- GetFrameForNode(aNode, aOptions.mCreateFramesForSuppressedWhitespace);
|
|
|
|
+ GetFrameForNode(aNode, aOptions.mCreateFramesForSuppressedWhitespace, aOptions.mRecurseWhenNoFrame);
|
|
|
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 0e38125bc75874f4edbe1916194204ee8845a9bd..96cfa21eed9a4c33ffc7095458268acb263bc75a 100644
|
2022-06-02 09:04:04 -07:00
|
|
|
--- a/layout/base/PresShell.cpp
|
|
|
|
+++ b/layout/base/PresShell.cpp
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -10936,7 +10936,9 @@ auto PresShell::ComputeActiveness() const -> Activeness {
|
2022-06-02 09:04:04 -07:00
|
|
|
if (!browserChild->IsVisible()) {
|
|
|
|
MOZ_LOG(gLog, LogLevel::Debug,
|
|
|
|
(" > BrowserChild %p is not visible", browserChild));
|
|
|
|
- return {false, inActiveTab};
|
|
|
|
+ bool isActive;
|
|
|
|
+ root->GetDocShell()->GetForceActiveState(&isActive);
|
|
|
|
+ return {isActive, inActiveTab};
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the browser is visible but just due to be preserving layers
|
2021-06-08 16:00:15 -07:00
|
|
|
diff --git a/layout/style/GeckoBindings.h b/layout/style/GeckoBindings.h
|
2023-05-18 00:50:43 +00:00
|
|
|
index 953a040ecf8c99364faa7cbd4d1f212971fe9b47..aa63c02a85cd23303cb4874dbed9425bf4e315ac 100644
|
2021-06-08 16:00:15 -07:00
|
|
|
--- a/layout/style/GeckoBindings.h
|
|
|
|
+++ b/layout/style/GeckoBindings.h
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -615,6 +615,7 @@ void Gecko_MediaFeatures_GetDeviceSize(const mozilla::dom::Document*,
|
2021-06-08 16:00:15 -07:00
|
|
|
|
|
|
|
float Gecko_MediaFeatures_GetResolution(const mozilla::dom::Document*);
|
|
|
|
bool Gecko_MediaFeatures_PrefersReducedMotion(const mozilla::dom::Document*);
|
|
|
|
+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
|
2023-04-24 21:28:08 +00:00
|
|
|
index 5cd90a4ca6cb85808076ece7dbc616c3fecdc352..7fbb6e25a815c4d63919c40beaea89aae62add59 100644
|
2021-05-18 21:23:12 +02:00
|
|
|
--- a/layout/style/nsMediaFeatures.cpp
|
|
|
|
+++ b/layout/style/nsMediaFeatures.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -276,10 +276,11 @@ bool Gecko_MediaFeatures_MatchesPlatform(StylePlatform aPlatform) {
|
2021-05-18 21:23:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Gecko_MediaFeatures_PrefersReducedMotion(const Document* aDocument) {
|
2023-03-21 01:23:12 +00:00
|
|
|
- if (aDocument->ShouldResistFingerprinting()) {
|
2021-05-18 21:23:12 +02:00
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
|
|
|
|
+ return aDocument->PrefersReducedMotion();
|
2021-06-08 16:00:15 -07:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool Gecko_MediaFeatures_ForcedColors(const Document* aDocument) {
|
|
|
|
+ return aDocument->ForcedColors();
|
2021-05-18 21:23:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
StylePrefersColorScheme Gecko_MediaFeatures_PrefersColorScheme(
|
2021-09-01 13:27:37 +03:00
|
|
|
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
|
2023-05-18 00:50:43 +00:00
|
|
|
index 35dc85223333f510b7dd7b96739738b0f8a1629a..eca736a28ff5a9f75a6e1f19f8f4bc9614a93af0 100644
|
2021-09-01 13:27:37 +03:00
|
|
|
--- a/modules/libpref/init/all.js
|
|
|
|
+++ b/modules/libpref/init/all.js
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -4117,7 +4117,9 @@ pref("devtools.experiment.f12.shortcut_disabled", false);
|
2021-09-01 13:27:37 +03:00
|
|
|
// doesn't provide a way to lock the pref
|
|
|
|
pref("dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled", false);
|
|
|
|
#else
|
|
|
|
-pref("dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled", false, locked);
|
|
|
|
+// Playwright: DO NOT make preference locked so that we can overwrite it
|
|
|
|
+// later in our playwright.cfg file.
|
|
|
|
+pref("dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled", false);
|
|
|
|
#endif
|
|
|
|
|
2023-01-23 11:29:48 -08:00
|
|
|
// Whether sites require the open-protocol-handler permission to open a
|
2020-11-13 14:56:27 -08:00
|
|
|
diff --git a/netwerk/base/nsINetworkInterceptController.idl b/netwerk/base/nsINetworkInterceptController.idl
|
2023-05-18 00:50:43 +00:00
|
|
|
index d72dc570dc82ff9d576942b9e7c23d8a74d68049..a5fcddc4b0e53a862e5a77120b4ccff8a27cfbab 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.
|
|
|
|
diff --git a/netwerk/protocol/http/InterceptedHttpChannel.cpp b/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
2023-03-21 01:23:12 +00:00
|
|
|
index 735b3a134a8c7104909ff9424eff74eab80c4830..a31e8b68e201dbf238d80ab32d46d4657f9b8cd7 100644
|
2020-11-13 14:56:27 -08:00
|
|
|
--- a/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
|
|
|
+++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -728,6 +728,14 @@ NS_IMPL_ISUPPORTS(ResetInterceptionHeaderVisitor, nsIHttpHeaderVisitor)
|
|
|
|
|
|
|
|
} // 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",
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1070,11 +1078,18 @@ InterceptedHttpChannel::OnStartRequest(nsIRequest* aRequest) {
|
|
|
|
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
|
2023-04-24 21:28:08 +00:00
|
|
|
index da570e5b6dbaffb9a7ba8bffcf14dd9e180d5215..3782a2d47b1feca7897924bff46ac4a0b0a383df 100644
|
2020-03-05 17:20:07 -08:00
|
|
|
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
|
|
|
|
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1371,6 +1371,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
|
2023-01-23 11:29:48 -08:00
|
|
|
index 4f2f595fb14c7c7244d5fe9a3da2eadc0c3b3adc..3ca0b4a3b9f4bdf21c1107a1e5ea3f0f58050f51 100644
|
2020-03-05 17:20:07 -08:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.cpp
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.cpp
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -472,7 +472,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;
|
|
|
|
@@ -689,14 +694,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-01-23 11:29:48 -08:00
|
|
|
index 42760f8ec675af22bdf27a07954b1d3b600d29ab..aad868ef636dbb743f3268d662db7914a2418588 100644
|
2020-03-31 17:32:50 -07:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.h
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.h
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -119,6 +119,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-01-23 11:29:48 -08:00
|
|
|
index e31cf158dcac3540b0c721cbd677b8522d7549b3..029fc67df81911e3abf3724e8ed99e4bde010f4b 100644
|
2020-03-31 17:32:50 -07:00
|
|
|
--- a/security/manager/ssl/nsICertOverrideService.idl
|
|
|
|
+++ b/security/manager/ssl/nsICertOverrideService.idl
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -143,7 +143,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
|
|
|
};
|
2020-03-22 23:52:59 -07:00
|
|
|
diff --git a/services/settings/Utils.jsm b/services/settings/Utils.jsm
|
2023-04-24 21:28:08 +00:00
|
|
|
index 94f47133802fd47a8a2bb800bdda8382d7ee82e5..2aa50e24dc1cb39012ed1d2b3b370cce546d28b1 100644
|
2020-03-22 23:52:59 -07:00
|
|
|
--- a/services/settings/Utils.jsm
|
|
|
|
+++ b/services/settings/Utils.jsm
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -103,7 +103,7 @@ function _isUndefined(value) {
|
2022-05-02 21:46:05 -06:00
|
|
|
|
|
|
|
var Utils = {
|
|
|
|
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
|
|
|
},
|
2021-06-08 16:00:15 -07:00
|
|
|
diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs
|
2023-04-24 21:28:08 +00:00
|
|
|
index 8f56f185d2ab47041a73837fe1b150c305db2893..8282ca4c0aa6d5848642fcfb48e74a90924ca7fe 100644
|
2021-06-08 16:00:15 -07:00
|
|
|
--- a/servo/components/style/gecko/media_features.rs
|
|
|
|
+++ b/servo/components/style/gecko/media_features.rs
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -265,10 +265,15 @@ pub enum ForcedColors {
|
2021-06-08 16:00:15 -07:00
|
|
|
|
|
|
|
/// https://drafts.csswg.org/mediaqueries-5/#forced-colors
|
2022-06-29 04:46:49 -07:00
|
|
|
fn eval_forced_colors(context: &Context, query_value: Option<ForcedColors>) -> bool {
|
|
|
|
- let forced = !context.device().use_document_colors();
|
2021-06-08 16:00:15 -07:00
|
|
|
+ let prefers_forced_colors =
|
2022-06-29 04:46:49 -07:00
|
|
|
+ unsafe { bindings::Gecko_MediaFeatures_ForcedColors(context.device().document()) };
|
2021-06-08 16:00:15 -07:00
|
|
|
+ let query_value = match query_value {
|
|
|
|
+ Some(v) => v,
|
|
|
|
+ None => return prefers_forced_colors,
|
|
|
|
+ };
|
|
|
|
match query_value {
|
|
|
|
- Some(query_value) => forced == (query_value == ForcedColors::Active),
|
|
|
|
- None => forced,
|
|
|
|
+ ForcedColors::Active => prefers_forced_colors,
|
|
|
|
+ ForcedColors::None => !prefers_forced_colors,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 00:36:46 -07:00
|
|
|
diff --git a/toolkit/components/browser/nsIWebBrowserChrome.idl b/toolkit/components/browser/nsIWebBrowserChrome.idl
|
2023-04-24 21:28:08 +00:00
|
|
|
index 54de3abab5757dd706e3d909ccef6a0bed5deacc..f5c5480cd052ede0c76e5eec733dbb9283389045 100644
|
2020-09-30 00:36:46 -07:00
|
|
|
--- a/toolkit/components/browser/nsIWebBrowserChrome.idl
|
|
|
|
+++ b/toolkit/components/browser/nsIWebBrowserChrome.idl
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -71,6 +71,9 @@ interface nsIWebBrowserChrome : nsISupports
|
2020-09-30 00:36:46 -07:00
|
|
|
// Whether this window should use out-of-process cross-origin subframes.
|
|
|
|
const unsigned long CHROME_FISSION_WINDOW = 0x00200000;
|
|
|
|
|
|
|
|
+ // 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.
|
|
|
|
const unsigned long CHROME_SUPPRESS_ANIMATION = 0x01000000;
|
2023-01-23 11:29:48 -08:00
|
|
|
diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
|
2023-05-18 00:50:43 +00:00
|
|
|
index 0fad0ee2916098af5923f5ad0fc8a479f8ec706a..4b5586f7213919e871c085cb8b07f80f5a7d893f 100644
|
2023-01-23 11:29:48 -08:00
|
|
|
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
|
|
|
|
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.sys.mjs
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -113,6 +113,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) {
|
2020-03-24 20:51:21 -07:00
|
|
|
diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp
|
2023-01-23 11:29:48 -08:00
|
|
|
index 34ced370120f843ab7afd330fb5626ae6f6da7e4..205fc4e5fe3adeacbfe5ab6c15d1bbccf7baf9e8 100644
|
2020-03-24 20:51:21 -07:00
|
|
|
--- a/toolkit/components/startup/nsAppStartup.cpp
|
|
|
|
+++ b/toolkit/components/startup/nsAppStartup.cpp
|
2021-11-04 11:26:20 -07:00
|
|
|
@@ -370,7 +370,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
|
2023-04-24 21:28:08 +00:00
|
|
|
index 6d6a91821e0df64e12e576d8c9e5b3d2e6aade27..1a8b8ff82586cca439dafc5e13e8c46adadd6ecc 100644
|
2020-09-30 00:36:46 -07:00
|
|
|
--- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
|
|
|
+++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1854,7 +1854,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
|
|
|
/**
|
2020-03-22 23:52:59 -07:00
|
|
|
diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/UpdateService.jsm
|
2023-05-18 00:50:43 +00:00
|
|
|
index b6257a954787a9f4015c4d55836c70865edeb5a4..ea2eb94efea166aa90993217871c3c80c6d247fc 100644
|
2020-03-22 23:52:59 -07:00
|
|
|
--- a/toolkit/mozapps/update/UpdateService.jsm
|
|
|
|
+++ b/toolkit/mozapps/update/UpdateService.jsm
|
2023-05-18 00:50:43 +00:00
|
|
|
@@ -3864,6 +3864,8 @@ UpdateService.prototype = {
|
2021-07-14 08:26:43 -08:00
|
|
|
},
|
2020-03-22 23:52:59 -07:00
|
|
|
|
2021-07-14 08:26:43 -08:00
|
|
|
get disabledForTesting() {
|
2022-06-29 04:46:49 -07:00
|
|
|
+ /* for playwright */
|
|
|
|
+ return true;
|
|
|
|
return (
|
2022-07-29 05:47:00 -07:00
|
|
|
(Cu.isInAutomation ||
|
|
|
|
lazy.Marionette.running ||
|
2019-11-18 18:18:28 -08:00
|
|
|
diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
|
2023-01-23 11:29:48 -08:00
|
|
|
index 04453a437873b2e6339cb7e81ee11c2a5bb46bb1..2ce3151b9a97e7b86619109716a6d942b80f58ed 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/toolkit/toolkit.mozbuild
|
|
|
|
+++ b/toolkit/toolkit.mozbuild
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -153,6 +153,7 @@ if CONFIG['ENABLE_WEBDRIVER']:
|
2021-07-14 08:26:43 -08:00
|
|
|
'/remote',
|
2019-11-18 18:18:28 -08:00
|
|
|
'/testing/firefox-ui',
|
|
|
|
'/testing/marionette',
|
2020-03-05 17:20:07 -08:00
|
|
|
+ '/juggler',
|
2019-11-18 18:18:28 -08:00
|
|
|
'/toolkit/components/telemetry/tests/marionette',
|
|
|
|
]
|
|
|
|
|
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
|
2023-01-23 11:29:48 -08:00
|
|
|
index ea14a59b80bbfbaa17d7569734b8409d9d21fcde..28cb052c3115f91e6a036ad8466385ff1d740cd0 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
|
2021-12-07 11:53:17 -08:00
|
|
|
@@ -14,9 +14,11 @@
|
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"
|
2021-12-07 11:53:17 -08:00
|
|
|
#include "nsWindowsHelpers.h"
|
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
|
|
|
|
|
|
|
+#include <io.h>
|
|
|
|
#include <windows.h>
|
2021-12-07 11:53:17 -08:00
|
|
|
#include <versionhelpers.h>
|
|
|
|
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -130,6 +132,19 @@ 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
|
2023-01-23 11:29:48 -08:00
|
|
|
index e1e46ccdceae595f95d100116ff480905047e82b..eaa0252e768140120158525723ad867b8cb020be 100644
|
2019-11-18 18:18:28 -08:00
|
|
|
--- a/uriloader/base/nsDocLoader.cpp
|
|
|
|
+++ b/uriloader/base/nsDocLoader.cpp
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -830,6 +830,13 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout,
|
2019-12-11 17:53:46 -08:00
|
|
|
("DocLoader:%p: Firing load event for document.open\n",
|
|
|
|
this));
|
|
|
|
|
|
|
|
+ nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
|
|
+ if (os) {
|
|
|
|
+ nsIPrincipal* principal = doc->NodePrincipal();
|
2020-01-11 01:20:39 +01:00
|
|
|
+ if (!principal->IsSystemPrincipal())
|
2019-12-11 17:53:46 -08:00
|
|
|
+ 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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 540aaedd7462759740df31a0cb5d228651ba94b7..c0a1119dc4a51e7ff8cbfdbda5f007d9eb958948 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"
|
|
|
|
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -836,6 +837,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);
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -1446,7 +1453,12 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel* aChannel) {
|
2020-04-06 23:34:30 -07:00
|
|
|
// Strip off the ".part" from mTempLeafName
|
|
|
|
mTempLeafName.Truncate(mTempLeafName.Length() - ArrayLength(".part") + 1);
|
|
|
|
|
|
|
|
+ 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);
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1635,7 +1647,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;
|
|
|
|
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -1687,6 +1728,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
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -2197,6 +2241,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;
|
|
|
|
}
|
|
|
|
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -2682,6 +2736,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
|
2023-03-21 01:23:12 +00:00
|
|
|
index 62f9d60abcd072e4ca23cd44cf52133d29b91dfc..5ebb5c6c305fdbc761641cdf2929787874dad5df 100644
|
2020-04-06 23:34:30 -07:00
|
|
|
--- a/uriloader/exthandler/nsExternalHelperAppService.h
|
|
|
|
+++ b/uriloader/exthandler/nsExternalHelperAppService.h
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -253,6 +253,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;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -452,6 +454,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
|
2022-08-23 15:13:06 -07:00
|
|
|
index 307e6196a89df52d0bccc3ebd1359f58e32de75d..c3692d0f76178ac3aeb1c77a0e973bfa22359346 100644
|
2020-04-06 23:34:30 -07:00
|
|
|
--- a/uriloader/exthandler/nsIExternalHelperAppService.idl
|
|
|
|
+++ b/uriloader/exthandler/nsIExternalHelperAppService.idl
|
2020-04-23 14:26:00 -07:00
|
|
|
@@ -6,6 +6,8 @@
|
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;
|
|
|
|
interface nsIRequest;
|
|
|
|
interface nsIStreamListener;
|
2020-10-07 14:12:19 -07:00
|
|
|
@@ -15,6 +17,17 @@ interface nsIWebProgressListener2;
|
|
|
|
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
|
|
|
|
+{
|
2020-04-23 14:26:00 -07:00
|
|
|
+ bool 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.
|
2020-10-07 14:12:19 -07:00
|
|
|
@@ -76,6 +89,7 @@ interface nsIExternalHelperAppService : nsISupports
|
2020-04-06 23:34:30 -07:00
|
|
|
boolean applyDecodingForExtension(in AUTF8String aExtension,
|
|
|
|
in ACString aEncodingType);
|
|
|
|
|
|
|
|
+ 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
|
2021-04-01 11:27:44 -07:00
|
|
|
diff --git a/widget/cocoa/NativeKeyBindings.mm b/widget/cocoa/NativeKeyBindings.mm
|
2022-05-02 21:46:05 -06:00
|
|
|
index d3e5983259053175584254e7ac01ca9ce024f33a..97f5b851c402fea5477c0ee57af451c62b016eec 100644
|
2021-04-01 11:27:44 -07:00
|
|
|
--- a/widget/cocoa/NativeKeyBindings.mm
|
|
|
|
+++ b/widget/cocoa/NativeKeyBindings.mm
|
2023-02-21 11:46:10 -08:00
|
|
|
@@ -492,6 +492,13 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
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())) {
|
2023-02-21 11:46:10 -08:00
|
|
|
@@ -512,6 +519,13 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
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())) {
|
2023-02-21 11:46:10 -08:00
|
|
|
@@ -532,6 +546,10 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
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()) {
|
2023-02-21 11:46:10 -08:00
|
|
|
@@ -541,7 +559,7 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
2021-04-01 11:27:44 -07:00
|
|
|
instance->AppendEditCommandsForSelector(
|
|
|
|
!aEvent.IsShift()
|
|
|
|
? ToObjcSelectorPtr(@selector(moveToBeginningOfDocument:))
|
|
|
|
- : ToObjcSelectorPtr(@selector(moveToBegginingOfDocumentAndModifySelection:)),
|
|
|
|
+ : ToObjcSelectorPtr(@selector(moveToBeginningOfDocumentAndModifySelection:)),
|
|
|
|
aCommands);
|
|
|
|
break;
|
|
|
|
}
|
2023-02-21 11:46:10 -08:00
|
|
|
@@ -564,6 +582,10 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
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()) {
|
2020-07-14 11:20:36 -07:00
|
|
|
diff --git a/widget/headless/HeadlessCompositorWidget.cpp b/widget/headless/HeadlessCompositorWidget.cpp
|
2023-04-24 21:28:08 +00:00
|
|
|
index bb4ee9175e66dc40de1871a7f91368fe309494a3..856faef297c9eb0a510df123513b9ac095634e98 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-04-24 21:28:08 +00:00
|
|
|
@@ -16,7 +17,30 @@ HeadlessCompositorWidget::HeadlessCompositorWidget(
|
|
|
|
: CompositorWidget(aOptions),
|
|
|
|
mWidget(aWindow),
|
|
|
|
mClientSize(LayoutDeviceIntSize(aInitData.InitialClientSize()),
|
|
|
|
- "HeadlessCompositorWidget::mClientSize") {}
|
|
|
|
+ "HeadlessCompositorWidget::mClientSize"),
|
|
|
|
+ mMon("snapshotListener") {}
|
|
|
|
+
|
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-04-24 21:28:08 +00:00
|
|
|
|
2020-07-14 11:20:36 -07:00
|
|
|
void HeadlessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
|
|
|
|
if (RefPtr<CompositorVsyncDispatcher> cvd =
|
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
|
2023-05-18 00:50:43 +00:00
|
|
|
index 0112fab80c463a7d02a1b0397eeb74c075c38501..ba9f27cf9e315b95aebde5338ed5f520df72c779 100644
|
2020-07-14 11:20:36 -07:00
|
|
|
--- a/widget/headless/HeadlessWidget.cpp
|
|
|
|
+++ b/widget/headless/HeadlessWidget.cpp
|
2023-03-21 01:23:12 +00:00
|
|
|
@@ -109,6 +109,8 @@ void HeadlessWidget::Destroy() {
|
2020-07-15 09:37:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ SetSnapshotListener(nullptr);
|
|
|
|
+
|
|
|
|
nsBaseWidget::OnDestroy();
|
|
|
|
|
|
|
|
nsBaseWidget::Destroy();
|
2023-04-24 21:28:08 +00:00
|
|
|
@@ -614,5 +616,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
|
2023-05-18 00:50:43 +00:00
|
|
|
index f07c929d9228c5dfebf983818213516bc4be5cb6..e560485adefeb1f58efd65c0b6c941ccc4fd4723 100644
|
2020-07-14 11:20:36 -07:00
|
|
|
--- a/widget/headless/HeadlessWidget.h
|
|
|
|
+++ b/widget/headless/HeadlessWidget.h
|
2023-01-23 11:29:48 -08:00
|
|
|
@@ -141,6 +141,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;
|
2020-10-13 12:24:11 -07:00
|
|
|
diff --git a/xpcom/reflect/xptinfo/xptinfo.h b/xpcom/reflect/xptinfo/xptinfo.h
|
2022-07-05 08:20:01 -07:00
|
|
|
index 2456c2c2b58b27cd595880b547ed20fb687a1835..e967c089b2331c7cd36d34e511543fbc84320b7d 100644
|
2020-10-13 12:24:11 -07:00
|
|
|
--- a/xpcom/reflect/xptinfo/xptinfo.h
|
|
|
|
+++ b/xpcom/reflect/xptinfo/xptinfo.h
|
2021-07-14 08:26:43 -08:00
|
|
|
@@ -514,7 +514,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
|
|
|
|
|
|
|
|
/**
|