зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1583400: Make IsCurrentInnerWindow Fission-compatible. r=bzbarsky
IsCurrentInnerWindow() should only return true when we are the current inner of our BrowsingContext, which has a longer lifetime than individual GlobalWindowOuter instances. In particular, if our BrowsingContext has no GlobalWindowOuter hanging off it, that means that currently it's hosting an inner window from some other process and we are not the current inner. If it _does_ have a GlobalWindowOuter hanging off it, it's possible that this is not the same as our mOuterWindow, if the BrowsingContext navigated to a different site and then navigated back to our site. Therefore, we need to check that we are the current inner of whatever the BrowsingContext's current GlobalWindowOuter is, if it has one at all. Differential Revision: https://phabricator.services.mozilla.com/D48595 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8a440a3269
Коммит
bc437d3e44
|
@ -2548,6 +2548,26 @@ bool nsPIDOMWindowInner::HasOpenWebSockets() const {
|
|||
(mTopInnerWindow && mTopInnerWindow->mNumOfOpenWebSockets);
|
||||
}
|
||||
|
||||
bool nsPIDOMWindowInner::IsCurrentInnerWindow() const {
|
||||
auto* bc = GetBrowsingContext();
|
||||
MOZ_ASSERT(bc);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> outer;
|
||||
// When a BC is discarded, it stops returning outer windows altogether. That
|
||||
// doesn't work for this check, since we still want current inner window to be
|
||||
// treated as current after that point. Simply falling back to `mOuterWindow`
|
||||
// here isn't ideal, since it will start returning true for inner windows
|
||||
// which were current before a remoteness switch once a BrowsingContext has
|
||||
// been discarded, but it's not incorrect in a way which should cause
|
||||
// significant issues.
|
||||
if (!bc->IsDiscarded()) {
|
||||
outer = bc->GetDOMWindow();
|
||||
} else {
|
||||
outer = mOuterWindow;
|
||||
}
|
||||
return outer && outer->GetCurrentInnerWindow() == this;
|
||||
}
|
||||
|
||||
void nsPIDOMWindowInner::SetAudioCapture(bool aCapture) {
|
||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
if (service) {
|
||||
|
|
|
@ -158,13 +158,13 @@ class nsPIDOMWindowInner : public mozIDOMWindow {
|
|||
return static_cast<nsPIDOMWindowInner*>(aFrom);
|
||||
}
|
||||
|
||||
// Returns true if this object has an outer window and it is the current inner
|
||||
// window of that outer.
|
||||
inline bool IsCurrentInnerWindow() const;
|
||||
// Returns true if this object is the currently-active inner window for its
|
||||
// BrowsingContext.
|
||||
bool IsCurrentInnerWindow() const;
|
||||
|
||||
// Returns true if the document of this window is the active document. This
|
||||
// is not identical to IsCurrentInnerWindow() because document.open() will
|
||||
// keep the same document active but create a new window.
|
||||
// is identical to IsCurrentInnerWindow() now that document.open() no longer
|
||||
// creates new inner windows for the document it is called on.
|
||||
inline bool HasActiveDocument();
|
||||
|
||||
// Returns true if this window is the same as mTopInnerWindow
|
||||
|
|
|
@ -48,14 +48,8 @@ bool nsPIDOMWindowInner::IsHandlingResizeEvent() const {
|
|||
return mIsHandlingResizeEvent;
|
||||
}
|
||||
|
||||
bool nsPIDOMWindowInner::IsCurrentInnerWindow() const {
|
||||
return mOuterWindow && mOuterWindow->GetCurrentInnerWindow() == this;
|
||||
}
|
||||
|
||||
bool nsPIDOMWindowInner::HasActiveDocument() {
|
||||
return IsCurrentInnerWindow() ||
|
||||
(mOuterWindow && mOuterWindow->GetCurrentInnerWindow() &&
|
||||
mOuterWindow->GetCurrentInnerWindow()->GetDoc() == mDoc);
|
||||
return IsCurrentInnerWindow();
|
||||
}
|
||||
|
||||
bool nsPIDOMWindowInner::IsTopInnerWindow() const {
|
||||
|
|
|
@ -87,7 +87,6 @@ skip-if = toolkit == "android" && debug && !is_fennec
|
|||
[test_bug916945.html]
|
||||
[test_bug92773.html]
|
||||
[test_bug940783.html]
|
||||
fail-if = fission
|
||||
[test_bug965082.html]
|
||||
skip-if = fission && webrender && debug # Crashes intermittently: @ nsDocShell::SetParentWidget(nsIWidget*)
|
||||
[test_bug960820.html]
|
||||
|
|
Загрузка…
Ссылка в новой задаче