switching from quirks to standards mode via document.write() bombs

UNCONFIRMED
Unassigned

Status

()

--
major
UNCONFIRMED
10 years ago
10 years ago

People

(Reporter: bulk88, Unassigned)

Tracking

unspecified
x86
Windows XP
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(4 attachments)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080829 Firefox/2.0.0.17
Build Identifier: 

This is a tag soup page from hell rendered in quirks mode.

http://lix.in/-2dc5ee

I made a bookmarket to write in http://dbaron.org/mozilla/tests/compat?doctype=%3C%21DOCTYPE+HTML+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+HTML+4.01%2F%2FEN%22%3E this mozilla test.

Source of lix.in page for the record and the bookmarket I'll place here as attachments. I also included pics of what I see renderede and evidence from DOM Inspector that something is very wrong.

Basically everything is FUBARed. Rendering wise, Quirks stylesheet is taking effect.

Reproducible: Always

Steps to Reproduce:
1. copy paste http://lix.in/-2dc5ee in Mozilla and press the green arrow to the right of the url bar
2. DO NOT CLICK ON "Continue"
3. copy and paste in the following bookmarket into url box and press green arrow to right of url box

javascript:document.open();document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head><title>Compatibility Mode Test</title><style type="text/css">body { background: white; color: black; }.set { border: medium solid black; margin: 1em; }.first, .standards { color: #069; }.FIRST { color: white; }.second { color: white; }.SECOND, .quirks { color: #960; }</style></head><body><h1>Compatibility Mode Test</h1><p>Doctype is <span style="border: thin solid black;">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;</span>.</p><div style="position: relative; height: 3em;" class="set">  <div style="position: absolute; height: 100%; width: 100%">    <span class="standards">The quirks stylesheet is NOT applied.</span><br>    <span class="quirks">The quirks stylesheet is applied.</span>  </div>  <div style="position: absolute; height: 100%; width: 100%">    <table width="90%" cellpadding="0" cellspacing="0"><tr><td>      <p style="background: white; color: white">You can\'t see this.</p>    </td></tr></table>  </div></div><div style="position: relative; height: 3em;" class="set">  <div style="position: absolute; height: 100%; width: 100%; padding-top: 1px;">	<span class="standards">The inline box model shows you are in full	standards mode.</span>	<br><span class="quirks">The inline box model shows you are in quirks	mode <strong>or</strong> almost standards mode.</span>  </div>  <div style="position: absolute; height: 100%; width: 100%">    <table width="90%" cellpadding="0" cellspacing="0">      <tr><td><img src="../../images/vh40" height="1" width="1"></td></tr>      <tr><td style="background: white; color: white;">You can\'t see this.</td></tr>    </table>  </div></div><div class="set"><div class="first">The CSS stylesheet code is in standards mode.</div><div class="second">The CSS stylesheet code is in quirks mode.</div></div><p class="set">Comment parsing is in<!------> <span class="quirks">quirks</span> <span style="display: none"><!------> <span class="standards">standards</span><!------> </span> <!------>mode.</p><div class="set">The DOM says we are in<script type="text/javascript">var mode = document.compatMode;var output;if (mode == "BackCompat") {  output = "<span class=\'quirks\'>" + mode + "</span>";} else {  output = "<span class=\'standards\'>" + mode + "</span>";}document.write(output);</script>mode.</div></body></html>');document.close(); void 0;
Actual Results:  
Mozilla-sourced test page fails.

Expected Results:  
Not be using quirk mode style sheet. Pass the Mozilla-sourced test page.

I encountered this bug while trying to copy valid XHTML from an iframe back into the parent document (same origin was disabled). Parent document was rendering in quirks mode, and the valid XHTML and its CSS suddenly got the quirks stylesheet applied and the page rendered wrong of course even though the doctype was changed and document cleaned out of all tag soup.
(Reporter)

Comment 1

10 years ago
Created attachment 345082 [details]
moz test page rendering
Comment on attachment 345082 [details]
moz test page rendering

Reporter put personal information in screenshot, and so has asked for it to be hidden. Making private.

Gerv
Looks like a dup of bug 450191, most likely.
Depends on: 450191
(Reporter)

Comment 4

10 years ago
Created attachment 345169 [details]
moz test page rendering 1
(Reporter)

Comment 5

10 years ago
Created attachment 345171 [details]
mozilla is loading the quirks mode stylesheet
(Reporter)

Comment 6

10 years ago
Created attachment 345172 [details]
tag soup test page from lix.in, for the record
(Reporter)

Comment 7

10 years ago
Created attachment 345173 [details]
bookmarklet used to rewrite page
The content of attachment 345082 [details] has been deleted by
    Gervase Markham <gerv@mozilla.org>
who provided the following reason:

Requested by submitter - personal information contained

The token used to delete this attachment was generated at 2008-10-28 17:58:24 PDT.
Is this still an issue now that bug 450191 is fixed?  It seems to work fine for m using that bookmarklet on the page in comment 0.

If this works now, can we add a testcase?
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.