Closed Bug 9314 Opened 25 years ago Closed 25 years ago

Calling "top.window.close()" from within a timeout crashes (in M7)

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: tonyr, Assigned: vidur)

Details

(I had no idea which component to assign this to but since the code is in the DOM
directory...)

The following JavaScript attached to any window opened using
window.openDialog(...) causes a crash in nsGlobalWindow.cpp at line #1560, seems
like this would occur on all platforms but I don't currently have any way to
verify that.

--------------------------------------------
var intervalState = null;
var intervalCount = 0;
function OnLoadWindow()
{
	intervalState = setInterval( "OnInterval()", 100);
}

function OnInterval()
{
	// do something a few times
	intervalCount = intervalCount + 1;
	if (intervalCount > 10) {
		clearInterval( intervalState);
		top.window.close();
	}
}

-----------------------------------------

In GlobalWindowImpl::RunTimeout(...) after the timeout script is evaluated, it
calls "mContext->ScriptEvaluated()".  Apparently, the top.window.close()
JavaScript call causes mContext to become null which crashes.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Oops! Forgot to close this and say that a fix was checked in on 7/8/1999.
Status: RESOLVED → VERIFIED
Verified. Marking verified.
You need to log in before you can comment on or make changes to this bug.