Closed Bug 265814 Opened 20 years ago Closed 20 years ago

The output of document.write() is always (first) parsed in quirks mode

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mrbkap, Assigned: mrbkap)

Details

Attachments

(3 files, 1 obsolete file)

I came across this when investigating bug 165323. Basically, when we come across
a document.write() in the body, we try to parse just the contents of that
write() as their own block. That parse is always performed in quirks mode in the
parser. If the parse fails for any reason (such as an unclosed comment) the data
is then inserted into the regular input stream, and parsed in standards mode.
I'll attach a testcase shortly.
Attached file testcase (obsolete) —
Attached file better testcase
The last testcase was sort of unclear (it showed the problem, but in a
roundabout way). This one is much more self-explanatory.
Attachment #163181 - Attachment is obsolete: true
Attached patch patch v1Splinter Review
This patch ensures that we bring over the DTD mode from the last context (since
nsHTMLDocument::WriteCommon() doesn't send one in). I'm not sure if we can get
here without a mPrevContext for the new parsercontect, so I'm not sure if the
else clause is strictly necessary, but I thought it wouldn't hurt to be
defensive.
Comment on attachment 163184 [details] [diff] [review]
patch v1

bz, since you know about this, I'll ping you for r (and maybe sr?)=.
Attachment #163184 - Flags: review?(bzbarsky)
Comment on attachment 163184 [details] [diff] [review]
patch v1

r=bzbarsky if you only do the preservation thing when |aMode ==
eDTDMode_autodetect|.

jst, would you sr?
Attachment #163184 - Flags: superreview?(jst)
Attachment #163184 - Flags: review?(bzbarsky)
Attachment #163184 - Flags: review+
Attached patch patch v2Splinter Review
Comment on attachment 163184 [details] [diff] [review]
patch v1

sr=jst
Attachment #163184 - Flags: superreview?(jst) → superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: