diff --git a/spec.bs b/spec.bs index 9d97980..a500313 100644 --- a/spec.bs +++ b/spec.bs @@ -599,6 +599,13 @@ A component is a [=struct=] with the following [=struct/items=]: 1. Return |result|. +
Note, [=basic URL parser/state override=] is not used here because it enforces restrictions that are only appropriate for the {{URL/protocol}} setter. Instead we use the protocol to parse a dummy URL using the normal parsing entry point.
1. If |parseResult| is failure, then throw a {{TypeError}}. - 1. Return |dummyURL|'s [=url/scheme=]. + 1. Return |parseResult|'s [=url/scheme=].Note, we set the [=URL record=]'s [=url/scheme=] in order for the [=basic URL parser=] to recognize and normalize default port values.
1. Let |parseResult| be the result of running [=basic URL parser=] given |portValue| with |dummyURL| as [=basic URL parser/url=] and [=port state=] as [=basic URL parser/state override=]. @@ -1779,7 +1785,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifierNote, implementations are free to simply disable slash prepending in their URL parsing code instead of paying the performance penalty of inserting and removing characters in this algorithm. 1. Append |value| to the end of |modified value|. - 1. Let |dummyURL| be a new [=URL record=]. + 1. Let |dummyURL| be the result of [=creating a dummy URL=]. 1. Run [=basic URL parser=] given |modified value| with |dummyURL| as [=basic URL parser/url=] and [=path start state=] as [=basic URL parser/state override=]. 1. Let |result| be the result of [=URL path serializing=] |dummyURL|. 1. If |leading slash| is false, then set |result| to the [=code point substring to the end of the string|code point substring=] from 2 to the end of the string within |result|. @@ -1790,7 +1796,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier To canonicalize an opaque pathname given a string |value|: 1. If |value| is the empty string, return |value|. - 1. Let |dummyURL| be a new [=URL record=]. + 1. Let |dummyURL| be the result of [=creating a dummy URL=]. 1. Set |dummyURL|'s [=url/path=] to the empty string. 1. Let |parseResult| be the result of running [=basic URL parser|URL parsing=] given |value| with |dummyURL| as [=basic URL parser/url=] and [=basic URL parser/opaque path state=] as [=basic URL parser/state override=]. 1. If |parseResult| is failure, then throw a {{TypeError}}. @@ -1801,7 +1807,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier To canonicalize a search given a string |value|: 1. If |value| is the empty string, return |value|. - 1. Let |dummyURL| be a new [=URL record=]. + 1. Let |dummyURL| be the result of [=creating a dummy URL=]. 1. Set |dummyURL|'s [=url/query=] to the empty string. 1. Run [=basic URL parser=] given |value| with |dummyURL| as [=basic URL parser/url=] and [=query state=] as [=basic URL parser/state override=]. 1. Return |dummyURL|'s [=url/query=]. @@ -1811,7 +1817,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier To canonicalize a hash given a string |value|: 1. If |value| is the empty string, return |value|. - 1. Let |dummyURL| be a new [=URL record=]. + 1. Let |dummyURL| be the result of [=creating a dummy URL=]. 1. Set |dummyURL|'s [=url/fragment=] to the empty string. 1. Run [=basic URL parser=] given |value| with |dummyURL| as [=basic URL parser/url=] and [=fragment state=] as [=basic URL parser/state override=]. 1. Return |dummyURL|'s [=url/fragment=].