Bug 1510928 - Don't assert when setting opener to closed window. r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D13529

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Farre 2018-12-05 12:21:17 +00:00
Родитель e0ef65f04a
Коммит 1fc714c017
1 изменённых файлов: 10 добавлений и 3 удалений

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

@ -2226,9 +2226,16 @@ void nsGlobalWindowOuter::SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
NS_ASSERTION(mOpener || !aOpener, "Opener must support weak references!"); NS_ASSERTION(mOpener || !aOpener, "Opener must support weak references!");
if (mDocShell) { if (mDocShell) {
MOZ_DIAGNOSTIC_ASSERT(!aOriginalOpener || !aOpener || MOZ_DIAGNOSTIC_ASSERT(
aOpener->GetBrowsingContext() == !aOriginalOpener || !aOpener ||
GetBrowsingContext()->GetOpener()); // TODO(farre): Allowing to set a closed or closing window as
// opener is not ideal, since it won't have a docshell and
// therefore no browsing context. This means that we're
// effectively setting the browsing context opener to null and
// the window opener to a closed window. This needs to be
// cleaned up, see Bug 1511353.
nsGlobalWindowOuter::Cast(aOpener)->IsClosedOrClosing() ||
aOpener->GetBrowsingContext() == GetBrowsingContext()->GetOpener());
// TODO(farre): Here we really wish to only consider the case // TODO(farre): Here we really wish to only consider the case
// where 'aOriginalOpener'. See bug 1509016. // where 'aOriginalOpener'. See bug 1509016.
GetBrowsingContext()->SetOpener(aOpener ? aOpener->GetBrowsingContext() GetBrowsingContext()->SetOpener(aOpener ? aOpener->GetBrowsingContext()