Bug 1546887 - If requesting window.closed during teardown, return true instead of throwing. r=peterv
authorMike Conley <mconley@mozilla.com>
Thu, 16 May 2019 12:34:57 +0000
changeset 474057 bf656a3314e93271eaa946c029648ba70aba1460
parent 474056 1ad490784e09e55189385096091ca8c1ae815bbb
child 474058 8b9b08b7c3ff7529044d7950a1fdd697209d50a9
push id36022
push userncsoregi@mozilla.com
push dateThu, 16 May 2019 21:55:16 +0000
treeherdermozilla-central@96802be91766 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1546887
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546887 - If requesting window.closed during teardown, return true instead of throwing. r=peterv Differential Revision: https://phabricator.services.mozilla.com/D30435
dom/base/nsGlobalWindowInner.cpp
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -2595,17 +2595,22 @@ BarProp* nsGlobalWindowInner::GetScrollb
   if (!mScrollbars) {
     mScrollbars = new ScrollbarsProp(this);
   }
 
   return mScrollbars;
 }
 
 bool nsGlobalWindowInner::GetClosed(ErrorResult& aError) {
-  FORWARD_TO_OUTER_OR_THROW(GetClosedOuter, (), aError, false);
+  // If we're called from JS (which is the only way we should be getting called
+  // here) and we reach this point, that means our JS global is the current
+  // target of the WindowProxy, which means that we are the "current inner"
+  // of our outer. So if FORWARD_TO_OUTER fails to forward, that means the
+  // outer is already torn down, which corresponds to the closed state.
+  FORWARD_TO_OUTER(GetClosedOuter, (), true);
 }
 
 nsDOMWindowList* nsGlobalWindowInner::GetFrames() {
   FORWARD_TO_OUTER(GetFrames, (), nullptr);
 }
 
 already_AddRefed<nsPIDOMWindowOuter> nsGlobalWindowInner::IndexedGetter(
     uint32_t aIndex) {