Can't open a document after creating frames in javascript

RESOLVED DUPLICATE of bug 22681

Status

()

Core
DOM: Core & HTML
--
major
RESOLVED DUPLICATE of bug 22681
17 years ago
17 years ago

People

(Reporter: Brian McKee, Assigned: jst)

Tracking

Trunk
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
BuildID:    20010726

I am opening a new window and writing html to it.  The html should create a 
page with 2 blank frames.  The page is then closed.  Then I try to write to the 
document of one of those frames, but I get an error message saying the document 
has no properties as soon as I try to call the document.open() function.

Reproducible: Always
Steps to Reproduce:
1.I'll give code below.
2.
3.

Actual Results:  I got the error "d has no properties".  d is a variable that 
describes a newly created document in a frame.

Expected Results:  Opened the document.

Here's part of the code.  This is in a function.  There is a global variable 
called ReportWin.  It will stop running and give the message on the third to 
last line...the d.open statement when d is ReportWin.top.contents.document.

if ((ReportWin == null) || (ReportWin.closed)) {
    ReportWin = open("", rtitle, "status,scrollbars,resizable");
  }  
  else 
    ReportWin.focus();
  var str = "";
  var d = ReportWin.document;
  d.open('text/html');
  d.writeln('<head><title>' + globalData.pubcode + ' Report 
Menu</title></head>');
  d.writeln("<frameset framespacing='1' frameborder='0' cols='192,*'>");
  d.writeln("<frame name='contents' target='main' src='about:blank' 
scrolling='no' noresize>");
  d.writeln("<frame name='main' src='about:blank' scrolling='auto'>");
  d.writeln("<noframes><body><p>This page uses frames, but your browser doesn't 
support them.");
  d.writeln("</body></noframes></frameset>");
  d.close();  
  
  var d = ReportWin.top.contents.document;
  d.open('text/html');
  str = "<head><title>" + pubname + " Reports</title></head>";
  d.writeln('<body bgcolor="blue" text="white" link="yellow" vlink="azure">');

Comment 1

17 years ago
Browser, not engine --> DOM Level 0.


brianchi73@telocity.com: 

1. Could you try a more recent build? Yours is rather old.
   New builds are actually made every day, and can be downloaded 
   from the ftp sites. See:

http://www.mozilla.org/download-mozilla.html 	(general download info)
http://www.mozilla.org/binaries.html            (where the nightly binaries are)
http://ftp.mozilla.org/pub/mozilla/nightly/latest/ (where the latest builds are)


2. If the problem has gone away, please resolve this bug as "WORKSFORME"
   with the option buttons above.

3. If the problem is still there, please attach a reduced HTML testcase
   via the "Create a new attachment" link above - thanks.
Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
(Reporter)

Comment 2

17 years ago
Created attachment 49969 [details]
Test for opening a window, creating frames and writing to documents in frames.
(Reporter)

Comment 3

17 years ago
Unfortunately I cannot try a new build because I'm testing Netscape 6.1.  When I 
try to get support for that...it always leads me to the Gecko engine, and the 
latest build from Netscape is 20010726.  I have, however, created a test file 
that works in IE 5.0, Netscape 4.76 and fails in Netscape 6.1 with a javascript 
error.
seeing this on current linux cvs.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
(Assignee)

Comment 5

17 years ago
The reason the testcase doesn't work is that Mozilla/Netscape6x doesn't
synchronously create a document in frames, the document of a frame/iframe will
be null until the document in the frame/iframe is done loading. And even loading
about:blank takes a little time. This is a dup, but I don't have the other bug
number handy right now.

Comment 6

17 years ago
Maybe you should write it down somewhere ;-)

*** This bug has been marked as a duplicate of 22681 ***
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.