Closed
Bug 332848
Opened 18 years ago
Closed 18 years ago
document.write sorta but not really supported in XHTML
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
(Keywords: fixed1.8.0.4, fixed1.8.1, Whiteboard: [sg:want])
Attachments
(1 file)
2.98 KB,
patch
|
mrbkap
:
review+
jst
:
review+
dveditz
:
superreview+
dveditz
:
approval-branch-1.8.1+
dveditz
:
approval1.8.0.4+
|
Details | Diff | Splinter Review |
In XHTML right now, if you do a document.write on a document that's done parsing, it will work (and parse with the tagsoup parser). If you then call document.write again (on the still-open document) it will throw. Oh, and calling Write() will try to terminate mParser in some cases before ever checking for XHTML. And Close() will kill the parser in XHTML. Why are we playing the games with checking for mParser before throwing and so forth? Imo, the first thing in Close/OpenCommon/WriteCommon should be a check for XHTML and a throw if that tests true...
Assignee | ||
Comment 1•18 years ago
|
||
Note that I ran across this in bug 332807. In general, allowing our parser to be messed with like this in XML is scary to me -- it's not well-tested at all.
Flags: blocking1.9a1?
Flags: blocking1.8.1?
Flags: blocking1.8.0.3?
Comment 2•18 years ago
|
||
We need an owner to investigate this. We are plus'ing it for now but might reconsider if we can't get action on it. a=timr for drivers.
Flags: blocking1.8.0.3? → blocking1.8.0.3+
Updated•18 years ago
|
Whiteboard: [sg:want]
Assignee | ||
Comment 3•18 years ago
|
||
Attachment #217346 -
Flags: superreview?(jst)
Attachment #217346 -
Flags: review?(mrbkap)
Comment 4•18 years ago
|
||
Comment on attachment 217346 [details] [diff] [review] I say we do this r=mrbkap
Attachment #217346 -
Flags: review?(mrbkap) → review+
Comment 5•18 years ago
|
||
Comment on attachment 217346 [details] [diff] [review] I say we do this sr=dveditz
Attachment #217346 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 6•18 years ago
|
||
Comment on attachment 217346 [details] [diff] [review] I say we do this This really needs ok from jst...
Attachment #217346 -
Flags: review?(jst)
Comment 7•18 years ago
|
||
I'm worried that this change will break some bookmarklets and web sites. Why not fix document.open and document.write to work correctly instead? Is the problem that the XML parser doesn't like to be terminated early? (I think "work correctly" means: document.write would throw if used during XHTML page load, document.open would create a new text/html or text/plain document as requested, and document.write by itself would imply document.open('text/html').)
Assignee | ||
Comment 8•18 years ago
|
||
> Is the problem that the XML parser doesn't like to be terminated early?
Yes. Or rather, that termination via close() or write() does weird stuff to not only the parser but also the DOM and makes assumptions about the DOM that are false for XML. I'm not so interested in mutating the type of our document from XHTML to HTML... If someone wants to do that, sure, but I really don't have the time to write something like that and test it properly, including dealing with the above assumptions.
Note that the only way things can work now is if you wait till the document is loaded and then issue one single write() call and nothing else. Anything else will throw. At least in terms of adding data to the document...
Comment 9•18 years ago
|
||
(In reply to comment #0) > In XHTML right now, if you do a document.write on a document that's done > parsing, it will work (and parse with the tagsoup parser). If you then call > document.write again (on the still-open document) it will throw. > i may be missing something, but in bug 332807 there is no need for document.write to achieve a crash - check https://bugzilla.mozilla.org/attachment.cgi?id=217383 and bug 332807 works for text/html.
Comment 10•18 years ago
|
||
I'm confused. Doesn't document.open() create a new document? So why does it break when the previous document was XHTML, and you call document.write twice?
No, document.open() does not create a new document, it starts modification of the existing one.
Comment 12•18 years ago
|
||
(In reply to comment #10) > I'm confused. Doesn't document.open() create a new document? So why does it i am not competent enough to comment, but it seems irrelevant what document.open() creates. the interesting part is what it *destroys* afaict. > break when the previous document was XHTML, and you call document.write twice? > the two bugs got mixed. in https://bugzilla.mozilla.org/attachment.cgi?id=217382 working from *html* and xhtml there is no document.write()
Comment 13•18 years ago
|
||
> No, document.open() does not create a new document, it starts modification of
> the existing one.
I guess I was confused by the fact that it does create a new session history entry. The previous document not bfcached unless you go back and forth a few times.
Assignee | ||
Comment 14•18 years ago
|
||
Georgi, this bug is not the same as bug 332807. This bug is its own set of problems, completely unrelated to the XBL mess that is bug 332807. And in fact, what matters in this bug is not what document.open() destroys, imo, but _how_ it destroys it. And whether other code expects that to happen.
Comment 15•18 years ago
|
||
sorry as usual i have misunderstood :)
Comment 16•18 years ago
|
||
jst: we need your review so we can land this.
Updated•18 years ago
|
Whiteboard: [sg:want] → [sg:want] need r=jst
Comment 17•18 years ago
|
||
Comment on attachment 217346 [details] [diff] [review] I say we do this r=jst
Attachment #217346 -
Flags: review?(jst) → review+
Updated•18 years ago
|
Whiteboard: [sg:want] need r=jst → [sg:want] needs landing (everywhere)
Comment 18•18 years ago
|
||
Comment on attachment 217346 [details] [diff] [review] I say we do this approved for 1.8.0 branch, a=dveditz
Attachment #217346 -
Flags: approval1.8.0.4+
Attachment #217346 -
Flags: approval-branch-1.8.1+
Assignee | ||
Comment 19•18 years ago
|
||
Fixed, trunk and both branches.
Assignee: general → bzbarsky
Flags: blocking1.9a1?
Flags: blocking1.8.1?
Keywords: fixed1.8.0.4,
fixed1.8.1
Assignee | ||
Updated•18 years ago
|
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Whiteboard: [sg:want] needs landing (everywhere) → [sg:want]
Comment 21•16 years ago
|
||
bindings allow to embed XUL in html (quirks mode). is xul:iframe.parent == HTMLDocument considered safe ?
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•