Closed Bug 332446 Opened 19 years ago Closed 18 years ago

Mess on the screen with using document.write with undefined variable.

Categories

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

x86
All
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 81980

People

(Reporter: bsg, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.12) Gecko/20050915 Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.12) Gecko/20050915 Hello! Consider the follwing example: ----- BEGIN ----- <html> <head> <script language="JavaScript"> function start () { document.open (); document.writeln ("<html><body>"+ UndefinedVariable + "</body></html>"); document.close (); } </script> </head> <body> Scroll down below and click the link. <hr size="800"> <a href="javascript: start ();">START</a>. <hr size="800"> </body> </html> ----- END ----- Here we creating a new document from Javascript function by printing it with document.writeln() when a user clicks a link. But if we trying to print any undefined variable, browser will display mess (on lower part of screen)on Mozilla and black background in Firefox. And animated Mozilla icon will never stop. If we define variable as usual, everything will be ok. By mess I mean some strange color dots on gray background. <hr> tags are used only to create document large than window, so user must scroll it down to access the link. Without scrolling there will no be mess but only forever runing Mozilla icon. So if you have a very big screen resolution, adjust <hr> size accordingly. ;-) This bug is actual both for Mozilla and Firefox on Linux and Windows. P.S. If we printing correct document but forget about call to document.close(), then animated Mozilla icon will never stop too (because document is not closed). Is it good? Thanks. Reproducible: Always Actual Results: Mess or black background on lover part of screen. Expected Results: I don't know. ;-) I seean error on Javascript console about undefined variable, but I'm sure I don't have to see a mess. :-)
WFM with Firefox trunk. Do you see the problem with just document.open(), or do you need the bogus document.write attempt to see the problem? > P.S. If we printing correct document but forget about call to document.close(), > then animated Mozilla icon will never stop too (because document is not > closed). Is it good? See bug 81980.
You are right. The test case can be much simplier: ----- BEGIN ----- <html> <body> Scroll down below and click the link. <hr size="800"> <a href="javascript: document.open ();">START</a>. <hr size="800"> </body> </html> ------ END ------ So to see a mess you need an event handler that opens document and not closes it.
So, it seems it's all about bug 81980 with missed document.close(). And when there is no document.close(), you will see neverending icon animation and garbage on screen. And even if you press Stop button, animation will stop, but garbage will stay.
Attached file reporter's testcase
For next time: bugs are easier to read if, instead of pasting code into the report when you are filing, you instead file the bug, and then add the code in an attachment.
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: