Bug 65407

Summary: Webkit doesn't clear timeouts and intervals when open() is called on a document that's not already open
Product: WebKit Reporter: Tobias Markus <tobbi.bugs>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: abarth, ap, bzbarsky, eric, me
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
testcase
none
updated test case none

Tobias Markus
Reported 2011-07-29 22:03:04 PDT
Created attachment 102424 [details] testcase As per https://bugzilla.mozilla.org/show_bug.cgi?id=675399#c1 and http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#dom-document-write, calling of document.write after parsing is done should trigger a new document object to be created (please refer to that bug for proper explanation: --- You're calling document.write() after parsing is done. Per http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#dom-document-write step 3, this triggers a call to open(). Then http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#dom-document-open step 12 replaces the window associated with the document with a new window. The list of timeouts is attached to the old window, so goes away. WebKit just gets this wrong. Please report the problem to them.... ---
Attachments
testcase (255 bytes, text/html)
2011-07-29 22:03 PDT, Tobias Markus
no flags
updated test case (276 bytes, text/html)
2011-08-01 15:53 PDT, Alexey Proskuryakov
no flags
Alexey Proskuryakov
Comment 1 2011-08-01 15:53:14 PDT
Created attachment 102580 [details] updated test case That text means that the first call to document.write() after parsing is done should replace original content, and that's what happens in both WebKit And Gecko. But why does the insertion point become undefined after the first document.write()?
Boris Zbarsky
Comment 2 2011-08-01 17:43:06 PDT
The issue is not the insertion point. The issue is that the open() should clear the interval (because it sets up a new Window), but doesn't seem to in WebKit.
Alexey Proskuryakov
Comment 3 2011-08-01 21:44:38 PDT
Thanks, that makes sense. We don't set up a new document or window on document.open() though, we just remove all children of the existing document, and do some other cleanup. But custom properties all survive, too. This doesn't feel like a typical WebKit bug, perhaps we're matching IE or older Gecko.
Adam Barth
Comment 4 2011-08-02 00:07:33 PDT
I don't know the history of why we have the current behavior, but we should probably match other browsers.
Note You need to log in before you can comment on or make changes to this bug.