Closed Bug 206173 Opened 22 years ago Closed 22 years ago

display hangs

Categories

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

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 114461

People

(Reporter: ve3ll, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4b) Gecko/20030509 Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4b) Gecko/20030509 i have a search engine in .js that writes a report. the report has a button to a scripted function if searched value needs adding have stripped engine code to only part that writes report. if i comment out the included script display works but not when it is in the .js file .... this stuff works ok in msie and opera but not in mozilla based stuff. the .js file is // verified with jslint 2003:05:17 var docObj = document; var queryvalue = "freddy"; //global defaults // search function would have more -- stripped to rudiments function asearch() { var winvar = docObj.open("","fred"); // capture window handle if (winvar !== undefined) {docObj = winvar;} // but not when Opera ;-{ docObj.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'); docObj.writeln('<html><head><title>TEST 3<\/title>'); docObj.writeln('<link href="zestyle.css" rel="stylesheet" type="text/css">'); docObj.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'); // comment out next four lines to make it work in mozilla docObj.writeln('<script type="text/javascript">\nfunction mailit() {'); docObj.write('top.location.href="mailto:ve3ll@rac.ca'); docObj.writeln('?Subject=EducationSite! needs ['+queryvalue+'] in db!";'); docObj.writeln('} <\/script>'); docObj.writeln('<\/head><body>'); docObj.writeln('<h1>Hello buddy<\/h1>'); docObj.writeln('<\/body><\/html>'); docObj.close(); } AND A SIMPLE DRIVER FUNCTION IS : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title>Driver</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="asearch.js"></script> </head><body><h1>test</h1> <form name="f" action="?" method="post"> <input name="x" type="button" value="go!" onClick="asearch();"> </form></body></html> Reproducible: Always Steps to Reproduce: 1.Add the two scripts to local drive as asearch.js and test.htm 2.run test in opera or msie to see expeced results 3.run test and press button --- notice no head written 4.comment appropriate lines in .js and rerun to observe that expected results now happen Actual Results: no head displayed in report also cant view anything with frame -- view source Expected Results: displayed the head and allowed view source.
If we strip down the example to a minimum, and place all the JS in-line, we have <html><head> <script> var docObj = document; var queryvalue = "freddy"; function asearch() { var winvar = docObj.open(); // capture window handle alert(queryvalue); docObj.close(); } </script></head> <body><br> <input type="button" value="Test" onclick="asearch();"> </body></html> When we run this testcase in IE6, we get the alert ---> "freddy". In Mozilla, we get the same error in the JavaScript Console as in the example you gave above: Error: queryvalue is not defined The reason is, you are doing a document.open() after the global variable |queryvalue| is defined. In Mozilla (but not IE) that destroys the JS context and replaces it with a brand-new one. In the new JS context, the variable |queryvalue| has not been defined, hence the error in the JavaScript Console. This is not a JS Engine issue, so I'm reassigning this to the DOM experts. This bug is either invalid or a duplicate of bug 114461, "document.open() clobbers JS context"
Assignee: rogerl → dom_bugs
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → ashishbhatt
Summary: when reading .js files that write scripts to new file -- display hangs → display hangs
*** This bug has been marked as a duplicate of 114461 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: