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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>12837</bug_id>
          
          <creation_ts>2011-05-31 23:11:52 +0000</creation_ts>
          <short_desc>Define unloading document cleanup steps</short_desc>
          <delta_ts>2016-08-12 08:53:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>XHR</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 3.1</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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="Simon Pieters">zcorpan</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>annevk</cc>
    
    <cc>hsteen</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>48983</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-05-31 23:11:52 +0000</bug_when>
    <thetext>XHR should define unloading document cleanup steps ( http://www.whatwg.org/specs/web-apps/current-work/complete/history.html#unloading-document-cleanup-steps )

if there are open XHRs, close them and make the document unsalvageable</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55293</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-08-17 12:21:00 +0000</bug_when>
    <thetext>This specification defines the following unloading document cleanup steps.

Make disappear any XMLHttpRequest objects that were created by the XMLHttpRequest() constructor  or AnonXMLHttpRequest() constructor whose global object is the Document&apos;s Window object. 

If this affected any XMLHttpRequest objects, the set Document&apos;s salvageable state to false.

If a user agent is to make disappear an XMLHttpRequest object (this happens when a Document object goes away), the user agent must follow the first appropriate set of steps from the following list:

↪If the XMLHttpRequest object is in the OPENED state with the send() flag being true, or the HEADERS_RECEIVED state, or the LOADING state

Act as if the user aborted the cancels the request.

↪Otherwise

Do nothing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55294</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-08-17 12:25:33 +0000</bug_when>
    <thetext>possibly you need to have a way to kill an XHR without firing events, to use when navigating away</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55312</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-08-17 15:58:28 +0000</bug_when>
    <thetext>So why exactly is this not needed for EventSource?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55370</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-08-17 22:51:09 +0000</bug_when>
    <thetext>This is only needed for WebSocket apparently. For HTTP you can just kill the connection.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95942</commentid>
    <comment_count>5</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2013-11-07 13:44:48 +0000</bug_when>
    <thetext>Per Anne&apos;s comment above no spec change is required.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95943</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-11-07 13:49:41 +0000</bug_when>
    <thetext>Are you sure? I&apos;m not a 100% sure. We have a way to terminate without events now so we might want to mention that it should be used here...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95945</commentid>
    <comment_count>7</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2013-11-07 14:15:00 +0000</bug_when>
    <thetext>I&apos;m not 100% sure either, but the referenced document unloading stuff was pretty specific to WebSocket in the details. We probably want to consult some developers and ask if there&apos;s anything we need to say here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95952</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-11-07 14:32:20 +0000</bug_when>
    <thetext>Let&apos;s leave this open until what needs to happen is decided on.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106573</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-05-21 14:31:49 +0000</bug_when>
    <thetext>Looks similar to bug 23878 which I just assigned to Ian. Going to try that with this too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112423</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-29 21:21:27 +0000</bug_when>
    <thetext>I&apos;m confused as to what you want me to do here. Can you elaborate?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113176</commentid>
    <comment_count>11</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-15 08:13:52 +0000</bug_when>
    <thetext>Sorry, I meant to ask you to look at comment 0 and comment 1 to see if there&apos;s anything we need to define here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113238</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-10-15 19:05:38 +0000</bug_when>
    <thetext>Isn&apos;t this an XHR problem? I don&apos;t understand what you&apos;re asking me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113279</commentid>
    <comment_count>13</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-16 08:01:44 +0000</bug_when>
    <thetext>The main problem is that I&apos;m not sure what to do. Whether this is applicable to XMLHttpRequest or not. If this is just about closing the connection, then I think we have that other bug for that about terminating all fetches associated with an environment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113282</commentid>
    <comment_count>14</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-10-16 09:01:35 +0000</bug_when>
    <thetext>You also need to make the document unsalvageable if it closed the connection. IIRC some browsers did this when I filed the bug, but maybe we should check what browsers do today...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113285</commentid>
    <comment_count>15</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-16 09:49:43 +0000</bug_when>
    <thetext>&quot;unsalvageable&quot; is only mentioned in informative text in HTML. And does not include other elements that do fetching. I take it XMLHttpRequest is special in that regard when you tested it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113289</commentid>
    <comment_count>16</comment_count>
      <attachid>1524</attachid>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-10-16 10:22:53 +0000</bug_when>
    <thetext>Created attachment 1524
Demo unloading document, no XHR</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113290</commentid>
    <comment_count>17</comment_count>
      <attachid>1525</attachid>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-10-16 10:23:27 +0000</bug_when>
    <thetext>Created attachment 1525
Demo unloading document, with XHR</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113292</commentid>
    <comment_count>18</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-10-16 10:31:26 +0000</bug_when>
    <thetext>The normative bit is https://html.spec.whatwg.org/multipage/browsers.html#unloading-documents:concept-document-salvageable-8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113295</commentid>
    <comment_count>19</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-16 11:31:30 +0000</bug_when>
    <thetext>https://simon.html5.org/dump/unload-baseline.html
https://simon.html5.org/dump/unload-xhr.html

Given these, it seems there is no difference when using XMLHttpRequest.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115558</commentid>
    <comment_count>20</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-11-26 20:05:39 +0000</bug_when>
    <thetext>I&apos;m sending this back to XHR for now since I don&apos;t really understand what I&apos;m supposed to do here, but please don&apos;t hesitate to send it back to me if there&apos;s something I should be doing. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115610</commentid>
    <comment_count>21</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-11-27 10:22:18 +0000</bug_when>
    <thetext>http://krijnhoetmer.nl/irc-logs/whatwg/20141016#l-568</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127132</commentid>
    <comment_count>22</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-08-12 08:53:35 +0000</bug_when>
    <thetext>Demos still work for me.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1524</attachid>
            <date>2014-10-16 10:22:53 +0000</date>
            <delta_ts>2014-10-16 10:22:53 +0000</delta_ts>
            <desc>Demo unloading document, no XHR</desc>
            <filename>unload-baseline.html</filename>
            <type>text/html</type>
            <size>448</size>
            <attacher name="Simon Pieters">zcorpan</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+CjEKPGEgaHJlZj0nZGF0YTp0ZXh0L2h0bWwsPHNjcmlwdD5zZXRUaW1l
b3V0KGZ1bmN0aW9uKCkgeyBoaXN0b3J5LmJhY2soKTsgfSwgMTAwMCk7PC9zY3JpcHQ+Mic+PC9h
Pgo8c2NyaXB0PgpmdW5jdGlvbiBjbGVhbnVwKCkgewogIGRlbGV0ZSBzZXNzaW9uU3RvcmFnZS5m
b287Cn0KaWYgKHNlc3Npb25TdG9yYWdlLmZvbykgewogIGNsZWFudXAoKTsKICBhbGVydCgiRG9j
dW1lbnQgd2FzIHJlcGFyc2VkIik7Cn0gZWxzZSB7CiAgc2Vzc2lvblN0b3JhZ2UuZm9vID0gImZv
byI7CiAgc2V0VGltZW91dChmdW5jdGlvbigpIHsgZG9jdW1lbnQubGlua3NbMF0uY2xpY2soKTsg
fSwgMTAwMCk7CiAgc2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgIGNsZWFudXAoKTsKICAgIGFs
ZXJ0KCJEb2N1bWVudCBzdXJ2aXZlZCIpCiAgfSwgMzAwMCk7Cn0KPC9zY3JpcHQ+Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1525</attachid>
            <date>2014-10-16 10:23:27 +0000</date>
            <delta_ts>2014-10-16 10:23:27 +0000</delta_ts>
            <desc>Demo unloading document, with XHR</desc>
            <filename>unload-xhr.html</filename>
            <type>text/html</type>
            <size>576</size>
            <attacher name="Simon Pieters">zcorpan</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+CjEKPGEgaHJlZj0nZGF0YTp0ZXh0L2h0bWwsPHNjcmlwdD5zZXRUaW1l
b3V0KGZ1bmN0aW9uKCkgeyBoaXN0b3J5LmJhY2soKTsgfSwgMTAwMCk7PC9zY3JpcHQ+Mic+PC9h
Pgo8c2NyaXB0PgpmdW5jdGlvbiBjbGVhbnVwKCkgewogIGRlbGV0ZSBzZXNzaW9uU3RvcmFnZS5m
b287Cn0KaWYgKHNlc3Npb25TdG9yYWdlLmZvbykgewogIGNsZWFudXAoKTsKICBhbGVydCgiRG9j
dW1lbnQgd2FzIHJlcGFyc2VkIik7Cn0gZWxzZSB7CiAgc2Vzc2lvblN0b3JhZ2UuZm9vID0gImZv
byI7CiAgdmFyIHhociA9IG5ldyBYTUxIdHRwUmVxdWVzdCgpOwogIHhoci5vcGVuKCdHRVQnLCAn
aHR0cDovL3czYy10ZXN0Lm9yZy9pbWFnZXMvZ3JlZW4tMXgxLnBuZz9waXBlPXRyaWNrbGUoZDMp
Jyk7CiAgeGhyLnNlbmQoKTsKICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkgeyBkb2N1bWVudC5saW5r
c1swXS5jbGljaygpOyB9LCAxMDAwKTsKICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkgewogICAgY2xl
YW51cCgpOwogICAgYWxlcnQoIkRvY3VtZW50IHN1cnZpdmVkIikKICB9LCAzMDAwKTsKfQo8L3Nj
cmlwdD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>