<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>65407</bug_id>
          
          <creation_ts>2011-07-29 22:03:04 -0700</creation_ts>
          <short_desc>Webkit doesn&apos;t clear timeouts and intervals when open() is called on a document that&apos;s not already open</short_desc>
          <delta_ts>2011-08-28 06:44:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tobias Markus">tobbi.bugs</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>ap</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>eric</cc>
    
    <cc>me</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>444250</commentid>
    <comment_count>0</comment_count>
      <attachid>102424</attachid>
    <who name="Tobias Markus">tobbi.bugs</who>
    <bug_when>2011-07-29 22:03:04 -0700</bug_when>
    <thetext>Created attachment 102424
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&apos;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....
---</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>444949</commentid>
    <comment_count>1</comment_count>
      <attachid>102580</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-08-01 15:53:14 -0700</bug_when>
    <thetext>Created attachment 102580
updated test case

That text means that the first call to document.write() after parsing is done should replace original content, and that&apos;s what happens in both WebKit And Gecko. But why does the insertion point become undefined after the first document.write()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>445033</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-08-01 17:43:06 -0700</bug_when>
    <thetext>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&apos;t seem to in WebKit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>445100</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-08-01 21:44:38 -0700</bug_when>
    <thetext>Thanks, that makes sense. We don&apos;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&apos;t feel like a typical WebKit bug, perhaps we&apos;re matching IE or older Gecko.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>445128</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-08-02 00:07:33 -0700</bug_when>
    <thetext>I don&apos;t know the history of why we have the current behavior, but we should probably match other browsers.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>102424</attachid>
            <date>2011-07-29 22:03:04 -0700</date>
            <delta_ts>2011-08-01 15:53:14 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>testcase.html</filename>
            <type>text/html</type>
            <size>255</size>
            <attacher name="Tobias Markus">tobbi.bugs</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgoJPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPgoJZnVuY3Rpb24g
aW5jcmVtZW50KCkgeyAKCQlkb2N1bWVudC53cml0ZSgiYSIpOwoJfQoKCXZhciBJRCA9IGRvY3Vt
ZW50LmFkZEV2ZW50TGlzdGVuZXIoIkRPTUNvbnRlbnRMb2FkZWQiLCBmdW5jdGlvbigpIHsgd2lu
ZG93LnNldEludGVydmFsKCJpbmNyZW1lbnQoKTsiLCAxMDAwKTsgfSk7Cgk8L3NjcmlwdD4KPC9o
ZWFkPgo8Ym9keT4KPC9ib2R5Pgo8L2h0bWw+
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>102580</attachid>
            <date>2011-08-01 15:53:14 -0700</date>
            <delta_ts>2011-08-01 15:53:14 -0700</delta_ts>
            <desc>updated test case</desc>
            <filename>testcase.html</filename>
            <type>text/html</type>
            <size>276</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGh0bWw+PGhlYWQ+Cgk8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+CglmdW5jdGlvbiBp
bmNyZW1lbnQoKSB7CgkJZG9jdW1lbnQud3JpdGUoImEiKTsKCX0KCgl2YXIgSUQgPSBkb2N1bWVu
dC5hZGRFdmVudExpc3RlbmVyKCJET01Db250ZW50TG9hZGVkIiwgZnVuY3Rpb24oKSB7IHdpbmRv
dy5zZXRJbnRlcnZhbCgiaW5jcmVtZW50KCk7IiwgMTAwMCk7IH0sIGZhbHNlKTsKCTwvc2NyaXB0
Pgo8L2hlYWQ+Cjxib2R5PgpPcmlnaW5hbCBjb250ZW50CjwvYm9keT48L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>