From 4ba631a00c768b9ee8a5cc50b6ded6277d498f85 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 3 Feb 2014 17:23:12 +0000 Subject: [PATCH] Support blob URLs in URL parsing. https://www.w3.org/Bugs/Public/show_bug.cgi?id=17765 --- url.html | 88 ++++++++++++++++++++++++++++++++++++++-------------- url.src.html | 83 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 126 insertions(+), 45 deletions(-) diff --git a/url.html b/url.html index 51c23b9e..4f6f0d5d 100644 --- a/url.html +++ b/url.html @@ -760,6 +760,14 @@

5 URLs

protocol attribute. +

A URL also has an associated +object that is either null or a +Blob. +[FILEAPI] + +

At this point this is used primarily to support "blob" +URLs, but others can be added going forward, hence "object". +

A relative scheme is a scheme listed in the first column of @@ -939,6 +947,36 @@

5.2 Parsing

The URL parser takes a string input, optionally with a +base URL base, and +optionally with an encoding +encoding override, and then runs these steps: + +

    +
  1. Let url be the result of running the + basic URL parser on input + with base, and encoding override as provided. + +

  2. If url is failure, return failure. + +

  3. If url's scheme is not + "blob", return url. + +

  4. If url's scheme data + is not in the blob URL store, return + url. [FILEAPI] + +

  5. Set url's object to a + structured clone of the entry in the + blob URL store corresponding to + url's scheme data. + [HTML] + +

  6. Return url. +

+ + +

The basic URL parser takes a string +input, optionally with a base URL base, optionally with an encoding encoding override, optionally with an @@ -949,10 +987,10 @@

5.2 Parsing

The encoding override argument is a legacy concept only relevant for HTML. The url and state override arguments are only for use by methods of objects implementing the URLUtils interface. - [HTML] + [HTML]

When the url and state override arguments are not - passed the URL parser returns either a + passed the basic URL parser returns either a URL or failure. If they are passed the algorithm simply modifies the passed url and can terminate without returning anything. @@ -1757,7 +1795,7 @@

6 While this description makes application/x-www-form-urlencoded sound dated — and really, it is — the format is in widespread use due to its prevalence of HTML forms. -[HTML] +[HTML]

6.1 Parsing

@@ -2037,7 +2075,7 @@

7 API

The associated query encoding is a legacy concept only relevant for HTML. -[HTML] +[HTML]

Specifications defining objects implementing URLUtils or URLUtilsReadOnly must use the @@ -2051,16 +2089,17 @@

7 API

  • Set input to the given value. -

  • Let URL be the result of - parsing +

  • Let url be the result of running the + URL parser on input with base URL being the result of running get the base and query encoding as encoding override. + -

  • If URL is not failure, set - url to URL. +

  • If url is not failure, set + url to url.

  • If url is non-null and its @@ -2105,8 +2144,8 @@

    7.1 Constructors

    +

    A URL also has an associated +object that is either null or a +Blob. +FILEAPI + +

    At this point this is used primarily to support "blob" +URLs, but others can be added going forward, hence "object". +

    A relative scheme is a scheme listed in the first column of @@ -908,6 +916,36 @@

    Parsing

    The URL parser takes a string input, optionally with a +base URL base, and +optionally with an encoding +encoding override, and then runs these steps: + +

      +
    1. Let url be the result of running the + basic URL parser on input + with base, and encoding override as provided. + +

    2. If url is failure, return failure. + +

    3. If url's scheme is not + "blob", return url. + +

    4. If url's scheme data + is not in the blob URL store, return + url. FILEAPI + +

    5. Set url's object to a + structured clone of the entry in the + blob URL store corresponding to + url's scheme data. + HTML + +

    6. Return url. +

    + + +

    The basic URL parser takes a string +input, optionally with a base URL base, optionally with an encoding encoding override, optionally with an @@ -918,10 +956,10 @@

    Parsing

    The encoding override argument is a legacy concept only relevant for HTML. The url and state override arguments are only for use by methods of objects implementing the URLUtils interface. - HTML + HTML

    When the url and state override arguments are not - passed the URL parser returns either a + passed the basic URL parser returns either a URL or failure. If they are passed the algorithm simply modifies the passed url and can terminate without returning anything. @@ -1726,7 +1764,7 @@

    application/x-www-form-urlencoded

    While this description makes application/x-www-form-urlencoded sound dated — and really, it is — the format is in widespread use due to its prevalence of HTML forms. -HTML +HTML

    Parsing

    @@ -2006,7 +2044,7 @@

    API

    The associated query encoding is a legacy concept only relevant for HTML. -HTML +HTML

    Specifications defining objects implementing URLUtils or URLUtilsReadOnly must use the @@ -2020,16 +2058,17 @@

    API

  • Set input to the given value. -

  • Let URL be the result of - parsing +

  • Let url be the result of running the + URL parser on input with base URL being the result of running get the base and query encoding as encoding override. + -

  • If URL is not failure, set - url to URL. +

  • If url is not failure, set + url to url.

  • If url is non-null and its @@ -2074,8 +2113,8 @@

    Constructors

    constructor must run these steps:
      -
    1. Parse base and set - base to the result of that algorithm. +

    2. Basic URL parse base + and set base to the result of that algorithm.

    3. If base is failure, throw a TypeError exception. @@ -2095,7 +2134,7 @@

      Constructors

    -

    To parse a string into a +

    To Basic URL parse a string into a URL without using a base URL, invoke the constructor with a single argument: @@ -2180,7 +2219,7 @@

    URLUtils and URLUtilsReadOnly members

    This means that if the href attribute is set -to value that would cause the parser to return +to value that would cause the URL parser to return failure, that value is still passed through unchanged. This is one of those unfortunate legacy incidents.