Bug 860941 - Clarify shutdown invariants in ~nsGlobalWindow. r=jst

While the mArguments invariant should hold for _outers_, it doesn't necessarily
hold for inners, so this assertion fires reliably in automation. If mCleanedUp
is true then mArguments is definitely null, so let's disentangle this from
mArguments and be clearer about the invariants we expect.
This commit is contained in:
Bobby Holley 2013-05-16 23:33:14 -07:00
parent 0d5c9c4ac9
commit 1423107658

View File

@ -1232,9 +1232,16 @@ nsGlobalWindow::~nsGlobalWindow()
mDoc = nullptr;
NS_ASSERTION(!mArguments, "mArguments wasn't cleaned up properly!");
CleanUp(true);
// Outer windows are always supposed to call CleanUp before letting themselves
// be destroyed. And while CleanUp generally seems to be intended to clean up
// outers, we've historically called it for both. Changing this would probably
// involve auditing all of the references that inners and outers can have, and
// separating the handling into CleanUp() and FreeInnerObjects.
if (IsInnerWindow()) {
CleanUp(true);
} else {
MOZ_ASSERT(mCleanedUp);
}
nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
if (ac)