Open Bug 443988 Opened 17 years ago Updated 3 years ago

Files pointed to by "script" or "link" are parsed twice

Categories

(Core :: XSLT, defect)

x86
Windows 2000
defect

Tracking

()

People

(Reporter: manfred.staudinger, Unassigned)

References

()

Details

(Keywords: helpwanted, perf)

Attachments

(3 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 If xml is served as application/xml and has an XSLT stylesheet specified with PI, the the files pointed to by script and link must not been read and parsed before the XSL transformation eventually puts those elements in the output tree (DOM). Currently in in FF 3.0 all those files are parsed before the transformation takes place. Whatever the transformation puts in the output tree is also read and parsed, which at this time is correct. The problem was the same in FF 2 but not investigated. In the additional Information you will find the input XML, the XSLT, the output from the transformation, the content of the files, and the trace output from "Live HTTP headers". Cache was switched off for this. If this "double parsing" bug is not specific for PI (which I doubt), then it might have a far reaching impact. Reproducible: Always Steps to Reproduce: 1. Call http://test.rudolphina.org/test-css.xml 2. Look at the error console 3. Check Live HTTP headers Actual Results: <script src="test-js-any.js" type="text/javascript"></script> produces 2 HTTP 404 responses <script src="test-js-ie.js" type="text/javascript"></script> produces: Error: anything is not defined Source File: http://test.rudolphina.org/test-js-ie.js Line: 1 <link rel="stylesheet" href="test-css-any.css" type="text/css" /> produces 2 HTTP 404 responses <link rel="stylesheet" href="test-css-ie.css" type="text/css" /> produces: Warning: Error in parsing value for property 'cursor'. Declaration dropped. Source File: http://test.rudolphina.org/test-css-ie.css Line: 1 Expected Results: <script src="test-js-any.js" type="text/javascript"></script> should produce 1 HTTP 404 response <link rel="stylesheet" href="test-css-any.css" type="text/css" /> should produce 1 HTTP 404 response http://test.rudolphina.org/test-css.xml ======================================================= test-css.xml: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-css.xsl" type="text/xsl"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test Firefox parsing twice</title> <script src="test-js-any.js" type="text/javascript"></script><!-- 404 --> <script src="test-js-ie.js" type="text/javascript"></script><!-- error --> <link rel="stylesheet" href="test-css-any.css" type="text/css" /><!-- 404 --> <link rel="stylesheet" href="test-css-ie.css" type="text/css" /><!-- error --> </head> <body> <h1>Test Firefox parsing twice</h1> </body> </html> ======================================================= test-css.xsl: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" encoding="UTF-8" omit-xml-declaration="no" indent="no"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="@*|text()|comment()"> <xsl:copy/> </xsl:template> <xsl:template match="xhtml:link[contains(@href, '-ie.')]"/> <xsl:template match="xhtml:script[contains(@src, '-ie.')]"/> </xsl:stylesheet> ======================================================= Output from the Transformation (as shown by "View Generated Source"): <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test Firefox parsing twice</title> <script src="test-js-any.js" type="text/javascript"/> <link rel="stylesheet" href="test-css-any.css" type="text/css"/> </head> <body> <h1>Test Firefox parsing twice</h1> </body> </html> ======================================================= Content of test-js-ie.js anything ======================================================= Content of test-css-ie.js h1 {cursor: hand;} ======================================================= Files test-js-any.js and test-css-any.js do _not_ exist ======================================================= Messages from Error Console Error: anything is not defined Source File: http://test.rudolphina.org/test-js-ie.js Line: 1 Warning: Error in parsing value for property 'cursor'. Declaration dropped. Source File: http://test.rudolphina.org/test-css-ie.css Line: 1 ======================================================= Messages from Live HTTP headers: Generator #request# GET http://test.rudolphina.org/test-css.xml GET /test-css.xml #request# GET http://test.rudolphina.org/test-css.xsl #request# GET http://test.rudolphina.org/test-js-any.js GET /test-css.xsl GET /test-js-any.js #request# GET http://test.rudolphina.org/test-js-ie.js GET /test-js-ie.js #request# GET http://test.rudolphina.org/test-css-any.css #request# GET http://test.rudolphina.org/test-css-ie.css #request# GET http://test.rudolphina.org/test-js-any.js #request# GET http://test.rudolphina.org/test-css-any.css GET /test-css-any.css GET /test-css-ie.css GET /test-js-any.js GET /test-css-any.css ======================================================= Messages from Live HTTP headers: Headers http://test.rudolphina.org/test-css.xml GET /test-css.xml HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 200 OK Date: Mon, 07 Jul 2008 18:54:50 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Last-Modified: Mon, 07 Jul 2008 18:52:08 GMT Etag: "43a0351-218-487265d8" Accept-Ranges: bytes Content-Length: 536 Keep-Alive: timeout=2, max=200 Connection: Keep-Alive Content-Type: application/xml ---------------------------------------------------------- http://test.rudolphina.org/test-css.xsl GET /test-css.xsl HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: text/xml,application/xml,application/xhtml+xml,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://test.rudolphina.org/test-css.xml Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 200 OK Date: Mon, 07 Jul 2008 18:54:51 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Last-Modified: Mon, 07 Jul 2008 18:52:04 GMT Etag: "43a0350-30b-487265d4" Accept-Ranges: bytes Content-Length: 779 Keep-Alive: timeout=2, max=199 Connection: Keep-Alive Content-Type: application/xml ---------------------------------------------------------- http://test.rudolphina.org/test-js-any.js GET /test-js-any.js HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://test.rudolphina.org/test-css.xml Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 404 Not Found Date: Mon, 07 Jul 2008 18:54:51 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Content-Length: 619 Keep-Alive: timeout=2, max=197 Connection: Keep-Alive Content-Type: text/html ---------------------------------------------------------- http://test.rudolphina.org/test-js-ie.js GET /test-js-ie.js HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://test.rudolphina.org/test-css.xml Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 200 OK Date: Mon, 07 Jul 2008 18:54:51 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Last-Modified: Mon, 07 Jul 2008 18:51:51 GMT Etag: "43a038e-8-487265c7" Accept-Ranges: bytes Content-Length: 8 Keep-Alive: timeout=2, max=197 Connection: Keep-Alive Content-Type: application/x-javascript ---------------------------------------------------------- http://test.rudolphina.org/test-css-any.css GET /test-css-any.css HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: text/css,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://test.rudolphina.org/test-css.xml Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 404 Not Found Date: Mon, 07 Jul 2008 18:54:52 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Content-Length: 619 Keep-Alive: timeout=2, max=195 Connection: Keep-Alive Content-Type: text/html ---------------------------------------------------------- http://test.rudolphina.org/test-css-ie.css GET /test-css-ie.css HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: text/css,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://test.rudolphina.org/test-css.xml Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 200 OK Date: Mon, 07 Jul 2008 18:54:52 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Last-Modified: Mon, 07 Jul 2008 18:26:13 GMT Etag: "43a0356-12-48725fc5" Accept-Ranges: bytes Content-Length: 18 Keep-Alive: timeout=2, max=200 Connection: Keep-Alive Content-Type: text/css ---------------------------------------------------------- http://test.rudolphina.org/test-js-any.js GET /test-js-any.js HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://test.rudolphina.org/test-css.xml Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 404 Not Found Date: Mon, 07 Jul 2008 18:54:52 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Content-Length: 619 Keep-Alive: timeout=2, max=194 Connection: Keep-Alive Content-Type: text/html ---------------------------------------------------------- http://test.rudolphina.org/test-css-any.css GET /test-css-any.css HTTP/1.1 Host: test.rudolphina.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Accept: text/css,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://test.rudolphina.org/test-css.xml Cookie: __utma=62540841.1008961208.1214127032.1214127032.1214127032.1; __utmz=62540841.1214127032.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP/1.x 404 Not Found Date: Mon, 07 Jul 2008 18:54:52 GMT Server: Apache/1.3.34 Ben-SSL/1.55 Content-Length: 619 Keep-Alive: timeout=2, max=198 Connection: Keep-Alive Content-Type: text/html ----------------------------------------------------------
Component: General → XSLT
Product: Firefox → Core
QA Contact: general → xslt
Attached file Input XML
Attached file XSLT
Summary: Files pointed to by html script or link are wrongly read and parsed before the XSL transformation (initiated from PI) takes place. → Files pointed to by "script" or "link" are parsed twice
Keywords: perf
I've put the input XML, XSLT and output from "Live HTTP headers" in separate appendices, but was not able to delete those lines from the inline message, sorry. Also I could not find the component responsible for parsing the files for script and link twice and my guess "XSLT" should possible be corrected, thanks.
> the files pointed to by script and link must not been read and parsed Can you please point to where the spec says that? I do agree it's desirable not to do that, but I see nothing that says we MUST NOT (in RFC terms) do it. sicking, should XSLT source documents be just treated as data documents? Or would that break something?
Severity: major → normal
Status: UNCONFIRMED → NEW
Ever confirmed: true
No, that is exactly what we should do. Though I think we should additionally create plain nsXMLElements for such nodes to avoid things like parsing attributes and such. And doing that might be enough to fix the bug.
Keywords: helpwanted
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: