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 // broken addons. The chrome tests in toolkit/mozapps/downloads are a good
// testing ground. // testing ground.
// //
// Here are some quirks that the test suite depends on: // 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
// * When chrome code executes |win|.close(), that close happens immediately, // ReallyCloseWindow. This allows setTimeout handlers that are set after
// along with the accompanying "domwindowclosed" notification. But _only_ if // FinalClose() is called to run before the window is torn down.
// |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.
bool indirect = GetContextInternal() && // Occasionally null. See bug 877390. bool indirect = GetContextInternal() && // Occasionally null. See bug 877390.
(nsContentUtils::GetCurrentJSContext() == (nsContentUtils::GetCurrentJSContext() ==
GetContextInternal()->GetNativeContext()); GetContextInternal()->GetNativeContext());
if ((!indirect && nsContentUtils::IsCallerChrome()) || if (NS_FAILED(nsCloseEvent::PostCloseEvent(this, indirect))) {
NS_FAILED(nsCloseEvent::PostCloseEvent(this, indirect))) {
ReallyCloseWindow(); ReallyCloseWindow();
} else { } else {
mHavePendingClose = true; mHavePendingClose = true;