зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1582716 - Remove nsDocShell::GetIsOnlyToplevelInTabGroup. r=nika
We can remove isOnlyToplevelInTabGroup entirely since we have BrowsingContext/BrowsingContextGroup exposed through chrome-webidl. Checking if a browsing context is the only top level (auxilliary or otherwise) is only a matter of checking that there isn't a parent, and that the size of the browsing context group is 1. Differential Revision: https://phabricator.services.mozilla.com/D46590 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c929efd7dc
Коммит
d2c1ccbf9e
|
@ -13464,35 +13464,6 @@ nsCommandManager* nsDocShell::GetCommandManager() {
|
|||
return mCommandManager;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsOnlyToplevelInTabGroup(bool* aResult) {
|
||||
MOZ_ASSERT(aResult);
|
||||
|
||||
nsPIDOMWindowOuter* outer = GetWindow();
|
||||
MOZ_ASSERT(outer);
|
||||
|
||||
// If we are not toplevel then we are not the only toplevel window in the
|
||||
// tab group.
|
||||
if (outer->GetInProcessScriptableParentOrNull()) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If we have any other toplevel windows in our tab group, then we are not
|
||||
// the only toplevel window in the tab group.
|
||||
nsTArray<nsPIDOMWindowOuter*> toplevelWindows =
|
||||
outer->TabGroup()->GetTopLevelWindows();
|
||||
if (toplevelWindows.Length() > 1) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
MOZ_ASSERT(toplevelWindows.Length() == 1);
|
||||
MOZ_ASSERT(toplevelWindows[0] == outer);
|
||||
|
||||
*aResult = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAwaitingLargeAlloc(bool* aResult) {
|
||||
MOZ_ASSERT(aResult);
|
||||
|
|
|
@ -1055,20 +1055,6 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
*/
|
||||
[infallible] attribute nsIDocShell_MetaViewportOverride metaViewportOverride;
|
||||
|
||||
/**
|
||||
* This value is `true` if its corresponding unit of related browsing contexts
|
||||
* (TabGroup) contains only 1 toplevel window, and that window is the outer
|
||||
* window corresponding to this docshell.
|
||||
*
|
||||
* The value is `false` otherwise. This is the case if the docshell is an
|
||||
* iframe, has window.opener set, or another window with window.opener
|
||||
* referring to this window exists.
|
||||
*
|
||||
* If this value is `false`, it would be web content visible for a load
|
||||
* occuring in this docshell to be performed within a different docshell.
|
||||
*/
|
||||
[infallible] readonly attribute boolean isOnlyToplevelInTabGroup;
|
||||
|
||||
/**
|
||||
* Returns `true` if this docshell was created due to a Large-Allocation
|
||||
* header, and has not seen the initiating load yet.
|
||||
|
|
|
@ -204,20 +204,6 @@ void TabGroup::MaybeDestroy() {
|
|||
}
|
||||
}
|
||||
|
||||
nsTArray<nsPIDOMWindowOuter*> TabGroup::GetTopLevelWindows() const {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsTArray<nsPIDOMWindowOuter*> array;
|
||||
|
||||
for (nsPIDOMWindowOuter* outerWindow : mWindows) {
|
||||
if (outerWindow->GetDocShell() &&
|
||||
!outerWindow->GetInProcessScriptableParentOrNull()) {
|
||||
array.AppendElement(outerWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
TabGroup::HashEntry::HashEntry(const nsACString* aKey)
|
||||
: nsCStringHashKey(aKey), mDocGroup(nullptr) {}
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ class TabGroup final : public SchedulerGroup,
|
|||
// Count with 'aActiveOnly' = true
|
||||
uint32_t Count(bool aActiveOnly = false) const;
|
||||
|
||||
nsTArray<nsPIDOMWindowOuter*> GetTopLevelWindows() const;
|
||||
const nsTArray<nsPIDOMWindowOuter*>& GetWindows() { return mWindows; }
|
||||
|
||||
// This method is always safe to call off the main thread. The nsIEventTarget
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/dom/BlobURLProtocolHandler.h"
|
||||
#include "mozilla/dom/BrowsingContext.h"
|
||||
#include "mozilla/dom/BrowsingContextGroup.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/CustomElementRegistry.h"
|
||||
|
@ -9243,7 +9245,11 @@ bool nsContentUtils::AttemptLargeAllocationLoad(nsIHttpChannel* aChannel) {
|
|||
}
|
||||
|
||||
nsIDocShell* docShell = outer->GetDocShell();
|
||||
if (!docShell->GetIsOnlyToplevelInTabGroup()) {
|
||||
BrowsingContext* browsingContext = docShell->GetBrowsingContext();
|
||||
bool isOnlyToplevelBrowsingContext =
|
||||
!browsingContext->GetParent() &&
|
||||
browsingContext->Group()->Toplevels().Length() == 1;
|
||||
if (!isOnlyToplevelBrowsingContext) {
|
||||
outer->SetLargeAllocStatus(LargeAllocStatus::NOT_ONLY_TOPLEVEL_IN_TABGROUP);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -659,11 +659,14 @@ var E10SUtils = {
|
|||
// to change processes, we want to load into a new process so that we can throw
|
||||
// this one out. We don't want to move into a new process if we have post data,
|
||||
// because we would accidentally throw out that data.
|
||||
let isOnlyToplevelBrowsingContext =
|
||||
!aDocShell.browsingContext.parent &&
|
||||
aDocShell.browsingContext.group.getToplevels().length == 1;
|
||||
if (
|
||||
!aHasPostData &&
|
||||
Services.appinfo.remoteType == LARGE_ALLOCATION_REMOTE_TYPE &&
|
||||
!aDocShell.awaitingLargeAlloc &&
|
||||
aDocShell.isOnlyToplevelInTabGroup
|
||||
isOnlyToplevelBrowsingContext
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче