<?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>24137</bug_id>
          
          <creation_ts>2013-12-19 12:17:07 +0000</creation_ts>
          <short_desc>I think the fetching stops working per spec after the document has unloaded, since the document isn&apos;t fully active at that point (or maybe the document even gets discarded before all ping URLs have started fetching)</short_desc>
          <delta_ts>2019-03-29 21:24:45 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#hyperlink-auditing</bug_file_loc>
          <status_whiteboard>blocked on dependencies</status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          <dependson>24080</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>annevk</cc>
    
    <cc>d</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97804</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-12-19 12:17:07 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html
Multipage: http://www.whatwg.org/C#hyperlink-auditing
Complete: http://www.whatwg.org/c#hyperlink-auditing
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html

Comment:
I think the fetching stops working per spec after the document has unloaded,
since the document isn&apos;t fully active at that point (or maybe the document
even gets discarded before all ping URLs have started fetching)

Posted from: 90.230.218.37 by simonp@opera.com
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.19 Safari/537.36 OPR/19.0.1326.9 (Edition Next)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97981</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-03 22:08:00 +0000</bug_when>
    <thetext>Why would they stop working? The queued tasks don&apos;t get processed, but they&apos;re no-ops anyway, so that&apos;s fine. The rest of the algorithm works irrespective of whether the document is active or not, at least as specced in the HTML spec. Is it different in fetch.spec.whatwg.org?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98073</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-01-07 13:52:52 +0000</bug_when>
    <thetext>At least step 10 in http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resources.html#fetch seems problematic...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98146</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-08 19:25:52 +0000</bug_when>
    <thetext>Why? It&apos;s still associated with a browsing context, no?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98151</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-01-08 20:06:53 +0000</bug_when>
    <thetext>It&apos;s not clear to me that a document that has been discarded is associated with a browsing context.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98214</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-09 18:57:17 +0000</bug_when>
    <thetext>Why would it not be? Does anything disassociate it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98230</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-01-09 21:34:45 +0000</bug_when>
    <thetext>Hmmmmm. Maybe not... It seems hard to reason about a document that is no longer in memory.

But at least *this* seems like a problem:

&quot;Cancel any instances of the fetch algorithm in the context of this Document&quot;

http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#abort-a-document

called from

http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#discard-a-document</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98384</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-14 00:07:18 +0000</bug_when>
    <thetext>The spec doesn&apos;t say anything about it not being in memory, technically. :-)

But yeah, the cancelation is an issue...

We could make the ping=&quot;&quot;s not be associated with a document, or something. Or pass a special argument to &quot;fetch&quot; that makes it safe from &quot;abort&quot;. Or use something other than &quot;fetch&quot;, somehow. Anne, any preferences?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98406</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-14 10:29:10 +0000</bug_when>
    <thetext>So Fetch doesn&apos;t have that step 10 or knowledge of a Document object. The fetch algorithm defined in Fetch can be cancelled.

So HTML should probably track ongoing fetches and cancel them once a Document is collected. Having that collection is also useful for http://www.w3c-test.org/webperf/specs/ResourceTiming/ and company I guess.

Does that make sense?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98447</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-14 19:14:04 +0000</bug_when>
    <thetext>Checking that steps like that are not removed is one of the things that I need to do before moving to the fetch spec. :-)

But that seems somewhat orthogonal to this bug. This bug is about how to _not_ cancel specific ongoing fetches in some circumstances.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98481</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-15 09:33:47 +0000</bug_when>
    <thetext>So the Fetch standard definitely supports that, since there is no intertwingling. I try to write it from the perspective of the whole thing being on a distinct thread and I&apos;d like to not bridge that even for specification convenience as I think it&apos;ll make things easier down the road (with service workers and other such features).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98528</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-15 22:23:24 +0000</bug_when>
    <thetext>Well you presumably have _some_ intertwingling, since you have to push things onto the event loop, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98563</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-16 10:50:32 +0000</bug_when>
    <thetext>Yeah, I do assume an event loop at the moment. I see that mostly as messaging things back out of the thread.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98632</commentid>
    <comment_count>13</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-16 17:17:22 +0000</bug_when>
    <thetext>So what Document are you associating those tasks with?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98692</commentid>
    <comment_count>14</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-17 11:11:52 +0000</bug_when>
    <thetext>It just puts them on the networking task source. I didn&apos;t know you had to explicitly associate with a document. Where is that done?

