From 0c3fbfee5e3ba7281e7dbea1f95b2da3e1bae388 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 7 Jan 2016 17:58:17 +0100 Subject: [PATCH] Clarify callers of the 'resolve a URL' algorithm --- source | 168 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 85 insertions(+), 83 deletions(-) diff --git a/source b/source index 0612f3ca628..1284f04671c 100644 --- a/source +++ b/source @@ -6925,7 +6925,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

If a reflecting IDL attribute is a DOMString attribute whose content attribute is defined to contain a URL, then on getting, the IDL attribute must resolve the value of the content attribute relative to the element - and return the resulting absolute URL if that was successful, or the empty string + and return the resulting absolute URL if that was successful, or the empty string otherwise; and on setting, must set the content attribute to the specified literal value. If the content attribute is absent, the IDL attribute must return the default value, if the content attribute has one, or else the empty string.

@@ -8848,7 +8848,8 @@ partial /*sealed*/ interface Document {
  • Resolve the method's first argument, relative to the API base URL specified by the entry settings object. If this is not - successful, throw a SyntaxError exception and abort these steps. Otherwise, let url be the resulting absolute URL.

  • + successful, throw a SyntaxError exception and abort these steps. Otherwise, let + url be the resulting parsed URL.

  • If the origin of url is not the same as the origin of document, throw a SecurityError exception @@ -11646,7 +11647,7 @@ gave me some of the songs they wrote. I love sharing my music.</p> url (thus, the base's href attribute isn't affected by other base elements).

  • -
  • If the previous step was successful, return the resulting absolute URL and +

  • If the previous step was successful, return the resulting absolute URL and abort these steps.

  • Otherwise, return the empty string.

  • @@ -11804,12 +11805,14 @@ gave me some of the songs they wrote. I love sharing my music.</p>
  • If the previous step fails, then abort these steps.

  • +
  • Otherwise, let url be the resulting parsed URL.

  • +
  • Let corsAttributeState be the current state of the element's crossorigin content attribute.

  • Let request be the result of creating a potential-CORS request given the - absolute URL and corsAttributeState. + data-x="create a potential-CORS request">creating a potential-CORS request given + url and corsAttributeState.

  • Set request's client to the link element's node document's Window object's @@ -12778,9 +12781,10 @@ people expect to have work and what is necessary.

  • Strip any U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), and U+000D CARRIAGE RETURN (CR) characters from url.

  • -
  • Resolve the url value to an - absolute URL, relative to the meta element. If this fails, abort - these steps.

  • +
  • Resolve the url value, relative to the + meta element. If this fails, abort these steps.

  • + +
  • Otherwise, let parsed url be the resulting parsed URL.

  • @@ -12794,7 +12798,7 @@ people expect to have work and what is necessary. redirect and if the meta element's node document's active sandboxing flag set does not have the sandboxed automatic features browsing context flag set, navigate the - Document's browsing context to url, with + Document's browsing context to parsed url, with replacement enabled, and with the Document's browsing context as the source browsing context.

    @@ -12820,7 +12824,7 @@ people expect to have work and what is necessary.
  • Provide the user with an interface that, when selected, navigates a browsing context to - url, with the Document's browsing context as + parsed url, with the Document's browsing context as the source browsing context.

  • Do nothing.

  • @@ -21067,8 +21071,7 @@ interface HTMLHyperlinkElementUtils { navigate to an error page to report the error, or may ignore the error and do nothing. In either case, the user agent must abort these steps.

    -
  • Otherwise, let URL be the resulting absolute - URL.

  • +
  • Otherwise, let URL be the resulting absolute URL.

  • If there is a hyperlink suffix, append it to URL.

  • @@ -23871,15 +23874,16 @@ interface HTMLImageElement : HTMLElement {
      -
    1. Resolve selected source, relative - to the element, and let the result be absolute URL. If that is not successful, then - abort these inner set of steps.

    2. +
    3. Resolve selected source, relative to the + element. + If that is not successful, then abort this inner set of steps. + Otherwise, let absolute URL be the resulting absolute URL.

    4. -
    5. Let key be a tuple consisting of the resulting absolute - URL, the img element's crossorigin - attribute's mode, and, if that mode is not No CORS, - the node document's origin.

    6. +
    7. Let key be a tuple consisting of absolute URL, the + img element's crossorigin attribute's + mode, and, if that mode is not No CORS, the + node document's origin.

    8. If the list of available images contains an entry for key, then set the ignore higher-layer caching flag for that entry, @@ -24859,7 +24863,7 @@ interface HTMLImageElement : HTMLElement { -->

    9. Resolve selected source, - relative to the element, and let the result be absolute URL. + relative to the element, and let absolute URL be the resulting absolute URL. If that is not successful, abort these steps.

    10. ⌛ Let corsAttributeState be the state of the element's audio</a> test instead.)</p>

      Otherwise, resolve the value of the src attribute, relative to the iframe element.

      -

      If that is not successful, then let url be the string - "about:blank". Otherwise, let url be the resulting - absolute URL.

      +

      If that is not successful, then let url be the URL + "about:blank". Otherwise, let url be the resulting parsed + URL.

    11. @@ -27246,7 +27250,7 @@ href="?audio">audio</a> test instead.)</p>
      1. Let request be a new request whose - url is the resulting absolute URL, + url is the resulting parsed URL, client is the element's node document's Window object's environment settings object, destination is "browsing context name of the element's nes

      2. Let request be a new request whose - url is the resulting absolute URL, + url is the resulting parsed URL, client is the element's node document's Window object's environment settings object, destination is "browsing context name of the element's nes then there is no poster frame; abort these steps.

      3. Let request be a new request whose - url is the resulting absolute URL, + url is the resulting parsed URL, client is the element's node document's Window object's environment settings object, type is "image", HTMLAudioElement : HTMLMediaElement {};

        If the element has a src attribute whose value is not the empty string and whose value, when the attribute was set, could be successfully resolved relative to the element, then the element's track - URL is the resulting absolute URL. Otherwise, the element's track + URL is the resulting absolute URL. Otherwise, the element's track URL is the empty string.

        @@ -30052,7 +30056,7 @@ interface HTMLMediaElement : HTMLElement { attribute's value is the empty string, then end the synchronous section, and jump down to the failed with attribute step below.

      4. -
      5. ⌛ Let absolute URL be the absolute URL that +

      6. ⌛ Let absolute URL be the resulting absolute URL that would have resulted from resolving the URL specified by the src attribute's value relative to the media element when the src attribute was last @@ -30132,7 +30136,7 @@ interface HTMLMediaElement : HTMLElement { synchronous section, and jump down to the failed with elements step below.

      7. -
      8. ⌛ Let absolute URL be the absolute URL that +

      9. ⌛ Let absolute URL be the resulting absolute URL that would have resulted from resolving the URL specified by candidate's src attribute's value relative to the candidate when the request whose - url is the resulting absolute URL, + url is the resulting parsed URL, client is the element's node document's Window object's environment settings object, type is "image",

        Resolve the URL action, relative to the submitter element. If this fails, abort these steps.

      10. -
      11. Let action be the resulting absolute URL.

      12. +
      13. Let action be the resulting absolute URL.

      14. -
      15. Let action components be the resulting parsed - URL.

      16. +
      17. Let parsed action be the resulting parsed URL.

      18. Let scheme be the scheme of - the resulting parsed URL.

      19. + parsed action.

      20. Let enctype be the submitter element's enctype.

      21. @@ -56405,8 +56408,6 @@ fur set using the application/x-www-form-urlencoded encoding algorithm, interpreted as a US-ASCII string.

        - -

        Set parsed action's query component to query.

        @@ -59434,7 +59435,7 @@ dictionary RelatedEventInit : EventInit {
      22. Let request be the result of creating a potential-CORS request given the - resulting absolute URL and the current state of the element's + resulting parsed URL and the current state of the element's crossorigin content attribute.

      23. Set request's client to the @@ -69385,7 +69386,7 @@ Demos:

        -

        The value is the absolute URL that results from resolving the value of the element's src attribute relative to the element at the time the attribute is set, or the empty string if there is no such attribute or if resolving it results in an error.

        @@ -69397,7 +69398,7 @@ Demos:
        -

        The value is the absolute URL that results from resolving the value of the element's href attribute relative to the element at the time the attribute is set, or the empty string if there is no such attribute or if resolving it results in an error.

        @@ -69409,7 +69410,7 @@ Demos:
        -

        The value is the absolute URL that results from resolving the value of the element's data attribute relative to the element at the time the attribute is set, or the empty string if there is no such attribute or if resolving it results in an error.

        @@ -80348,7 +80349,7 @@ interface History {
      24. If that fails, throw a SecurityError exception and abort these steps.
      25. -
      26. Compare the resulting parsed URL to the result of applying the URL +
      27. Compare the resulting parsed URL to the result of applying the URL parser algorithm to the document's address. If any component of these two URLs differ other than the path, query, and 1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON O element into a document">inserted into the document, the user agent must resolve the value of that attribute relative to that element, and if that is successful, must apply the URL serialiser - algorithm to the resulting parsed URL with the exclude fragment flag set to + algorithm to the resulting parsed URL with the exclude fragment flag set to obtain manifest URL, and then run the application cache selection algorithm with manifest URL as the manifest URL, passing in the newly-created Document. Otherwise, if the attribute is absent, its value is the empty @@ -84048,7 +84049,7 @@ NETWORK:

        If this fails, then jump back to the step labeled start of line.

        -

        If the resulting parsed URL has a different If the resulting parsed URL has a different scheme component than base URL (the manifest's URL), then jump back to the step labeled start of line.

        @@ -84073,7 +84074,7 @@ NETWORK:

        If either fails, then jump back to the step labeled start of line.

        -

        If the absolute URL corresponding to either part one or +

        If the resulting parsed URL corresponding to either part one or part two does not have the same origin as the manifest's URL, then jump back to the step labeled start of line.

        @@ -84117,7 +84118,7 @@ NETWORK:

        If this fails, then jump back to the step labeled start of line.

        -

        If the resulting parsed URL has a different If the resulting parsed URL has a different scheme component than base URL (the manifest's URL), then jump back to the step labeled start of line.

        @@ -89532,18 +89533,18 @@ interface NavigatorContentUtils { url">resolving the url argument relative to the API base URL specified by the entry settings object is not successful.

        -

        The resulting absolute URL would by definition not be a valid +

        The resulting absolute URL would by definition not be a valid URL as it would include the string "%s" which is not a valid component in a URL.

        -

        User agents must throw a SecurityError exception if the resulting absolute +

        User agents must throw a SecurityError exception if the resulting parsed URL has an origin that differs from the origin specified by the entry settings object.

        This is forcibly the case if the %s placeholder is in the scheme, host, or port parts of the URL.

        -

        The resulting absolute URL is the proto-URL. It identifies the +

        The resulting absolute URL is the proto-URL. It identifies the handler for the purposes of the methods described below.

        When the user agent uses this handler, it must replace the first occurrence of the exact @@ -89794,11 +89795,11 @@ interface NavigatorContentUtils {

      28. If this fails, then throw a SyntaxError exception, aborting the method.

      29. -
      30. If the resulting absolute URL's origin is not the same +

      31. If the resulting parsed URL's origin is not the same origin as the origin specified by the entry settings object, throw a SecurityError exception, aborting the method.

      32. -
      33. Return the resulting absolute URL as the result of preprocessing the +

      34. Return the resulting absolute URL as the result of preprocessing the argument.

      @@ -90479,7 +90480,7 @@ interface MimeType {
    12. If this fails, abort these steps.

    13. -
    14. Process the resulting absolute URL as the URL to an OpenSearch +

    15. Process the resulting absolute URL as the URL to an OpenSearch description document.

    @@ -90508,7 +90509,7 @@ interface MimeType {
  • If this fails, return 0 and abort these steps.

  • Let host2 be the host component - of the resulting parsed URL.

  • + of the resulting parsed URL.

  • @@ -91280,7 +91281,7 @@ dictionary EventSourceInit {
  • Let request be the result of creating a potential-CORS request given the - resulting absolute URL, corsAttributeState, and with the same-origin + resulting parsed URL, corsAttributeState, and with the same-origin fallback flag set.

  • Set request's client to @@ -92236,10 +92237,11 @@ interface WebSocket : EventTarget {


    -

    The url attribute must return the result of - resolving the URL that was passed to the - constructor, with the URL character encoding set to UTF-8. (It doesn't matter what it is resolved - relative to, since we already know it is an absolute URL.)

    +

    The url attribute must return the + resulting absolute URL of resolving the + URL that was passed to the constructor, with the URL character encoding set to UTF-8. + (It doesn't matter what it is resolved relative to, since we already know it is an + absolute URL.)

    The readyState attribute represents the state of the connection. It can have the following values:

    @@ -92808,42 +92810,43 @@ socket.onopen = function () { encoding set to UTF-8.

    -

    It doesn't matter what it is resolved relative to, since we already know it is - an absolute URL at this point.

    +

    Since we already know the url string is an absolute URL, + resolving it will never return an error, and it doesn't + matter what it is resolved relative to.

  • -
  • If the resulting parsed URL does not have a

    If the resulting parsed URL does not have a scheme component whose value is either "ws" or "wss", then fail this algorithm.

  • -
  • If the resulting parsed URL has a non-null

    If the resulting parsed URL has a non-null fragment component, then fail this algorithm.

  • -
  • If the scheme component of the resulting - parsed URL is "ws", set secure to false; +

  • If the scheme component of the resulting + parsed URL is "ws", set secure to false; otherwise, the scheme component is "wss", set secure to true.

  • -
  • Let host be the value of the resulting parsed URL's

    Let host be the value of the resulting parsed URL's host component.

  • -
  • If the resulting parsed URL has a port +

  • If the resulting parsed URL has a port component that is not the empty string, then let port be that component's value; otherwise, there is no explicit port.

  • If there is no explicit port, then: if secure is false, let port be 80, otherwise let port be 443.

  • -
  • Let resource name be the value of the resulting parsed URL's

    Let resource name be the value of the resulting parsed URL's path component (which might be empty).

  • If resource name is the empty string, set it to a single character U+002F SOLIDUS (/).

  • -
  • If the resulting parsed URL has a non-null

    If the resulting parsed URL has a non-null query component, then append a single U+003F QUESTION MARK character (?) to resource name, followed by the value of the query component.