mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
browser(firefox): force always active docshell (#4363)
This forces active docshell for all content processes. References #4208
This commit is contained in:
parent
49e4d9a347
commit
c522a0dfba
@ -1,2 +1,2 @@
|
|||||||
1202
|
1203
|
||||||
Changed: yurys@chromium.org Thu Nov 5 20:30:30 GMTST 2020
|
Changed: lushnikov@chromium.org Thu Nov 5 17:39:41 PST 2020
|
||||||
|
@ -92,6 +92,7 @@ function initialize() {
|
|||||||
|
|
||||||
// Enforce focused state for all top level documents.
|
// Enforce focused state for all top level documents.
|
||||||
docShell.overrideHasFocus = true;
|
docShell.overrideHasFocus = true;
|
||||||
|
docShell.forceActiveState = true;
|
||||||
frameTree = new FrameTree(docShell);
|
frameTree = new FrameTree(docShell);
|
||||||
for (const [name, value] of Object.entries(settings)) {
|
for (const [name, value] of Object.entries(settings)) {
|
||||||
if (value !== undefined)
|
if (value !== undefined)
|
||||||
|
@ -178,7 +178,7 @@ index 040c7b124dec6bb254563bbe74fe50012cb077a3..b4e6b8132786af70e8ad0dce88b67c28
|
|||||||
const transportProvider = {
|
const transportProvider = {
|
||||||
setListener(upgradeListener) {
|
setListener(upgradeListener) {
|
||||||
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
|
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
|
||||||
index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336a1baf2e4 100644
|
index 665db419cb4909d34cdd3963d922aed12cf2c8ac..feadde48633ee78a5910c776d34d42864bf0e682 100644
|
||||||
--- a/docshell/base/nsDocShell.cpp
|
--- a/docshell/base/nsDocShell.cpp
|
||||||
+++ b/docshell/base/nsDocShell.cpp
|
+++ b/docshell/base/nsDocShell.cpp
|
||||||
@@ -15,6 +15,12 @@
|
@@ -15,6 +15,12 @@
|
||||||
@ -226,19 +226,20 @@ index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336
|
|||||||
#include "nsNetCID.h"
|
#include "nsNetCID.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsObjectLoadingContent.h"
|
#include "nsObjectLoadingContent.h"
|
||||||
@@ -391,6 +401,11 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
|
@@ -391,6 +401,12 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
|
||||||
mAllowDNSPrefetch(true),
|
mAllowDNSPrefetch(true),
|
||||||
mAllowWindowControl(true),
|
mAllowWindowControl(true),
|
||||||
mCSSErrorReportingEnabled(false),
|
mCSSErrorReportingEnabled(false),
|
||||||
+ mFileInputInterceptionEnabled(false),
|
+ mFileInputInterceptionEnabled(false),
|
||||||
+ mOverrideHasFocus(false),
|
+ mOverrideHasFocus(false),
|
||||||
+ mBypassCSPEnabled(false),
|
+ mBypassCSPEnabled(false),
|
||||||
|
+ mForceActiveState(false),
|
||||||
+ mOnlineOverride(nsIDocShell::ONLINE_OVERRIDE_NONE),
|
+ mOnlineOverride(nsIDocShell::ONLINE_OVERRIDE_NONE),
|
||||||
+ mColorSchemeOverride(COLOR_SCHEME_OVERRIDE_NONE),
|
+ mColorSchemeOverride(COLOR_SCHEME_OVERRIDE_NONE),
|
||||||
mAllowAuth(mItemType == typeContent),
|
mAllowAuth(mItemType == typeContent),
|
||||||
mAllowKeywordFixup(false),
|
mAllowKeywordFixup(false),
|
||||||
mIsOffScreenBrowser(false),
|
mIsOffScreenBrowser(false),
|
||||||
@@ -1418,6 +1433,7 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
|
@@ -1418,6 +1434,7 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +247,7 @@ index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336
|
|||||||
if (!isSubFrame && !isRoot) {
|
if (!isSubFrame && !isRoot) {
|
||||||
/*
|
/*
|
||||||
* We don't want to send OnLocationChange notifications when
|
* We don't want to send OnLocationChange notifications when
|
||||||
@@ -3214,6 +3230,189 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
|
@@ -3214,6 +3231,204 @@ nsDocShell::GetMessageManager(ContentFrameMessageManager** aMessageManager) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +273,21 @@ index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336
|
|||||||
+ return NS_OK;
|
+ return NS_OK;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
+NS_IMETHODIMP
|
||||||
|
+nsDocShell::GetForceActiveState(bool* aEnabled) {
|
||||||
|
+ MOZ_ASSERT(aEnabled);
|
||||||
|
+ *aEnabled = mForceActiveState;
|
||||||
|
+ return NS_OK;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+NS_IMETHODIMP
|
||||||
|
+nsDocShell::SetForceActiveState(bool aEnabled) {
|
||||||
|
+ mForceActiveState = aEnabled;
|
||||||
|
+ if (aEnabled)
|
||||||
|
+ SetIsActive(true);
|
||||||
|
+ return NS_OK;
|
||||||
|
+}
|
||||||
|
+
|
||||||
+bool nsDocShell::IsBypassCSPEnabled() {
|
+bool nsDocShell::IsBypassCSPEnabled() {
|
||||||
+ return GetRootDocShell()->mBypassCSPEnabled;
|
+ return GetRootDocShell()->mBypassCSPEnabled;
|
||||||
+}
|
+}
|
||||||
@ -436,7 +452,17 @@ index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetIsNavigating(bool* aOut) {
|
nsDocShell::GetIsNavigating(bool* aOut) {
|
||||||
*aOut = mIsNavigating;
|
*aOut = mIsNavigating;
|
||||||
@@ -8526,6 +8725,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
|
@@ -4821,6 +5036,9 @@ nsDocShell::GetSuspendMediaWhenInactive(bool* aSuspendMediaWhenInactive) {
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocShell::SetIsActive(bool aIsActive) {
|
||||||
|
+ if (mForceActiveState && !aIsActive)
|
||||||
|
+ return NS_OK;
|
||||||
|
+
|
||||||
|
// Keep track ourselves.
|
||||||
|
// Changing the activeness on a discarded browsing context has no effect.
|
||||||
|
Unused << mBrowsingContext->SetIsActive(aIsActive);
|
||||||
|
@@ -8526,6 +8744,12 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
|
||||||
true, // aForceNoOpener
|
true, // aForceNoOpener
|
||||||
getter_AddRefs(newBC));
|
getter_AddRefs(newBC));
|
||||||
MOZ_ASSERT(!newBC);
|
MOZ_ASSERT(!newBC);
|
||||||
@ -449,7 +475,7 @@ index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12413,6 +12618,9 @@ class OnLinkClickEvent : public Runnable {
|
@@ -12413,6 +12637,9 @@ class OnLinkClickEvent : public Runnable {
|
||||||
mHandler->OnLinkClickSync(mContent, mLoadState, mNoOpenerImplied,
|
mHandler->OnLinkClickSync(mContent, mLoadState, mNoOpenerImplied,
|
||||||
mTriggeringPrincipal);
|
mTriggeringPrincipal);
|
||||||
}
|
}
|
||||||
@ -459,7 +485,7 @@ index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12498,6 +12706,8 @@ nsresult nsDocShell::OnLinkClick(
|
@@ -12498,6 +12725,8 @@ nsresult nsDocShell::OnLinkClick(
|
||||||
nsCOMPtr<nsIRunnable> ev =
|
nsCOMPtr<nsIRunnable> ev =
|
||||||
new OnLinkClickEvent(this, aContent, loadState, noOpenerImplied,
|
new OnLinkClickEvent(this, aContent, loadState, noOpenerImplied,
|
||||||
aIsTrusted, aTriggeringPrincipal);
|
aIsTrusted, aTriggeringPrincipal);
|
||||||
@ -469,7 +495,7 @@ index 665db419cb4909d34cdd3963d922aed12cf2c8ac..9323dade18a7780802275fa6fcebe336
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
|
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
|
||||||
index 0d3594f977ac28595f830cbc5e310a8af284d777..7e3222a0cafc3f38e335c9dc8654019a067a7a39 100644
|
index 0d3594f977ac28595f830cbc5e310a8af284d777..0149141757abef2787a09bba20d98714fd50d50d 100644
|
||||||
--- a/docshell/base/nsDocShell.h
|
--- a/docshell/base/nsDocShell.h
|
||||||
+++ b/docshell/base/nsDocShell.h
|
+++ b/docshell/base/nsDocShell.h
|
||||||
@@ -13,6 +13,7 @@
|
@@ -13,6 +13,7 @@
|
||||||
@ -513,13 +539,14 @@ index 0d3594f977ac28595f830cbc5e310a8af284d777..7e3222a0cafc3f38e335c9dc8654019a
|
|||||||
// Handles retrieval of subframe session history for nsDocShell::LoadURI. If a
|
// Handles retrieval of subframe session history for nsDocShell::LoadURI. If a
|
||||||
// load is requested in a subframe of the current DocShell, the subframe
|
// 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
|
// loadType may need to reflect the loadType of the parent document, or in
|
||||||
@@ -1264,6 +1277,14 @@ class nsDocShell final : public nsDocLoader,
|
@@ -1264,6 +1277,15 @@ class nsDocShell final : public nsDocLoader,
|
||||||
bool mAllowDNSPrefetch : 1;
|
bool mAllowDNSPrefetch : 1;
|
||||||
bool mAllowWindowControl : 1;
|
bool mAllowWindowControl : 1;
|
||||||
bool mCSSErrorReportingEnabled : 1;
|
bool mCSSErrorReportingEnabled : 1;
|
||||||
+ bool mFileInputInterceptionEnabled: 1;
|
+ bool mFileInputInterceptionEnabled: 1;
|
||||||
+ bool mOverrideHasFocus : 1;
|
+ bool mOverrideHasFocus : 1;
|
||||||
+ bool mBypassCSPEnabled : 1;
|
+ bool mBypassCSPEnabled : 1;
|
||||||
|
+ bool mForceActiveState : 1;
|
||||||
+ nsString mLanguageOverride;
|
+ nsString mLanguageOverride;
|
||||||
+ RefPtr<nsGeolocationService> mGeolocationServiceOverride;
|
+ RefPtr<nsGeolocationService> mGeolocationServiceOverride;
|
||||||
+ OnlineOverride mOnlineOverride;
|
+ OnlineOverride mOnlineOverride;
|
||||||
@ -529,7 +556,7 @@ index 0d3594f977ac28595f830cbc5e310a8af284d777..7e3222a0cafc3f38e335c9dc8654019a
|
|||||||
bool mAllowKeywordFixup : 1;
|
bool mAllowKeywordFixup : 1;
|
||||||
bool mIsOffScreenBrowser : 1;
|
bool mIsOffScreenBrowser : 1;
|
||||||
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
|
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
|
||||||
index 605de327047b338a0abde638e3b3a9fc5a617815..773511a4ae35b14262afeb3d005b437d30d96c0a 100644
|
index 605de327047b338a0abde638e3b3a9fc5a617815..4e16debccf367a72c07660fb92015c5fb5de9b34 100644
|
||||||
--- a/docshell/base/nsIDocShell.idl
|
--- a/docshell/base/nsIDocShell.idl
|
||||||
+++ b/docshell/base/nsIDocShell.idl
|
+++ b/docshell/base/nsIDocShell.idl
|
||||||
@@ -44,6 +44,7 @@ interface nsIURI;
|
@@ -44,6 +44,7 @@ interface nsIURI;
|
||||||
@ -540,7 +567,7 @@ index 605de327047b338a0abde638e3b3a9fc5a617815..773511a4ae35b14262afeb3d005b437d
|
|||||||
interface nsIDocShellLoadInfo;
|
interface nsIDocShellLoadInfo;
|
||||||
interface nsIEditor;
|
interface nsIEditor;
|
||||||
interface nsIEditingSession;
|
interface nsIEditingSession;
|
||||||
@@ -923,6 +924,33 @@ interface nsIDocShell : nsIDocShellTreeItem
|
@@ -923,6 +924,35 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
*/
|
*/
|
||||||
void synchronizeLayoutHistoryState();
|
void synchronizeLayoutHistoryState();
|
||||||
|
|
||||||
@ -550,6 +577,8 @@ index 605de327047b338a0abde638e3b3a9fc5a617815..773511a4ae35b14262afeb3d005b437d
|
|||||||
+
|
+
|
||||||
+ attribute boolean bypassCSPEnabled;
|
+ attribute boolean bypassCSPEnabled;
|
||||||
+
|
+
|
||||||
|
+ attribute boolean forceActiveState;
|
||||||
|
+
|
||||||
+ attribute AString languageOverride;
|
+ attribute AString languageOverride;
|
||||||
+
|
+
|
||||||
+ boolean overrideTimezone(in AString timezoneId);
|
+ boolean overrideTimezone(in AString timezoneId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user