The linked url shows "success" on the page in firefox, but is blank in webkit. It uses document.write in onload on the <body>. In addition, having the document.write in onload will also cause a subsequent document.write to fail. For example <body onload="document.write('success')"><script type="text/javascript">document.write('success');</script></body> will print nothing, but if the onload on the body is removed, it will print success.
The second example you describe shows a document.write happening *previous* to the one in the onload handler. The body of the <script> element will be executed as soon as it is parsed, which will happen before the onload event fires. My guess is that the document.write inside the <script> executes correctly, but then the document is cleared when the document.write in the onload handler does an implicit document.open. But this is just speculation.
Created attachment 15809 [details] close the write content when the doc is closed
(In reply to comment #2) > Created an attachment (id=15809) [edit] > close the write content when the doc is closed http://bugs.webkit.org/show_bug.cgi?id=14821 is a duplicate of this bug.
*** Bug 14821 has been marked as a duplicate of this bug. ***
Comment on attachment 15809 [details] close the write content when the doc is closed This patch is not for TOT. Must be for the S60 branch.
Comment on attachment 15809 [details] close the write content when the doc is closed I'm going to mark this r- as the patch is for the S60 branch while the bug was reported against trunk. This means that the patch does not address the bug that was reported.
Comment on attachment 15809 [details] close the write content when the doc is closed this patch is applicable to tiger branch as well not just S60. Could someone please review ?
Comment on attachment 15809 [details] close the write content when the doc is closed As mentioned, the bug is reported against trunk so a patch for the Tiger branch does not resolve the bug.
Also, the patch for TOT should include a test case and a ChangeLog entry. Please see <http://webkit.org/coding/contributing.html> for information on contributing code.
Created attachment 15964 [details] close the stream after write by appending </html> for the corresponding <html> tag added in write()
The patch still doesn't have a test, so it cannot be landed. However, I'm leaving the review flag on for someone to review code changes. BTW, this seems to be a duplicate of bug 8961.
Created attachment 15968 [details] test case test case
Comment on attachment 15968 [details] test case Your test case should be included in the patch, along with the expected results. It seems that this test should also be a text-only test rather than dumping the rendertree.
Comment on attachment 15964 [details] close the stream after write by appending </html> for the corresponding <html> tag added in write() Your ChangeLog entries should include information about the change as well as a reference to the bug is being fixed, as well as your name rather than "webcore" in the header line. The name "m_beginWriteStream" seems less than ideal. It reads more like a function name due to it starting with a verb. I can't suggest a better name as I'm not entirely clear on what the purpose of the variable is.
Comment on attachment 15964 [details] close the stream after write by appending </html> for the corresponding <html> tag added in write() As noted above, this needs a more detailed ChangeLog and an included test case. r-
I'm not sure the basic approach here is right: a) Writing a </html> close tag shouldn't be necessary to have the written contents actually appear; the fact that it is likely indicates some deeper problem. b) This probably means that certain kinds of document.write *after* onload won't work right either, and there isn't code around to write the </html> in such cases.
This bug doesn't seem active anymore; actually closing as a duplicate. *** This bug has been marked as a duplicate of 8961 ***