Bug 874502 part 6. Remove IsCallerChrome path for tearing down windows synchronously. r=bzbarsky

This commit is contained in:
Bobby Holley 2013-09-17 17:45:48 -04:00
parent fdea328feb
commit 8696b88eb9

View File

@ -7268,22 +7268,14 @@ nsGlobalWindow::FinalClose()
// broken addons. The chrome tests in toolkit/mozapps/downloads are a good
// testing ground.
//
// Here are some quirks that the test suite depends on:
//
// * When chrome code executes |win|.close(), that close happens immediately,
// along with the accompanying "domwindowclosed" notification. But _only_ if
// |win|'s JSContext is not at the top of the stack. If it is, the close
// _must not_ happen immediately.
//
// * If |win|'s JSContext is at the top of the stack, we must complete _two_
// round-trips to the event loop before the call to ReallyCloseWindow. This
// allows setTimeout handlers that are set after FinalClose() is called to
// run before the window is torn down.
// In particular, if |win|'s JSContext is at the top of the stack, we must
// complete _two_ round-trips to the event loop before the call to
// ReallyCloseWindow. This allows setTimeout handlers that are set after
// FinalClose() is called to run before the window is torn down.
bool indirect = GetContextInternal() && // Occasionally null. See bug 877390.
(nsContentUtils::GetCurrentJSContext() ==
GetContextInternal()->GetNativeContext());
if ((!indirect && nsContentUtils::IsCallerChrome()) ||
NS_FAILED(nsCloseEvent::PostCloseEvent(this, indirect))) {
if (NS_FAILED(nsCloseEvent::PostCloseEvent(this, indirect))) {
ReallyCloseWindow();
} else {
mHavePendingClose = true;