Closed Bug 57107 Opened 24 years ago Closed 20 years ago

document.open() and setTimeout cause <a href..>s to fail

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect, P3)

x86
Windows 2000
defect

Tracking

()

RESOLVED INVALID
Future

People

(Reporter: email1, Assigned: john)

Details

(Keywords: relnote)

This bug is a problem with javascript trees and other menu systems since the 
menus usually have links to html documents and based on user input need to 
redraw themselves.

The test case consists of three files.  What should happen (as in IE and 
Netscape) is that clicking on the link should open that url in the second 
frame.  In Mozilla this does not work, nothing happens when clicking on the 
link.  If the setTimeout is increased to something like 1000 ms, then the link 
does work.

If document.open is called before the href link has completed loading, the 
request seems to be canceled. If the open (and close) are ommitted, then the 
href link is opened, but the document is not cleared properly.

---- treeframeset.htm ----
<html>
<head>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><!--
function tMDisplay()
{
  tMD = frames[0].document;

  if (document.images)
  	tMD.open("text/html", "replace");
  else
  	tMD.open("text/html");

	tMD.write('<html><body>');
	tMD.write('<a href="http://www.bierling.net" target="result" 
onClick="return parent.tMClick();">Bierling.net</a>');
	tMD.write('</body></html>');
	tMD.close();
}

function tMClick()
{
  setTimeout("tMDisplay()", 10);
	return true;
}
-->
</script>
</head>

<frameset cols="66%,*">
  <frame Name="tree" scrolling="no" noresize target="result" src="tree.htm">
	<frame name="result" src="frame2.htm">
</frameset>
</html>

---- tree.htm ----
<html>
<body onLoad="parent.tMDisplay();">
</body>
</html>

---- frame2.htm ----
<html>
<body>
Frame 2
</body>
</html>
Browser, not engine. Reassigning to HTMLFrames for further triage -
Assignee: rogerl → pollmann
Component: Javascript Engine → HTMLFrames
QA Contact: pschwartau → petersen
repoter: are yuo seeing this with new builds?
Yes, the problem still exists in:
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; m18) Gecko/20001103

This is my current workaround:
if (link && navigator.appName == 'Netscape' && parseInt(navigator.appVersion) 
== 5)
  frames[tMFrame].location.replace(frames[tMFrame].location.href);
else
  setTimeout("tMDisplay()", 10);
setting bug status to New
Status: UNCONFIRMED → NEW
Ever confirmed: true
What's the status of this bug?  Its still occuring in 0.7.

If the function referenced by setTimeout() is called before the document is 
loaded in the second frame, the load is cancelled and nothing happens.
petersen@netscape.com: does it still happen with the current builds?
Assignee: pollmann → marek
Keywords: relnote
Target Milestone: --- → mozilla0.9
Yes, it still occurs in .8.
QA Contact update
QA Contact: petersen → amar
assigning to pollmann (and setting TM to Future). Eric, please change it if you
think it's incorrect.
Assignee: marek → pollmann
Target Milestone: mozilla0.9 → Future
Bulk reassignin HTML FRAME/IFRAME bugs to Eric.
Assignee: pollmann → evaughan
Bulk re-assigning all of Eric's HTMLFrame bugs to John.
Assignee: eric → jkeiser
The testcase posted in this bug document.writes to the same frame to which the
link is trying to load.  So I'm not sure how it's expected to do anything useful.

If that's the only testcase showing the bug, this is invalid, I'd say....
No response, and what I said in comment 12 stands, so marking invalid.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Product: Core → Core Graveyard
Component: Layout: HTML Frames → Layout: Images
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.