From 32a7a2092eeff52aca78a0224816a9b327893cc6 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 25 Sep 2015 10:47:00 +0200 Subject: [PATCH] Inline URLUtilsReadOnly The URLUtils abstraction is not working out. See #164 and https://github.com/whatwg/url/issues/62 for details. --- source | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 136 insertions(+), 15 deletions(-) diff --git a/source b/source index e0ac68a32e4..dfe9423a5f8 100644 --- a/source +++ b/source @@ -2695,6 +2695,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
  • The fragment component of a parsed URL
  • Parse errors from the URL parser
  • The URL serialiser +
  • The host serialiser +
  • The serialise an integer
  • Default encode set
  • Percent encode
  • UTF-8 percent encode @@ -95256,9 +95258,13 @@ interface WorkerGlobalScope : EventTarget { WorkerGlobalScope object itself.

    The location attribute must - return the WorkerLocation object created for the WorkerGlobalScope - object when the worker was created. It represents the WorkerGlobalScope object's - url.

    + return the WorkerLocation object whose associated WorkerGlobalScope object is + the WorkerGlobalScope object.

    + +

    While the WorkerLocation object is created after the + WorkerGlobalScope object, this is not problematic as it cannot be observed from + script.


    @@ -95572,6 +95578,9 @@ interface WorkerGlobalScope : EventTarget { environment. (In either case, by definition, it is a worker environment.)

  • +
  • Create a new WorkerLocation object and associate it with worker global + scope.

    +
  • Let script be a new script.

    @@ -96393,22 +96402,134 @@ interface WorkerNavigator {};

    Worker locations

    [Exposed=Worker]
    -interface WorkerLocation { };
    -WorkerLocation implements URLUtilsReadOnly;
    +interface WorkerLocation { + stringifier readonly attribute USVString href; + readonly attribute USVString origin; + readonly attribute USVString protocol; + readonly attribute USVString host; + readonly attribute USVString hostname; + readonly attribute USVString port; + readonly attribute USVString pathname; + readonly attribute USVString search; + readonly attribute USVString hash; +}; + +

    A WorkerLocation object has an associated WorkerGlobalScope object (a + WorkerGlobalScope object). + +

    The href attribute's getter must + return the associated WorkerGlobalScope object's + url, serialised.

    + +

    The origin attribute's getter must + return the Unicode serialization of the + associated WorkerGlobalScope + object's url's origin.

    + +

    It returns the Unicode rather than the ASCII serialisation for + compatibility with MessageEvent.

    + +

    The protocol attribute's getter + must run return the associated WorkerGlobalScope object's + url's scheme, followed by ":".

    + +

    The host attribute's getter must run + these steps:

    + +
      +
    1. Let url be the associated WorkerGlobalScope object's + url.

    2. + +
    3. If url's host is null, return the empty + string.

    4. + +
    5. If url's port is null, return + url's host, serialised.

    6. + +
    7. Return url's host, serialised, followed by ":" and url's port, serialised.

    8. +
    + +

    The hostname attribute's getter + must run these steps:

    + +
      +
    1. Let host be the associated WorkerGlobalScope object's + url's host.

    2. + +
    3. If host is null, return the empty string.

    4. + +
    5. Return host serialised.

    6. +
    + +

    The port attribute's getter must run + these steps:

    + +
      +
    1. Let port be the WorkerGlobalScope object's url's port.

    2. + +
    3. If port is null, return the empty string.

    4. + +
    5. Return port, serialised.

    6. +
    + +

    The pathname attribute's getter + must run these steps:

    + +
      +
    1. Let url be the associated WorkerGlobalScope object's + url.

    2. + +
    3. If url's non-relative flag is set, return the first string in + url's path.

    4. -

      A WorkerLocation object represents the WorkerGlobalScope object's - url. +

    5. Return "/", followed by the strings in url's path (including empty strings), separated from each other by + "/".

    6. +
    + +

    The search attribute's getter must + run these steps:

    -

    The WorkerLocation interface supports the URLUtilsReadOnly - interface.

    +
      +
    1. Let query be the associated WorkerGlobalScope object's + url's query.

    2. + +
    3. If query is either null or the empty string, return the empty string.

    4. -

      When the object is created, the user agent must invoke the element's - URLUtilsReadOnly interface's set the - input algorithm with the absolute URL that the WorkerLocation - object represents as the given value.

      +
    5. Return "?", followed by query.

    6. +
    -

    The element's URLUtilsReadOnly interface's get the base algorithm must return null.

    +

    The hash attribute's getter must run + these steps:

    + +
      +
    1. Let fragment be the associated WorkerGlobalScope object's + url's fragment.

    2. + +
    3. If fragment is either null or the empty string, return the empty string.

    4. + +
    5. Return "#", followed by fragment.

    6. +