mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1626362 - Move nsDocShell::mUserErrorPages to BrowsingContext. r=nika
This is only used by Thunderbird, and is always true for Firefox. I've made CanSet only allow the embedder process, which is the desired behaviour, and should work for non-e10s. Differential Revision: https://phabricator.services.mozilla.com/D80109
This commit is contained in:
parent
19c4b43cba
commit
f0b769ce30
@ -321,6 +321,8 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
|
||||
inherit ? inherit->GetUseGlobalHistory() : false;
|
||||
context->mFields.SetWithoutSyncing<IDX_UseGlobalHistory>(useGlobalHistory);
|
||||
|
||||
context->mFields.SetWithoutSyncing<IDX_UseErrorPages>(true);
|
||||
|
||||
nsCOMPtr<nsIRequestContextService> rcsvc =
|
||||
net::RequestContextService::GetOrCreate();
|
||||
if (rcsvc) {
|
||||
@ -2076,6 +2078,12 @@ bool BrowsingContext::CanSet(FieldIndex<IDX_FullscreenAllowedByOwner>,
|
||||
return CheckOnlyEmbedderCanSet(aSource);
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_UseErrorPages>,
|
||||
const bool& aUseErrorPages,
|
||||
ContentParent* aSource) {
|
||||
return CheckOnlyEmbedderCanSet(aSource);
|
||||
}
|
||||
|
||||
// We map `watchedByDevTools` WebIDL attribute to `watchedByDevToolsInternal`
|
||||
// BC field. And we map it to the top level BrowsingContext.
|
||||
bool BrowsingContext::WatchedByDevTools() {
|
||||
|
@ -147,7 +147,8 @@ class WindowProxyHolder;
|
||||
/* Signals that session history is enabled for this browsing context tree. \
|
||||
* This is only ever set to true on the top BC, so consumers need to get \
|
||||
* the value from the top BC! */ \
|
||||
FIELD(HasSessionHistory, bool)
|
||||
FIELD(HasSessionHistory, bool) \
|
||||
FIELD(UseErrorPages, bool)
|
||||
|
||||
// BrowsingContext, in this context, is the cross process replicated
|
||||
// environment in which information about documents is stored. In
|
||||
@ -786,6 +787,9 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
||||
bool CanSet(FieldIndex<IDX_BrowserId>, const uint32_t& aValue,
|
||||
ContentParent* aSource);
|
||||
|
||||
bool CanSet(FieldIndex<IDX_UseErrorPages>, const bool& aUseErrorPages,
|
||||
ContentParent* aSource);
|
||||
|
||||
template <size_t I, typename T>
|
||||
bool CanSet(FieldIndex<I>, const T&, ContentParent*) {
|
||||
return true;
|
||||
|
@ -377,7 +377,6 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
|
||||
mAllowMedia(true),
|
||||
mAllowDNSPrefetch(true),
|
||||
mAllowWindowControl(true),
|
||||
mUseErrorPages(true),
|
||||
mCSSErrorReportingEnabled(false),
|
||||
mAllowAuth(mItemType == typeContent),
|
||||
mAllowKeywordFixup(false),
|
||||
@ -1866,13 +1865,13 @@ already_AddRefed<nsILoadURIDelegate> nsDocShell::GetLoadURIDelegate() {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetUseErrorPages(bool* aUseErrorPages) {
|
||||
*aUseErrorPages = mUseErrorPages;
|
||||
*aUseErrorPages = mBrowsingContext->GetUseErrorPages();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetUseErrorPages(bool aUseErrorPages) {
|
||||
mUseErrorPages = aUseErrorPages;
|
||||
mBrowsingContext->SetUseErrorPages(aUseErrorPages);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3606,7 +3605,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
||||
error = "nssFailure2";
|
||||
}
|
||||
|
||||
if (mUseErrorPages) {
|
||||
if (mBrowsingContext->GetUseErrorPages()) {
|
||||
// Display an error page
|
||||
nsresult loadedPage =
|
||||
LoadErrorPage(aURI, aURL, errorPage.get(), error, messageStr.get(),
|
||||
@ -6086,7 +6085,8 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
!GetExtantDocument() || GetExtantDocument()->IsInitialDocument();
|
||||
bool skippedUnknownProtocolNavigation = false;
|
||||
aStatus = FilterStatusForErrorPage(aStatus, aChannel, mLoadType, isTopFrame,
|
||||
mUseErrorPages, isInitialDocument,
|
||||
mBrowsingContext->GetUseErrorPages(),
|
||||
isInitialDocument,
|
||||
&skippedUnknownProtocolNavigation);
|
||||
if (NS_FAILED(aStatus)) {
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
|
@ -1184,7 +1184,6 @@ class nsDocShell final : public nsDocLoader,
|
||||
bool mAllowMedia : 1;
|
||||
bool mAllowDNSPrefetch : 1;
|
||||
bool mAllowWindowControl : 1;
|
||||
bool mUseErrorPages : 1;
|
||||
bool mCSSErrorReportingEnabled : 1;
|
||||
bool mAllowAuth : 1;
|
||||
bool mAllowKeywordFixup : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user