2020-01-30 05:56:11 +03:00
|
|
|
diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h
|
2021-04-20 23:27:57 +03:00
|
|
|
index 26606bdefcd1a184f0ae731fb5ffe973253c8b2e..e4f62f9d31914b37ba3eb9c2f5f65da36d33b781 100644
|
2020-01-30 05:56:11 +03:00
|
|
|
--- a/accessible/base/NotificationController.h
|
|
|
|
+++ b/accessible/base/NotificationController.h
|
2021-04-20 23:27:57 +03:00
|
|
|
@@ -275,6 +275,8 @@ class NotificationController final : public EventQueue,
|
2020-01-30 05:56:11 +03: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
|
2021-04-02 02:49:01 +03:00
|
|
|
index ec83b699e1449b2610b43b35694ee18d80cee2ff..66854bda7d8c20627949289b9f2e2e161a00fea8 100644
|
2020-01-30 05:56:11 +03:00
|
|
|
--- a/accessible/xpcom/xpcAccessibleDocument.cpp
|
|
|
|
+++ b/accessible/xpcom/xpcAccessibleDocument.cpp
|
2021-04-02 02:49:01 +03:00
|
|
|
@@ -142,6 +142,15 @@ xpcAccessibleDocument::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) {
|
2020-01-30 05:56:11 +03: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
|
2021-04-02 02:49:01 +03:00
|
|
|
index 94aab80cef662a0ba092557cf2a9882c3dc919ac..f1df85042035d89665d7103faf52a8922856a052 100644
|
2020-01-30 05:56:11 +03: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 20:58:56 +03:00
|
|
|
diff --git a/browser/app/winlauncher/LauncherProcessWin.cpp b/browser/app/winlauncher/LauncherProcessWin.cpp
|
2021-07-14 19:26:43 +03:00
|
|
|
index 6aebc7bde2cbb00ef2e127e417d92e5406c21259..dfbd67d4c8316c8f9d1019969a6f8433f75cb9a7 100644
|
2020-10-05 20:58:56 +03:00
|
|
|
--- a/browser/app/winlauncher/LauncherProcessWin.cpp
|
|
|
|
+++ b/browser/app/winlauncher/LauncherProcessWin.cpp
|
2020-10-08 00:12:19 +03:00
|
|
|
@@ -23,6 +23,7 @@
|
2020-10-05 20:58:56 +03:00
|
|
|
#include "mozilla/WinHeaderOnlyUtils.h"
|
|
|
|
#include "nsWindowsHelpers.h"
|
|
|
|
|
|
|
|
+#include <io.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <processthreadsapi.h>
|
|
|
|
|
2021-03-03 05:52:19 +03:00
|
|
|
@@ -327,8 +328,19 @@ Maybe<int> LauncherMain(int& argc, wchar_t* argv[],
|
2020-10-05 20:58:56 +03:00
|
|
|
HANDLE stdHandles[] = {::GetStdHandle(STD_INPUT_HANDLE),
|
|
|
|
::GetStdHandle(STD_OUTPUT_HANDLE),
|
|
|
|
::GetStdHandle(STD_ERROR_HANDLE)};
|
|
|
|
-
|
|
|
|
attrs.AddInheritableHandles(stdHandles);
|
|
|
|
+ // Playwright pipe installation.
|
|
|
|
+ bool hasJugglerPipe =
|
|
|
|
+ mozilla::CheckArg(argc, argv, L"juggler-pipe",
|
|
|
|
+ static_cast<const wchar_t**>(nullptr),
|
|
|
|
+ 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 21:32:47 +03:00
|
|
|
+ if (hasJugglerPipe) {
|
2020-10-05 20:58:56 +03: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-19 05:18:28 +03:00
|
|
|
diff --git a/browser/installer/allowed-dupes.mn b/browser/installer/allowed-dupes.mn
|
2021-09-08 16:47:26 +03:00
|
|
|
index 2e9dd92cf49ac185a5ae7090bc65f5c013eb8ffc..8e52e68c1fe0f61bdfa4198855de092572ef3129 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/browser/installer/allowed-dupes.mn
|
|
|
|
+++ b/browser/installer/allowed-dupes.mn
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -72,6 +72,12 @@ browser/features/webcompat@mozilla.org/shims/empty-shim.txt
|
|
|
|
removed-files
|
|
|
|
#endif
|
2020-04-16 03:31:59 +03:00
|
|
|
|
2019-11-19 05:18:28 +03: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-16 03:31:59 +03:00
|
|
|
+
|
2019-11-19 05:18:28 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
index b74da500f0a2b236779fa21cc287f8ae9f3aa23a..2d0319916e001a98dbe5a88e2ee8bfd76aede930 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/browser/installer/package-manifest.in
|
|
|
|
+++ b/browser/installer/package-manifest.in
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -201,6 +201,11 @@
|
2021-07-14 19:26:43 +03:00
|
|
|
@RESPATH@/chrome/remote.manifest
|
2019-11-19 05:18:28 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
+@RESPATH@/chrome/juggler@JAREXT@
|
|
|
|
+@RESPATH@/chrome/juggler.manifest
|
|
|
|
+@RESPATH@/components/juggler.manifest
|
|
|
|
+@RESPATH@/components/juggler.js
|
|
|
|
+
|
|
|
|
#if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
|
|
|
|
@RESPATH@/components/TestInterfaceJS.js
|
|
|
|
@RESPATH@/components/TestInterfaceJS.manifest
|
2020-01-29 01:03:19 +03:00
|
|
|
diff --git a/devtools/server/socket/websocket-server.js b/devtools/server/socket/websocket-server.js
|
|
|
|
index 040c7b124dec6bb254563bbe74fe50012cb077a3..b4e6b8132786af70e8ad0dce88b67c2835307f88 100644
|
|
|
|
--- a/devtools/server/socket/websocket-server.js
|
|
|
|
+++ b/devtools/server/socket/websocket-server.js
|
|
|
|
@@ -133,13 +133,12 @@ function writeHttpResponse(output, response) {
|
|
|
|
* 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");
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -189,13 +188,13 @@ function computeKey(key) {
|
|
|
|
/**
|
|
|
|
* 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, [
|
|
|
|
@@ -217,8 +216,8 @@ const serverHandshake = async function(input, output) {
|
|
|
|
* 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 22:23:12 +03:00
|
|
|
diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 7f5837052f73a08ec8cc9f3cd5aa196d1ce7d927..0ef65d18a0b46832131cd8166b1f5be7473d9c16 100644
|
2021-05-18 22:23:12 +03:00
|
|
|
--- a/docshell/base/BrowsingContext.cpp
|
|
|
|
+++ b/docshell/base/BrowsingContext.cpp
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -107,6 +107,20 @@ struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride>
|
2021-05-18 22:23:12 +03: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-09 02:00:15 +03:00
|
|
|
+
|
|
|
|
+template <>
|
|
|
|
+struct ParamTraits<mozilla::dom::ForcedColorsOverride>
|
|
|
|
+ : public ContiguousEnumSerializer<
|
|
|
|
+ mozilla::dom::ForcedColorsOverride,
|
|
|
|
+ mozilla::dom::ForcedColorsOverride::None,
|
|
|
|
+ mozilla::dom::ForcedColorsOverride::EndGuard_> {};
|
2021-05-18 22:23:12 +03:00
|
|
|
+
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
|
|
|
|
: public ContiguousEnumSerializer<
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -2722,6 +2736,40 @@ void BrowsingContext::DidSet(FieldIndex<IDX_PrefersColorSchemeOverride>,
|
2021-05-18 22:23:12 +03: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-09 02:00:15 +03: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 22:23:12 +03:00
|
|
|
+
|
|
|
|
void BrowsingContext::DidSet(FieldIndex<IDX_MediumOverride>,
|
|
|
|
nsString&& aOldValue) {
|
|
|
|
MOZ_ASSERT(IsTop());
|
|
|
|
diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h
|
2021-10-14 01:49:41 +03:00
|
|
|
index 678fe50e1646e3de7e138b9522e300e8d02290bd..c324c4049306c488b31ae06c73821006102233a3 100644
|
2021-05-18 22:23:12 +03:00
|
|
|
--- a/docshell/base/BrowsingContext.h
|
|
|
|
+++ b/docshell/base/BrowsingContext.h
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -195,6 +195,8 @@ enum class ExplicitActiveStatus : uint8_t {
|
2021-05-18 22:23:12 +03:00
|
|
|
FIELD(ServiceWorkersTestingEnabled, bool) \
|
|
|
|
FIELD(MediumOverride, nsString) \
|
|
|
|
FIELD(PrefersColorSchemeOverride, mozilla::dom::PrefersColorSchemeOverride) \
|
|
|
|
+ FIELD(PrefersReducedMotionOverride, mozilla::dom::PrefersReducedMotionOverride) \
|
2021-06-09 02:00:15 +03:00
|
|
|
+ FIELD(ForcedColorsOverride, mozilla::dom::ForcedColorsOverride) \
|
2021-05-18 22:23:12 +03:00
|
|
|
FIELD(DisplayMode, mozilla::dom::DisplayMode) \
|
2021-09-08 16:47:26 +03:00
|
|
|
/* The number of entries added to the session history because of this \
|
|
|
|
* browsing context. */ \
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -855,6 +857,14 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
2021-05-18 22:23:12 +03:00
|
|
|
return GetPrefersColorSchemeOverride();
|
|
|
|
}
|
|
|
|
|
|
|
|
+ dom::PrefersReducedMotionOverride PrefersReducedMotionOverride() const {
|
|
|
|
+ return GetPrefersReducedMotionOverride();
|
|
|
|
+ }
|
2021-06-09 02:00:15 +03:00
|
|
|
+
|
|
|
|
+ dom::ForcedColorsOverride ForcedColorsOverride() const {
|
|
|
|
+ return GetForcedColorsOverride();
|
|
|
|
+ }
|
2021-05-18 22:23:12 +03:00
|
|
|
+
|
|
|
|
void FlushSessionStore();
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
bool IsInBFCache() const;
|
|
|
|
@@ -990,6 +1000,23 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
2021-05-18 22:23:12 +03:00
|
|
|
void DidSet(FieldIndex<IDX_PrefersColorSchemeOverride>,
|
|
|
|
dom::PrefersColorSchemeOverride aOldValue);
|
|
|
|
|
|
|
|
+ bool CanSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
|
|
|
|
+ dom::PrefersReducedMotionOverride, ContentParent*) {
|
|
|
|
+ return IsTop();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void DidSet(FieldIndex<IDX_PrefersReducedMotionOverride>,
|
|
|
|
+ dom::PrefersReducedMotionOverride aOldValue);
|
2021-06-09 02:00:15 +03:00
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bool CanSet(FieldIndex<IDX_ForcedColorsOverride>,
|
|
|
|
+ dom::ForcedColorsOverride, ContentParent*) {
|
|
|
|
+ return IsTop();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void DidSet(FieldIndex<IDX_ForcedColorsOverride>,
|
|
|
|
+ dom::ForcedColorsOverride aOldValue);
|
2021-05-18 22:23:12 +03:00
|
|
|
+
|
|
|
|
void DidSet(FieldIndex<IDX_MediumOverride>, nsString&& aOldValue);
|
|
|
|
|
|
|
|
bool CanSet(FieldIndex<IDX_SuspendMediaWhenInactive>, bool, ContentParent*) {
|
2019-11-19 05:18:28 +03:00
|
|
|
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 850b2dec6baa50b983ed2976b99ae24d36d37af1..a9a505a10ea5879d92e10803d80ab44a99af7b5e 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/docshell/base/nsDocShell.cpp
|
|
|
|
+++ b/docshell/base/nsDocShell.cpp
|
2020-04-02 00:10:30 +03:00
|
|
|
@@ -15,6 +15,12 @@
|
2020-03-27 02:33:07 +03: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"
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -64,6 +70,7 @@
|
2020-03-20 21:14:42 +03: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 20:32:50 +03:00
|
|
|
#include "mozilla/dom/HTMLIFrameElement.h"
|
2020-03-20 21:14:42 +03:00
|
|
|
#include "mozilla/dom/PerformanceNavigation.h"
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -88,6 +95,7 @@
|
2020-03-27 02:33:07 +03:00
|
|
|
#include "mozilla/dom/LoadURIOptionsBinding.h"
|
|
|
|
#include "mozilla/dom/JSWindowActorChild.h"
|
2020-06-10 08:48:10 +03:00
|
|
|
#include "mozilla/ipc/ProtocolUtils.h"
|
2020-03-27 02:33:07 +03:00
|
|
|
+#include "mozilla/dom/WorkerCommon.h"
|
2020-05-08 04:37:15 +03:00
|
|
|
#include "mozilla/net/DocumentChannel.h"
|
2021-07-14 19:26:43 +03:00
|
|
|
#include "mozilla/net/DocumentChannelChild.h"
|
2020-08-12 20:09:20 +03:00
|
|
|
#include "mozilla/net/ParentChannelWrapper.h"
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -111,6 +119,7 @@
|
2019-11-26 00:56:39 +03:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "mozilla/dom/Document.h"
|
|
|
|
+#include "mozilla/dom/Element.h"
|
|
|
|
#include "nsIDocumentLoaderFactory.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
|
|
|
#include "nsIEditingSession.h"
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -205,6 +214,7 @@
|
2020-03-31 01:05:46 +03:00
|
|
|
#include "nsGlobalWindow.h"
|
|
|
|
#include "nsISearchService.h"
|
|
|
|
#include "nsJSEnvironment.h"
|
|
|
|
+#include "nsJSUtils.h"
|
|
|
|
#include "nsNetCID.h"
|
|
|
|
#include "nsNetUtil.h"
|
|
|
|
#include "nsObjectLoadingContent.h"
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -368,6 +378,14 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
|
2020-08-12 20:09:20 +03:00
|
|
|
mAllowDNSPrefetch(true),
|
2020-05-08 04:37:15 +03:00
|
|
|
mAllowWindowControl(true),
|
2019-11-26 00:56:39 +03:00
|
|
|
mCSSErrorReportingEnabled(false),
|
|
|
|
+ mFileInputInterceptionEnabled(false),
|
2020-04-16 00:41:18 +03:00
|
|
|
+ mOverrideHasFocus(false),
|
2019-11-26 02:26:03 +03:00
|
|
|
+ mBypassCSPEnabled(false),
|
2020-11-06 04:53:22 +03:00
|
|
|
+ mForceActiveState(false),
|
2020-03-22 23:51:49 +03:00
|
|
|
+ mOnlineOverride(nsIDocShell::ONLINE_OVERRIDE_NONE),
|
2020-07-28 23:46:37 +03:00
|
|
|
+ mColorSchemeOverride(COLOR_SCHEME_OVERRIDE_NONE),
|
2021-05-18 22:23:12 +03:00
|
|
|
+ mReducedMotionOverride(REDUCED_MOTION_OVERRIDE_NONE),
|
2021-06-09 02:00:15 +03:00
|
|
|
+ mForcedColorsOverride(FORCED_COLORS_OVERRIDE_NO_OVERRIDE),
|
2019-11-26 00:56:39 +03:00
|
|
|
mAllowAuth(mItemType == typeContent),
|
|
|
|
mAllowKeywordFixup(false),
|
2021-04-02 02:49:01 +03:00
|
|
|
mDisableMetaRefreshWhenInactive(false),
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -3086,6 +3104,239 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
|
2019-11-26 00:56:39 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2020-03-22 23:51:49 +03:00
|
|
|
+// =============== Juggler Begin =======================
|
|
|
|
+
|
2019-11-26 00:56:39 +03: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-26 02:26:03 +03: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-06 04:53:22 +03: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-15 02:28:48 +03:00
|
|
|
+ ActivenessMaybeChanged();
|
2020-11-06 04:53:22 +03:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2019-11-26 02:26:03 +03:00
|
|
|
+bool nsDocShell::IsBypassCSPEnabled() {
|
|
|
|
+ return GetRootDocShell()->mBypassCSPEnabled;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2020-04-16 00:41:18 +03: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-21 03:03:20 +03:00
|
|
|
+nsDocShell::GetLanguageOverride(nsAString& aLanguageOverride) {
|
2020-03-22 23:51:49 +03:00
|
|
|
+ aLanguageOverride = GetRootDocShell()->mLanguageOverride;
|
2020-03-21 03:03:20 +03:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2020-03-27 02:33:07 +03: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-21 03:03:20 +03:00
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetLanguageOverride(const nsAString& aLanguageOverride) {
|
|
|
|
+ mLanguageOverride = aLanguageOverride;
|
2020-03-27 02:33:07 +03:00
|
|
|
+ SetIcuLocale(aLanguageOverride);
|
2020-03-21 03:03:20 +03:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2020-04-02 00:10:30 +03:00
|
|
|
+nsDocShell::OverrideTimezone(const nsAString& aTimezoneOverride,
|
|
|
|
+ bool* aSuccess) {
|
2020-03-31 01:05:46 +03:00
|
|
|
+ NS_ENSURE_ARG(aSuccess);
|
2020-04-02 00:10:30 +03:00
|
|
|
+ NS_LossyConvertUTF16toASCII timeZoneId(aTimezoneOverride);
|
|
|
|
+ *aSuccess = nsJSUtils::SetTimeZoneOverride(timeZoneId.get());
|
2020-03-31 01:05:46 +03:00
|
|
|
+
|
2020-04-02 00:10:30 +03:00
|
|
|
+ // Set TZ which affects localtime_s().
|
2020-03-31 01:05:46 +03: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-02 00:10:30 +03:00
|
|
|
+ *aSuccess = setTimeZoneEnv(timeZoneId.get());
|
|
|
|
+ if (!*aSuccess) {
|
|
|
|
+ fprintf(stderr, "Failed to set 'TZ' to '%s'\n", timeZoneId.get());
|
|
|
|
+ }
|
2020-03-31 01:05:46 +03:00
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
2019-11-26 00:56:39 +03:00
|
|
|
+nsDocShell::GetFileInputInterceptionEnabled(bool* aEnabled) {
|
|
|
|
+ MOZ_ASSERT(aEnabled);
|
2020-03-22 23:51:49 +03:00
|
|
|
+ *aEnabled = GetRootDocShell()->mFileInputInterceptionEnabled;
|
2019-11-26 00:56:39 +03: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 21:14:42 +03:00
|
|
|
+
|
2020-03-22 23:51:49 +03:00
|
|
|
+RefPtr<nsGeolocationService> nsDocShell::GetGeolocationServiceOverride() {
|
|
|
|
+ return GetRootDocShell()->mGeolocationServiceOverride;
|
2020-03-20 21:14:42 +03:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetGeolocationOverride(nsIDOMGeoPosition* aGeolocationOverride) {
|
|
|
|
+ if (aGeolocationOverride) {
|
2020-03-22 23:51:49 +03:00
|
|
|
+ if (!mGeolocationServiceOverride) {
|
|
|
|
+ mGeolocationServiceOverride = new nsGeolocationService();
|
|
|
|
+ mGeolocationServiceOverride->Init();
|
2020-03-20 21:14:42 +03:00
|
|
|
+ }
|
2020-03-22 23:51:49 +03:00
|
|
|
+ mGeolocationServiceOverride->Update(aGeolocationOverride);
|
2020-03-20 21:14:42 +03:00
|
|
|
+ } else {
|
2020-03-22 23:51:49 +03:00
|
|
|
+ mGeolocationServiceOverride = nullptr;
|
2020-03-20 21:14:42 +03:00
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
2020-03-22 23:51:49 +03: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 23:46:37 +03:00
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::GetColorSchemeOverride(ColorSchemeOverride* aColorSchemeOverride) {
|
|
|
|
+ *aColorSchemeOverride = GetRootDocShell()->mColorSchemeOverride;
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsDocShell::SetColorSchemeOverride(ColorSchemeOverride aColorSchemeOverride) {
|
|
|
|
+ mColorSchemeOverride = aColorSchemeOverride;
|
2020-08-13 22:16:00 +03:00
|
|
|
+ RefPtr<nsPresContext> presContext = GetPresContext();
|
|
|
|
+ if (presContext) {
|
|
|
|
+ presContext->MediaFeatureValuesChanged(
|
2020-11-18 19:19:09 +03:00
|
|
|
+ {MediaFeatureChangeReason::SystemMetricsChange},
|
|
|
|
+ MediaFeatureChangePropagation::JustThisDocument);
|
2020-08-13 22:16:00 +03:00
|
|
|
+ }
|
2020-07-28 23:46:37 +03:00
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
2021-05-18 22:23:12 +03:00
|
|
|
+NS_IMETHODIMP
|
|
|
|
+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-09 02:00:15 +03: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 23:51:49 +03:00
|
|
|
+// =============== Juggler End =======================
|
2019-11-26 00:56:39 +03:00
|
|
|
+
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDocShell::GetIsNavigating(bool* aOut) {
|
|
|
|
*aOut = mIsNavigating;
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -4720,7 +4971,7 @@ nsDocShell::GetVisibility(bool* aVisibility) {
|
2020-12-15 02:28:48 +03:00
|
|
|
}
|
2020-11-06 04:53:22 +03:00
|
|
|
|
2020-12-15 02:28:48 +03: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-15 02:28:48 +03:00
|
|
|
if (RefPtr<PresShell> presShell = GetPresShell()) {
|
2021-08-11 03:37:57 +03:00
|
|
|
presShell->ActivenessMaybeChanged();
|
2020-12-15 02:28:48 +03:00
|
|
|
}
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -8442,6 +8693,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
|
2020-04-15 22:02:08 +03: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;
|
|
|
|
}
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -12489,6 +12746,9 @@ class OnLinkClickEvent : public Runnable {
|
2020-08-06 20:32:50 +03:00
|
|
|
mHandler->OnLinkClickSync(mContent, mLoadState, mNoOpenerImplied,
|
|
|
|
mTriggeringPrincipal);
|
2020-03-05 22:59:29 +03:00
|
|
|
}
|
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ observerService->NotifyObservers(ToSupports(mContent), "juggler-link-click-sync", nullptr);
|
|
|
|
+
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -12567,6 +12827,8 @@ nsresult nsDocShell::OnLinkClick(
|
2020-08-06 20:32:50 +03:00
|
|
|
nsCOMPtr<nsIRunnable> ev =
|
|
|
|
new OnLinkClickEvent(this, aContent, loadState, noOpenerImplied,
|
|
|
|
aIsTrusted, aTriggeringPrincipal);
|
2020-03-05 22:59:29 +03:00
|
|
|
+ nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
+ observerService->NotifyObservers(ToSupports(aContent), "juggler-link-click", nullptr);
|
2020-05-08 04:37:15 +03:00
|
|
|
return Dispatch(TaskCategory::UI, ev.forget());
|
2020-03-05 22:59:29 +03:00
|
|
|
}
|
|
|
|
|
2019-11-26 00:56:39 +03:00
|
|
|
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
|
2021-10-14 01:49:41 +03:00
|
|
|
index 03bda9a0856c06a690227b5059971515896eebb0..7ffb3dc9a2fa2486671d9b747605812449515b7c 100644
|
2019-11-26 00:56:39 +03:00
|
|
|
--- a/docshell/base/nsDocShell.h
|
|
|
|
+++ b/docshell/base/nsDocShell.h
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -16,6 +16,7 @@
|
2020-03-07 05:25:27 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2019-11-26 00:56:39 +03:00
|
|
|
#include "mozilla/WeakPtr.h"
|
|
|
|
#include "mozilla/dom/BrowsingContext.h"
|
|
|
|
+#include "mozilla/dom/Element.h"
|
2020-03-07 05:25:27 +03:00
|
|
|
#include "mozilla/dom/WindowProxyHolder.h"
|
2020-12-15 02:28:48 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCharsetSource.h"
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -76,6 +77,7 @@ class nsCommandManager;
|
2020-12-15 02:28:48 +03:00
|
|
|
class nsDocShellEditorData;
|
|
|
|
class nsDOMNavigationTiming;
|
|
|
|
class nsDSURIContentListener;
|
|
|
|
+class nsGeolocationService;
|
|
|
|
class nsGlobalWindowOuter;
|
|
|
|
|
|
|
|
class FramingChecker;
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -400,6 +402,15 @@ class nsDocShell final : public nsDocLoader,
|
2020-03-25 09:25:17 +03:00
|
|
|
void SetWillChangeProcess() { mWillChangeProcess = true; }
|
2020-10-08 00:12:19 +03:00
|
|
|
bool WillChangeProcess() { return mWillChangeProcess; }
|
2019-11-26 00:56:39 +03:00
|
|
|
|
|
|
|
+ bool IsFileInputInterceptionEnabled();
|
|
|
|
+ void FilePickerShown(mozilla::dom::Element* element);
|
2019-11-26 02:26:03 +03:00
|
|
|
+
|
2020-04-16 00:41:18 +03:00
|
|
|
+ bool ShouldOverrideHasFocus() const;
|
|
|
|
+
|
2019-11-26 02:26:03 +03:00
|
|
|
+ bool IsBypassCSPEnabled();
|
2020-03-20 21:14:42 +03:00
|
|
|
+
|
2020-03-22 23:51:49 +03:00
|
|
|
+ RefPtr<nsGeolocationService> GetGeolocationServiceOverride();
|
2019-11-26 00:56:39 +03:00
|
|
|
+
|
|
|
|
// Create a content viewer within this nsDocShell for the given
|
|
|
|
// `WindowGlobalChild` actor.
|
|
|
|
nsresult CreateContentViewerForActor(
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -1000,6 +1011,8 @@ class nsDocShell final : public nsDocLoader,
|
2019-11-26 00:56:39 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1278,6 +1291,17 @@ class nsDocShell final : public nsDocLoader,
|
2020-08-12 20:09:20 +03:00
|
|
|
bool mAllowDNSPrefetch : 1;
|
2020-05-08 04:37:15 +03:00
|
|
|
bool mAllowWindowControl : 1;
|
2019-11-26 00:56:39 +03:00
|
|
|
bool mCSSErrorReportingEnabled : 1;
|
|
|
|
+ bool mFileInputInterceptionEnabled: 1;
|
2020-04-16 00:41:18 +03:00
|
|
|
+ bool mOverrideHasFocus : 1;
|
2019-11-26 02:26:03 +03:00
|
|
|
+ bool mBypassCSPEnabled : 1;
|
2020-11-06 04:53:22 +03:00
|
|
|
+ bool mForceActiveState : 1;
|
2020-03-21 03:03:20 +03:00
|
|
|
+ nsString mLanguageOverride;
|
2020-03-22 23:51:49 +03:00
|
|
|
+ RefPtr<nsGeolocationService> mGeolocationServiceOverride;
|
|
|
|
+ OnlineOverride mOnlineOverride;
|
2020-07-28 23:46:37 +03:00
|
|
|
+ ColorSchemeOverride mColorSchemeOverride;
|
2021-05-18 22:23:12 +03:00
|
|
|
+ ReducedMotionOverride mReducedMotionOverride;
|
2021-06-09 02:00:15 +03:00
|
|
|
+ ForcedColorsOverride mForcedColorsOverride;
|
2020-03-22 23:51:49 +03:00
|
|
|
+
|
2019-11-26 00:56:39 +03:00
|
|
|
bool mAllowAuth : 1;
|
|
|
|
bool mAllowKeywordFixup : 1;
|
2021-04-02 02:49:01 +03:00
|
|
|
bool mDisableMetaRefreshWhenInactive : 1;
|
2019-11-26 00:56:39 +03:00
|
|
|
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
|
2021-10-14 01:49:41 +03:00
|
|
|
index cde0c30784c28f4bef85e0100fd374a1823f2896..4a1f8bc872d1ab8e13143763d65530037ab149c3 100644
|
2019-11-26 00:56:39 +03:00
|
|
|
--- a/docshell/base/nsIDocShell.idl
|
|
|
|
+++ b/docshell/base/nsIDocShell.idl
|
2020-03-20 21:14:42 +03:00
|
|
|
@@ -44,6 +44,7 @@ interface nsIURI;
|
|
|
|
interface nsIChannel;
|
|
|
|
interface nsIContentViewer;
|
|
|
|
interface nsIContentSecurityPolicy;
|
|
|
|
+interface nsIDOMGeoPosition;
|
|
|
|
interface nsIEditor;
|
|
|
|
interface nsIEditingSession;
|
2021-04-02 02:49:01 +03:00
|
|
|
interface nsIInputStream;
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -805,6 +806,49 @@ interface nsIDocShell : nsIDocShellTreeItem
|
2019-11-26 00:56:39 +03:00
|
|
|
*/
|
2020-01-11 03:20:39 +03:00
|
|
|
void synchronizeLayoutHistoryState();
|
2020-05-08 04:37:15 +03:00
|
|
|
|
2019-11-26 00:56:39 +03:00
|
|
|
+ attribute boolean fileInputInterceptionEnabled;
|
2019-11-26 02:26:03 +03:00
|
|
|
+
|
2020-04-16 00:41:18 +03:00
|
|
|
+ attribute boolean overrideHasFocus;
|
|
|
|
+
|
2019-11-26 02:26:03 +03:00
|
|
|
+ attribute boolean bypassCSPEnabled;
|
2020-03-20 21:14:42 +03:00
|
|
|
+
|
2020-11-06 04:53:22 +03:00
|
|
|
+ attribute boolean forceActiveState;
|
|
|
|
+
|
2020-03-21 03:03:20 +03:00
|
|
|
+ attribute AString languageOverride;
|
|
|
|
+
|
2020-03-31 01:05:46 +03:00
|
|
|
+ boolean overrideTimezone(in AString timezoneId);
|
|
|
|
+
|
2020-03-22 23:51:49 +03:00
|
|
|
+ cenum OnlineOverride: 8 {
|
|
|
|
+ ONLINE_OVERRIDE_NONE = 0,
|
|
|
|
+ ONLINE_OVERRIDE_ONLINE = 1,
|
|
|
|
+ ONLINE_OVERRIDE_OFFLINE = 2,
|
|
|
|
+ };
|
|
|
|
+ [infallible] attribute nsIDocShell_OnlineOverride onlineOverride;
|
|
|
|
+
|
2020-07-28 23:46:37 +03:00
|
|
|
+ cenum ColorSchemeOverride : 8 {
|
|
|
|
+ COLOR_SCHEME_OVERRIDE_LIGHT,
|
|
|
|
+ COLOR_SCHEME_OVERRIDE_DARK,
|
|
|
|
+ COLOR_SCHEME_OVERRIDE_NO_PREFERENCE,
|
|
|
|
+ COLOR_SCHEME_OVERRIDE_NONE, /* This clears the override. */
|
|
|
|
+ };
|
|
|
|
+ [infallible] attribute nsIDocShell_ColorSchemeOverride colorSchemeOverride;
|
|
|
|
+
|
2021-05-18 22:23:12 +03: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-09 02:00:15 +03: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 21:14:42 +03:00
|
|
|
+ void setGeolocationOverride(in nsIDOMGeoPosition position);
|
2020-05-08 04:37:15 +03:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* This attempts to save any applicable layout history state (like
|
|
|
|
* scroll position) in the nsISHEntry. This is normally done
|
2019-11-26 02:26:03 +03:00
|
|
|
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index bbac2d0720f767fde2b1034c60bdedd490942bf3..7c2dc00171fc2ad32e5cf40ba1f31d825506c364 100644
|
2019-11-26 02:26:03 +03:00
|
|
|
--- a/dom/base/Document.cpp
|
|
|
|
+++ b/dom/base/Document.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -3496,6 +3496,9 @@ void Document::SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages) {
|
2019-11-26 02:26:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void Document::ApplySettingsFromCSP(bool aSpeculative) {
|
|
|
|
+ if (mDocumentContainer && mDocumentContainer->IsBypassCSPEnabled())
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (!aSpeculative) {
|
|
|
|
// 1) apply settings from regular CSP
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -3558,6 +3561,11 @@ nsresult Document::InitCSP(nsIChannel* aChannel) {
|
2019-11-26 02:26:03 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ 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;
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -4340,6 +4348,10 @@ bool Document::HasFocus(ErrorResult& rv) const {
|
2020-04-16 00:41:18 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (IsActive() && mDocumentContainer->ShouldOverrideHasFocus()) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
2021-08-11 03:37:57 +03:00
|
|
|
if (!fm->IsInActiveWindow(bc)) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -17201,6 +17213,20 @@ void Document::RemoveToplevelLoadingDocument(Document* aDoc) {
|
2020-07-28 23:46:37 +03:00
|
|
|
|
|
|
|
StylePrefersColorScheme Document::PrefersColorScheme(
|
|
|
|
IgnoreRFP aIgnoreRFP) const {
|
|
|
|
+ auto* docShell = static_cast<nsDocShell*>(GetDocShell());
|
|
|
|
+ nsIDocShell::ColorSchemeOverride colorScheme;
|
2021-03-30 00:53:18 +03:00
|
|
|
+ if (docShell && docShell->GetColorSchemeOverride(&colorScheme) == NS_OK &&
|
2020-07-28 23:46:37 +03:00
|
|
|
+ colorScheme != nsIDocShell::COLOR_SCHEME_OVERRIDE_NONE) {
|
|
|
|
+ switch (colorScheme) {
|
|
|
|
+ case nsIDocShell::COLOR_SCHEME_OVERRIDE_LIGHT:
|
|
|
|
+ return StylePrefersColorScheme::Light;
|
|
|
|
+ case nsIDocShell::COLOR_SCHEME_OVERRIDE_DARK:
|
|
|
|
+ return StylePrefersColorScheme::Dark;
|
2021-06-09 02:00:15 +03:00
|
|
|
+ case nsIDocShell::COLOR_SCHEME_OVERRIDE_NONE:
|
2020-07-28 23:46:37 +03:00
|
|
|
+ case nsIDocShell::COLOR_SCHEME_OVERRIDE_NO_PREFERENCE:
|
2021-04-20 23:27:57 +03:00
|
|
|
+ break;
|
2020-07-28 23:46:37 +03:00
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
if (aIgnoreRFP == IgnoreRFP::No &&
|
|
|
|
nsContentUtils::ShouldResistFingerprinting(this)) {
|
|
|
|
return StylePrefersColorScheme::Light;
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -17240,6 +17266,71 @@ StylePrefersColorScheme Document::PrefersColorScheme(
|
2021-05-18 22:23:12 +03:00
|
|
|
return dark ? StylePrefersColorScheme::Dark : StylePrefersColorScheme::Light;
|
|
|
|
}
|
|
|
|
|
|
|
|
+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;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (nsContentUtils::ShouldResistFingerprinting(this)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
|
|
|
|
+}
|
2021-06-09 02:00:15 +03: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 22:23:12 +03:00
|
|
|
+
|
|
|
|
// static
|
|
|
|
bool Document::UseOverlayScrollbars(const Document* aDocument) {
|
|
|
|
BrowsingContext* bc = aDocument ? aDocument->GetBrowsingContext() : nullptr;
|
|
|
|
diff --git a/dom/base/Document.h b/dom/base/Document.h
|
2021-10-14 01:49:41 +03:00
|
|
|
index f4def501ba9748eb58f8cd10f7ee435801461584..869377af6814ea599f0e32ef84878412f9d72f1a 100644
|
2021-05-18 22:23:12 +03:00
|
|
|
--- a/dom/base/Document.h
|
|
|
|
+++ b/dom/base/Document.h
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -3985,6 +3985,9 @@ class Document : public nsINode,
|
2021-05-18 22:23:12 +03:00
|
|
|
enum class IgnoreRFP { No, Yes };
|
|
|
|
StylePrefersColorScheme PrefersColorScheme(IgnoreRFP = IgnoreRFP::No) const;
|
|
|
|
|
|
|
|
+ bool PrefersReducedMotion() const;
|
2021-06-09 02:00:15 +03:00
|
|
|
+ bool ForcedColors() const;
|
2021-05-18 22:23:12 +03:00
|
|
|
+
|
|
|
|
// Returns true if we use overlay scrollbars on the system wide or on the
|
|
|
|
// given document.
|
|
|
|
static bool UseOverlayScrollbars(const Document* aDocument);
|
2020-03-21 03:03:20 +03:00
|
|
|
diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 364ac8dfc6bb104450e466e82f3c130414a6958a..a2bb9c766b001005c144afeae8463e5c966605ee 100644
|
2020-03-21 03:03:20 +03:00
|
|
|
--- a/dom/base/Navigator.cpp
|
|
|
|
+++ b/dom/base/Navigator.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -327,14 +327,18 @@ void Navigator::GetAppName(nsAString& aAppName, CallerType aCallerType) const {
|
2020-05-08 04:37:15 +03:00
|
|
|
* for more detail.
|
2020-03-21 03:03:20 +03: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-02 02:50:11 +03:00
|
|
|
for (nsDependentSubstring lang :
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -386,7 +390,9 @@ void Navigator::GetLanguage(nsAString& aLanguage) {
|
2020-03-21 03:03:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void Navigator::GetLanguages(nsTArray<nsString>& aLanguages) {
|
|
|
|
- GetAcceptLanguages(aLanguages);
|
|
|
|
+ nsString languageOverride;
|
|
|
|
+ mWindow->GetDocShell()->GetLanguageOverride(languageOverride);
|
|
|
|
+ GetAcceptLanguages(&languageOverride, aLanguages);
|
|
|
|
|
2020-05-08 04:37:15 +03:00
|
|
|
// The returned value is cached by the binding code. The window listens to the
|
2020-03-21 03:03:20 +03:00
|
|
|
// accept languages change and will clear the cache when needed. It has to
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -554,7 +560,13 @@ bool Navigator::CookieEnabled() {
|
2020-03-22 23:51:49 +03: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-21 03:03:20 +03:00
|
|
|
diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h
|
2021-10-14 01:49:41 +03:00
|
|
|
index cb7321e409ea0bbaf1af8fb521f748919a673d5d..8c8ad8bc41a8568571acc721128a9db3c4a0a0da 100644
|
2020-03-21 03:03:20 +03:00
|
|
|
--- a/dom/base/Navigator.h
|
|
|
|
+++ b/dom/base/Navigator.h
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -214,7 +214,7 @@ class Navigator final : public nsISupports, public nsWrapperCache {
|
2020-03-21 03:03:20 +03: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 22:24:11 +03:00
|
|
|
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 286518d1a20f9e7b7cb66666d3d8de5d921214a7..031ab7ac9abb8db2c501e765c4c02b8f512a152f 100644
|
2020-10-13 22:24:11 +03:00
|
|
|
--- a/dom/base/nsContentUtils.cpp
|
|
|
|
+++ b/dom/base/nsContentUtils.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -8176,7 +8176,8 @@ nsresult nsContentUtils::SendMouseEvent(
|
2020-10-13 22:24:11 +03: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 22:24:11 +03:00
|
|
|
- bool aIsWidgetEventSynthesized) {
|
|
|
|
+ bool aIsWidgetEventSynthesized,
|
|
|
|
+ bool convertToPointer) {
|
|
|
|
nsPoint offset;
|
|
|
|
nsCOMPtr<nsIWidget> widget = GetWidget(aPresShell, &offset);
|
|
|
|
if (!widget) return NS_ERROR_FAILURE;
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -8233,6 +8234,7 @@ nsresult nsContentUtils::SendMouseEvent(
|
2020-10-13 22:24:11 +03:00
|
|
|
event.mTime = PR_IntervalNow();
|
|
|
|
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
|
2021-10-14 01:49:41 +03:00
|
|
|
index 935c5b5b21439a1d17921cd55abda9984b8d1d41..614e386ad1bd557391fb0ed7f2f07aba6511398b 100644
|
2020-10-13 22:24:11 +03:00
|
|
|
--- a/dom/base/nsContentUtils.h
|
|
|
|
+++ b/dom/base/nsContentUtils.h
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -2901,7 +2901,8 @@ class nsContentUtils {
|
2020-10-13 22:24:11 +03: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 22:24:11 +03:00
|
|
|
|
|
|
|
static void FirePageShowEventForFrameLoaderSwap(
|
|
|
|
nsIDocShellTreeItem* aItem,
|
|
|
|
diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 36501952ff935d9d83cb75ac8da8a609c9e5244e..097e3b2fd1b031aa8bfbcd5ca7f820513cea3b1b 100644
|
2020-10-13 22:24:11 +03:00
|
|
|
--- a/dom/base/nsDOMWindowUtils.cpp
|
|
|
|
+++ b/dom/base/nsDOMWindowUtils.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -639,7 +639,7 @@ nsDOMWindowUtils::SendMouseEvent(
|
2020-10-13 22:24:11 +03: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,
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -647,7 +647,7 @@ nsDOMWindowUtils::SendMouseEvent(
|
2020-10-13 22:24:11 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -674,13 +674,13 @@ nsDOMWindowUtils::SendMouseEventCommon(
|
2020-10-13 22:24:11 +03: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 22:24:11 +03: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 22:24:11 +03:00
|
|
|
|
2021-08-11 03:37:57 +03:00
|
|
|
if (aPreventDefault) {
|
|
|
|
*aPreventDefault = preventDefaultResult != PreventDefaultResult::No;
|
2020-10-13 22:24:11 +03:00
|
|
|
diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h
|
2021-10-14 01:49:41 +03:00
|
|
|
index 30e0fafa77857c33e9871259a6ac0cebac965df8..3d8810abcfac1c220529b4e6163b0159475723ff 100644
|
2020-10-13 22:24:11 +03: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-21 02:47:27 +03:00
|
|
|
diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 83c5148a768ca961de36caaec3d0c5417109a6f1..313b63cf1561b36c007bc59bf43cdd871f26ab8c 100644
|
2020-07-21 02:47:27 +03:00
|
|
|
--- a/dom/base/nsFocusManager.cpp
|
|
|
|
+++ b/dom/base/nsFocusManager.cpp
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -1603,6 +1603,10 @@ void nsFocusManager::SetFocusInner(Element* aNewContent, int32_t aFlags,
|
2020-10-16 11:28:13 +03: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 19:26:43 +03:00
|
|
|
!isElementInActiveWindow && (aFlags & FLAG_RAISE) &&
|
|
|
|
@@ -2870,7 +2874,9 @@ void nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow,
|
2020-07-21 02:47:27 +03: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-27 04:42:21 +03:00
|
|
|
diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index dc434d7f32ae2cf9b286d8aef1eafc23e4d75b14..722daa6726fecdb7f578a7d5490306b9ae1d8075 100644
|
2020-03-27 04:42:21 +03:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.cpp
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -2476,7 +2476,7 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
|
2020-07-01 23:28:13 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -2495,10 +2495,16 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
|
2020-07-01 23:28:13 +03: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));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -2622,6 +2628,19 @@ void nsGlobalWindowOuter::DispatchDOMWindowCreated() {
|
2020-07-01 23:28:13 +03: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-29 00:47:14 +03:00
|
|
|
void nsGlobalWindowOuter::ClearStatus() { SetStatusOuter(u""_ns); }
|
2020-07-01 23:28:13 +03:00
|
|
|
|
|
|
|
void nsGlobalWindowOuter::SetDocShell(nsDocShell* aDocShell) {
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -3820,6 +3839,14 @@ Maybe<CSSIntSize> nsGlobalWindowOuter::GetRDMDeviceSize(
|
2020-03-27 04:42:21 +03: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 23:28:13 +03:00
|
|
|
diff --git a/dom/base/nsGlobalWindowOuter.h b/dom/base/nsGlobalWindowOuter.h
|
2021-10-14 01:49:41 +03:00
|
|
|
index 6b55b7da87a78966a45f5a48488a9a86005ef65b..b634c094c1ef3c56e7a1cba44fe55cd1b36e7a14 100644
|
2020-07-01 23:28:13 +03:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.h
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.h
|
2021-04-20 23:27:57 +03:00
|
|
|
@@ -324,6 +324,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
|
2020-07-01 23:28:13 +03:00
|
|
|
|
|
|
|
// Outer windows only.
|
|
|
|
void DispatchDOMWindowCreated();
|
|
|
|
+ void JugglerDispatchDOMWindowReused();
|
|
|
|
|
|
|
|
// Outer windows only.
|
|
|
|
virtual void EnsureSizeAndPositionUpToDate() override;
|
2020-04-13 21:31:02 +03:00
|
|
|
diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
index 81209300bd6ec3178ca6f6ce9f413a09b8988abc..bd438a8c570b8f0a5c43c7e1317f0a4ca59b036d 100644
|
2020-04-13 21:31:02 +03:00
|
|
|
--- a/dom/base/nsINode.cpp
|
|
|
|
+++ b/dom/base/nsINode.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -1297,6 +1297,49 @@ void nsINode::GetBoxQuadsFromWindowOrigin(const BoxQuadOptions& aOptions,
|
2020-04-13 21:31:02 +03:00
|
|
|
mozilla::GetBoxQuadsFromWindowOrigin(this, aOptions, aResult, aRv);
|
|
|
|
}
|
|
|
|
|
|
|
|
+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-17 07:38:32 +03:00
|
|
|
+ return aRv.ThrowNotFoundError("Node is detached from document");
|
2020-04-13 21:31:02 +03:00
|
|
|
+ }
|
|
|
|
+ PresShell* presShell = document->GetPresShell();
|
|
|
|
+ if (!presShell) {
|
2020-06-17 07:38:32 +03:00
|
|
|
+ return aRv.ThrowNotFoundError("Node is detached from document");
|
2020-04-13 21:31:02 +03:00
|
|
|
+ }
|
|
|
|
+ if (!IsContent()) {
|
2020-06-17 07:38:32 +03:00
|
|
|
+ return aRv.ThrowNotFoundError("Node does not have a layout object");
|
2020-04-13 21:31:02 +03:00
|
|
|
+ }
|
|
|
|
+ aRv = NS_OK;
|
|
|
|
+ nsIFrame* primaryFrame = AsContent()->GetPrimaryFrame(FlushType::Frames);
|
2020-06-17 07:38:32 +03:00
|
|
|
+ if (!primaryFrame) {
|
|
|
|
+ return aRv.ThrowNotFoundError("Node does not have a layout object");
|
2020-04-13 21:31:02 +03: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));
|
|
|
|
+ }
|
|
|
|
+ presShell->ScrollFrameRectIntoView(
|
|
|
|
+ primaryFrame, rect,
|
2021-07-14 19:26:43 +03:00
|
|
|
+ nsMargin(),
|
2020-04-13 21:31:02 +03:00
|
|
|
+ ScrollAxis(kScrollToCenter, WhenToScroll::Always),
|
|
|
|
+ ScrollAxis(kScrollToCenter, WhenToScroll::Always),
|
|
|
|
+ ScrollFlags::ScrollOverflowHidden);
|
2020-04-15 02:24:36 +03: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 21:31:02 +03: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
|
2021-09-08 16:47:26 +03:00
|
|
|
index 0cfca9698701c7022ed1b7ac4f314de0521a6844..fb164f4c6545bdd6428074c2b5fe25ed4cccdebd 100644
|
2020-04-13 21:31:02 +03:00
|
|
|
--- a/dom/base/nsINode.h
|
|
|
|
+++ b/dom/base/nsINode.h
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -2060,6 +2060,10 @@ class nsINode : public mozilla::dom::EventTarget {
|
2020-04-13 21:31:02 +03: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-02 00:10:30 +03:00
|
|
|
diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp
|
2021-07-14 19:26:43 +03:00
|
|
|
index e80aeccd572446f7c35f554510a98b11bd01dfab..2edb82b914c2a2c4ed36ee663a7c54da91df5690 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/dom/base/nsJSUtils.cpp
|
|
|
|
+++ b/dom/base/nsJSUtils.cpp
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -242,6 +242,11 @@ bool nsJSUtils::GetScopeChainForElement(
|
2020-04-02 00:10:30 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
index c22cddecd75ee538aa401b9195d23bad71e067b3..1b48a12fd30c305aecf1929a47cb22a1bb4a5e80 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/dom/base/nsJSUtils.h
|
|
|
|
+++ b/dom/base/nsJSUtils.h
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -107,6 +107,7 @@ class nsJSUtils {
|
2020-04-02 00:10:30 +03: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 22:23:12 +03:00
|
|
|
diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl
|
2021-10-14 01:49:41 +03:00
|
|
|
index 4f8f8df3cecec37d87dfb6f23d5888419d9b8d6c..2e5ef8dc4599a6bd26654023360421394cc59c3e 100644
|
2021-05-18 22:23:12 +03:00
|
|
|
--- a/dom/chrome-webidl/BrowsingContext.webidl
|
|
|
|
+++ b/dom/chrome-webidl/BrowsingContext.webidl
|
2021-06-09 02:00:15 +03:00
|
|
|
@@ -52,6 +52,24 @@ enum PrefersColorSchemeOverride {
|
2021-05-18 22:23:12 +03:00
|
|
|
"dark",
|
|
|
|
};
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * CSS prefers-reduced-motion values.
|
|
|
|
+ */
|
|
|
|
+enum PrefersReducedMotionOverride {
|
|
|
|
+ "none",
|
|
|
|
+ "reduce",
|
|
|
|
+ "no-preference",
|
|
|
|
+};
|
2021-06-09 02:00:15 +03:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * CSS forced-colors values.
|
|
|
|
+ */
|
|
|
|
+enum ForcedColorsOverride {
|
|
|
|
+ "none",
|
|
|
|
+ "active",
|
|
|
|
+ "no-override", /* This clears the override. */
|
|
|
|
+};
|
2021-05-18 22:23:12 +03:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Allowed overrides of platform/pref default behaviour for touch events.
|
|
|
|
*/
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -178,6 +196,12 @@ interface BrowsingContext {
|
2021-05-18 22:23:12 +03:00
|
|
|
// Color-scheme simulation, for DevTools.
|
|
|
|
[SetterThrows] attribute PrefersColorSchemeOverride prefersColorSchemeOverride;
|
|
|
|
|
|
|
|
+ // Reduced-Motion simulation, for DevTools.
|
|
|
|
+ [SetterThrows] attribute PrefersReducedMotionOverride prefersReducedMotionOverride;
|
2021-06-09 02:00:15 +03:00
|
|
|
+
|
|
|
|
+ // Forced-Colors simulation, for DevTools.
|
|
|
|
+ [SetterThrows] attribute ForcedColorsOverride forcedColorsOverride;
|
2021-05-18 22:23:12 +03:00
|
|
|
+
|
|
|
|
/**
|
|
|
|
* A unique identifier for the browser element that is hosting this
|
|
|
|
* BrowsingContext tree. Every BrowsingContext in the element's tree will
|
2020-03-20 21:14:42 +03:00
|
|
|
diff --git a/dom/geolocation/Geolocation.cpp b/dom/geolocation/Geolocation.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
index 5a08b70e271a643639f34de4569564912c58afef..ad8259fb9bab4ead26eabf85ee087b0555ee2e8e 100644
|
2020-03-20 21:14:42 +03:00
|
|
|
--- a/dom/geolocation/Geolocation.cpp
|
|
|
|
+++ b/dom/geolocation/Geolocation.cpp
|
2020-03-25 09:25:17 +03: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"
|
2020-12-15 02:28:48 +03:00
|
|
|
@@ -254,10 +255,8 @@ nsGeolocationRequest::Allow(JS::HandleValue aChoices) {
|
2020-03-20 21:14:42 +03: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) {
|
|
|
|
DOMTimeStamp cachedPositionTime_ms;
|
2020-12-15 02:28:48 +03:00
|
|
|
@@ -431,8 +430,7 @@ void nsGeolocationRequest::Shutdown() {
|
2020-03-20 21:14:42 +03: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();
|
|
|
|
}
|
2020-12-15 02:28:48 +03:00
|
|
|
@@ -708,8 +706,14 @@ void nsGeolocationService::StopDevice() {
|
2020-03-20 21:14:42 +03:00
|
|
|
StaticRefPtr<nsGeolocationService> nsGeolocationService::sService;
|
|
|
|
|
|
|
|
already_AddRefed<nsGeolocationService>
|
|
|
|
-nsGeolocationService::GetGeolocationService() {
|
|
|
|
+nsGeolocationService::GetGeolocationService(nsDocShell* docShell) {
|
|
|
|
RefPtr<nsGeolocationService> result;
|
|
|
|
+ if (docShell) {
|
2020-03-22 23:51:49 +03:00
|
|
|
+ result = docShell->GetGeolocationServiceOverride();
|
2020-03-20 21:14:42 +03:00
|
|
|
+ if (result)
|
|
|
|
+ return result.forget();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (nsGeolocationService::sService) {
|
|
|
|
result = nsGeolocationService::sService;
|
|
|
|
|
2020-12-15 02:28:48 +03:00
|
|
|
@@ -801,7 +805,9 @@ nsresult Geolocation::Init(nsPIDOMWindowInner* aContentDom) {
|
2020-03-20 21:14:42 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
index ed81524ff3ce803802578a38433b6b724df8ccf2..55022f28db9ca5695c0bdee8ffd9509c5e2467d3 100644
|
2020-03-20 21:14:42 +03:00
|
|
|
--- a/dom/geolocation/Geolocation.h
|
|
|
|
+++ b/dom/geolocation/Geolocation.h
|
2020-12-15 02:28:48 +03:00
|
|
|
@@ -31,6 +31,7 @@
|
|
|
|
|
|
|
|
#include "nsIGeolocationProvider.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
+#include "nsDocShell.h"
|
|
|
|
|
|
|
|
class nsGeolocationService;
|
|
|
|
class nsGeolocationRequest;
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -42,6 +43,11 @@ using GeoPositionCallback =
|
|
|
|
CallbackObjectHolder<PositionCallback, nsIDOMGeoPositionCallback>;
|
|
|
|
using GeoPositionErrorCallback =
|
|
|
|
CallbackObjectHolder<PositionErrorCallback, nsIDOMGeoPositionErrorCallback>;
|
|
|
|
+typedef CallbackObjectHolder<PositionCallback, nsIDOMGeoPositionCallback>
|
|
|
|
+ GeoPositionCallback;
|
|
|
|
+typedef CallbackObjectHolder<PositionErrorCallback,
|
|
|
|
+ nsIDOMGeoPositionErrorCallback>
|
|
|
|
+ GeoPositionErrorCallback;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
@@ -50,13 +56,14 @@ struct CachedPositionAndAccuracy {
|
2020-12-15 02:28:48 +03:00
|
|
|
bool isHighAccuracy;
|
|
|
|
};
|
|
|
|
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Singleton that manages the geolocation provider
|
|
|
|
*/
|
2020-03-20 21:14:42 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -183,6 +190,8 @@ class Geolocation final : public nsIGeolocationUpdate, public nsWrapperCache {
|
2020-03-20 21:14:42 +03:00
|
|
|
// null.
|
|
|
|
static already_AddRefed<Geolocation> NonWindowSingleton();
|
|
|
|
|
|
|
|
+ nsGeolocationService* GetGeolocationService() { return mService; };
|
|
|
|
+
|
|
|
|
private:
|
|
|
|
~Geolocation();
|
|
|
|
|
2019-11-26 00:56:39 +03:00
|
|
|
diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index ab9fcf3f490265c00308aa29696f16ec1a4c40ed..cbc44a798f74bb829367524f7af540187efad0de 100644
|
2019-11-26 00:56:39 +03:00
|
|
|
--- a/dom/html/HTMLInputElement.cpp
|
|
|
|
+++ b/dom/html/HTMLInputElement.cpp
|
2021-03-03 05:52:19 +03:00
|
|
|
@@ -52,6 +52,7 @@
|
2019-11-26 00:56:39 +03:00
|
|
|
#include "nsMappedAttributes.h"
|
|
|
|
#include "nsIFormControl.h"
|
|
|
|
#include "mozilla/dom/Document.h"
|
|
|
|
+#include "nsDocShell.h"
|
|
|
|
#include "nsIFormControlFrame.h"
|
|
|
|
#include "nsITextControlFrame.h"
|
|
|
|
#include "nsIFrame.h"
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -735,6 +736,12 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
|
2019-11-26 00:56:39 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ nsDocShell* docShell = static_cast<nsDocShell*>(win->GetDocShell());
|
|
|
|
+ if (docShell && docShell->IsFileInputInterceptionEnabled()) {
|
|
|
|
+ docShell->FilePickerShown(this);
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
+
|
2020-12-15 02:28:48 +03:00
|
|
|
if (IsPopupBlocked(doc)) {
|
2019-11-26 00:56:39 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2020-10-13 22:24:11 +03:00
|
|
|
diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl
|
2021-10-14 01:49:41 +03:00
|
|
|
index 1316c91ba0717c484a351db894660335b57b3d3b..08bcfc78a396c860f9c13ba20e165b46bf8af247 100644
|
2020-10-13 22:24:11 +03:00
|
|
|
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
|
|
|
|
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
|
2020-10-29 00:47:14 +03:00
|
|
|
@@ -353,7 +353,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
2020-10-13 22:24:11 +03: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-28 02:22:02 +03:00
|
|
|
diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.cc b/dom/media/systemservices/video_engine/desktop_capture_impl.cc
|
2021-05-07 05:11:42 +03:00
|
|
|
index 7bc92fe4408c2878c9d7c8bdb97a7c257258ee31..b20480c3c0ca96097e61d37f44e127d45ab4648a 100644
|
2020-07-28 02:22:02 +03:00
|
|
|
--- a/dom/media/systemservices/video_engine/desktop_capture_impl.cc
|
|
|
|
+++ b/dom/media/systemservices/video_engine/desktop_capture_impl.cc
|
2021-05-07 05:11:42 +03:00
|
|
|
@@ -123,10 +123,11 @@ int32_t ScreenDeviceInfoImpl::GetOrientation(const char* deviceUniqueIdUTF8,
|
|
|
|
return 0;
|
|
|
|
}
|
2020-07-28 02:22:02 +03:00
|
|
|
|
2021-05-07 05:11:42 +03:00
|
|
|
-VideoCaptureModule* DesktopCaptureImpl::Create(const int32_t id,
|
|
|
|
+VideoCaptureModuleEx* DesktopCaptureImpl::Create(const int32_t id,
|
2020-07-28 02:22:02 +03:00
|
|
|
const char* uniqueId,
|
|
|
|
- const CaptureDeviceType type) {
|
|
|
|
- return new rtc::RefCountedObject<DesktopCaptureImpl>(id, uniqueId, type);
|
|
|
|
+ const CaptureDeviceType type,
|
|
|
|
+ bool captureCursor) {
|
|
|
|
+ return new rtc::RefCountedObject<DesktopCaptureImpl>(id, uniqueId, type, captureCursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t WindowDeviceInfoImpl::Init() {
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -360,12 +361,16 @@ int32_t DesktopCaptureImpl::Init() {
|
2020-07-28 02:22:02 +03:00
|
|
|
DesktopCapturer::SourceId sourceId = atoi(_deviceUniqueId.c_str());
|
|
|
|
pWindowCapturer->SelectSource(sourceId);
|
|
|
|
|
|
|
|
- MouseCursorMonitor* pMouseCursorMonitor =
|
|
|
|
- MouseCursorMonitor::CreateForWindow(
|
|
|
|
- webrtc::DesktopCaptureOptions::CreateDefault(), sourceId);
|
|
|
|
- desktop_capturer_cursor_composer_ =
|
|
|
|
- std::unique_ptr<DesktopAndCursorComposer>(new DesktopAndCursorComposer(
|
|
|
|
- pWindowCapturer.release(), pMouseCursorMonitor));
|
|
|
|
+ if (capture_cursor_) {
|
|
|
|
+ MouseCursorMonitor* pMouseCursorMonitor =
|
|
|
|
+ MouseCursorMonitor::CreateForWindow(
|
|
|
|
+ webrtc::DesktopCaptureOptions::CreateDefault(), sourceId);
|
|
|
|
+ desktop_capturer_cursor_composer_ =
|
|
|
|
+ std::unique_ptr<DesktopAndCursorComposer>(new DesktopAndCursorComposer(
|
|
|
|
+ pWindowCapturer.release(), pMouseCursorMonitor));
|
|
|
|
+ } else {
|
|
|
|
+ desktop_capturer_cursor_composer_ = std::move(pWindowCapturer);
|
|
|
|
+ }
|
2020-08-12 20:09:20 +03:00
|
|
|
} else if (_deviceType == CaptureDeviceType::Browser) {
|
|
|
|
// XXX We don't capture cursors, so avoid the extra indirection layer. We
|
|
|
|
// could also pass null for the pMouseCursorMonitor.
|
|
|
|
@@ -382,7 +387,8 @@ int32_t DesktopCaptureImpl::Init() {
|
2020-07-28 02:22:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
DesktopCaptureImpl::DesktopCaptureImpl(const int32_t id, const char* uniqueId,
|
|
|
|
- const CaptureDeviceType type)
|
|
|
|
+ const CaptureDeviceType type,
|
|
|
|
+ bool captureCursor)
|
|
|
|
: _id(id),
|
|
|
|
_deviceUniqueId(uniqueId),
|
|
|
|
_deviceType(type),
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -393,6 +399,7 @@ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t id, const char* uniqueId,
|
2020-07-28 02:22:02 +03:00
|
|
|
delta_ntp_internal_ms_(
|
|
|
|
Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() -
|
|
|
|
last_capture_time_),
|
|
|
|
+ capture_cursor_(captureCursor),
|
|
|
|
time_event_(EventWrapper::Create()),
|
|
|
|
#if defined(_WIN32)
|
|
|
|
capturer_thread_(
|
2021-05-07 05:11:42 +03:00
|
|
|
@@ -437,6 +444,19 @@ void DesktopCaptureImpl::DeRegisterCaptureDataCallback(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void DesktopCaptureImpl::RegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) {
|
|
|
|
+ rtc::CritScope lock(&_apiCs);
|
|
|
|
+ _rawFrameCallbacks.insert(rawFrameCallback);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void DesktopCaptureImpl::DeRegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) {
|
|
|
|
+ rtc::CritScope lock(&_apiCs);
|
|
|
|
+ auto it = _rawFrameCallbacks.find(rawFrameCallback);
|
|
|
|
+ if (it != _rawFrameCallbacks.end()) {
|
|
|
|
+ _rawFrameCallbacks.erase(it);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int32_t DesktopCaptureImpl::StopCaptureIfAllClientsClose() {
|
|
|
|
if (_dataCallBacks.empty()) {
|
|
|
|
return StopCapture();
|
|
|
|
@@ -644,6 +664,12 @@ void DesktopCaptureImpl::OnCaptureResult(DesktopCapturer::Result result,
|
|
|
|
frameInfo.height = frame->size().height();
|
|
|
|
frameInfo.videoType = VideoType::kARGB;
|
|
|
|
|
|
|
|
+ size_t videoFrameStride =
|
|
|
|
+ frameInfo.width * DesktopFrame::kBytesPerPixel;
|
|
|
|
+ for (auto rawFrameCallback : _rawFrameCallbacks) {
|
|
|
|
+ rawFrameCallback->OnRawFrame(videoFrame, videoFrameStride, frameInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
size_t videoFrameLength =
|
|
|
|
frameInfo.width * frameInfo.height * DesktopFrame::kBytesPerPixel;
|
|
|
|
IncomingFrame(videoFrame, videoFrameLength, frameInfo);
|
2020-07-28 02:22:02 +03:00
|
|
|
diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.h b/dom/media/systemservices/video_engine/desktop_capture_impl.h
|
2021-05-07 05:11:42 +03:00
|
|
|
index 137281596e66793b8525ca2a5d156b4bd171da65..0e64c0b810b306e4a2509e4ad0d9596034d338fa 100644
|
2020-07-28 02:22:02 +03:00
|
|
|
--- a/dom/media/systemservices/video_engine/desktop_capture_impl.h
|
|
|
|
+++ b/dom/media/systemservices/video_engine/desktop_capture_impl.h
|
2021-05-07 05:11:42 +03:00
|
|
|
@@ -42,6 +42,21 @@ namespace webrtc {
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
@@ -154,13 +169,14 @@ class BrowserDeviceInfoImpl : public VideoCaptureModule::DeviceInfo {
|
|
|
|
// As with video, DesktopCaptureImpl is a proxy for screen sharing
|
|
|
|
// and follows the video pipeline design
|
|
|
|
class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|
|
|
- public VideoCaptureModule,
|
|
|
|
+ public VideoCaptureModuleEx,
|
|
|
|
public VideoCaptureExternal {
|
|
|
|
public:
|
2020-07-28 02:22:02 +03:00
|
|
|
/* Create a screen capture modules object
|
|
|
|
*/
|
2021-05-07 05:11:42 +03:00
|
|
|
- static VideoCaptureModule* Create(const int32_t id, const char* uniqueId,
|
2020-07-28 02:22:02 +03:00
|
|
|
- const CaptureDeviceType type);
|
2021-05-07 05:11:42 +03:00
|
|
|
+ static VideoCaptureModuleEx* Create(const int32_t id, const char* uniqueId,
|
2020-07-28 02:22:02 +03:00
|
|
|
+ const CaptureDeviceType type,
|
|
|
|
+ bool captureCursor = true);
|
|
|
|
static VideoCaptureModule::DeviceInfo* CreateDeviceInfo(
|
|
|
|
const int32_t id, const CaptureDeviceType type);
|
|
|
|
|
2021-05-07 05:11:42 +03:00
|
|
|
@@ -170,6 +186,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|
|
|
void DeRegisterCaptureDataCallback(
|
|
|
|
rtc::VideoSinkInterface<VideoFrame>* dataCallback) override;
|
|
|
|
int32_t StopCaptureIfAllClientsClose() override;
|
|
|
|
+ void RegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) override;
|
|
|
|
+ void DeRegisterRawFrameCallback(RawFrameCallback* rawFrameCallback) override;
|
|
|
|
|
|
|
|
int32_t SetCaptureRotation(VideoRotation rotation) override;
|
|
|
|
bool SetApplyRotation(bool enable) override;
|
|
|
|
@@ -192,7 +210,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
2020-07-28 02:22:02 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DesktopCaptureImpl(const int32_t id, const char* uniqueId,
|
|
|
|
- const CaptureDeviceType type);
|
|
|
|
+ const CaptureDeviceType type, bool captureCursor);
|
|
|
|
virtual ~DesktopCaptureImpl();
|
|
|
|
int32_t DeliverCapturedFrame(webrtc::VideoFrame& captureFrame,
|
|
|
|
int64_t capture_time);
|
2021-05-07 05:11:42 +03:00
|
|
|
@@ -215,6 +233,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|
|
|
rtc::CriticalSection _apiCs;
|
|
|
|
|
|
|
|
std::set<rtc::VideoSinkInterface<VideoFrame>*> _dataCallBacks;
|
|
|
|
+ std::set<RawFrameCallback*> _rawFrameCallbacks;
|
|
|
|
|
|
|
|
int64_t _incomingFrameTimesNanos
|
|
|
|
[kFrameRateCountHistorySize]; // timestamp for local captured frames
|
|
|
|
@@ -240,6 +259,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
2020-07-28 02:22:02 +03:00
|
|
|
void process();
|
|
|
|
|
|
|
|
private:
|
|
|
|
+ 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 22:52:23 +03:00
|
|
|
diff --git a/dom/script/ScriptSettings.cpp b/dom/script/ScriptSettings.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
index 2c9e8f43e5cd8312d17f0e852593af52c9472a58..814a63c985bb4b7a6f29f0416515782e72264219 100644
|
2020-01-16 22:52:23 +03:00
|
|
|
--- a/dom/script/ScriptSettings.cpp
|
|
|
|
+++ b/dom/script/ScriptSettings.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -179,6 +179,30 @@ ScriptSettingsStackEntry::~ScriptSettingsStackEntry() {
|
2020-01-16 22:52:23 +03: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.
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -206,7 +230,7 @@ static nsIGlobalObject* ClampToSubject(nsIGlobalObject* aGlobalOrNull) {
|
2020-01-16 22:52:23 +03:00
|
|
|
NS_ENSURE_TRUE(globalPrin, GetCurrentGlobal());
|
|
|
|
if (!nsContentUtils::SubjectPrincipalOrSystemIfNativeCaller()
|
|
|
|
->SubsumesConsideringDomain(globalPrin)) {
|
|
|
|
- return GetCurrentGlobal();
|
|
|
|
+ return UnwrapSandboxGlobal(GetCurrentGlobal());
|
|
|
|
}
|
|
|
|
|
|
|
|
return aGlobalOrNull;
|
2019-11-26 02:26:03 +03:00
|
|
|
diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp
|
2021-08-11 03:37:57 +03:00
|
|
|
index 532c12cd7d447d1d4f3faca3d06b81450b4ede2a..c2d480b3d9924ae469343d5825983ac5132c72ec 100644
|
2019-11-26 02:26:03 +03:00
|
|
|
--- a/dom/security/nsCSPUtils.cpp
|
|
|
|
+++ b/dom/security/nsCSPUtils.cpp
|
2021-03-03 05:52:19 +03:00
|
|
|
@@ -127,6 +127,11 @@ void CSP_ApplyMetaCSPToDoc(mozilla::dom::Document& aDoc,
|
2019-11-26 02:26:03 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (aDoc.GetDocShell() &&
|
|
|
|
+ nsDocShell::Cast(aDoc.GetDocShell())->IsBypassCSPEnabled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
nsAutoString policyStr(
|
|
|
|
nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(
|
|
|
|
aPolicyStr));
|
2020-04-13 21:31:02 +03:00
|
|
|
diff --git a/dom/webidl/GeometryUtils.webidl b/dom/webidl/GeometryUtils.webidl
|
|
|
|
index 2f71b284ee5f7e11f117c447834b48355784448c..d996e0a3cbbb19c1dc320c305c6d74037bffa0d3 100644
|
|
|
|
--- a/dom/webidl/GeometryUtils.webidl
|
|
|
|
+++ b/dom/webidl/GeometryUtils.webidl
|
|
|
|
@@ -27,6 +27,9 @@ interface mixin GeometryUtils {
|
|
|
|
[Throws, Func="nsINode::HasBoxQuadsSupport", NeedsCallerType]
|
|
|
|
sequence<DOMQuad> getBoxQuads(optional BoxQuadOptions options = {});
|
|
|
|
|
|
|
|
+ [ChromeOnly, Throws, Func="nsINode::HasBoxQuadsSupport"]
|
|
|
|
+ void scrollRectIntoViewIfNeeded(long x, long y, long w, long h);
|
|
|
|
+
|
|
|
|
/* 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-21 03:03:20 +03:00
|
|
|
diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 46062dacd05b19bf60bbf019be6298add5c006c2..9e277533c9a93c93ff426c56919a8d2d544cb761 100644
|
2020-03-21 03:03:20 +03:00
|
|
|
--- a/dom/workers/RuntimeService.cpp
|
|
|
|
+++ b/dom/workers/RuntimeService.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1029,7 +1029,7 @@ void PrefLanguagesChanged(const char* /* aPrefName */, void* /* aClosure */) {
|
2020-03-21 03:03:20 +03:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
|
|
|
nsTArray<nsString> languages;
|
|
|
|
- Navigator::GetAcceptLanguages(languages);
|
|
|
|
+ Navigator::GetAcceptLanguages(nullptr, languages);
|
|
|
|
|
|
|
|
RuntimeService* runtime = RuntimeService::GetService();
|
|
|
|
if (runtime) {
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1232,8 +1232,7 @@ bool RuntimeService::RegisterWorker(WorkerPrivate& aWorkerPrivate) {
|
2020-03-21 03:03:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// The navigator overridden properties should have already been read.
|
|
|
|
-
|
|
|
|
- Navigator::GetAcceptLanguages(mNavigatorProperties.mLanguages);
|
|
|
|
+ Navigator::GetAcceptLanguages(nullptr, mNavigatorProperties.mLanguages);
|
|
|
|
mNavigatorPropertiesLoaded = true;
|
|
|
|
}
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1941,6 +1940,13 @@ void RuntimeService::PropagateStorageAccessPermissionGranted(
|
2020-03-27 02:33:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void RuntimeService::ResetDefaultLocaleInAllWorkers() {
|
|
|
|
+ AssertIsOnMainThread();
|
2020-08-12 20:09:20 +03:00
|
|
|
+ BroadcastAllWorkers([](auto& worker) {
|
|
|
|
+ worker.ResetDefaultLocale();
|
|
|
|
+ });
|
2020-03-27 02:33:07 +03:00
|
|
|
+}
|
|
|
|
+
|
2020-08-06 20:32:50 +03:00
|
|
|
void RuntimeService::NoteIdleThread(SafeRefPtr<WorkerThread> aThread) {
|
2020-03-27 02:33:07 +03:00
|
|
|
AssertIsOnMainThread();
|
|
|
|
MOZ_ASSERT(aThread);
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -2359,6 +2365,14 @@ void PropagateStorageAccessPermissionGrantedToWorkers(
|
2020-03-27 02:33:07 +03: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
|
2021-04-02 02:49:01 +03:00
|
|
|
index 0ca5f99fab6fe97135a0852d538d6fed027ae054..472c00b8b75c4d79e0dd62973445824420e14d2e 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/RuntimeService.h
|
|
|
|
+++ b/dom/workers/RuntimeService.h
|
2021-04-02 02:49:01 +03:00
|
|
|
@@ -122,6 +122,8 @@ class RuntimeService final : public nsIObserver {
|
2020-08-06 20:32:50 +03:00
|
|
|
void PropagateStorageAccessPermissionGranted(
|
|
|
|
const nsPIDOMWindowInner& aWindow);
|
2020-03-27 02:33:07 +03:00
|
|
|
|
|
|
|
+ void ResetDefaultLocaleInAllWorkers();
|
|
|
|
+
|
|
|
|
const NavigatorProperties& GetNavigatorProperties() const {
|
|
|
|
return mNavigatorProperties;
|
|
|
|
}
|
|
|
|
diff --git a/dom/workers/WorkerCommon.h b/dom/workers/WorkerCommon.h
|
2020-12-15 02:28:48 +03:00
|
|
|
index 8b1b46d69f2c90d851d292c285a1ba9bdbd4d9b7..dea5259b0a82e5e6d3c431fc78e60d5df80b3eda 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/WorkerCommon.h
|
|
|
|
+++ b/dom/workers/WorkerCommon.h
|
2020-12-15 02:28:48 +03:00
|
|
|
@@ -45,6 +45,8 @@ void ResumeWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
2020-08-06 20:32:50 +03:00
|
|
|
void PropagateStorageAccessPermissionGrantedToWorkers(
|
|
|
|
const nsPIDOMWindowInner& aWindow);
|
2020-03-27 02:33:07 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
index f7ddc7064011c1cf7485ff71266c8b66e693e1cb..08e8233da3610dddbf62697d738b81bd21d6116e 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/WorkerPrivate.cpp
|
|
|
|
+++ b/dom/workers/WorkerPrivate.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -673,6 +673,18 @@ class UpdateContextOptionsRunnable final : public WorkerControlRunnable {
|
2020-03-27 02:33:07 +03: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;
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1873,6 +1885,16 @@ void WorkerPrivate::UpdateContextOptions(
|
2020-03-27 02:33:07 +03: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();
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -4896,6 +4918,15 @@ void WorkerPrivate::UpdateContextOptionsInternal(
|
2020-03-27 02:33:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void WorkerPrivate::ResetDefaultLocaleInternal(JSContext* aCx) {
|
|
|
|
+ JS_ResetDefaultLocale(JS_GetRuntime(aCx));
|
2020-08-12 20:09:20 +03:00
|
|
|
+ auto data = mWorkerThreadAccessible.Access();
|
2020-03-27 02:33:07 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
index 15a82dacb09759ef43c9260213d14451138e374d..69560271bf3bb79de90e1db19378b4a2267841b1 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/WorkerPrivate.h
|
|
|
|
+++ b/dom/workers/WorkerPrivate.h
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -309,6 +309,8 @@ class WorkerPrivate final : public RelativeTimeline {
|
2020-03-27 02:33:07 +03: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,
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -903,6 +905,8 @@ class WorkerPrivate final : public RelativeTimeline {
|
2020-03-27 02:33:07 +03:00
|
|
|
|
|
|
|
void UpdateContextOptions(const JS::ContextOptions& aContextOptions);
|
|
|
|
|
|
|
|
+ void ResetDefaultLocale();
|
|
|
|
+
|
|
|
|
void UpdateLanguages(const nsTArray<nsString>& aLanguages);
|
|
|
|
|
2020-05-08 04:37:15 +03:00
|
|
|
void UpdateJSWorkerMemoryParameter(JSGCParamKey key, Maybe<uint32_t> value);
|
2020-04-02 00:10:30 +03:00
|
|
|
diff --git a/js/public/Date.h b/js/public/Date.h
|
2021-04-02 02:49:01 +03:00
|
|
|
index bb69d58dc96ed7f0b37f73e26abdd0bdfeaaf556..8436d439f72287176a2fe6a1a837d3db73409e67 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/js/public/Date.h
|
|
|
|
+++ b/js/public/Date.h
|
2021-04-02 02:49:01 +03:00
|
|
|
@@ -53,6 +53,8 @@ namespace JS {
|
2020-04-02 00:10:30 +03: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-26 02:28:33 +03:00
|
|
|
diff --git a/js/src/debugger/Object.cpp b/js/src/debugger/Object.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index b32d426ba38045d14e6f1e79d17e8e6061e78227..df782034e79466fcc251e9a06e99d2e1f4f073aa 100644
|
2020-03-26 02:28:33 +03:00
|
|
|
--- a/js/src/debugger/Object.cpp
|
|
|
|
+++ b/js/src/debugger/Object.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -2337,7 +2337,11 @@ Maybe<Completion> DebuggerObject::call(JSContext* cx,
|
2020-03-26 02:28:33 +03: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-02 00:10:30 +03:00
|
|
|
diff --git a/js/src/vm/DateTime.cpp b/js/src/vm/DateTime.cpp
|
2021-07-14 19:26:43 +03:00
|
|
|
index 056f87c0e4bed207192937337e36dca3e7801c1f..bb569c20ddaba30642b2021cf9bfc6439c449a3b 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/js/src/vm/DateTime.cpp
|
|
|
|
+++ b/js/src/vm/DateTime.cpp
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -168,6 +168,11 @@ void js::DateTimeInfo::internalResetTimeZone(ResetTimeZoneMode mode) {
|
2020-04-02 00:10:30 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void js::DateTimeInfo::internalSetTimeZoneOverride(mozilla::UniquePtr<icu::TimeZone> timeZone) {
|
|
|
|
+ timeZoneOverride_ = std::move(timeZone);
|
|
|
|
+ internalResetTimeZone(ResetTimeZoneMode::ResetEvenIfOffsetUnchanged);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void js::DateTimeInfo::updateTimeZone() {
|
|
|
|
MOZ_ASSERT(timeZoneStatus_ != TimeZoneStatus::Valid);
|
|
|
|
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -528,10 +533,27 @@ void js::ResetTimeZoneInternal(ResetTimeZoneMode mode) {
|
2020-04-02 00:10:30 +03:00
|
|
|
js::DateTimeInfo::resetTimeZone(mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
+void js::SetTimeZoneOverrideInternal(mozilla::UniquePtr<icu::TimeZone> timeZone) {
|
|
|
|
+ auto guard = js::DateTimeInfo::instance->lock();
|
|
|
|
+ guard->internalSetTimeZoneOverride(std::move(timeZone));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
JS_PUBLIC_API void JS::ResetTimeZone() {
|
|
|
|
js::ResetTimeZoneInternal(js::ResetTimeZoneMode::ResetEvenIfOffsetUnchanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
+JS_PUBLIC_API bool JS::SetTimeZoneOverride(const char* timeZoneId) {
|
|
|
|
+ // Validate timezone id.
|
|
|
|
+ mozilla::UniquePtr<icu::TimeZone> timeZone(icu::TimeZone::createTimeZone(
|
|
|
|
+ icu::UnicodeString(timeZoneId, -1, US_INV)));
|
|
|
|
+ if (!timeZone || *timeZone == icu::TimeZone::getUnknown()) {
|
|
|
|
+ fprintf(stderr, "Invalid timezone id: %s\n", timeZoneId);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ js::SetTimeZoneOverrideInternal(std::move(timeZone));
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
#if defined(XP_WIN)
|
|
|
|
static bool IsOlsonCompatibleWindowsTimeZoneId(const char* tz) {
|
|
|
|
// ICU ignores the TZ environment variable on Windows and instead directly
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -732,6 +754,11 @@ void js::ResyncICUDefaultTimeZone() {
|
2020-04-02 00:10:30 +03:00
|
|
|
|
|
|
|
void js::DateTimeInfo::internalResyncICUDefaultTimeZone() {
|
|
|
|
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
|
|
|
+ if (timeZoneOverride_) {
|
|
|
|
+ icu::TimeZone::setDefault(*timeZoneOverride_);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (const char* tz = std::getenv("TZ")) {
|
|
|
|
icu::UnicodeString tzid;
|
|
|
|
|
|
|
|
diff --git a/js/src/vm/DateTime.h b/js/src/vm/DateTime.h
|
2021-07-14 19:26:43 +03:00
|
|
|
index 7dfeb9c257112b24bf6561789d7fa7f9dde932b2..5bacec827b1f5249434acbe09902e5c13ecdf4de 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/js/src/vm/DateTime.h
|
|
|
|
+++ b/js/src/vm/DateTime.h
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -65,6 +65,8 @@ enum class ResetTimeZoneMode : bool {
|
2020-04-02 00:10:30 +03:00
|
|
|
*/
|
|
|
|
extern void ResetTimeZoneInternal(ResetTimeZoneMode mode);
|
|
|
|
|
|
|
|
+extern void SetTimeZoneOverrideInternal(mozilla::UniquePtr<icu::TimeZone> timeZone);
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* 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
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -204,6 +206,7 @@ class DateTimeInfo {
|
2020-04-02 00:10:30 +03:00
|
|
|
// and js::ResyncICUDefaultTimeZone().
|
|
|
|
friend void js::ResetTimeZoneInternal(ResetTimeZoneMode);
|
|
|
|
friend void js::ResyncICUDefaultTimeZone();
|
|
|
|
+ friend void js::SetTimeZoneOverrideInternal(mozilla::UniquePtr<icu::TimeZone>);
|
|
|
|
|
|
|
|
static void resetTimeZone(ResetTimeZoneMode mode) {
|
|
|
|
auto guard = instance->lock();
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -300,6 +303,8 @@ class DateTimeInfo {
|
2020-04-02 00:10:30 +03:00
|
|
|
JS::UniqueChars locale_;
|
|
|
|
JS::UniqueTwoByteChars standardName_;
|
|
|
|
JS::UniqueTwoByteChars daylightSavingsName_;
|
|
|
|
+
|
|
|
|
+ mozilla::UniquePtr<icu::TimeZone> timeZoneOverride_;
|
|
|
|
#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
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -315,6 +320,8 @@ class DateTimeInfo {
|
2020-04-02 00:10:30 +03:00
|
|
|
|
|
|
|
void internalResetTimeZone(ResetTimeZoneMode mode);
|
|
|
|
|
|
|
|
+ void internalSetTimeZoneOverride(mozilla::UniquePtr<icu::TimeZone> timeZone);
|
|
|
|
+
|
|
|
|
void updateTimeZone();
|
|
|
|
|
|
|
|
void internalResyncICUDefaultTimeZone();
|
2021-06-09 02:00:15 +03:00
|
|
|
diff --git a/layout/style/GeckoBindings.h b/layout/style/GeckoBindings.h
|
2021-10-14 01:49:41 +03:00
|
|
|
index 54f4dc98e2a587b29e0acbdbfd9accd9c0df6089..177ff1a99fca3a5eba6f3ce9bd35788bfb99be53 100644
|
2021-06-09 02:00:15 +03:00
|
|
|
--- a/layout/style/GeckoBindings.h
|
|
|
|
+++ b/layout/style/GeckoBindings.h
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -587,6 +587,7 @@ void Gecko_MediaFeatures_GetDeviceSize(const mozilla::dom::Document*,
|
2021-06-09 02:00:15 +03: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 22:23:12 +03:00
|
|
|
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
|
2021-06-09 02:00:15 +03:00
|
|
|
index fffe37c359c5ba3a4e8cb4a44256f2c69182885b..6ef5b76cc58313266025f806755a89a8836c4e14 100644
|
2021-05-18 22:23:12 +03:00
|
|
|
--- a/layout/style/nsMediaFeatures.cpp
|
|
|
|
+++ b/layout/style/nsMediaFeatures.cpp
|
2021-06-09 02:00:15 +03:00
|
|
|
@@ -246,10 +246,11 @@ nsAtom* Gecko_MediaFeatures_GetOperatingSystemVersion(
|
2021-05-18 22:23:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Gecko_MediaFeatures_PrefersReducedMotion(const Document* aDocument) {
|
|
|
|
- if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- return LookAndFeel::GetInt(LookAndFeel::IntID::PrefersReducedMotion, 0) == 1;
|
|
|
|
+ return aDocument->PrefersReducedMotion();
|
2021-06-09 02:00:15 +03:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool Gecko_MediaFeatures_ForcedColors(const Document* aDocument) {
|
|
|
|
+ return aDocument->ForcedColors();
|
2021-05-18 22:23:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
StylePrefersColorScheme Gecko_MediaFeatures_PrefersColorScheme(
|
2021-05-07 05:11:42 +03:00
|
|
|
diff --git a/media/libjpeg/jconfig.h b/media/libjpeg/jconfig.h
|
|
|
|
index f2723e654098ff27542e1eb16a536c11ad0af617..b0b480551ff7d895dfdeb5a9800874858929c8ba 100644
|
|
|
|
--- a/media/libjpeg/jconfig.h
|
|
|
|
+++ b/media/libjpeg/jconfig.h
|
|
|
|
@@ -17,6 +17,7 @@
|
|
|
|
/* #undef D_ARITH_CODING_SUPPORTED */
|
|
|
|
|
|
|
|
/* Support in-memory source/destination managers */
|
|
|
|
+#define MEM_SRCDST_SUPPORTED 1
|
|
|
|
/* #undef MEM_SRCDST_SUPPORTED */
|
|
|
|
|
|
|
|
/* Use accelerated SIMD routines. */
|
2021-09-01 13:27:37 +03:00
|
|
|
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
|
2021-10-14 01:49:41 +03:00
|
|
|
index 88500d6e37dd78500caa159d6ff1ee4001c06c4d..02442cdda5d4e7d4cca0c97b87963f642d43467b 100644
|
2021-09-01 13:27:37 +03:00
|
|
|
--- a/modules/libpref/init/all.js
|
|
|
|
+++ b/modules/libpref/init/all.js
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -4564,7 +4564,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
|
|
|
|
|
|
|
|
// Whether to start the private browsing mode at application startup
|
2020-11-14 01:56:27 +03:00
|
|
|
diff --git a/netwerk/base/nsINetworkInterceptController.idl b/netwerk/base/nsINetworkInterceptController.idl
|
2021-10-14 01:49:41 +03:00
|
|
|
index e869cd28d396aa87c522241d3e63d435ee8dbae6..2d307f089209721d88d231b03e8628890b8228ea 100644
|
2020-11-14 01:56:27 +03: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-14 01:56:27 +03:00
|
|
|
*/
|
2021-08-11 03:37:57 +03:00
|
|
|
void resetInterception(in boolean bypass);
|
2020-11-14 01:56:27 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
index 1e86f25b4e85f5ddb216381617930e6752ce98a2..fa2dd452819edefbc466c6072050520f21677155 100644
|
2020-11-14 01:56:27 +03:00
|
|
|
--- a/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
|
|
|
+++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -648,6 +648,14 @@ void InterceptedHttpChannel::DoAsyncAbort(nsresult aStatus) {
|
2020-11-14 01:56:27 +03:00
|
|
|
Unused << AsyncAbort(aStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+InterceptedHttpChannel::ResetInterceptionWithURI(nsIURI* aURI) {
|
|
|
|
+ if (aURI) {
|
|
|
|
+ mURI = aURI;
|
|
|
|
+ }
|
2021-08-11 03:37:57 +03:00
|
|
|
+ return ResetInterception(true);
|
2020-11-14 01:56:27 +03:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
NS_IMETHODIMP
|
2021-08-11 03:37:57 +03:00
|
|
|
InterceptedHttpChannel::ResetInterception(bool aBypass) {
|
2020-11-14 01:56:27 +03:00
|
|
|
if (mCanceled) {
|
2020-03-06 04:20:07 +03:00
|
|
|
diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
index 35526ca3a37327b324166dd42e450d108667a643..a2c70b2b432b2a714a928a1c08f520b058cb0583 100644
|
2020-03-06 04:20:07 +03:00
|
|
|
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
|
|
|
|
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -1280,9 +1280,12 @@ void nsHtml5TreeOpExecutor::AddSpeculationCSP(const nsAString& aCSP) {
|
2020-03-06 04:20:07 +03:00
|
|
|
if (!StaticPrefs::security_csp_enable()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
-
|
|
|
|
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
|
2021-08-11 03:37:57 +03:00
|
|
|
index e108f50ef6d3e9b7b2fd6dbdf5742bcba2e65571..6d34e51fc2f63626014ec8c13ff85c5f63e4cdd1 100644
|
2020-03-06 04:20:07 +03:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.cpp
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.cpp
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -565,7 +565,12 @@ nsCertOverrideService::HasMatchingOverride(
|
2020-04-01 03:32:50 +03:00
|
|
|
bool disableAllSecurityCheck = false;
|
|
|
|
{
|
|
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
- disableAllSecurityCheck = mDisableAllSecurityCheck;
|
2021-08-11 03:37:57 +03:00
|
|
|
+ if (aOriginAttributes.mUserContextId) {
|
2020-04-01 03:32:50 +03:00
|
|
|
+ disableAllSecurityCheck = mUserContextIdsWithDisabledSecurityChecks.has(
|
2021-08-11 03:37:57 +03:00
|
|
|
+ aOriginAttributes.mUserContextId);
|
2020-04-01 03:32:50 +03:00
|
|
|
+ } else {
|
|
|
|
+ disableAllSecurityCheck = mDisableAllSecurityCheck;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
if (disableAllSecurityCheck) {
|
|
|
|
nsCertOverride::OverrideBits all = nsCertOverride::OverrideBits::Untrusted |
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -811,14 +816,24 @@ static bool IsDebugger() {
|
2020-04-01 03:32:50 +03:00
|
|
|
|
2020-03-06 04:20:07 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCertOverrideService::
|
2020-04-01 03:32:50 +03:00
|
|
|
- SetDisableAllSecurityChecksAndLetAttackersInterceptMyData(bool aDisable) {
|
2020-03-06 04:20:07 +03:00
|
|
|
- if (!(PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR") || IsDebugger())) {
|
2020-04-01 03:32:50 +03:00
|
|
|
+ SetDisableAllSecurityChecksAndLetAttackersInterceptMyData(
|
|
|
|
+ bool aDisable, uint32_t aUserContextId) {
|
2020-03-06 04:20:07 +03: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-04-01 03:32:50 +03:00
|
|
|
+ } else {
|
2021-08-11 03:37:57 +03:00
|
|
|
+ mDisableAllSecurityCheck = aDisable;
|
2020-04-01 03:32:50 +03:00
|
|
|
+ }
|
2021-08-11 03:37:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsINSSComponent> nss(do_GetService(PSM_COMPONENT_CONTRACTID));
|
2020-04-01 03:32:50 +03:00
|
|
|
diff --git a/security/manager/ssl/nsCertOverrideService.h b/security/manager/ssl/nsCertOverrideService.h
|
2021-08-11 03:37:57 +03:00
|
|
|
index 4c23cd20b9ccb72c2bc9d25ef7a832fe54993127..f43754414de091e5d745b96d440f9df8ac87f008 100644
|
2020-04-01 03:32:50 +03:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.h
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.h
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -132,6 +132,7 @@ class nsCertOverrideService final : public nsICertOverrideService,
|
2020-11-18 19:19:09 +03:00
|
|
|
private:
|
2020-04-01 03:32:50 +03:00
|
|
|
~nsCertOverrideService();
|
|
|
|
|
|
|
|
+ mozilla::HashSet<uint32_t> mUserContextIdsWithDisabledSecurityChecks;
|
|
|
|
mozilla::Mutex mMutex;
|
2020-11-18 19:19:09 +03:00
|
|
|
bool mDisableAllSecurityCheck;
|
2020-04-01 03:32:50 +03:00
|
|
|
nsCOMPtr<nsIFile> mSettingsFile;
|
|
|
|
diff --git a/security/manager/ssl/nsICertOverrideService.idl b/security/manager/ssl/nsICertOverrideService.idl
|
2021-08-11 03:37:57 +03:00
|
|
|
index da8f32c8f618d7fbea39f1c47645f0328d6aa28e..260424dc96b352d5de90db56aa8e4a777914fdfe 100644
|
2020-04-01 03:32:50 +03:00
|
|
|
--- a/security/manager/ssl/nsICertOverrideService.idl
|
|
|
|
+++ b/security/manager/ssl/nsICertOverrideService.idl
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -213,7 +213,9 @@ interface nsICertOverrideService : nsISupports {
|
2020-04-01 03:32:50 +03: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-04-01 03:32:50 +03:00
|
|
|
};
|
2020-03-23 09:52:59 +03:00
|
|
|
diff --git a/services/settings/Utils.jsm b/services/settings/Utils.jsm
|
2021-10-14 01:49:41 +03:00
|
|
|
index 8fcff97cd9f57d14f6f06f20b5bc2c0aec33f686..37c884b7eb81d6a06175568effd6d10e817f4320 100644
|
2020-03-23 09:52:59 +03:00
|
|
|
--- a/services/settings/Utils.jsm
|
|
|
|
+++ b/services/settings/Utils.jsm
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -63,7 +63,7 @@ var Utils = {
|
2020-03-23 09:52:59 +03:00
|
|
|
);
|
|
|
|
const isXpcshell = env.exists("XPCSHELL_TEST_PROFILE_DIR");
|
2021-08-11 03:37:57 +03:00
|
|
|
const isNotThunderbird = AppConstants.MOZ_APP_NAME != "thunderbird";
|
|
|
|
- return AppConstants.RELEASE_OR_BETA &&
|
|
|
|
+ return false && AppConstants.RELEASE_OR_BETA &&
|
|
|
|
!Cu.isInAutomation &&
|
|
|
|
!isXpcshell &&
|
|
|
|
isNotThunderbird
|
2021-06-09 02:00:15 +03:00
|
|
|
diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs
|
2021-08-11 03:37:57 +03:00
|
|
|
index 664a12f4108f8056f68893c1127d96099c0d30c9..2e2873f7f3127420e96154314acf363ef06806fc 100644
|
2021-06-09 02:00:15 +03:00
|
|
|
--- a/servo/components/style/gecko/media_features.rs
|
|
|
|
+++ b/servo/components/style/gecko/media_features.rs
|
|
|
|
@@ -336,10 +336,15 @@ pub enum ForcedColors {
|
|
|
|
|
|
|
|
/// https://drafts.csswg.org/mediaqueries-5/#forced-colors
|
|
|
|
fn eval_forced_colors(device: &Device, query_value: Option<ForcedColors>) -> bool {
|
|
|
|
- let forced = !device.use_document_colors();
|
|
|
|
+ let prefers_forced_colors =
|
|
|
|
+ unsafe { bindings::Gecko_MediaFeatures_ForcedColors(device.document()) };
|
|
|
|
+ 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 10:36:46 +03:00
|
|
|
diff --git a/toolkit/components/browser/nsIWebBrowserChrome.idl b/toolkit/components/browser/nsIWebBrowserChrome.idl
|
|
|
|
index 1e9bea1655af731fc003f8d0cab3ad4d2ad29f5d..5081c0e1ee0c41c6a79bd2ed358a57442e3baa6b 100644
|
|
|
|
--- a/toolkit/components/browser/nsIWebBrowserChrome.idl
|
|
|
|
+++ b/toolkit/components/browser/nsIWebBrowserChrome.idl
|
|
|
|
@@ -70,6 +70,9 @@ interface nsIWebBrowserChrome : nsISupports
|
|
|
|
// 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;
|
2021-08-25 17:26:20 +03:00
|
|
|
diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
|
2021-09-08 16:47:26 +03:00
|
|
|
index 733782457c8e654fc2431df874439e24fe7bd4f0..9bdd6dccd1e907c0776e3bd01bb0659d35218787 100644
|
2021-08-25 17:26:20 +03:00
|
|
|
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
|
|
|
|
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
|
|
|
|
@@ -115,6 +115,12 @@ EnterprisePoliciesManager.prototype = {
|
|
|
|
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-25 06:51:21 +03:00
|
|
|
diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 8611838aac6fa0b1aab0f41add8373a6789b4f7e..9304a43fd9bfeb9efdfc148711072f77c6901e1a 100644
|
2020-03-25 06:51:21 +03:00
|
|
|
--- a/toolkit/components/startup/nsAppStartup.cpp
|
|
|
|
+++ b/toolkit/components/startup/nsAppStartup.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -359,7 +359,7 @@ nsAppStartup::Quit(uint32_t aMode, int aExitCode, bool* aUserAllowedQuit) {
|
2020-03-25 06:51:21 +03: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-19 05:18:28 +03:00
|
|
|
diff --git a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
index 86f9574c8519b8e3f27d25339d44b83828a04f5c..adb5bba55421b27656d9b9e236f83b95b41300ba 100644
|
2019-11-19 05:18:28 +03: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-19 05:18:28 +03: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 10:36:46 +03:00
|
|
|
diff --git a/toolkit/components/windowwatcher/nsWindowWatcher.cpp b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
index f79bf206cfc3a33cd71c96811c2c3a113d11e534..3a6fe37e93838d515f1e9369d336095024371c0f 100644
|
2020-09-30 10:36:46 +03:00
|
|
|
--- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
|
|
|
+++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -1828,6 +1828,10 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForContent(
|
2020-09-30 10:36:46 +03:00
|
|
|
uint32_t chromeFlags = CalculateChromeFlagsHelper(
|
|
|
|
nsIWebBrowserChrome::CHROME_WINDOW_BORDERS, aFeatures, aSizeSpec);
|
|
|
|
|
|
|
|
+ if (aFeatures.Exists("width") || aFeatures.Exists("height")) {
|
|
|
|
+ chromeFlags |= nsIWebBrowserChrome::JUGGLER_WINDOW_EXPLICIT_SIZE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return EnsureFlagsSafeForContent(chromeFlags);
|
|
|
|
}
|
|
|
|
|
2020-03-23 09:52:59 +03:00
|
|
|
diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/UpdateService.jsm
|
2021-10-14 01:49:41 +03:00
|
|
|
index 4788151add891b8a68703a1f2fff89a8aa8040ee..657e9583831fc5a05e288641a634e4ab71b33f45 100644
|
2020-03-23 09:52:59 +03:00
|
|
|
--- a/toolkit/mozapps/update/UpdateService.jsm
|
|
|
|
+++ b/toolkit/mozapps/update/UpdateService.jsm
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -3656,7 +3656,7 @@ UpdateService.prototype = {
|
2021-07-14 19:26:43 +03:00
|
|
|
},
|
2020-03-23 09:52:59 +03:00
|
|
|
|
2021-07-14 19:26:43 +03:00
|
|
|
get disabledForTesting() {
|
2020-03-23 09:52:59 +03:00
|
|
|
- return (
|
|
|
|
+ return true || (
|
2021-07-14 19:26:43 +03:00
|
|
|
(Cu.isInAutomation || Marionette.running || RemoteAgent.listening) &&
|
2020-03-23 09:52:59 +03:00
|
|
|
Services.prefs.getBoolPref(PREF_APP_UPDATE_DISABLEDFORTESTING, false)
|
|
|
|
);
|
2019-11-19 05:18:28 +03:00
|
|
|
diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
|
2021-09-08 16:47:26 +03:00
|
|
|
index fd9903bac5b07c655ee77c94f8f795b6773676ad..a8dd1a58457d28271366cd9d57ab072a3b3dfec7 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/toolkit/toolkit.mozbuild
|
|
|
|
+++ b/toolkit/toolkit.mozbuild
|
2021-08-11 03:37:57 +03:00
|
|
|
@@ -168,6 +168,7 @@ if CONFIG['ENABLE_WEBDRIVER']:
|
2021-07-14 19:26:43 +03:00
|
|
|
'/remote',
|
2019-11-19 05:18:28 +03:00
|
|
|
'/testing/firefox-ui',
|
|
|
|
'/testing/marionette',
|
2020-03-06 04:20:07 +03:00
|
|
|
+ '/juggler',
|
2019-11-19 05:18:28 +03: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 21:32:47 +03:00
|
|
|
diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp
|
|
|
|
index 109c53cac98302d657d2a5a997f2ba687db14515..4d3c4beddaf627441e28f2a49d793d56fe4e2447 100644
|
|
|
|
--- a/toolkit/xre/nsWindowsWMain.cpp
|
|
|
|
+++ b/toolkit/xre/nsWindowsWMain.cpp
|
|
|
|
@@ -14,8 +14,10 @@
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "mozilla/Char16.h"
|
|
|
|
+#include "mozilla/CmdLineAndEnvUtils.h"
|
|
|
|
#include "nsUTF8Utils.h"
|
|
|
|
|
|
|
|
+#include <io.h>
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
@@ -94,6 +96,20 @@ static void FreeAllocStrings(int argc, char** argv) {
|
|
|
|
int wmain(int argc, WCHAR** argv) {
|
|
|
|
SanitizeEnvironmentVariables();
|
|
|
|
SetDllDirectoryW(L"");
|
|
|
|
+ bool hasJugglerPipe =
|
|
|
|
+ mozilla::CheckArg(argc, argv, L"juggler-pipe",
|
|
|
|
+ static_cast<const wchar_t**>(nullptr),
|
|
|
|
+ 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-19 05:18:28 +03:00
|
|
|
diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 4fd3b29938cb2d355b6b18ee21c3a4ee4cb5d67e..0700601b843dfc9a3925b4a28f16047fb13aa3fc 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/uriloader/base/nsDocLoader.cpp
|
|
|
|
+++ b/uriloader/base/nsDocLoader.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -826,6 +826,13 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout,
|
2019-12-12 04:53:46 +03: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 03:20:39 +03:00
|
|
|
+ if (!principal->IsSystemPrincipal())
|
2019-12-12 04:53:46 +03: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-07 09:34:30 +03:00
|
|
|
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index d2c088abc9a2387c8dbe1706cd3fc7f4bc402184..c887ebd77945fadd6fc1b87a7e18529775444772 100644
|
2020-04-07 09:34:30 +03:00
|
|
|
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
|
|
|
|
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -101,6 +101,7 @@
|
2020-04-07 09:34:30 +03:00
|
|
|
|
|
|
|
#include "mozilla/Components.h"
|
|
|
|
#include "mozilla/ClearOnShutdown.h"
|
|
|
|
+#include "mozilla/ErrorNames.h"
|
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
#include "mozilla/ipc/URIUtils.h"
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -911,6 +912,12 @@ NS_IMETHODIMP nsExternalHelperAppService::ApplyDecodingForExtension(
|
2020-04-07 09:34:30 +03: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);
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1577,7 +1584,12 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel* aChannel) {
|
2020-04-07 09:34:30 +03: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);
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1755,7 +1767,36 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
2020-04-07 09:34:30 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
- rv = SetUpTempFile(aChannel);
|
|
|
|
+ bool isIntercepted = false;
|
|
|
|
+ nsCOMPtr<nsIDownloadInterceptor> interceptor = mExtProtSvc->mInterceptor;
|
|
|
|
+ if (interceptor) {
|
|
|
|
+ nsCOMPtr<nsIFile> fileToUse;
|
2020-04-24 00:26:00 +03:00
|
|
|
+ rv = interceptor->InterceptDownloadRequest(this, request, mBrowsingContext, getter_AddRefs(fileToUse), &isIntercepted);
|
2020-04-07 09:34:30 +03: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;
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -1818,6 +1859,10 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
2021-08-11 03:37:57 +03:00
|
|
|
mMimeInfo->GetAlwaysAskBeforeHandling(&alwaysAsk);
|
|
|
|
}
|
2020-08-12 20:09:20 +03:00
|
|
|
|
2020-04-07 09:34:30 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -2301,6 +2346,16 @@ nsExternalAppHandler::OnSaveComplete(nsIBackgroundFileSaver* aSaver,
|
2020-04-07 09:34:30 +03: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 20:43:04 +03:00
|
|
|
+ Unused << rv;
|
2020-04-07 09:34:30 +03:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -2743,6 +2798,15 @@ NS_IMETHODIMP nsExternalAppHandler::Cancel(nsresult aReason) {
|
2020-04-07 09:34:30 +03: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 20:43:04 +03:00
|
|
|
+ Unused << rv;
|
2020-04-07 09:34:30 +03: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
|
2021-10-14 01:49:41 +03:00
|
|
|
index a1bc740b6514a1ce04ae30a78932209df07a21c1..b3aa6a44475b677305d74a63d333a1d9d416ea80 100644
|
2020-04-07 09:34:30 +03:00
|
|
|
--- a/uriloader/exthandler/nsExternalHelperAppService.h
|
|
|
|
+++ b/uriloader/exthandler/nsExternalHelperAppService.h
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -209,6 +209,8 @@ class nsExternalHelperAppService : public nsIExternalHelperAppService,
|
2020-04-07 09:34:30 +03:00
|
|
|
mozilla::dom::BrowsingContext* aContentContext, bool aForceSave,
|
|
|
|
nsIInterfaceRequestor* aWindowContext,
|
|
|
|
nsIStreamListener** aStreamListener);
|
|
|
|
+
|
|
|
|
+ nsCOMPtr<nsIDownloadInterceptor> mInterceptor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -402,6 +404,9 @@ class nsExternalAppHandler final : public nsIStreamListener,
|
2020-04-07 09:34:30 +03: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
|
2021-09-08 16:47:26 +03:00
|
|
|
index ca6dd36125ffc80080977f1e375d16dc61bd16c3..22b5432b0eacbf2fa163a65e57ad3227ee71bca6 100644
|
2020-04-07 09:34:30 +03:00
|
|
|
--- a/uriloader/exthandler/nsIExternalHelperAppService.idl
|
|
|
|
+++ b/uriloader/exthandler/nsIExternalHelperAppService.idl
|
2020-04-24 00:26:00 +03:00
|
|
|
@@ -6,6 +6,8 @@
|
2020-04-07 09:34:30 +03:00
|
|
|
|
|
|
|
#include "nsICancelable.idl"
|
|
|
|
|
2020-04-24 00:26:00 +03:00
|
|
|
+webidl BrowsingContext;
|
2020-04-07 09:34:30 +03:00
|
|
|
+interface nsIHelperAppLauncher;
|
|
|
|
interface nsIURI;
|
|
|
|
interface nsIRequest;
|
|
|
|
interface nsIStreamListener;
|
2020-10-08 00:12:19 +03:00
|
|
|
@@ -15,6 +17,17 @@ interface nsIWebProgressListener2;
|
|
|
|
interface nsIInterfaceRequestor;
|
|
|
|
webidl BrowsingContext;
|
2020-04-07 09:34:30 +03:00
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Interceptor interface used by Juggler.
|
|
|
|
+ */
|
|
|
|
+[scriptable, uuid(9a20e9b0-75d0-11ea-bc55-0242ac130003)]
|
|
|
|
+interface nsIDownloadInterceptor : nsISupports
|
|
|
|
+{
|
2020-04-24 00:26:00 +03:00
|
|
|
+ bool interceptDownloadRequest(in nsIHelperAppLauncher aHandler, in nsIRequest aRequest, in BrowsingContext aBrowsingContext, out nsIFile file);
|
2020-04-07 09:34:30 +03: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-08 00:12:19 +03:00
|
|
|
@@ -43,7 +56,7 @@ interface nsIExternalHelperAppService : nsISupports
|
2020-04-07 09:34:30 +03:00
|
|
|
in nsIInterfaceRequestor aContentContext,
|
|
|
|
in boolean aForceSave,
|
|
|
|
[optional] in nsIInterfaceRequestor aWindowContext);
|
|
|
|
-
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Binds an external helper application to a stream listener. The caller
|
|
|
|
* should pump data into the returned stream listener. When the OnStopRequest
|
2020-10-08 00:12:19 +03:00
|
|
|
@@ -76,6 +89,7 @@ interface nsIExternalHelperAppService : nsISupports
|
2020-04-07 09:34:30 +03:00
|
|
|
boolean applyDecodingForExtension(in AUTF8String aExtension,
|
|
|
|
in ACString aEncodingType);
|
|
|
|
|
|
|
|
+ void setDownloadInterceptor(in nsIDownloadInterceptor interceptor);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-07-15 19:37:08 +03:00
|
|
|
diff --git a/widget/InProcessCompositorWidget.cpp b/widget/InProcessCompositorWidget.cpp
|
2021-04-02 02:49:01 +03:00
|
|
|
index 3ebf466afd8aae8ab38ac5b711da2e100626ecf8..c8be7b53f0054c16adb9e76f424675dd9a3600a0 100644
|
2020-07-15 19:37:08 +03:00
|
|
|
--- a/widget/InProcessCompositorWidget.cpp
|
|
|
|
+++ b/widget/InProcessCompositorWidget.cpp
|
2020-12-18 08:02:01 +03:00
|
|
|
@@ -4,7 +4,10 @@
|
2020-07-15 19:37:08 +03:00
|
|
|
|
|
|
|
#include "InProcessCompositorWidget.h"
|
|
|
|
|
|
|
|
+#include "HeadlessCompositorWidget.h"
|
|
|
|
+#include "HeadlessWidget.h"
|
|
|
|
#include "mozilla/VsyncDispatcher.h"
|
2020-12-18 08:02:01 +03:00
|
|
|
+#include "mozilla/widget/PlatformWidgetTypes.h"
|
2020-07-15 19:37:08 +03:00
|
|
|
#include "nsBaseWidget.h"
|
|
|
|
|
2020-12-18 08:02:01 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
|
2021-04-02 02:49:01 +03:00
|
|
|
@@ -27,6 +30,12 @@ RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
|
|
|
|
// do it after the static_cast.
|
|
|
|
nsBaseWidget* widget = static_cast<nsBaseWidget*>(aWidget);
|
|
|
|
MOZ_RELEASE_ASSERT(widget);
|
2020-07-15 19:37:08 +03:00
|
|
|
+ if (aInitData.type() ==
|
|
|
|
+ CompositorWidgetInitData::THeadlessCompositorWidgetInitData) {
|
|
|
|
+ return new HeadlessCompositorWidget(
|
|
|
|
+ aInitData.get_HeadlessCompositorWidgetInitData(), aOptions,
|
|
|
|
+ static_cast<HeadlessWidget*>(aWidget));
|
|
|
|
+ }
|
|
|
|
# ifdef MOZ_WIDGET_ANDROID
|
2021-04-02 02:49:01 +03:00
|
|
|
return new AndroidCompositorWidget(aOptions, widget);
|
|
|
|
# else
|
2021-04-01 21:27:44 +03:00
|
|
|
diff --git a/widget/cocoa/NativeKeyBindings.mm b/widget/cocoa/NativeKeyBindings.mm
|
2021-04-02 02:49:01 +03:00
|
|
|
index 2b11df66d9445080d4d8a19a915b3e00285c5d32..caef1b65bbcff899f45c3e3cddfe76e88479ec30 100644
|
2021-04-01 21:27:44 +03:00
|
|
|
--- a/widget/cocoa/NativeKeyBindings.mm
|
|
|
|
+++ b/widget/cocoa/NativeKeyBindings.mm
|
|
|
|
@@ -491,6 +491,13 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
|
|
|
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())) {
|
|
|
|
@@ -511,6 +518,13 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
|
|
|
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())) {
|
|
|
|
@@ -531,6 +545,10 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
|
|
|
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()) {
|
|
|
|
@@ -540,7 +558,7 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
|
|
|
instance->AppendEditCommandsForSelector(
|
|
|
|
!aEvent.IsShift()
|
|
|
|
? ToObjcSelectorPtr(@selector(moveToBeginningOfDocument:))
|
|
|
|
- : ToObjcSelectorPtr(@selector(moveToBegginingOfDocumentAndModifySelection:)),
|
|
|
|
+ : ToObjcSelectorPtr(@selector(moveToBeginningOfDocumentAndModifySelection:)),
|
|
|
|
aCommands);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
@@ -563,6 +581,10 @@ void NativeKeyBindings::GetEditCommandsForTests(NativeKeyBindingsType aType,
|
|
|
|
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 21:20:36 +03:00
|
|
|
diff --git a/widget/headless/HeadlessCompositorWidget.cpp b/widget/headless/HeadlessCompositorWidget.cpp
|
2021-04-02 02:49:01 +03:00
|
|
|
index b31a969b7ab3d0fc80912b110d91dfdf3e5991f4..beb2343fe704e0f700693fd13280689caca0e4ca 100644
|
2020-07-14 21:20:36 +03: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"
|
2021-04-02 02:49:01 +03:00
|
|
|
@@ -17,6 +18,33 @@ HeadlessCompositorWidget::HeadlessCompositorWidget(
|
2020-07-14 21:20:36 +03:00
|
|
|
mClientSize = aInitData.InitialClientSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
+void HeadlessCompositorWidget::SetSnapshotListener(HeadlessWidget::SnapshotListener&& listener) {
|
|
|
|
+ MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
+
|
2020-08-05 03:58:57 +03:00
|
|
|
+ layers::CompositorThread()->Dispatch(NewRunnableMethod<HeadlessWidget::SnapshotListener&&>(
|
2020-07-14 21:20:36 +03:00
|
|
|
+ "HeadlessCompositorWidget::SetSnapshotListener", this,
|
|
|
|
+ &HeadlessCompositorWidget::SetSnapshotListenerOnCompositorThread,
|
2020-08-05 03:58:57 +03:00
|
|
|
+ std::move(listener)));
|
2020-07-14 21:20:36 +03:00
|
|
|
+}
|
|
|
|
+
|
2020-07-21 00:24:52 +03:00
|
|
|
+void HeadlessCompositorWidget::SetSnapshotListenerOnCompositorThread(
|
2020-08-05 03:58:57 +03:00
|
|
|
+ HeadlessWidget::SnapshotListener&& listener) {
|
2020-07-14 21:20:36 +03:00
|
|
|
+ MOZ_ASSERT(NS_IsInCompositorThread());
|
|
|
|
+ mSnapshotListener = std::move(listener);
|
2020-07-15 19:37:08 +03:00
|
|
|
+ PeriodicSnapshot();
|
2020-07-14 21:20:36 +03:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+already_AddRefed<gfx::DrawTarget> HeadlessCompositorWidget::StartRemoteDrawingInRegion(
|
2021-04-02 02:49:01 +03:00
|
|
|
+ const LayoutDeviceIntRegion& aInvalidRegion,
|
|
|
|
+ layers::BufferMode* aBufferMode) {
|
2020-07-14 21:20:36 +03:00
|
|
|
+ if (!mDrawTarget)
|
|
|
|
+ return nullptr;
|
|
|
|
+
|
|
|
|
+ *aBufferMode = layers::BufferMode::BUFFER_NONE;
|
|
|
|
+ RefPtr<gfx::DrawTarget> result = mDrawTarget;
|
|
|
|
+ return result.forget();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void HeadlessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
|
|
|
|
if (RefPtr<CompositorVsyncDispatcher> cvd =
|
|
|
|
mWidget->GetCompositorVsyncDispatcher()) {
|
2021-04-02 02:49:01 +03:00
|
|
|
@@ -29,6 +57,58 @@ nsIWidget* HeadlessCompositorWidget::RealWidget() { return mWidget; }
|
2020-07-14 21:20:36 +03:00
|
|
|
void HeadlessCompositorWidget::NotifyClientSizeChanged(
|
|
|
|
const LayoutDeviceIntSize& aClientSize) {
|
|
|
|
mClientSize = aClientSize;
|
2020-07-21 00:24:52 +03:00
|
|
|
+ layers::CompositorThread()->Dispatch(NewRunnableMethod<LayoutDeviceIntSize>(
|
|
|
|
+ "HeadlessCompositorWidget::UpdateDrawTarget", this,
|
|
|
|
+ &HeadlessCompositorWidget::UpdateDrawTarget,
|
|
|
|
+ aClientSize));
|
2020-07-14 21:20:36 +03:00
|
|
|
+}
|
|
|
|
+
|
2020-07-21 00:24:52 +03:00
|
|
|
+void HeadlessCompositorWidget::UpdateDrawTarget(const LayoutDeviceIntSize& aClientSize) {
|
|
|
|
+ MOZ_ASSERT(NS_IsInCompositorThread());
|
|
|
|
+ if (aClientSize.IsEmpty()) {
|
2020-07-14 21:20:36 +03:00
|
|
|
+ mDrawTarget = nullptr;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
2020-07-21 00:24:52 +03:00
|
|
|
+ RefPtr<gfx::DrawTarget> old = std::move(mDrawTarget);
|
2020-07-14 21:20:36 +03:00
|
|
|
+ gfx::SurfaceFormat format = gfx::SurfaceFormat::B8G8R8A8;
|
2020-07-21 00:24:52 +03:00
|
|
|
+ gfx::IntSize size = aClientSize.ToUnknownSize();
|
2020-07-14 21:20:36 +03:00
|
|
|
+ mDrawTarget = mozilla::gfx::Factory::CreateDrawTarget(
|
|
|
|
+ mozilla::gfx::BackendType::SKIA, size, format);
|
2020-07-21 00:24:52 +03:00
|
|
|
+ if (old) {
|
|
|
|
+ RefPtr<gfx::SourceSurface> snapshot = old->Snapshot();
|
|
|
|
+ if (snapshot)
|
|
|
|
+ mDrawTarget->CopySurface(snapshot.get(), old->GetRect(), gfx::IntPoint(0, 0));
|
|
|
|
+ }
|
2020-07-15 19:37:08 +03:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void HeadlessCompositorWidget::PeriodicSnapshot() {
|
2020-08-05 03:58:57 +03:00
|
|
|
+ if (!mSnapshotListener)
|
2020-07-15 19:37:08 +03:00
|
|
|
+ return;
|
|
|
|
+
|
2020-08-05 03:58:57 +03:00
|
|
|
+ TakeSnapshot();
|
|
|
|
+ NS_DelayedDispatchToCurrentThread(NewRunnableMethod(
|
|
|
|
+ "HeadlessCompositorWidget::PeriodicSnapshot", this,
|
|
|
|
+ &HeadlessCompositorWidget::PeriodicSnapshot), 40);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void HeadlessCompositorWidget::TakeSnapshot() {
|
|
|
|
+ if (!mDrawTarget)
|
2020-07-15 19:37:08 +03: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 21:20:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
LayoutDeviceIntSize HeadlessCompositorWidget::GetClientSize() {
|
|
|
|
diff --git a/widget/headless/HeadlessCompositorWidget.h b/widget/headless/HeadlessCompositorWidget.h
|
2021-04-02 02:49:01 +03:00
|
|
|
index 7f91de9e67d7ffa02de3eef1d760e5cfd05e7ad6..684293dab3e81e8a60d245f979f2051df395948f 100644
|
2020-07-14 21:20:36 +03:00
|
|
|
--- a/widget/headless/HeadlessCompositorWidget.h
|
|
|
|
+++ b/widget/headless/HeadlessCompositorWidget.h
|
2021-04-02 02:49:01 +03:00
|
|
|
@@ -23,8 +23,12 @@ class HeadlessCompositorWidget final : public CompositorWidget,
|
2020-07-14 21:20:36 +03:00
|
|
|
HeadlessWidget* aWindow);
|
|
|
|
|
|
|
|
void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize);
|
|
|
|
+ void SetSnapshotListener(HeadlessWidget::SnapshotListener&& listener);
|
|
|
|
|
|
|
|
// CompositorWidget Overrides
|
|
|
|
+ already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
|
2021-04-02 02:49:01 +03:00
|
|
|
+ const LayoutDeviceIntRegion& aInvalidRegion,
|
|
|
|
+ layers::BufferMode* aBufferMode) override;
|
|
|
|
|
2020-07-14 21:20:36 +03:00
|
|
|
uintptr_t GetWidgetKey() override;
|
|
|
|
|
2020-07-21 00:24:52 +03:00
|
|
|
@@ -42,9 +46,18 @@ class HeadlessCompositorWidget final : public CompositorWidget,
|
2020-07-14 21:20:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2020-07-21 00:24:52 +03:00
|
|
|
+ void SetSnapshotListenerOnCompositorThread(
|
2020-08-05 03:58:57 +03:00
|
|
|
+ HeadlessWidget::SnapshotListener&& listener);
|
2020-07-21 00:24:52 +03:00
|
|
|
+ void UpdateDrawTarget(const LayoutDeviceIntSize& aClientSize);
|
2020-07-15 19:37:08 +03:00
|
|
|
+ void PeriodicSnapshot();
|
2020-08-05 03:58:57 +03:00
|
|
|
+ void TakeSnapshot();
|
2020-07-14 21:20:36 +03:00
|
|
|
+
|
|
|
|
HeadlessWidget* mWidget;
|
|
|
|
|
|
|
|
LayoutDeviceIntSize mClientSize;
|
|
|
|
+
|
|
|
|
+ HeadlessWidget::SnapshotListener mSnapshotListener;
|
|
|
|
+ RefPtr<gfx::DrawTarget> mDrawTarget;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widget
|
|
|
|
diff --git a/widget/headless/HeadlessWidget.cpp b/widget/headless/HeadlessWidget.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
index 4cd7a8be322851f2710b4c60fbd6377f8cc4abfc..6bfb3da3e82ebfb453cd036c8b22921d506a3762 100644
|
2020-07-14 21:20:36 +03:00
|
|
|
--- a/widget/headless/HeadlessWidget.cpp
|
|
|
|
+++ b/widget/headless/HeadlessWidget.cpp
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -107,6 +107,8 @@ void HeadlessWidget::Destroy() {
|
2020-07-15 19:37:08 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ SetSnapshotListener(nullptr);
|
|
|
|
+
|
|
|
|
nsBaseWidget::OnDestroy();
|
|
|
|
|
|
|
|
nsBaseWidget::Destroy();
|
2021-10-14 01:49:41 +03:00
|
|
|
@@ -561,5 +563,15 @@ nsresult HeadlessWidget::SynthesizeNativeTouchPadPinch(
|
2021-03-03 05:52:19 +03:00
|
|
|
DispatchPinchGestureInput(inputToDispatch);
|
2020-07-14 21:20:36 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2021-03-03 05:52:19 +03:00
|
|
|
+
|
2020-07-14 21:20:36 +03:00
|
|
|
+void HeadlessWidget::SetSnapshotListener(SnapshotListener&& listener) {
|
|
|
|
+ if (!mCompositorWidget) {
|
2020-08-05 03:38:46 +03:00
|
|
|
+ if (listener)
|
|
|
|
+ fprintf(stderr, "Trying to set SnapshotListener without compositor widget\n");
|
2020-07-14 21:20:36 +03:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ mCompositorWidget->SetSnapshotListener(std::move(listener));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
diff --git a/widget/headless/HeadlessWidget.h b/widget/headless/HeadlessWidget.h
|
2021-09-08 16:47:26 +03:00
|
|
|
index 1035eb41173427e22773f6c0273787b9f134c90b..6dc4dd043e2bb06ce816f6a945687753bf2a3e8b 100644
|
2020-07-14 21:20:36 +03:00
|
|
|
--- a/widget/headless/HeadlessWidget.h
|
|
|
|
+++ b/widget/headless/HeadlessWidget.h
|
2021-09-08 16:47:26 +03:00
|
|
|
@@ -140,6 +140,9 @@ class HeadlessWidget : public nsBaseWidget {
|
|
|
|
TouchpadGesturePhase aEventPhase, float aScale,
|
|
|
|
LayoutDeviceIntPoint aPoint, int32_t aModifierFlags) override;
|
2020-07-14 21:20:36 +03:00
|
|
|
|
|
|
|
+ using SnapshotListener = std::function<void(RefPtr<gfx::DataSourceSurface>&&)>;
|
|
|
|
+ void SetSnapshotListener(SnapshotListener&& listener);
|
|
|
|
+
|
|
|
|
private:
|
|
|
|
~HeadlessWidget();
|
|
|
|
bool mEnabled;
|
2020-10-13 22:24:11 +03:00
|
|
|
diff --git a/xpcom/reflect/xptinfo/xptinfo.h b/xpcom/reflect/xptinfo/xptinfo.h
|
2021-07-14 19:26:43 +03:00
|
|
|
index efee881c142175c29d15f7ceaaebf852f39e44cd..014bf4b39b99eaf2fba6fb08827e7d2f964bab33 100644
|
2020-10-13 22:24:11 +03:00
|
|
|
--- a/xpcom/reflect/xptinfo/xptinfo.h
|
|
|
|
+++ b/xpcom/reflect/xptinfo/xptinfo.h
|
2021-07-14 19:26:43 +03:00
|
|
|
@@ -514,7 +514,7 @@ static_assert(sizeof(nsXPTMethodInfo) == 8, "wrong size");
|
2020-10-13 22:24:11 +03: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
|
|
|
|
|
|
|
|
/**
|