Bug 14599

Summary: document.write() inside an <iframe src> does not work
Product: WebKit Reporter: Sridhar Gurivireddy <just1gb>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: abarth, ap
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
Attachments:
Description Flags
test case
none
Testcase.. 2 files none

Description Sridhar Gurivireddy 2007-07-12 17:03:26 PDT
Document.write() inside an iframe src should write to the <iframe>. Safari does not do anything.

e.g code
#######
 <frameset id="frameset" border="1" cols="50%,50%" style='border: solid 1px;'>
 <frame name="frame2" src="about:blank">
 <frame name="frame1" src="javascript:
       try { document.write('whatever'); } catch(e) { window.alert(e.description); }
 ">
 </frameset>

This works well in other browsers
Comment 1 Alexey Proskuryakov 2007-07-12 22:13:10 PDT
Confirmed with r24241 on Mac OS X.
Comment 2 Alexey Proskuryakov 2007-07-12 22:13:58 PDT
Created attachment 15496 [details]
test case
Comment 3 David Kilzer (:ddkilzer) 2007-07-14 14:28:42 PDT
Not a regression as the reduction behaves the same way with Safari 2.0.4 (419.3) with original WebKit on Mac OS X 10.4.10 (2R218).  Tested with a local debug build of WebKit r24285 with Safari 3.0 (522.12) on 10.410.

Comment 4 David Kilzer (:ddkilzer) 2007-07-14 14:58:19 PDT
(In reply to comment #2)
> Created an attachment (id=15496) [edit]
> test case

FWIW, this test case caused a crash in Firefox 2.0.0.4:

https://bugzilla.mozilla.org/show_bug.cgi?id=388181

Comment 5 Justin Haygood 2007-07-26 21:55:46 PDT
Created attachment 15695 [details]
Testcase.. 2 files

2 file testcase in ZIP....

test.html opens up an iframe which uses document.write.

I believe the bug description is wrong, and the test case provide demonstrates a different bug? Can you really put framecontent inline with the mainpage? I've never seen that be done.
Comment 6 Sridhar Gurivireddy 2007-09-26 15:21:16 PDT
I beleive basically the bug here is that document.write() does not update the content until document.close() is called.

javascript:document.write("sridhar") does not work in Safari, while
javascript:document.write("sridhar");document.close(); works
Comment 7 Alexey Proskuryakov 2007-09-26 21:29:25 PDT
(In reply to comment #6)
> I beleive basically the bug here is that document.write() does not update the
> content until document.close() is called.

This sounds like a duplicate of bug 8961.
Comment 8 Adam Barth 2010-08-13 20:23:23 PDT
Yep.  My patch for Bug 8961 fixes this one too.

*** This bug has been marked as a duplicate of bug 8961 ***