WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
31801
If there's <!-- inside a <script> block, the document will be parsed in two different ways
https://bugs.webkit.org/show_bug.cgi?id=31801
Summary
If there's <!-- inside a <script> block, the document will be parsed in two d...
Jacobo Tarrío
Reported
2009-11-23 04:05:11 PST
Created
attachment 43701
[details]
Files that illustrate the problem Instructions: 1. Unpack the attached testcase.tgz in a web server. 2. Load index.html 3. Open the iframe in a new tab. 4. Reload the new tab. Expected: - After (2), an iframe appears with the text "Hi!" inside. - After (3), the tab has the same contents as the iframe. - After (4), the text "Hi!" remains in the tab. Actual: - After (2), an empty iframe appears. - After (3), the tab is not empty, but contains the text "Hi!". - After (4), the text "Hi!" disappears. Description: I have found a situation where Webkit seems to parse a document differently in different circumstances when it finds the beginning of a HTML comment inside a <script> tag. If you load a HTML file like this in your browser: <html> <body> <script>/* <!-- */</script> <p>Hi!</p> </body> </html> You'll be able to see "Hi!" in the page. If you inspect the document, you'll see a <script> block that contains /* <!-- */ followed by the <p> block. However, if, before the script block, you add an external Javascript file with <script src="">, the page will be blank, and inspecting the document you'll see that the <script> block is now empty and there's no <p> block after it. (It doesn't matter if the <script> tags are inside the head or the body of the document.) If you include this file in a different HTML file as an iframe, the iframe will appear empty. However, if you right-click and select "open frame in new tab", you will see "Hi!" in the tab that opens. If you inspect the document, you'll see the <script src=""> block, the <script> block with /* <!-- */ inside and the <p>Hi!</p> block. However, if you now reload the tab, the "Hi!" will disappear. If you inspect the document now, you'll only see the <script src=""> block and an empty <script> block and nothing else, like in the previous case. If you remove the <script src=""> and try the previous steps, you will see "Hi!" at every step. I have reproduced this with Safari 4.04 (531.21.10) and Chrome 4.0.223.16 (532.3) in Windows, and Chrome 4.0.245.1 (532.5) in Linux. I have also been able to reproduce it with Konqueror. Firefox and Opera always show "Hi!".
Attachments
Files that illustrate the problem
(269 bytes, application/x-compressed-tar)
2009-11-23 04:05 PST
,
Jacobo Tarrío
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2009-11-23 11:05:32 PST
Duplicate of
bug 16722
?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug