Last Comment Bug 615927 - fails 2nd time through
: fails 2nd time through
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: unspecified
: x86 Windows 7
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Andrew Overholt [:overholt]
Depends on:
  Show dependency treegraph
Reported: 2010-12-01 10:51 PST by stephen
Modified: 2010-12-29 10:45 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

repro example (672 bytes, application/x-zip-compressed)
2010-12-01 11:38 PST, stephen
no flags Details

Description User image stephen 2010-12-01 10:51:21 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7) Gecko/20100101 Firefox/4.0b7

It appears that the snippet below will work the first time through but then the second time through document will be null after

	try {
		if (document == null) { throw new Error("before open"); };
		if (document == null) { throw new Error("before write"); }
		if (document == null) { throw new Error("before close"); }
	} catch (ex) {
		if (window.console) {
		} else {

Reproducible: Always

Steps to Reproduce:
1. load a page with a button to trigger
2. trigger the script (everything works fine)
3. trigger it again (document becomes null)
Actual Results:  
document is null

Expected Results:  
In FF 3.x this could be repeated indefinitely.

The page source has the script in an external JavaScript file, so it should be executing it each time the page is rebuilt. document is being refereced (not stored) so it should be pointing to the current document (rather than an old instance).

Storing the value returned from and using that for the remaining steps seems to be a workaround.

	var doc =;
Comment 1 User image stephen 2010-12-01 10:55:27 PST
I forgot to mention the alert that pops up says "before write".

Note also there's a typo in the console line.
Comment 2 User image Boris Zbarsky [:bz] (still a bit busy) 2010-12-01 11:09:51 PST
Can you attach a complete web page that shows the problem?
Comment 3 User image stephen 2010-12-01 11:38:42 PST
Created attachment 494459 [details]
repro example

Attachment is a simple web page and script which demonstrates the problem. Works fine in Firefox 3.6.13 but not in Firefox 4.0b7. Thanks.
Comment 4 User image Boris Zbarsky [:bz] (still a bit busy) 2010-12-01 15:01:10 PST
Hmm.  I see the issue in b7, but not on trunk.  Looks like this got fixed somewhere in this range:
Comment 5 User image stephen 2010-12-29 10:45:45 PST
NOTE: this now appears to have been fixed in the released version of 4.0b8.

Note You need to log in before you can comment on or make changes to this bug.