2020-01-30 05:56:11 +03:00
|
|
|
diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h
|
2020-05-08 04:37:15 +03:00
|
|
|
index f239731e0ff06cb01a4c0e8cf0ba4ff5014f88e0..53447ef12eb59bd065abbfd031bd6336a60020a2 100644
|
2020-01-30 05:56:11 +03:00
|
|
|
--- a/accessible/base/NotificationController.h
|
|
|
|
+++ b/accessible/base/NotificationController.h
|
2020-05-08 04:37:15 +03:00
|
|
|
@@ -284,6 +284,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
|
|
|
|
index e3dbe73f22252f11080c3f266b2309f842eba9dc..87f50fe3df7cc8f9bc26dabd5ee571cae270912a 100644
|
|
|
|
--- a/accessible/xpcom/xpcAccessibleDocument.cpp
|
|
|
|
+++ b/accessible/xpcom/xpcAccessibleDocument.cpp
|
|
|
|
@@ -143,6 +143,15 @@ xpcAccessibleDocument::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) {
|
|
|
|
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
|
|
|
|
index f042cc1081850ac60e329b70b5569f8b97d4e4dc..65bcff9b41b9471ef1427e3ea330481c194409bc 100644
|
|
|
|
--- 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.
|
|
|
|
*/
|
2019-11-19 05:18:28 +03:00
|
|
|
diff --git a/browser/installer/allowed-dupes.mn b/browser/installer/allowed-dupes.mn
|
2020-08-12 20:09:20 +03:00
|
|
|
index 1e583f9fb014129d791d25b64a727021d6848105..6a91ef0bd0796abf99d8fd54ff6aede94aeb0807 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/browser/installer/allowed-dupes.mn
|
|
|
|
+++ b/browser/installer/allowed-dupes.mn
|
2020-06-10 08:48:10 +03:00
|
|
|
@@ -64,6 +64,12 @@ browser/defaults/settings/pinning/pins.json
|
2019-11-19 05:18:28 +03:00
|
|
|
browser/defaults/settings/main/example.json
|
2020-06-10 08:48:10 +03:00
|
|
|
browser/defaults/settings/main/search-default-override-allowlist.json
|
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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 37f26e708c41dcbd1d7341e5f1c191789239d362..36a2e5b2d85e8221691a3b310e79df3dbceae018 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/browser/installer/package-manifest.in
|
|
|
|
+++ b/browser/installer/package-manifest.in
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -214,6 +214,11 @@
|
2019-11-19 05:18:28 +03:00
|
|
|
@RESPATH@/components/marionette.js
|
|
|
|
#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) {
|
2019-11-19 05:18:28 +03:00
|
|
|
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index ff630c49f8529baac227dfca33b7fc84b1a14d0a..fea8bf34ffbf1555a63a81f7f4d2a566778d6295 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"
|
2020-06-10 08:48:10 +03:00
|
|
|
@@ -57,6 +63,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"
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -78,6 +85,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"
|
2020-08-12 20:09:20 +03:00
|
|
|
#include "mozilla/net/ParentChannelWrapper.h"
|
2020-05-08 04:37:15 +03:00
|
|
|
#include "mozilla/net/UrlClassifierFeatureFactory.h"
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -102,6 +110,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"
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -193,6 +202,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"
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -386,6 +396,11 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
|
|
|
|
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-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),
|
2019-11-26 00:56:39 +03:00
|
|
|
mAllowAuth(mItemType == typeContent),
|
|
|
|
mAllowKeywordFixup(false),
|
|
|
|
mIsOffScreenBrowser(false),
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1287,6 +1302,7 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
|
2019-11-19 05:18:28 +03:00
|
|
|
isSubFrame = mLSHE->GetIsSubFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
+ FireOnFrameLocationChange(this, aRequest, aURI, aLocationFlags);
|
|
|
|
if (!isSubFrame && !isRoot) {
|
|
|
|
/*
|
|
|
|
* We don't want to send OnLocationChange notifications when
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -3021,6 +3037,184 @@ 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;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+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) {
|
|
|
|
+ MOZ_ASSERT(aEnabled);
|
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;
|
|
|
|
+ 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;
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -8291,6 +8485,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;
|
|
|
|
}
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -11908,6 +12108,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;
|
|
|
|
}
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -11993,6 +12196,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 391039a9629490529ba1d25cc6775a0e52da4417..baaef7046177a6bfbea0f783a006533ca6f2df7a 100644
|
2019-11-26 00:56:39 +03:00
|
|
|
--- a/docshell/base/nsDocShell.h
|
|
|
|
+++ b/docshell/base/nsDocShell.h
|
2020-03-20 21:14:42 +03:00
|
|
|
@@ -13,6 +13,7 @@
|
|
|
|
#include "Units.h"
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "mozilla/BasePrincipal.h"
|
|
|
|
+#include "mozilla/dom/Geolocation.h"
|
|
|
|
#include "mozilla/HalScreenConfiguration.h"
|
|
|
|
#include "mozilla/LinkedList.h"
|
|
|
|
#include "mozilla/Maybe.h"
|
|
|
|
@@ -25,6 +26,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"
|
|
|
|
#include "mozilla/dom/ChildSHistory.h"
|
2020-03-07 05:25:27 +03:00
|
|
|
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
|
|
|
#include "mozilla/dom/WindowProxyHolder.h"
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -409,6 +411,15 @@ class nsDocShell final : public nsDocLoader,
|
2020-03-25 09:25:17 +03:00
|
|
|
|
|
|
|
void SetWillChangeProcess() { mWillChangeProcess = true; }
|
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(
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -985,6 +996,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
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1199,6 +1212,14 @@ class nsDocShell final : public nsDocLoader,
|
|
|
|
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-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;
|
2020-03-22 23:51:49 +03:00
|
|
|
+
|
2019-11-26 00:56:39 +03:00
|
|
|
bool mAllowAuth : 1;
|
|
|
|
bool mAllowKeywordFixup : 1;
|
|
|
|
bool mIsOffScreenBrowser : 1;
|
|
|
|
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
|
2020-08-12 20:09:20 +03:00
|
|
|
index 22dae012b1a7532e320c4c35e948743927f5416d..54a8f19a4e8faa164d4ef0bf41445e1f1f556788 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 nsIDocShellLoadInfo;
|
|
|
|
interface nsIEditor;
|
|
|
|
interface nsIEditingSession;
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -989,6 +990,33 @@ 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-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;
|
|
|
|
+
|
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
|
2020-08-12 20:09:20 +03:00
|
|
|
index a0a53ddca585c3840b07a1548b1aaa8224900694..830685a8ef10b98a3daa6638ac855f718c0a85a4 100644
|
2019-11-26 02:26:03 +03:00
|
|
|
--- a/dom/base/Document.cpp
|
|
|
|
+++ b/dom/base/Document.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -3281,6 +3281,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
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -3335,6 +3338,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;
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -4103,6 +4111,10 @@ bool Document::HasFocus(ErrorResult& rv) const {
|
2020-04-16 00:41:18 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (IsActive() && mDocumentContainer->ShouldOverrideHasFocus()) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Is there a focused DOMWindow?
|
|
|
|
nsCOMPtr<mozIDOMWindowProxy> focusedWindow;
|
|
|
|
fm->GetFocusedWindow(getter_AddRefs(focusedWindow));
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -16501,6 +16513,19 @@ 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;
|
|
|
|
+ if (docShell->GetColorSchemeOverride(&colorScheme) == NS_OK &&
|
|
|
|
+ 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;
|
|
|
|
+ case nsIDocShell::COLOR_SCHEME_OVERRIDE_NO_PREFERENCE:
|
|
|
|
+ return StylePrefersColorScheme::NoPreference;
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
if (aIgnoreRFP == IgnoreRFP::No &&
|
|
|
|
nsContentUtils::ShouldResistFingerprinting(this)) {
|
|
|
|
return StylePrefersColorScheme::Light;
|
2020-03-21 03:03:20 +03:00
|
|
|
diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index dc90eec2dcea2c13f5f0cd78fdb0332b4e43d730..6000210aee8931810c27cb8b3776ff62a29cdf29 100644
|
2020-03-21 03:03:20 +03:00
|
|
|
--- a/dom/base/Navigator.cpp
|
|
|
|
+++ b/dom/base/Navigator.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -326,14 +326,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.
|
|
|
|
nsCharSeparatedTokenizer langTokenizer(acceptLang, ',');
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -389,7 +393,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
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -553,7 +559,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 9e898052f8eebd8331b46b105bc8b6eeff3a2e84..994243e99814a3f8882c9fe425ecab521b9820e4 100644
|
2020-03-21 03:03:20 +03:00
|
|
|
--- a/dom/base/Navigator.h
|
|
|
|
+++ b/dom/base/Navigator.h
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -220,7 +220,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-07-21 02:47:27 +03:00
|
|
|
diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index 4a22e7c667d52eecc88129da48f5b0070cb4df2c..d47dbe7e11304a7576d0261e9c225c0718f123c4 100644
|
2020-07-21 02:47:27 +03:00
|
|
|
--- a/dom/base/nsFocusManager.cpp
|
|
|
|
+++ b/dom/base/nsFocusManager.cpp
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -2713,7 +2713,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 951d43fbae18abc592ee5d6f3d39e8a24ecb1c8d..594f910898068f03db5d36a58e996c60e20bf96c 100644
|
2020-03-27 04:42:21 +03:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.cpp
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2427,7 +2427,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
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2446,10 +2446,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));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2569,6 +2575,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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void nsGlobalWindowOuter::ClearStatus() { SetStatusOuter(EmptyString()); }
|
|
|
|
|
|
|
|
void nsGlobalWindowOuter::SetDocShell(nsDocShell* aDocShell) {
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -3832,6 +3851,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index a795197f644fe7e8995e950a1773a27a45a8f386..034d3c7eed2fe73ff6f2401a18e6e8c7db55246c 100644
|
2020-07-01 23:28:13 +03:00
|
|
|
--- a/dom/base/nsGlobalWindowOuter.h
|
|
|
|
+++ b/dom/base/nsGlobalWindowOuter.h
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -320,6 +320,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index f5d900d618657b601baf079d8a9bc3ad265ef498..06e4d027929dcaccf188da2dd2e46ddc38603411 100644
|
2020-04-13 21:31:02 +03:00
|
|
|
--- a/dom/base/nsINode.cpp
|
|
|
|
+++ b/dom/base/nsINode.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1258,6 +1258,48 @@ 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,
|
|
|
|
+ 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
|
2020-08-12 20:09:20 +03:00
|
|
|
index b5484e2ec630ae2cea41d5570483443c6e107ff3..6a328235c1a42de77d8637fdb22746e500d4b1ed 100644
|
2020-04-13 21:31:02 +03:00
|
|
|
--- a/dom/base/nsINode.h
|
|
|
|
+++ b/dom/base/nsINode.h
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2049,6 +2049,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
|
2020-08-06 20:32:50 +03:00
|
|
|
index cafaf9d41801b763260e61feec926d41fe25d1c2..4462d5dc396d1648ccf050a7e0ccebebf301c443 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/dom/base/nsJSUtils.cpp
|
|
|
|
+++ b/dom/base/nsJSUtils.cpp
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -505,6 +505,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 30a03d39baf9e3b953e1ba8e9fea1a875a6d029a..5b3d2c85988500a937cecc6a056d397ab349ca4d 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/dom/base/nsJSUtils.h
|
|
|
|
+++ b/dom/base/nsJSUtils.h
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -231,6 +231,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();
|
2020-03-20 21:14:42 +03:00
|
|
|
diff --git a/dom/geolocation/Geolocation.cpp b/dom/geolocation/Geolocation.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index fcd27d4e0dc23ec84e796031943dfefb2a4fae5b..ea3ce6d547bc667c66acab03dbc7964155ba029e 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-08-12 20:09:20 +03:00
|
|
|
@@ -291,10 +292,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-08-12 20:09:20 +03:00
|
|
|
@@ -464,8 +463,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-08-12 20:09:20 +03:00
|
|
|
@@ -742,8 +740,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-08-12 20:09:20 +03:00
|
|
|
@@ -835,7 +839,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
|
|
|
|
index d92bd1c738016f93c66dbdc449c70937c37b6f9a..a4c1f0ca974470342cb8136705d78cfc00e35083 100644
|
|
|
|
--- a/dom/geolocation/Geolocation.h
|
|
|
|
+++ b/dom/geolocation/Geolocation.h
|
|
|
|
@@ -57,7 +57,7 @@ struct CachedPositionAndAccuracy {
|
|
|
|
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
|
|
|
|
@@ -182,6 +182,8 @@ class Geolocation final : public nsIGeolocationUpdate, public nsWrapperCache {
|
|
|
|
// 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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 6d5a0e696890ea3b367b8e1021df17ea438fc9a2..6bc53af4bee4327c439fd08af0feffe91b5b9bf9 100644
|
2019-11-26 00:56:39 +03:00
|
|
|
--- a/dom/html/HTMLInputElement.cpp
|
|
|
|
+++ b/dom/html/HTMLInputElement.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -45,6 +45,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"
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -708,6 +709,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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (IsPopupBlocked()) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2019-11-19 05:18:28 +03:00
|
|
|
diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index 592ec8ade75abca7a3d0db77ef2f83124d6d1704..daa5b8d70a161e0875432c2f1200498666d314d0 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/dom/ipc/BrowserChild.cpp
|
|
|
|
+++ b/dom/ipc/BrowserChild.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -3512,6 +3512,13 @@ NS_IMETHODIMP BrowserChild::OnStateChange(nsIWebProgress* aWebProgress,
|
2019-11-19 05:18:28 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
+NS_IMETHODIMP BrowserChild::OnFrameLocationChange(nsIWebProgress *aWebProgress,
|
|
|
|
+ nsIRequest *aRequest,
|
|
|
|
+ nsIURI *aLocation,
|
|
|
|
+ uint32_t aFlags) {
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
NS_IMETHODIMP BrowserChild::OnProgressChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest,
|
|
|
|
int32_t aCurSelfProgress,
|
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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 76dbf6ef6bed843568c45606fe825233c6cd77a5..a43e1977b278c52ee0611f387dd726bf7ffb8e7c 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
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -125,8 +125,9 @@ int32_t ScreenDeviceInfoImpl::GetOrientation(const char* deviceUniqueIdUTF8,
|
2020-07-28 02:22:02 +03:00
|
|
|
|
|
|
|
VideoCaptureModule* DesktopCaptureImpl::Create(const int32_t id,
|
|
|
|
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_(
|
|
|
|
diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.h b/dom/media/systemservices/video_engine/desktop_capture_impl.h
|
2020-08-12 20:09:20 +03:00
|
|
|
index e1f28e16da200a7727c6cb85ab41e843d81ce802..9e27e14f235e56b2b231060738c1422a79379b75 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
|
|
|
|
@@ -159,7 +159,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|
|
|
/* Create a screen capture modules object
|
|
|
|
*/
|
|
|
|
static VideoCaptureModule* Create(const int32_t id, const char* uniqueId,
|
|
|
|
- const CaptureDeviceType type);
|
|
|
|
+ const CaptureDeviceType type,
|
|
|
|
+ bool captureCursor = true);
|
|
|
|
static VideoCaptureModule::DeviceInfo* CreateDeviceInfo(
|
|
|
|
const int32_t id, const CaptureDeviceType type);
|
|
|
|
|
|
|
|
@@ -191,7 +192,7 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|
|
|
|
|
|
|
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);
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -239,6 +240,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 90d49d8ddc21e3f60fedf9dbfe6ca1a5e2af89b8..88ff30500cb0be53b11cddc3e63c1e4b6f346d3f 100644
|
2020-01-16 22:52:23 +03:00
|
|
|
--- a/dom/script/ScriptSettings.cpp
|
|
|
|
+++ b/dom/script/ScriptSettings.cpp
|
2020-06-10 08:48:10 +03:00
|
|
|
@@ -142,6 +142,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.
|
2020-06-10 08:48:10 +03:00
|
|
|
@@ -169,7 +193,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 7c6bd4a4fb996523c42885b158353c7b4ad9e8df..71bdf9108c9266f716dd5ed1af43d08a7fc7d7b7 100644
|
2019-11-26 02:26:03 +03:00
|
|
|
--- a/dom/security/nsCSPUtils.cpp
|
|
|
|
+++ b/dom/security/nsCSPUtils.cpp
|
2020-01-11 03:20:39 +03:00
|
|
|
@@ -121,6 +121,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 4183d9cd7b84f8594083ac7a0dc75eccc3a83092..73e7a6abd9192636b384cd34d82b8cdd3f199f67 100644
|
2020-03-21 03:03:20 +03:00
|
|
|
--- a/dom/workers/RuntimeService.cpp
|
|
|
|
+++ b/dom/workers/RuntimeService.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -996,7 +996,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) {
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1195,8 +1195,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;
|
|
|
|
}
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1896,6 +1895,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);
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2333,6 +2339,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 67eac10dabd93da344a1366dee5d1c4428a4352c..1c31651d8087c90983c08fe184b344853af87033 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/RuntimeService.h
|
|
|
|
+++ b/dom/workers/RuntimeService.h
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -121,6 +121,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-08-06 20:32:50 +03:00
|
|
|
index 0eeb8a65c328a2d5de0ec62cd94af1b249a101af..4625535b61d1ccd92da3e3bd0993b9a89d614747 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/WorkerCommon.h
|
|
|
|
+++ b/dom/workers/WorkerCommon.h
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -47,6 +47,8 @@ void ResumeWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
|
|
|
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
|
2020-08-12 20:09:20 +03:00
|
|
|
index ad6998081fae5cb43033d973e1b84ed0ab8873a3..8c038034b59b8cce479fb2100784cb165aff0870 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/WorkerPrivate.cpp
|
|
|
|
+++ b/dom/workers/WorkerPrivate.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -653,6 +653,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;
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1831,6 +1843,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();
|
|
|
|
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -4800,6 +4822,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index bc31b18cf9021f753a0f8b5a80dfb32041721113..200792e7266745642589104d02856468ddd5235a 100644
|
2020-03-27 02:33:07 +03:00
|
|
|
--- a/dom/workers/WorkerPrivate.h
|
|
|
|
+++ b/dom/workers/WorkerPrivate.h
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -297,6 +297,8 @@ class WorkerPrivate : 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,
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -886,6 +888,8 @@ class WorkerPrivate : 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
|
2020-05-08 04:37:15 +03:00
|
|
|
index e7a54d86c44499a3ec2adf1c156b9f9dfb0bc6b4..f56c1b419c4cb52bc371f6b8dbfffba464326fc4 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/js/public/Date.h
|
|
|
|
+++ b/js/public/Date.h
|
|
|
|
@@ -56,6 +56,8 @@ namespace JS {
|
|
|
|
*/
|
|
|
|
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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 07ec8d150da460d47a46b79649b9c231ffc7a716..0acac5aa54d557a2ce07217e14989fd88ca1b116 100644
|
2020-03-26 02:28:33 +03:00
|
|
|
--- a/js/src/debugger/Object.cpp
|
|
|
|
+++ b/js/src/debugger/Object.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2404,7 +2404,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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 2077eca87c1deb890491723eb6a3650497b71227..78f33af48cd62d77be1c359903aec4db51f38bcf 100644
|
2020-04-02 00:10:30 +03:00
|
|
|
--- a/js/src/vm/DateTime.cpp
|
|
|
|
+++ b/js/src/vm/DateTime.cpp
|
|
|
|
@@ -168,6 +168,11 @@ void js::DateTimeInfo::internalResetTimeZone(ResetTimeZoneMode mode) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+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);
|
|
|
|
|
|
|
|
@@ -528,10 +533,27 @@ void js::ResetTimeZoneInternal(ResetTimeZoneMode mode) {
|
|
|
|
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
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -733,6 +755,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
|
|
|
|
index 25c5b01fc54c8d45da8ceb7cf6ba163bee3c5361..490c5ce49cd9b5f804df59abbfb0450fb9d1f877 100644
|
|
|
|
--- a/js/src/vm/DateTime.h
|
|
|
|
+++ b/js/src/vm/DateTime.h
|
|
|
|
@@ -67,6 +67,8 @@ enum class ResetTimeZoneMode : bool {
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
@@ -206,6 +208,7 @@ class DateTimeInfo {
|
|
|
|
// 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();
|
|
|
|
@@ -302,6 +305,8 @@ class DateTimeInfo {
|
|
|
|
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
|
|
|
|
@@ -317,6 +322,8 @@ class DateTimeInfo {
|
|
|
|
|
|
|
|
void internalResetTimeZone(ResetTimeZoneMode mode);
|
|
|
|
|
|
|
|
+ void internalSetTimeZoneOverride(mozilla::UniquePtr<icu::TimeZone> timeZone);
|
|
|
|
+
|
|
|
|
void updateTimeZone();
|
|
|
|
|
|
|
|
void internalResyncICUDefaultTimeZone();
|
2020-03-06 04:20:07 +03:00
|
|
|
diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index 16a80a81f0446d53f5ed06cc5b898406a7d767bf..ec43bdc516dc399f69df6639f950ecc5b325bde3 100644
|
2020-03-06 04:20:07 +03:00
|
|
|
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
|
|
|
|
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1090,9 +1090,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) {
|
2020-04-01 03:32:50 +03:00
|
|
|
diff --git a/security/manager/ssl/SSLServerCertVerification.cpp b/security/manager/ssl/SSLServerCertVerification.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index d8cb518aaabe82869c2a9aa3b7a0695ccef0177d..78a131b9ff59435a98ee5ea14087b69d074dadec 100644
|
2020-04-01 03:32:50 +03:00
|
|
|
--- a/security/manager/ssl/SSLServerCertVerification.cpp
|
|
|
|
+++ b/security/manager/ssl/SSLServerCertVerification.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1187,8 +1187,8 @@ PRErrorCode AuthCertificateParseResults(
|
2020-04-01 03:32:50 +03:00
|
|
|
return SEC_ERROR_NO_MEMORY;
|
|
|
|
}
|
|
|
|
nsresult rv = overrideService->HasMatchingOverride(
|
|
|
|
- aHostName, aPort, nssCert, &overrideBits, &isTemporaryOverride,
|
|
|
|
- &haveOverride);
|
|
|
|
+ aHostName, aPort, aOriginAttributes.mUserContextId, nssCert,
|
|
|
|
+ &overrideBits, &isTemporaryOverride, &haveOverride);
|
|
|
|
if (NS_SUCCEEDED(rv) && haveOverride) {
|
|
|
|
// remove the errors that are already overriden
|
|
|
|
remainingDisplayErrors &= ~overrideBits;
|
2020-03-06 04:20:07 +03:00
|
|
|
diff --git a/security/manager/ssl/nsCertOverrideService.cpp b/security/manager/ssl/nsCertOverrideService.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index 2f98ba7a4c8e4bfe573fd4cffeb041b16e183add..0be3f0ddc4e27d1be3aaadb9fef4da2c26cc5d7e 100644
|
2020-03-06 04:20:07 +03:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.cpp
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -462,13 +462,20 @@ nsCertOverrideService::RememberTemporaryValidityOverrideUsingFingerprint(
|
2020-04-01 03:32:50 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCertOverrideService::HasMatchingOverride(const nsACString& aHostName,
|
|
|
|
- int32_t aPort, nsIX509Cert* aCert,
|
|
|
|
+ int32_t aPort,
|
|
|
|
+ uint32_t aUserContextId,
|
|
|
|
+ nsIX509Cert* aCert,
|
|
|
|
uint32_t* aOverrideBits,
|
|
|
|
bool* aIsTemporary, bool* _retval) {
|
|
|
|
bool disableAllSecurityCheck = false;
|
|
|
|
{
|
|
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
- disableAllSecurityCheck = mDisableAllSecurityCheck;
|
|
|
|
+ if (aUserContextId) {
|
|
|
|
+ disableAllSecurityCheck = mUserContextIdsWithDisabledSecurityChecks.has(
|
|
|
|
+ aUserContextId);
|
|
|
|
+ } else {
|
|
|
|
+ disableAllSecurityCheck = mDisableAllSecurityCheck;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
if (disableAllSecurityCheck) {
|
|
|
|
nsCertOverride::OverrideBits all = nsCertOverride::OverrideBits::Untrusted |
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -681,12 +688,21 @@ 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;
|
|
|
|
}
|
|
|
|
|
2020-04-01 03:32:50 +03:00
|
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
+ if (aUserContextId) {
|
|
|
|
+ if (aDisable) {
|
|
|
|
+ mozilla::Unused << mUserContextIdsWithDisabledSecurityChecks.put(aUserContextId);
|
|
|
|
+ } else {
|
|
|
|
+ mUserContextIdsWithDisabledSecurityChecks.remove(aUserContextId);
|
|
|
|
+ }
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
mDisableAllSecurityCheck = aDisable;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
diff --git a/security/manager/ssl/nsCertOverrideService.h b/security/manager/ssl/nsCertOverrideService.h
|
2020-08-12 20:09:20 +03:00
|
|
|
index a1611a28c960eef7ce9c4edc1bbc67c3f590849b..5c471f69964da9aba678e6f65fd71bdc502e2158 100644
|
2020-04-01 03:32:50 +03:00
|
|
|
--- a/security/manager/ssl/nsCertOverrideService.h
|
|
|
|
+++ b/security/manager/ssl/nsCertOverrideService.h
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -128,6 +128,7 @@ class nsCertOverrideService final : public nsICertOverrideService,
|
2020-04-01 03:32:50 +03:00
|
|
|
~nsCertOverrideService();
|
|
|
|
|
|
|
|
bool mDisableAllSecurityCheck;
|
|
|
|
+ mozilla::HashSet<uint32_t> mUserContextIdsWithDisabledSecurityChecks;
|
|
|
|
mozilla::Mutex mMutex;
|
|
|
|
nsCOMPtr<nsIFile> mSettingsFile;
|
|
|
|
nsTHashtable<nsCertOverrideEntry> mSettingsTable;
|
|
|
|
diff --git a/security/manager/ssl/nsICertOverrideService.idl b/security/manager/ssl/nsICertOverrideService.idl
|
|
|
|
index 6f0f8259b309c0a299c9c80b2943a498b0f1b0e6..03d17899be96bc87dc78f06277e1bd9eb93d08f8 100644
|
|
|
|
--- a/security/manager/ssl/nsICertOverrideService.idl
|
|
|
|
+++ b/security/manager/ssl/nsICertOverrideService.idl
|
|
|
|
@@ -98,6 +98,7 @@ interface nsICertOverrideService : nsISupports {
|
|
|
|
[must_use]
|
|
|
|
boolean hasMatchingOverride(in AUTF8String aHostName,
|
|
|
|
in int32_t aPort,
|
|
|
|
+ in uint32_t aUserContextId,
|
|
|
|
in nsIX509Cert aCert,
|
|
|
|
out uint32_t aOverrideBits,
|
|
|
|
out boolean aIsTemporary);
|
|
|
|
@@ -137,5 +138,7 @@ interface nsICertOverrideService : nsISupports {
|
|
|
|
* @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);
|
|
|
|
};
|
2020-03-23 09:52:59 +03:00
|
|
|
diff --git a/services/settings/Utils.jsm b/services/settings/Utils.jsm
|
2020-08-12 20:09:20 +03:00
|
|
|
index 66df8509044600a0d71eb36bb838f96087a53ef1..e4558874434e3aa57bc26344f0ca89b3ebb837bf 100644
|
2020-03-23 09:52:59 +03:00
|
|
|
--- a/services/settings/Utils.jsm
|
|
|
|
+++ b/services/settings/Utils.jsm
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -59,7 +59,7 @@ var Utils = {
|
2020-03-23 09:52:59 +03:00
|
|
|
Ci.nsIEnvironment
|
|
|
|
);
|
|
|
|
const isXpcshell = env.exists("XPCSHELL_TEST_PROFILE_DIR");
|
|
|
|
- return AppConstants.RELEASE_OR_BETA && !Cu.isInAutomation && !isXpcshell
|
|
|
|
+ return false && !Cu.isInAutomation && !isXpcshell
|
|
|
|
? "https://firefox.settings.services.mozilla.com/v1"
|
|
|
|
: gServerURL;
|
|
|
|
},
|
2020-03-25 06:51:21 +03:00
|
|
|
diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index 4eebb0e55ab3622e8f1f55655ef096d919e0ecb1..fb0e29281393f9c68d14a6549d3a9988569b0366 100644
|
2020-03-25 06:51:21 +03:00
|
|
|
--- a/toolkit/components/startup/nsAppStartup.cpp
|
|
|
|
+++ b/toolkit/components/startup/nsAppStartup.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -340,7 +340,7 @@ nsAppStartup::Quit(uint32_t aMode, 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
|
2020-08-12 20:09:20 +03:00
|
|
|
index 318037b12e9ea7b8bad92498950ac48ff936fb3c..44db941025a5253da38572600cd0fc57f54ee6bf 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
|
|
|
|
+++ b/toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -162,8 +162,16 @@ nsBrowserStatusFilter::OnStateChange(nsIWebProgress* aWebProgress,
|
2019-11-19 05:18:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
-nsBrowserStatusFilter::OnProgressChange(nsIWebProgress* aWebProgress,
|
|
|
|
- nsIRequest* aRequest,
|
|
|
|
+nsBrowserStatusFilter::OnFrameLocationChange(nsIWebProgress *aWebProgress,
|
|
|
|
+ nsIRequest *aRequest,
|
|
|
|
+ nsIURI *aLocation,
|
|
|
|
+ uint32_t aFlags) {
|
|
|
|
+ return NS_OK;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+NS_IMETHODIMP
|
|
|
|
+nsBrowserStatusFilter::OnProgressChange(nsIWebProgress *aWebProgress,
|
|
|
|
+ nsIRequest *aRequest,
|
|
|
|
int32_t aCurSelfProgress,
|
|
|
|
int32_t aMaxSelfProgress,
|
|
|
|
int32_t aCurTotalProgress,
|
2020-03-23 09:52:59 +03:00
|
|
|
diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/UpdateService.jsm
|
2020-08-12 20:09:20 +03:00
|
|
|
index 32a9ac1478a20ecfcf5c5fa1cefe8468b122b895..3aaa78c4558019c9d1d76b3c4204beae45f7b70c 100644
|
2020-03-23 09:52:59 +03:00
|
|
|
--- a/toolkit/mozapps/update/UpdateService.jsm
|
|
|
|
+++ b/toolkit/mozapps/update/UpdateService.jsm
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -3077,7 +3077,7 @@ UpdateService.prototype = {
|
2020-03-23 09:52:59 +03:00
|
|
|
).running;
|
|
|
|
}
|
|
|
|
|
|
|
|
- return (
|
|
|
|
+ return true || (
|
|
|
|
(Cu.isInAutomation || marionetteRunning) &&
|
|
|
|
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
|
2020-06-10 08:48:10 +03:00
|
|
|
index d092b8b223464ce9218272c81e75a77d38730dbb..bf80011e2cd59bd58b4f23788a56756d04b58a35 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/toolkit/toolkit.mozbuild
|
|
|
|
+++ b/toolkit/toolkit.mozbuild
|
2020-06-10 08:48:10 +03:00
|
|
|
@@ -167,6 +167,7 @@ if CONFIG['ENABLE_MARIONETTE']:
|
2019-11-19 05:18:28 +03:00
|
|
|
DIRS += [
|
|
|
|
'/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',
|
|
|
|
]
|
|
|
|
|
|
|
|
diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index 068fdf850be4b8f7db04262c78a52d287fa29099..bfd12761580e1771f45c048de89a346f7ed493a7 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/uriloader/base/nsDocLoader.cpp
|
|
|
|
+++ b/uriloader/base/nsDocLoader.cpp
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -789,6 +789,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-08-12 20:09:20 +03:00
|
|
|
@@ -1349,6 +1356,24 @@ void nsDocLoader::FireOnLocationChange(nsIWebProgress* aWebProgress,
|
2019-11-19 05:18:28 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+void nsDocLoader::FireOnFrameLocationChange(nsIWebProgress* aWebProgress,
|
|
|
|
+ nsIRequest* aRequest,
|
|
|
|
+ nsIURI *aUri,
|
|
|
|
+ uint32_t aFlags) {
|
|
|
|
+ NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_FRAME_LOCATION,
|
|
|
|
+ nsCOMPtr<nsIWebProgressListener2> listener2 =
|
|
|
|
+ do_QueryReferent(info.mWeakListener);
|
|
|
|
+ if (!listener2)
|
|
|
|
+ continue;
|
|
|
|
+ listener2->OnFrameLocationChange(aWebProgress, aRequest, aUri, aFlags);
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // Pass the notification up to the parent...
|
|
|
|
+ if (mParent) {
|
|
|
|
+ mParent->FireOnFrameLocationChange(aWebProgress, aRequest, aUri, aFlags);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void nsDocLoader::FireOnStatusChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest, nsresult aStatus,
|
|
|
|
const char16_t* aMessage) {
|
|
|
|
diff --git a/uriloader/base/nsDocLoader.h b/uriloader/base/nsDocLoader.h
|
2020-08-06 20:32:50 +03:00
|
|
|
index 0994d81476b242d59f235da2e84aea1bf8b1df86..be6dc9faa29183d4709ee92f75d015e917dd5435 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/uriloader/base/nsDocLoader.h
|
|
|
|
+++ b/uriloader/base/nsDocLoader.h
|
2020-06-10 08:48:10 +03:00
|
|
|
@@ -209,6 +209,11 @@ class nsDocLoader : public nsIDocumentLoader,
|
2020-05-08 04:37:15 +03:00
|
|
|
nsIURI* aURI, int32_t aDelay,
|
|
|
|
bool aSameURI);
|
2019-11-19 05:18:28 +03:00
|
|
|
|
|
|
|
+ void FireOnFrameLocationChange(nsIWebProgress* aWebProgress,
|
|
|
|
+ nsIRequest* aRequest,
|
|
|
|
+ nsIURI *aUri,
|
|
|
|
+ uint32_t aFlags);
|
|
|
|
+
|
2020-05-08 04:37:15 +03:00
|
|
|
// this function is overridden by the docshell, it is provided so that we
|
|
|
|
// can pass more information about redirect state (the normal OnStateChange
|
|
|
|
// doesn't get the new channel).
|
2019-11-19 05:18:28 +03:00
|
|
|
diff --git a/uriloader/base/nsIWebProgress.idl b/uriloader/base/nsIWebProgress.idl
|
2020-08-12 20:09:20 +03:00
|
|
|
index 70079adfff8a1b625ffd5aad5572c960cec5b646..5822ca46fb4022b0b31288f5492fcb4a2ac9baa1 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/uriloader/base/nsIWebProgress.idl
|
|
|
|
+++ b/uriloader/base/nsIWebProgress.idl
|
|
|
|
@@ -87,6 +87,10 @@ interface nsIWebProgress : nsISupports
|
|
|
|
* NOTIFY_REFRESH
|
|
|
|
* Receive onRefreshAttempted events.
|
|
|
|
* This is defined on nsIWebProgressListener2.
|
|
|
|
+ *
|
|
|
|
+ * NOTIFY_FRAME_LOCATION
|
|
|
|
+ * Receive onFrameLocationChange events.
|
|
|
|
+ * This is defined on nsIWebProgressListener2.
|
|
|
|
*/
|
|
|
|
const unsigned long NOTIFY_PROGRESS = 0x00000010;
|
|
|
|
const unsigned long NOTIFY_STATUS = 0x00000020;
|
|
|
|
@@ -94,11 +98,12 @@ interface nsIWebProgress : nsISupports
|
|
|
|
const unsigned long NOTIFY_LOCATION = 0x00000080;
|
|
|
|
const unsigned long NOTIFY_REFRESH = 0x00000100;
|
|
|
|
const unsigned long NOTIFY_CONTENT_BLOCKING = 0x00000200;
|
|
|
|
+ const unsigned long NOTIFY_FRAME_LOCATION = 0x00000400;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This flag enables all notifications.
|
|
|
|
*/
|
|
|
|
- const unsigned long NOTIFY_ALL = 0x000003ff;
|
|
|
|
+ const unsigned long NOTIFY_ALL = 0x000007ff;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers a listener to receive web progress events.
|
|
|
|
diff --git a/uriloader/base/nsIWebProgressListener2.idl b/uriloader/base/nsIWebProgressListener2.idl
|
2019-12-17 03:17:56 +03:00
|
|
|
index 87701f8d2cfee8bd84acd28c62b3be4989c9474c..ae1aa85c019cb21d4f7e79c35e8afe72709468a1 100644
|
2019-11-19 05:18:28 +03:00
|
|
|
--- a/uriloader/base/nsIWebProgressListener2.idl
|
|
|
|
+++ b/uriloader/base/nsIWebProgressListener2.idl
|
|
|
|
@@ -66,4 +66,27 @@ interface nsIWebProgressListener2 : nsIWebProgressListener {
|
|
|
|
in nsIURI aRefreshURI,
|
|
|
|
in long aMillis,
|
|
|
|
in boolean aSameURI);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Called when the location of the window or its subframes changes. This is not
|
|
|
|
+ * when a load is requested, but rather once it is verified that the load is
|
|
|
|
+ * going to occur in the given window. For instance, a load that starts in a
|
|
|
|
+ * window might send progress and status messages for the new site, but it
|
|
|
|
+ * will not send the onLocationChange until we are sure that we are loading
|
|
|
|
+ * this new page here.
|
|
|
|
+ *
|
|
|
|
+ * @param aWebProgress
|
|
|
|
+ * The nsIWebProgress instance that fired the notification.
|
|
|
|
+ * @param aRequest
|
|
|
|
+ * The associated nsIRequest. This may be null in some cases.
|
|
|
|
+ * @param aLocation
|
|
|
|
+ * The URI of the location that is being loaded.
|
|
|
|
+ * @param aFlags
|
|
|
|
+ * This is a value which explains the situation or the reason why
|
|
|
|
+ * the location has changed.
|
|
|
|
+ */
|
|
|
|
+ void onFrameLocationChange(in nsIWebProgress aWebProgress,
|
|
|
|
+ in nsIRequest aRequest,
|
|
|
|
+ in nsIURI aLocation,
|
|
|
|
+ [optional] in unsigned long aFlags);
|
|
|
|
};
|
2020-04-07 09:34:30 +03:00
|
|
|
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
|
2020-08-12 20:09:20 +03:00
|
|
|
index 0ef1af1ffef7c54d7236537f8de122a6b26b363e..c9dfbf280aeea8ed432a6483cba0675f09f3965a 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"
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -842,6 +843,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);
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1474,7 +1481,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);
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1643,7 +1655,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;
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -1689,6 +1730,11 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
|
|
|
|
|
|
|
bool alwaysAsk = true;
|
2020-04-07 09:34:30 +03:00
|
|
|
mMimeInfo->GetAlwaysAskBeforeHandling(&alwaysAsk);
|
|
|
|
+
|
|
|
|
+ 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
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2096,6 +2142,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;
|
|
|
|
}
|
|
|
|
|
2020-08-12 20:09:20 +03:00
|
|
|
@@ -2475,6 +2531,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
|
2020-08-06 20:32:50 +03:00
|
|
|
index f2bd67f64ccdb8971ec1d159dd7742a976cec218..074f3dc9e0441a3b9af32beaa72ca2a490f2f03d 100644
|
2020-04-07 09:34:30 +03:00
|
|
|
--- a/uriloader/exthandler/nsExternalHelperAppService.h
|
|
|
|
+++ b/uriloader/exthandler/nsExternalHelperAppService.h
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -191,6 +191,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;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-08-06 20:32:50 +03:00
|
|
|
@@ -373,6 +375,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
|
2020-06-10 08:48:10 +03:00
|
|
|
index ea8b9b08f3e6f6e99b8a4fa3fa427beb8c5f5945..a7ec2bd3afe53d500f0cd8f800223ee291340c18 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-04-24 00:26:00 +03:00
|
|
|
@@ -20,6 +22,17 @@ webidl BrowsingContext;
|
2020-04-07 09:34:30 +03:00
|
|
|
class nsExternalAppHandler;
|
|
|
|
%}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 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-06-10 08:48:10 +03:00
|
|
|
@@ -48,7 +61,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-06-10 08:48:10 +03:00
|
|
|
@@ -81,6 +94,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
|
2020-08-06 20:32:50 +03:00
|
|
|
index 38b94ac0b4bc259c3c18c7e2a73c59945828b284..64cf4f20439c6d111215551716edbf690270b2db 100644
|
2020-07-15 19:37:08 +03:00
|
|
|
--- a/widget/InProcessCompositorWidget.cpp
|
|
|
|
+++ b/widget/InProcessCompositorWidget.cpp
|
|
|
|
@@ -4,6 +4,8 @@
|
|
|
|
|
|
|
|
#include "InProcessCompositorWidget.h"
|
|
|
|
|
|
|
|
+#include "HeadlessCompositorWidget.h"
|
|
|
|
+#include "HeadlessWidget.h"
|
|
|
|
#include "mozilla/VsyncDispatcher.h"
|
|
|
|
#include "nsBaseWidget.h"
|
|
|
|
|
|
|
|
@@ -22,6 +24,12 @@ RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
|
|
|
|
const CompositorWidgetInitData& aInitData,
|
|
|
|
const layers::CompositorOptions& aOptions, nsIWidget* aWidget) {
|
|
|
|
MOZ_ASSERT(aWidget);
|
|
|
|
+ if (aInitData.type() ==
|
|
|
|
+ CompositorWidgetInitData::THeadlessCompositorWidgetInitData) {
|
|
|
|
+ return new HeadlessCompositorWidget(
|
|
|
|
+ aInitData.get_HeadlessCompositorWidgetInitData(), aOptions,
|
|
|
|
+ static_cast<HeadlessWidget*>(aWidget));
|
|
|
|
+ }
|
|
|
|
# ifdef MOZ_WIDGET_ANDROID
|
|
|
|
return new AndroidCompositorWidget(aOptions,
|
|
|
|
static_cast<nsBaseWidget*>(aWidget));
|
2020-07-14 21:20:36 +03:00
|
|
|
diff --git a/widget/headless/HeadlessCompositorWidget.cpp b/widget/headless/HeadlessCompositorWidget.cpp
|
2020-08-05 03:58:57 +03:00
|
|
|
index b31a969b7ab3d0fc80912b110d91dfdf3e5991f4..45456bd34713a32695c0fe6a84588f31e40c137d 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"
|
2020-08-05 03:58:57 +03:00
|
|
|
@@ -17,6 +18,32 @@ 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(
|
|
|
|
+ LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
|
|
|
|
+ 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()) {
|
2020-08-05 03:58:57 +03:00
|
|
|
@@ -29,6 +56,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
|
2020-08-05 03:58:57 +03:00
|
|
|
index 7f91de9e67d7ffa02de3eef1d760e5cfd05e7ad6..b0e3572413f80e5bd125f777c3247b10b8521a73 100644
|
2020-07-14 21:20:36 +03:00
|
|
|
--- a/widget/headless/HeadlessCompositorWidget.h
|
|
|
|
+++ b/widget/headless/HeadlessCompositorWidget.h
|
2020-07-15 19:37:08 +03:00
|
|
|
@@ -23,9 +23,13 @@ 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(
|
|
|
|
+ LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) override;
|
|
|
|
+
|
|
|
|
uintptr_t GetWidgetKey() override;
|
|
|
|
|
|
|
|
LayoutDeviceIntSize GetClientSize() 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
|
2020-08-06 20:32:50 +03:00
|
|
|
index f4f3acda7e645bf3c97b4bdd50eed6b429a7e74a..c1bbd3e07397b7b341538f78e18db987ae0d244e 100644
|
2020-07-14 21:20:36 +03:00
|
|
|
--- a/widget/headless/HeadlessWidget.cpp
|
|
|
|
+++ b/widget/headless/HeadlessWidget.cpp
|
2020-07-15 19:37:08 +03:00
|
|
|
@@ -104,6 +104,8 @@ void HeadlessWidget::Destroy() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ SetSnapshotListener(nullptr);
|
|
|
|
+
|
|
|
|
nsBaseWidget::OnDestroy();
|
|
|
|
|
|
|
|
nsBaseWidget::Destroy();
|
2020-08-05 03:38:46 +03:00
|
|
|
@@ -499,5 +501,14 @@ nsresult HeadlessWidget::SynthesizeNativeTouchPoint(
|
2020-07-14 21:20:36 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
+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
|
|
|
|
index c375629d4a954f872a2abdd6983ae38dbb98f4ca..1857a4874ac9f8a3d7e402b5707a9ea58f241eb9 100644
|
|
|
|
--- a/widget/headless/HeadlessWidget.h
|
|
|
|
+++ b/widget/headless/HeadlessWidget.h
|
|
|
|
@@ -153,6 +153,9 @@ class HeadlessWidget : public nsBaseWidget {
|
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override;
|
|
|
|
|
|
|
|
+ using SnapshotListener = std::function<void(RefPtr<gfx::DataSourceSurface>&&)>;
|
|
|
|
+ void SetSnapshotListener(SnapshotListener&& listener);
|
|
|
|
+
|
|
|
|
private:
|
|
|
|
~HeadlessWidget();
|
|
|
|
bool mEnabled;
|