Closed Bug 248259 Opened 20 years ago Closed 20 years ago

Javascript document.write() within XSL crashes mozilla

Categories

(Core :: XSLT, defect)

defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 202765

People

(Reporter: brendy, Assigned: peterv)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9

I had seen this problem mentioned on mailing lists as far back as 1999, but it
still appears to be an issue.

Any Javascript document.write() statement within an XSL file will crash Mozilla
on newer builds. I tried it on some older builds and they simply just showed a
white screen. I was sure to use the recommended xmlns as mentioned on the
Mozilla XSLT Page ( http://www.w3.org/1999/XSL/Transform )

Example Code:

--
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" method="html" />
	<xsl:template match="test" name="test">
		<html>
			<head></head>
			<body>
				<script type="text/javascript">
				<![CDATA[
				 //the alert works fine
				 //window.alert( 'Hello World' );
				 
				 //crashes mozilla everytime
				 document.write( 'Hello World' );
				]]>
				</script>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>
--

You can see an example of this in action here (WARNING: Crashes Mozilla):

http://shirtconcepts.com/brendon/bugzilla/examples/xslJSDocWrite/main.xml

Reproducible: Always
Steps to Reproduce:
1. Create a simple XSL File with html body and a script block within the body
2. Use a document.write() statement within the script block 
3. Link XSL file from XML file and open it


Actual Results:  
Mozilla crashes

Expected Results:  
Display the text from a document.write() statement

*** This bug has been marked as a duplicate of 202765 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.