I see the problem though. Do you have some other way in mind to fix this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98722</commentid>
    <comment_count>15</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-17 21:39:39 +0000</bug_when>
    <thetext>All tasks have a document associated with them, so that the event loop knows whether to run them or not (it skips tasks associated with inactive documents).

This specific bug probably needs a way to invoke fetch that just makes a disassociated fetch that doesn&apos;t ever come back to us, and can&apos;t be canceled. Which is probably what all fetches are in the Fetch spec currently, but that shouldn&apos;t be. If that makes sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98957</commentid>
    <comment_count>16</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-23 20:07:05 +0000</bug_when>
    <thetext>It makes sense. So maybe you should pass fetch a task source for it to use? What you say does not make sense for workers, or does it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99048</commentid>
    <comment_count>17</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-24 23:43:46 +0000</bug_when>
    <thetext>It wouldn&apos;t be a task queue, those are shared between documents (they&apos;re a property of the event loop). It&apos;d be a document, as far as I can tell. And presumably these tasks would just explicitly pass null as the document.

Workers as specced are broken as far as this goes currently. Their tasks aren&apos;t associated with documents, but they have dedicated event loops so the document-based filtering should just be ignored. Filed bug 24390.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99054</commentid>
    <comment_count>18</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-24 23:50:48 +0000</bug_when>
    <thetext>So is the idea that you either pass in a document or a worker to fetch and fetch than creates tasks with them?

Even so, if the document goes away, it seems it would need to cancel fetch explicitly unless it wants the request to continue.

I&apos;m still a bit uneasy about this setup as fetch is in a different thread. And I know we don&apos;t have to worry too much about it in English-land, but I feel like not caring might bite us later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99190</commentid>
    <comment_count>19</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-27 20:07:14 +0000</bug_when>
    <thetext>Well at the end of the day, the tasks sent back from fetch for all cases except ping=&quot;&quot; (and Beacon, I guess) need to end up on an event loop, and we have to (a) pick the right event loop, and (b) annotate the tasks in the way the event loop needs (which, for browsing context event loops, means knowing what document the task is for). I don&apos;t really mind how we do this, whether it&apos;s by passing in a lambda, or passing in opaque data, or passing in explicit data, or whatever.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99368</commentid>
    <comment_count>20</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-28 23:30:49 +0000</bug_when>
    <thetext>(I&apos;m going to punt on fixing this specific ping=&quot;&quot; bug until I integrate with the fetch spec, so that I don&apos;t have to worry about fixing my version of fetch=&quot;&quot; when I know I&apos;m just going to defer to Anne&apos;s eventually anyway.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99446</commentid>
    <comment_count>21</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-30 00:22:45 +0000</bug_when>
    <thetext>So besides caring about the document or worker, don&apos;t we also care about which fetch operation the tasks are for? Do you have any suggestions for an interface that works for you?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100045</commentid>
    <comment_count>22</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-07 18:22:54 +0000</bug_when>
    <thetext>Well presumably the tasks queued by a particular fetch algorithm instance are for that particular fetch algorithm instance, no? That seems implicit and obvious.

The interface I use in HTML now is sufficient, I think. I just talk about &quot;the tasks queued by the fetch algorithm&quot; or some such.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100074</commentid>
    <comment_count>23</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-07 23:47:20 +0000</bug_when>
    <thetext>We should take the discussion of how to edit fetch to another bug, btw. e.g. bug 24080.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114231</commentid>
    <comment_count>24</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-30 11:34:32 +0000</bug_when>
    <thetext>See also bug 23878.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128316</commentid>
    <comment_count>25</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-12-13 14:15:37 +0000</bug_when>
    <thetext>Anne, I believe all this works these days, right? Please reopen if not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128318</commentid>
    <comment_count>26</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-12-13 18:10:42 +0000</bug_when>
    <thetext>Tentatively reopening since I&apos;m pretty sure cancelation and how document lifetimes influence fetch is still very poorly defined.

I think we need to start with defining the lifetimes of groups of browsing contexts, browsing contexts, globals, and documents, and then figure out how those related to fetches. And then at some point what that means for an individual fetch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129698</commentid>
    <comment_count>27</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2019-03-29 21:24:45 +0000</bug_when>
    <thetext>https://github.com/whatwg/html/issues/4483</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>