From 7c5555a16f2920c02244c10756bb2f1a11e87a22 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 11 Sep 2015 11:54:24 +0200 Subject: [PATCH] Integrate Fetch into HTML This is not a perfect rewrite, but provides a much more solid basis for implementations and future work. Follow up fixes will be needed to create a more uniform whole. (See #151, #156, and #158.) Fixes: * https://www.w3.org/Bugs/Public/show_bug.cgi?id=24080 * https://www.w3.org/Bugs/Public/show_bug.cgi?id=24613 * https://www.w3.org/Bugs/Public/show_bug.cgi?id=24659 * #95 * #106 * #140 --- source | 1979 ++++++++++++++++++++++++-------------------------------- 1 file changed, 834 insertions(+), 1145 deletions(-) diff --git a/source b/source index 9c6cc00bac0..65241785afe 100644 --- a/source +++ b/source @@ -432,7 +432,7 @@ Web platform specification stack relative to other specifications can be best summed up as follows:

- +

Other code fragments are marked up like this.

+

Byte sequences with bytes in the range 0x00 to 0x7F, inclusive, are marked up like `this`.

+

Variables are marked up like this.

In an algorithm, steps in synchronous @@ -2745,12 +2748,6 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

  • Referer header -

    The following term is defined in the Web Origin specification:

    - - -

    The following terms are defined in the Cookie specification:

    + +

    then unless the user agent cannot support images, or its support for images has been disabled, + or the user agent only fetches images on demand, or the src + attribute's value is the empty string, the user agent must resolve the value of the src + attribute value, relative to the element, and if that is successful, run these substeps:

    + +
      +
    1. Let request be a new request whose + url is the resulting absolute URL, + client is the element's node document's + Window object's environment settings object, type is "image", destination is "subresource", + omit-Origin-header flag is set, credentials mode is "include", and whose use-URL-credentials flag is set.

    2. + +
    3. Fetch request.

    4. +

    Fetching the image must delay the load event of the element's node document until the task that is queued by the - networking task source once the resource has been fetched - (defined below) has been run.

    + networking task source once the resource has been fetched (defined below) has been + run.

    If the image was successfully obtained, with no network errors, and the image's type is a supported image type, and the image is a valid image of that type, then the image is said to be available. If this is true before the image is completely downloaded, each task that is queued by the networking task source while the image is being fetched must update the presentation of the image appropriately.

    + task">queued by the networking task source while the image is being fetched + must update the presentation of the image appropriately.

    The user agent should apply the image sniffing rules to determine the type of the image, with the image's task that is queued by - the networking task source once the resource has been fetched, must, if the download was successful and the image is available, queue a task to fire a simple - event named load at the input element; and - otherwise, if the fetching process fails without a response from the remote server, or completes - but the image is not a valid or supported image, queue a task to fire a simple - event named error on the input element.

    +

    The task that is queued + by the networking task source once the resource has been fetched, must, if the + download was successful and the image is available, + queue a task to fire a simple event named load at the input element; and otherwise, if the fetching + process fails without a response from the remote server, or completes but the image is not a valid + or supported image, queue a task to fire a simple event named error on the input element.


    @@ -56416,9 +56091,8 @@ fur
  • Let the form's planned navigation be null.

  • Navigate target browsing context to - the particular resource destination. If replace is - true, then target browsing context must be navigated with - replacement enabled.

    + destination. If replace is true, then target browsing + context must be navigated with replacement enabled.

    @@ -56499,9 +56173,12 @@ fur of form document, then abort these steps.

    [or do CORS] (this is commented out since only POST can trigger this now, and that's historically unrestricted)--> -

    Otherwise, plan to navigate to action using the HTTP - method given by method and with entity body as the - entity body, of type MIME type.

    +

    Otherwise, plan to navigate to a new request whose url is + action, method is method, + header list consists of Content-Type/MIME type, and body is entity body.

    @@ -59913,13 +59590,18 @@ dictionary RelatedEventInit : EventInit { event named error at the element, and abort these steps.

  • -
  • +
  • Let request be the result of creating a potential-CORS request given the + resulting absolute URL and the current state of the element's + crossorigin content attribute.

  • + +
  • Set request's client to the + element's node document's Window object's environment settings + object and type to "script".

  • -

    Do a potentially CORS-enabled fetch of the resulting - absolute URL, with the mode being the current state of the element's crossorigin content attribute, the origin being - the origin of the script element's node document, and the - default origin behaviour set to taint.

    +
  • +

    Fetch request.

    The resource obtained in this fashion can be either CORS-same-origin or CORS-cross-origin. This only affects how error reporting happens.

    @@ -59963,9 +59645,9 @@ dictionary RelatedEventInit : EventInit { that created the element.

    The task that the networking task source - places on the task queue once the fetching algorithm - has completed must set the element's "ready to be parser-executed" flag. The - parser will handle executing the script.

    + places on the task queue once fetching has completed must set the element's + "ready to be parser-executed" flag. The parser will handle executing the + script.

    @@ -59982,9 +59664,9 @@ dictionary RelatedEventInit : EventInit { script per Document at a time.)

    The task that the networking task source - places on the task queue once the fetching algorithm - has completed must set the element's "ready to be parser-executed" flag. The - parser will handle executing the script.

    + places on the task queue once fetching has completed must set the element's + "ready to be parser-executed" flag. The parser will handle executing the + script.

    @@ -60021,8 +59703,8 @@ dictionary RelatedEventInit : EventInit { element at the time the prepare a script algorithm started.

    The task that the networking task source - places on the task queue once the fetching algorithm - has completed must run the following steps:

    + places on the task queue once fetching has completed must run the following + steps:

      @@ -60056,9 +59738,9 @@ dictionary RelatedEventInit : EventInit { prepare a script algorithm started.

      The task that the networking task source - places on the task queue once the fetching algorithm - has completed must execute the script block and then remove the element from the - set of scripts that will execute as soon as possible.

      + places on the task queue once fetching has completed must execute the + script block and then remove the element from the set of scripts that will + execute as soon as possible.

      @@ -60077,8 +59759,8 @@ dictionary RelatedEventInit : EventInit {

      Fetching an external script must delay the load event of the element's node document until the task that is queued - by the networking task source once the resource has been fetched (defined above) has been run.

      + by the networking task source once the resource has been fetched (defined above) has + been run.

      The pending parsing-blocking script of a Document is used by the Document's parser(s).

      @@ -60263,8 +59945,9 @@ dictionary RelatedEventInit : EventInit { the environment settings object of the script element's node document's Window object.

      -

      If the script came from a resource that was fetched in the - steps above, and the resource was CORS-cross-origin, then pass the muted errors flag to the create a script algorithm as well.

      +

      If the script came from a resource that was fetched in the steps above, and the resource + was CORS-cross-origin, then pass the muted errors flag to the + create a script algorithm as well.

      This is where the script is compiled and actually executed.

      @@ -80203,8 +79886,7 @@ x === this; // true
      If a Document was obtained in some other manner (e.g. a data: URL typed in by the user or that was returned as the - location of an HTTP redirect (or equivalent - in other protocols), a Document created using the Document created using the createDocument() API, etc)
      @@ -80263,7 +79945,7 @@ x === this; // true
      If the media data is CORS-cross-origin
      The origin is a globally unique identifier assigned when the media - data is fetched.
      + data is fetched.
      If the media data is CORS-same-origin
      @@ -81401,8 +81083,8 @@ x === this; // true
    1. If the current entry in the session history represents a non-GET request - (e.g. it was the result of a POST submission) then update it to instead represent a GET request - (or equivalent).

    2. + (e.g. it was the result of a POST submission) then update it to instead represent a GET + request.

    3. @@ -81788,9 +81470,10 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O
    4. If mode is normal navigation, then act as if the assign() method had been called with value as its argument. Otherwise, act as if the replace() method had been called with value as its argument.

    5. + data-x="dom-location-assign">assign() method had been called with value as its + argument. Otherwise, act as if the replace() method + had been called with value as its argument.

    @@ -82028,18 +81711,19 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O address">address of the active document of the browsing context being navigated; if all the components of the resulting parsed URLs, ignoring any fragment components, are - identical, and the new resource is to be fetched using HTTP GET or equivalent, and the parsed URL of the - new resource has a fragment component that is not null - (even if it is empty), then navigate to that fragment - identifier and abort these steps.

  • + identical, and the new resource is to be fetched using `GET`, and the + parsed URL of the new resource has a fragment component that is not null (even if it is empty), + then navigate to that fragment identifier and abort these + steps.

  • If gone async is false, cancel any preexisting but not yet mature attempt to navigate the browsing - context, including canceling any instances of the fetch algorithm started by - those attempts. If one of those attempts has already created and initialised a new Document object, abort that Document also. (Navigation attempts that have , including canceling any instances of the fetch algorithm started by those attempts. If one of those attempts + has already created and initialised a new + Document object, abort that + Document also. (Navigation attempts that have matured already have session history entries, and are therefore handled during the update the session history with the new page algorithm, later.)

  • @@ -82180,14 +81864,15 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O
  • Process results: If the result of executing the script is void (there is no return - value), then the result of obtaining the resource for the URL is equivalent to an HTTP resource with an HTTP - 204 No Content response.

    - -

    Otherwise, the result of obtaining the resource for the URL is equivalent to an HTTP resource with a 200 OK - response whose Content-Type metadata is - text/html and whose response body is the return value converted to a string + value), then the result of obtaining the resource for the URL is a response whose + status is 204.

    + +

    Otherwise, the result of obtaining the resource for the URL is a response whose header list consists of Content-Type/text/html and whose body is the return value converted to a string value.

    When it comes time to set the document's address in the 1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O -

    If the new resource is to be fetched using HTTP GET or equivalent, and there are relevant application caches that are identified by a URL with the - same origin as the URL in question, and that have this URL as one of their - entries, excluding entries marked as foreign, - and whose mode is If the new resource is to be fetched using `GET`, and there are + relevant application caches that are + identified by a URL with the same origin as the URL in question, and that have + this URL as one of their entries, excluding entries marked as foreign, and whose mode is fast, and the user agent is not in a mode where it will avoid using application caches
    -

    Fetch the resource from the most - appropriate application cache of those that match.

    +

    Fetch the resource from the most appropriate + application cache of those that match.

    For example, imagine an HTML page with an associated application cache displaying an image and a form, where the image is also used by several other application @@ -82240,36 +81925,53 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O agent will not use an application cache at all; the submission will be made to the network.

    +

    This still needs to be integrated with the Fetch + standard.

    +
    Otherwise
    -

    Fetch the new resource, with the manual redirect flag - set.

    +
      +
    1. Let request be the new resource.

    2. + +
    3. If request is a URL, set request to a new request whose url + is request.

    4. + +
    5. Set request's client to the + source browsing context's active document's Window + object's environment settings object, target browsing context to the + browsing context being navigated, and redirect mode to "manual".

    6. + +
    7. Set request's omit-Origin-header flag. + +

    8. If request's method is not + `GET`, or, if the navigation algorithm + was invoked as a result of the form submission + algorithm, then if there is an origin of the active document + of the source browsing context, unset request's + omit-Origin-header flag.

    9. + +
    10. Otherwise, if the browsing context being navigated is a child + browsing context, and the browsing context container of the + browsing context being navigated has a browsing context scope + origin, set request's origin + to that browsing context scope origin and unset request's + omit-Origin-header flag.

    11. + +
    12. Fetch request.

    13. +
    -

    If the steps above invoked the fetch algorithm, the following requirements also - apply:

    - -

    If the resource is being fetched using a method other than one equivalent to HTTP's GET, or, if the navigation algorithm was invoked as a - result of the form submission algorithm, then the - fetching algorithm must be invoked from the origin of - the active document of the source browsing context, if any.

    - -

    Otherwise, if the browsing context being navigated is a child browsing - context, then the fetching algorithm must be invoked from the - browsing context scope origin of the browsing context container of the - browsing context being navigated, if it has one.

    -
  • @@ -82314,16 +82016,15 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O
  • Fallback in prefer-online mode: If the resource was not fetched from an - application cache, and was to be fetched using HTTP GET or equivalent, and there are relevant application caches that are identified by a URL with the - same origin as the URL in question, and that have this URL as one of their entries, - excluding entries marked as foreign, and whose - mode is application cache, and was to be fetched using `GET`, and + there are relevant application caches that are + identified by a URL with the same origin as the URL in question, and that have this + URL as one of their entries, excluding entries marked as foreign, and whose mode is prefer-online, and the user didn't cancel the navigation attempt during the earlier step, and the navigation attempt failed (e.g. the server - returned a 4xx or 5xx status code or - equivalent, or there was a DNS error), then:

    + returned a 4xx or 5xx status, or there was a DNS error), then:

    Let candidate be the resource identified by the URL in question from the most appropriate application cache of those that @@ -82340,26 +82041,25 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O

    This does not affect the address of the resource from which Request-URIs are obtained, as used to set the document's referrer in the initialise the Document object steps below; they still use the value as computed by the - original fetch algorithm.

    + original fetch algorithm.

  • Fallback for fallback entries: If the resource was not fetched from an - application cache, and was to be fetched using HTTP GET or equivalent, and its URL matches the fallback namespace of one or more - relevant application caches, and the most appropriate application cache of those that match - does not have an entry in its online + application cache, and was to be fetched using `GET`, and + its URL matches the fallback namespace + of one or more relevant application caches, and + the most appropriate application cache of those + that match does not have an entry in its online whitelist that has the same origin as the resource's URL and that is a prefix match for the resource's URL, and the user didn't cancel the navigation attempt during the earlier step, and the navigation attempt failed (e.g. the server returned a - 4xx or 5xx status code or equivalent, or - there was a DNS error), then:

    + 4xx or 5xx status, or there was a DNS error), then:

    Let candidate be the fallback resource specified for the fallback @@ -82378,7 +82078,7 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O

    This does not affect the address of the resource from which Request-URIs are obtained, as used to set the document's referrer in the initialise the Document object steps below; they still use the value as computed by the - original fetch algorithm.

    + original fetch algorithm.

  • @@ -82484,14 +82184,10 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O

    Setting the document's address: If there is no override URL, then any Document created by these steps must have its address set to the URL that was - originally to be fetched, ignoring any other data that was used to - obtain the resource (e.g. the entity body in the case of a POST submission is not part of - the document's address, nor is the URL of the fallback resource in the case of the - original load having failed and that URL having been found to match a fallback namespace). However, if there is - an override URL, then any Document created by these steps must have - its address set to that URL - instead.

    + originally to be fetched, ignoring any other data that was used to obtain the resource. However, + if there is an override URL, then any Document created by + these steps must have its address set to that + URL instead.

    An override URL is set when dereferencing a javascript: URL and when @@ -82513,9 +82209,9 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O attribute of the Window object to point to the new Document.

  • Set the document's referrer to the address of the resource from which - Request-URIs are obtained as determined when the fetch algorithm obtained the - resource, if that algorithm was used and determined such a value; otherwise, set it to the - empty string.

  • + Request-URIs are obtained as determined when the fetch algorithm obtained the resource, if + that algorithm was used and determined such a value; otherwise, set it to the empty + string.

  • Implement the sandboxing for the Document.

  • @@ -82687,9 +82383,9 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O initialise the Document object, and finally create an HTML parser and associate it with the Document. Each task that the networking task source places on the - task queue while the fetching algorithm runs must then - fill the parser's input byte stream with the fetched bytes and cause the HTML - parser to perform the appropriate processing of the input stream.

    + task queue while fetching runs must then fill the parser's input byte + stream with the fetched bytes and cause the HTML parser to perform the + appropriate processing of the input stream.

    The input byte stream converts bytes into characters for use in the tokenizer. This process relies, in part, on character encoding @@ -82780,9 +82476,9 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O that a leading LF in the text/plain stream doesn't get eaten itself-->, and switch the HTML parser's tokenizer to the PLAINTEXT state. Each task that the networking task source places on the - task queue while the fetching algorithm runs must then - fill the parser's input byte stream with the fetched bytes and cause the HTML - parser to perform the appropriate processing of the input stream.

    + task queue while fetching runs must then fill the parser's input byte + stream with the fetched bytes and cause the HTML parser to perform the + appropriate processing of the input stream.

    The rules for how to convert the bytes of the plain text document into actual characters, and the rules for actually rendering the text to the user, are defined in RFC 2046, RFC 3676, and @@ -83719,14 +83415,14 @@ dictionary PageTransitionEventInit : EventInit { Document's salvageable state to false also.

    -
  • Cancel any instances of the fetch algorithm in the context of - this Document, discarding any tasks queued for them, and discarding any further data received from the - network for them. If this resulted in any instances of the fetch - algorithm being canceled or any queued tasks or any network data getting discarded, then set the - Document's salvageable state to - false.

  • +
  • Cancel any instances of the fetch algorithm in the + context of this Document, discarding any tasks + queued for them, and discarding any further data received from + the network for them. If this resulted in any instances of the fetch algorithm being canceled or any queued tasks or any network data getting + discarded, then set the Document's salvageable state to false.

  • If the Document has an active parser, then abort that parser and set the Document's

  • +
  • Let request be a new request whose + url is manifest URL, client is null, destination is "subresource", + omit-Origin-header flag is set, referrer is "no-referrer", + synchronous flag is set, credentials + mode is "include", and whose use-URL-credentials + flag is set.

  • +
  • -

    Fetching the manifest: Fetch the resource from manifest URL with the blocking flag set, and let manifest be that resource. HTTP caching semantics should be honored for this - request. The override referrer source must be null.

    +

    Fetching the manifest: Let manifest be the result of fetching request. HTTP caching semantics should be + honored for this request.

    -

    Parse manifest according to the rules for - parsing manifests, obtaining a list of explicit - entries, fallback entries and the Parse manifest's body according to the + rules for parsing manifests, obtaining a list of + explicit entries, fallback entries and the fallback namespaces that map to them, entries for the online whitelist, and values for the online whitelist wildcard flag @@ -84929,8 +84636,8 @@ NETWORK:

  • -

    If fetching the manifest fails due to a 404 or 410 response or equivalent, then run these substeps:

    +

    If fetching the manifest fails due to a 404 or 410 response status, then run these + substeps:

      @@ -84983,10 +84690,10 @@ NETWORK:
    1. Otherwise, if fetching the manifest fails in some other way (e.g. the server returns - another 4xx or 5xx response or equivalent, or - there is a DNS error, or the connection times out, or the user cancels the download, or the - parser for manifests fails when checking the magic signature), or if the server returned a - redirect, then run the cache failure steps.

      + another 4xx or 5xx response, or there is a DNS error, or the connection times out, or the user + cancels the download, or the parser for manifests fails when checking the magic signature), or + if the server returned a redirect, then run the cache failure steps.

    2. @@ -84994,8 +84701,8 @@ NETWORK:

      If this is an upgrade attempt and the newly downloaded manifest is byte-for-byte identical to the manifest found in the - newest application cache in cache group, or the server reported it as "304 Not Modified" or equivalent, then run these substeps:

      + newest application cache in cache + group, or the response status is 304, then run these substeps:

        @@ -85011,15 +84718,15 @@ NETWORK: data-x="concept-appcache-pending-masters">list of pending master entries, wait for the resource for this entry to have either completely downloaded or failed.

        -

        If the download failed (e.g. the server returns a 4xx or 5xx response or equivalent, or there is a DNS error, the - connection times out, or the user cancels the download), or if the resource is labeled with - the "no-store" cache directive, then create a task to - fire a simple event that is cancelable named error at the ApplicationCache singleton of - the Document for this entry, if there still is one, and append it to task list. The default action of this event must be, if the user agent - shows caching progress, the display of some sort of user interface indicating to - the user that the user agent failed to save the application for offline use.

        +

        If the download failed (e.g. the server returns a 4xx or 5xx response, or there is a DNS + error, the connection times out, or the user cancels the download), or if the resource is + labeled with the "no-store" cache directive, then create a task to fire a simple event that is cancelable named + error at the ApplicationCache + singleton of the Document for this entry, if there still is one, and append it to + task list. The default action of this event must be, if the user agent shows + caching progress, the display of some sort of user interface indicating to the user + that the user agent failed to save the application for offline use.

        Otherwise, associate the Document for this entry with cache; store the resource for this entry in cache, if it isn't already there, and categorise its entry as a

        -
      1. - -

        Fetch the resource, from the origin of the - URL manifest URL, with the blocking flag set and - the manual redirect flag set. If this is an upgrade attempt, then use the newest application cache in cache group as an HTTP cache, and honor HTTP caching semantics (such as - expiration, ETags, and so forth) with respect to that cache. User agents may also have other - caches in place that are also honored. The override referrer source must be null.

        - -

        If the resource in question is already being downloaded for other reasons then - the existing download process can sometimes be used for the purposes of this step, as defined - by the fetching algorithm.

        - -

        An example of a resource that might already be being downloaded is a large - image on a Web page that is being seen for the first time. The image would get downloaded to - satisfy the img element on the page, as well as being listed in the cache - manifest. According to the rules for fetching that image only need - be downloaded once, and it can be used both for the cache and for the rendered Web page.

        - -
      2. +
      3. Let request be a new request whose + url is URL, client is null, destination is "subresource", origin is + manifest URL's origin, referrer is "no-referrer", + synchronous flag is set, credentials mode is "include", use-URL-credentials flag is set, and redirect mode is "manual".

      4. + +
      5. Fetch request. If this is an + upgrade attempt, then use the newest application cache in cache + group as an HTTP cache, and honor HTTP caching semantics (such as expiration, ETags, and + so forth) with respect to that cache. User agents may also have other caches in place that are + also honored.

      6. -

        If the previous step fails (e.g. the server returns a 4xx or 5xx response or equivalent, or there is a DNS error, or the - connection times out, or the user cancels the download), or if the server returned a redirect, - or if the resource is labeled with the "no-store" cache directive, then run the first - appropriate step from the following list:

        +

        If the previous step fails (e.g. the server returns a 4xx or 5xx response, or there is a + DNS error, or the connection times out, or the user cancels the download), or if the server + returned a redirect, or if the resource is labeled with the "no-store" cache directive, then + run the first appropriate step from the following list:

        @@ -85182,8 +84886,7 @@ NETWORK: -
        If the error was a 404 or 410 HTTP response or equivalent
        +
        If the error was a 404 or 410 HTTP response
        If the resource was labeled with the "no-store" cache directive
        @@ -85283,10 +84986,9 @@ NETWORK: data-x="concept-appcache-pending-masters">list of pending master entries, wait for the resource for this entry to have either completely downloaded or failed.

        -

        If the download failed (e.g. the server returns a 4xx or 5xx response or equivalent, or there is a DNS error, the - connection times out, or the user cancels the download), or if the resource is labeled with the - "no-store" cache directive, then run these substeps:

        +

        If the download failed (e.g. the server returns a 4xx or 5xx response, or there is a DNS + error, the connection times out, or the user cancels the download), or if the resource is + labeled with the "no-store" cache directive, then run these substeps:

          @@ -85332,12 +85034,20 @@ NETWORK: +
        1. Let request be a new request whose + url is manifest URL, client is null, destination is "subresource", + referrer is "no-referrer", + synchronous flag is set, credentials + mode is "include", and whose use-URL-credentials + flag is set.

        2. +
        3. -

          Fetch the resource from manifest URL again, with - the blocking flag set, and let second manifest be that resource. - HTTP caching semantics should again be honored for this request. The override referrer source must be null.

          +

          Let second manifest be the result of fetching request. HTTP caching semantics should again + be honored for this request.

          Since caching can be honored, authors are encouraged to avoid setting the cache headers on the manifest in such a way that the user agent would simply not contact the network @@ -85462,9 +85172,9 @@ NETWORK:

        -

        Attempts to fetch resources as part of the application cache download - process may be done with cache-defeating semantics, to avoid problems with stale or - inconsistent intermediary caches.

        +

        Attempts to fetch resources as part of the application cache download process may + be done with cache-defeating semantics, to avoid problems with stale or inconsistent intermediary + caches.


        @@ -85573,9 +85283,9 @@ NETWORK:
        If document was loaded using HTTP GET or - equivalent, and, there is a manifest URL, and manifest - URL has the same origin as document
        + cache, but it--> was loaded using `GET`, and, there is a + manifest URL, and manifest URL has the same origin as + document
        @@ -85611,20 +85321,22 @@ NETWORK:

        Changes to the networking model

        +

        If "AppCache" is not removed as a feature this + section needs to be integrated into the Fetch standard.

        +

        When a cache host is associated with an application cache whose completeness flag is complete, any and all loads for resources related to that cache host other than those for child browsing contexts must go through the following steps instead of immediately invoking the mechanisms appropriate to that resource's scheme:

        -
          +
            -
          1. If the resource is not to be fetched using the HTTP GET mechanism or equivalent, or if applying the URL +

          2. If the resource is not to be fetched using the GET method, or if applying the URL parser algorithm to both its URL and the application cache's manifest's URL results in two parsed URLs with different scheme components, - then fetch the resource normally and abort these steps.

          3. + then fetch the resource normally and abort these steps.

          4. If the resource's URL is a master entry, the manifest,

            If there is an entry in the application cache's online whitelist that has the same origin as the resource's URL and that is a prefix match for the resource's - URL, then fetch the resource normally and abort these steps.

          5. + URL, then fetch the resource normally and abort these steps.

          6. @@ -85644,25 +85356,26 @@ NETWORK: the application cache that is a prefix match for the resource's URL, then:

            -

            Fetch the resource normally. If this results in a redirect to a resource with - another origin (indicative of a captive portal), or a 4xx or 5xx status code or equivalent, or if there were network errors (but - not if the user canceled the download), then instead get, from the cache, the resource of the - fallback entry corresponding to the fallback namespace f. Abort - these steps.

            +

            Fetch the resource normally. If this results in a redirect to a resource with another + origin (indicative of a captive portal), or a 4xx or 5xx status code, or if there + were network errors (but not if the user canceled the download), then instead get, from the + cache, the resource of the fallback entry + corresponding to the fallback namespace + f. Abort these steps.

          7. If the application cache's online whitelist wildcard flag is open, then fetch the resource normally and abort these steps.

          8. + data-x="concept-appcache-onlinewhitelist-wildcard">online whitelist wildcard flag is + open, then fetch the resource normally and abort these steps.

          9. Fail the resource load as if there had been a generic network error.

          The above algorithm ensures that so long as the online whitelist wildcard flag is blocking, resources that are not present in the online whitelist wildcard flag is + blocking, resources that are not present in the manifest will always fail to load (at least, after the application cache has been primed the first time), making the testing of offline applications simpler.

          @@ -86276,17 +85989,6 @@ interface NavigatorOnLine {
        -
        A referrer source
        - -
        - -

        Either a Document (specifically, the responsible document), or a - URL, which is used by some APIs to determine what value to use for the Referer (sic) header in calls to the fetching algorithm.

        - -
        -
        An API URL character encoding
        @@ -86391,14 +86093,6 @@ interface NavigatorOnLine {
        -
        The referrer source
        -
        - -

        Return the Document with which the Window is currently - associated.

        - -
        -
        The API URL character encoding
        @@ -86875,9 +86569,9 @@ dictionary ErrorEventInit : EventInit {
        Using a resource
        -

        When an algorithm fetches a resource, if the fetching occurs - in a non-blocking fashion then the processing of the resource once some or all of the resource is available - is performed by a task.

        +

        When an algorithm fetches a resource, if the fetching + occurs in a non-blocking fashion then the processing of the resource once some or all of the + resource is available is performed by a task.

        Reacting to DOM manipulation
        @@ -86928,7 +86622,7 @@ dictionary ErrorEventInit : EventInit {

        A user agent may have one storage mutex. This mutex is used to control access to shared state like cookies. At any one point, the storage mutex is either free, or owned by a particular event loop or instance of the fetching algorithm.

        + data-x="concept-fetch">fetching algorithm.

        If a user agent does not implement a storage mutex, it is exempt from implementing the requirements that require it to acquire or release it.

        @@ -90182,8 +89876,7 @@ interface NavigatorContentUtils { data-x="dom-navigator-registerContentHandler">registerContentHandler() or registerProtocolHandler() methods were invoked, and then navigate an appropriate browsing - context to the resulting URL using the GET method (or equivalent for non-HTTP URLs).

        + context to the resulting URL.

        To get the escaped version of the absolute URL of the content in question, the user agent must replace every character in that absolute URL that is not a @@ -91916,35 +91609,41 @@ dictionary EventSourceInit {

      7. Create a new EventSource object.

      8. -
      9. Let CORS mode be

        Let corsAttributeState be Anonymous.

      10. If the second argument is present, and the withCredentials dictionary member has the - value true, then set CORS mode to corsAttributeState to Use Credentials and initialise the new EventSource object's withCredentials attribute to true.

      11. -
      12. Return the new EventSource object, but continue these steps - in parallel.

      13. +
      14. Let request be the result of creating a potential-CORS request given the + resulting absolute URL, corsAttributeState, and with the same-origin + fallback flag set.

      15. -
      16. +
      17. Set request's client to + entry settings object.

      18. -

        Do a potentially CORS-enabled fetch of the resulting absolute - URL using the referrer source specified by the entry settings - object, with the mode being CORS mode, and the origin being the origin specified by the entry settings - object, and process the resource obtained in - this fashion, if any, as described below.

        +
      19. User agents may set Accept/text/event-stream in request's + header list.

      20. -

        The definition of the fetching algorithm (which is - used by CORS) is such that if the browser is already fetching the resource identified by the - given absolute URL, that connection can be reused, instead of a new connection - being established. All messages received up to this point are dispatched immediately, in this - case.

        +
      21. User agents should set Cache-Control/no-cache in + request's header list and set + request's cache mode to "no-store".

      22. -
      23. +
      24. Set EventSource object's request to request.

      25. + +
      26. Return the new EventSource object, but continue these steps + in parallel.

      27. + +
      28. Fetch request.

      @@ -91985,8 +91684,9 @@ dictionary EventSourceInit { for handling the connection define when the value changes.

      The close() method must abort any - instances of the fetch algorithm started for this EventSource object, - and must set the readyState attribute to fetch algorithm started for this + EventSource object, and must set the readyState attribute to CLOSED.

      @@ -92011,6 +91711,8 @@ dictionary EventSourceInit {
        +
      • A request. This must initially be null.
      • +
      • A reconnection time, in milliseconds. This must initially be a user-agent-defined value, probably in the region of a few seconds.
      • @@ -92026,25 +91728,7 @@ dictionary EventSourceInit {

        Processing model

        The resource indicated in the argument to the EventSource - constructor is fetched when the constructor is run.

        - -

        For HTTP connections, the Accept header may be included; if - included, it must contain only formats of event framing that are supported by the user agent (one - of which must be text/event-stream, as described below).

        - -

        If the event source's last event ID - string is not the empty string, then a Last-Event-ID HTTP header must be included with the request, - whose value is the value of the event source's last event ID string, encoded as UTF-8.

        - -

        User agents should use the Cache-Control: no-cache - header in requests to bypass any caches for requests of event sources. (This header is not a custom request header, so the user agent will still use the - CORS simple cross-origin request mechanism.) User agents should ignore HTTP cache - headers in the response, never caching event sources.

        - -
        + constructor is fetched when the constructor is run.

        As data is received, the tasks queued by the networking task source to handle the data must act as follows.

        @@ -92058,34 +91742,24 @@ dictionary EventSourceInit { connection.

        The task that the networking task source places - on the task queue once the fetching algorithm for such a - resource (with the correct MIME type) has completed must cause the user agent to - reestablish the connection in parallel. This applies whether the connection is - closed gracefully or unexpectedly (but does not apply when the fetch algorithm is - canceled by the user agent, e.g. in response to window.stop(), - since in those cases the final task is actually discarded). - It doesn't apply for the error conditions listed below except - where explicitly specified.

        + on the task queue once fetching for such a resource (with the correct MIME + type) has completed must cause the user agent to reestablish the connection + in parallel. This applies whether the connection is closed gracefully or unexpectedly + (but does not apply when fetching is canceled by the user agent, e.g., in response to window.stop(), since in those cases the final task is actually discarded). It doesn't apply for the error + conditions listed below except where explicitly specified.

        HTTP 200 OK responses that have a Content-Type specifying an unsupported type, or that have no Content-Type at all, must cause the user agent to fail the connection.

        -

        HTTP 305 Use Proxy, 401 Unauthorized, and 407 Proxy Authentication Required should be treated - transparently as for any other subresource.

        - -

        HTTP 301 Moved Permanently, 302 Found, 303 See Other, and 307 Temporary Redirect responses are - handled by the fetching and CORS algorithms. In the case of 301 - redirects, the user agent must also remember the new URL so that subsequent requests for this - resource for this EventSource object start with the URL given for the last 301 seen - for requests for this object.

        -

        Network errors that prevents the connection from being established in the first place (e.g. DNS errors), must cause the user agent to reestablish the connection in parallel.

        Any other HTTP response code not listed here, as well as the - cancelation of the fetch algorithm by the user agent (e.g. in response to window.stop() or the user canceling the network connection manually) must cause the user agent to fail the connection.

        -

        For non-HTTP protocols, UAs should act in equivalent ways.

        -

        When a user agent is to announce the connection, the user agent must queue a @@ -92151,15 +91823,22 @@ dictionary EventSourceInit {

          -
        1. If the readyState attribute is not set - to CONNECTING, abort these steps.

        2. +
        3. If the EventSource object's readyState attribute is not set to CONNECTING, abort these steps.

        4. + +
        5. Let request be the EventSource object's request. + +

        6. If the EventSource object's last event ID string is not the empty + string, set Last-Event-ID/last event ID string, encoded as UTF-8, in + request's header list.

        7. -
        8. Perform a potentially CORS-enabled fetch of the absolute - URL of the event source resource, using the same referrer source, and with the - same mode and origin, as those - used in the original request triggered by the EventSource() constructor, and process the resource obtained in - this fashion, if any, as described earlier in this section.

        9. +
        10. Fetch request and process the + response obtained in this fashion, if any, as described earlier in this section.

        @@ -92590,20 +92269,15 @@ data: test

        If a user agent is to forcibly close an EventSource object (this happens when a Document object goes away - permanently), the user agent must abort any instances of the fetch algorithm started - for this EventSource object, and must set the readyState attribute to fetch algorithm started for this EventSource object, + and must set the readyState attribute to CLOSED.

        If an EventSource object is garbage collected while its connection is still open, - the user agent must abort any instance of the fetch algorithm opened by - this EventSource.

        - -

        It's possible for one active network connection to be shared by multiple - EventSource objects and their fetch algorithms, which is why the above - is phrased in terms of aborting the fetch algorithm and not the actual underlying - download.

        + the user agent must abort any instance of the fetch algorithm + opened by this EventSource.

        Implementation advice

        @@ -95717,8 +95391,8 @@ interface WorkerGlobalScope : EventTarget {

        Processing model

        When a user agent is to run a worker for a script with URL - url, an environment settings object settings object, and a referrer source parent referrer source it must run - the following steps:

        + url, an environment settings object settings object, and a + URL referrer it must run the following steps:

          @@ -95744,21 +95418,27 @@ interface WorkerGlobalScope : EventTarget { data-x="concept-appcache-selection">most appropriate application cache of those that match.

          -
        1. +
        2. Let request be a new request whose + url is url, client is settings object, type is "script", destination is "worker" if + worker global scope is a DedicatedWorkerGlobalScope object and "sharedworker" otherwise, referrer + is referrer, synchronous flag is set, mode is "same-origin", credentials mode is "same-origin", and whose use-URL-credentials flag is set.

        3. -

          Attempt to fetch the resource identified by url, from the - origin specified by settings object, using parent referrer source as the referrer source (not using - the referrer source specified by settings object!), and with the blocking flag set and - the force same-origin flag set.

          +
        4. Let response be the result of fetching request.

        5. -

          If the attempt fails, then for each Worker or SharedWorker object - associated with worker global scope, queue a task to fire a simple - event named error at that object. Abort these - steps.

          +
        6. -

          If the attempt succeeds, then let source be the result of running the UTF-8 - decode algorithm on the script resource.

          +

          If response response's status is an ok status, then let + source be the result of running the UTF-8 decode algorithm on + response's body.

          Let language be JavaScript.

          @@ -95768,6 +95448,11 @@ interface WorkerGlobalScope : EventTarget {
        7. +
        8. Otherwise, then for each Worker or SharedWorker object + associated with worker global scope, queue a task to fire a simple + event named error at that object. Abort these + steps.

        9. +
        10. In the newly created execution environment, create a JavaScript global environment whose global object is worker global scope. If worker global scope is a DedicatedWorkerGlobalScope object, then this is a @@ -96049,13 +95734,6 @@ interface AbstractWorker { -

          The referrer source
          -
          - -

          Return script address.

          - -
          -
          The API URL character encoding
          @@ -96229,7 +95907,7 @@ interface Worker : EventTarget {
        11. Run a worker for the script with URL worker URL, the environment settings object settings object, and with the - referrer source specified by the incumbent settings object.

        12. + incumbent settings object's creation URL.

        @@ -96460,7 +96138,7 @@ interface SharedWorker : EventTarget {

        Run a worker for the script with URL scriptURL, the environment settings object settings object, and with the - referrer source specified by the incumbent settings object.

        + incumbent settings object's creation URL.

        @@ -96496,16 +96174,28 @@ partial interface WorkerGlobalScope
      • -

        To get a fetch result, the user agent must attempt to fetch url, from the origin specified by settings object, using the referrer source specified by settings object, and with the blocking flag set.

        +

        To get a fetch result, the user agent must run these steps: -

      • - -
      • - -

        To postprocess the fetch result, the user agent must throw a NetworkError exception and abort all these steps if the fetching attempt failed (e.g. the server returned a 4xx or 5xx status code or equivalent, or there was a DNS error).

        +
          +
        1. Let request be a new request whose + url is url, client is settings object, type is "script", destination is "subresource", synchronous flag is set, credentials mode is "include", and whose use-URL-credentials flag is set.

        2. + +
        3. Return the result of fetching + request. +

      • +
      • To postprocess the fetch result, the user agent must throw a + NetworkError exception and abort all these steps if the fetching attempt failed + (e.g., the server returned a 4xx or 5xx status, or there was a DNS error).

      • +

      The import scripts into worker global scope algorithm has three hooks for algorithm steps that may be customized by any callers: validate the state, get a fetch result, and postprocess the fetch result.

      @@ -99449,8 +99139,7 @@ dictionary StorageEventInit : EventInit { certain. Whenever possible, this should be done without actually contacting the network layer (the bytes should be re-parsed from memory), even if, e.g., the document is marked as not being cacheable. If this is not possible and contacting the network layer would involve repeating - a request that uses a method other than HTTP GET (or - equivalent for non-HTTP URLs), then instead set the GET
      `), then instead set the confidence to certain and ignore the new encoding. The resource will be misinterpreted. User agents may notify the user of the situation, to aid in application development.

      @@ -110578,8 +110267,8 @@ keygen { binding: keygen; } as part of such auditing.

      User agents may allow users to navigate browsing contexts to the resources indicated by - the cite attributes on q, blockquote, + context">browsing contexts to the URLs indicated by the + cite attributes on q, blockquote, ins, and del elements.

      User agents may surface hyperlinks created by link @@ -117959,7 +117648,7 @@ INSERT INTERFACES HERE

      Autodiscovery in HTML/XHTML. In OpenSearch 1.1 Draft 4, Section 4.6.2. OpenSearch.org.
      [ORIGIN]
      -
      The Web Origin Concept, A. Barth. IETF.
      +
      (Non-normative) The Web Origin Concept, A. Barth. IETF.
      [PAGEVIS]
      (Non-normative) Page Visibility, J. Mann, A. Jain. W3C.