Backed out changeset 318b85f85682 (bug 1401379)

This commit is contained in:
Sebastian Hengst 2017-10-02 19:57:00 +02:00
Родитель 64e4e39ab0
Коммит 7edab52dde
3 изменённых файлов: 5 добавлений и 28 удалений

Просмотреть файл

@ -828,7 +828,6 @@ nsDocShell::nsDocShell()
, mEODForCurrentDocument(false)
, mURIResultedInDocument(false)
, mIsBeingDestroyed(false)
, mScriptGlobalDead(false)
, mIsExecutingOnLoadHandler(false)
, mIsPrintingOrPP(false)
, mSavingOldViewer(false)
@ -5979,9 +5978,8 @@ nsDocShell::Destroy()
mParentWidget = nullptr;
mCurrentURI = nullptr;
if (mScriptGlobal && !mScriptGlobalDead) {
if (mScriptGlobal) {
mScriptGlobal->DetachFromDocShell();
mScriptGlobalDead = true;
}
if (mSessionHistory) {
@ -13625,12 +13623,6 @@ NS_IMETHODIMP
nsDocShell::EnsureScriptEnvironment()
{
if (mScriptGlobal) {
// If the script global is dead, we may still have it around but we don't
// want to expose it from methods such as GetInterface, as their consumers
// will expect a non-dead window.
if (mScriptGlobalDead) {
return NS_ERROR_NOT_AVAILABLE;
}
return NS_OK;
}

Просмотреть файл

@ -1051,10 +1051,7 @@ protected:
bool mEODForCurrentDocument : 1;
bool mURIResultedInDocument : 1;
// mIsBeingDestroyed is set while the nsDocShell itself is being torn down,
// while mScriptGlobalDead is set after mScriptGlobal is torn down.
bool mIsBeingDestroyed : 1;
bool mScriptGlobalDead : 1;
bool mIsExecutingOnLoadHandler : 1;

Просмотреть файл

@ -3861,7 +3861,7 @@ nsGlobalWindow::ConfirmDialogIfNeeded()
{
MOZ_ASSERT(IsOuterWindow());
NS_ENSURE_TRUE(!IsCleanedUp(), false);
NS_ENSURE_TRUE(mDocShell, false);
nsCOMPtr<nsIPromptService> promptSvc =
do_GetService("@mozilla.org/embedcomp/prompt-service;1");
@ -4766,12 +4766,6 @@ nsGlobalWindow::GetParentOuter()
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
// If we've been cleaned up, we shouldn't report that we have a parent
// anymore.
if (mCleanedUp) {
return nullptr;
}
if (!mDocShell) {
return nullptr;
}
@ -5115,7 +5109,7 @@ nsGlobalWindow::GetClosedOuter()
MOZ_RELEASE_ASSERT(IsOuterWindow());
// If someone called close(), or if we don't have a docshell, we're closed.
return mIsClosed || mCleanedUp;
return mIsClosed || !mDocShell;
}
bool
@ -5457,12 +5451,6 @@ nsGlobalWindow::GetSanitizedOpener(nsPIDOMWindowOuter* aOpener)
return nullptr;
}
// If we or the opener have been cleaned up we should report a null as our
// opener.
if (mCleanedUp || win->mCleanedUp) {
return nullptr;
}
// We don't want to reveal the opener if the opener is a mail window,
// because opener can be used to spoof the contents of a message (bug 105050).
// So, we look in the opener's root docshell to see if it's a mail window.
@ -9392,7 +9380,7 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
if (mCleanedUp || !mDocShell || IsInModalState() ||
if (!mDocShell || IsInModalState() ||
(IsFrame() && !mDocShell->GetIsMozBrowser())) {
// window.close() is called on a frame in a frameset, on a window
// that's already closed, or on a window for which there's
@ -9482,7 +9470,7 @@ nsGlobalWindow::ForceClose()
MOZ_ASSERT(IsOuterWindow());
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
if (IsFrame() || mCleanedUp) {
if (IsFrame() || !mDocShell) {
// This may be a frame in a frameset, or a window that's already closed.
// Ignore such calls.
return;