diff --git a/spec.bs b/spec.bs index 9ba20ac..9064fac 100644 --- a/spec.bs +++ b/spec.bs @@ -282,7 +282,7 @@ Each {{URLPattern}} object has an associated hash component< 1. Set [=this=]'s [=URLPattern/password component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/password}}"], [=canonicalize a password=], and [=default options=]. 1. Set [=this=]'s [=URLPattern/hostname component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/hostname}}"], [=canonicalize a hostname=], and [=hostname options=]. 1. Set [=this=]'s [=URLPattern/port component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/port}}"], [=canonicalize a port=], and [=default options=]. - 1. If the result of running [=protocol component matches a special scheme=] given [=this=]'s [=URLPattern/protocol component=] is true, then set [=this=]'s [=URLPattern/pathname component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/pathname}}"], [=canonicalize a standard pathname=], and [=standard pathname options=]. + 1. If the result of running [=protocol component matches a special scheme=] given [=this=]'s [=URLPattern/protocol component=] is true, then set [=this=]'s [=URLPattern/pathname component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/pathname}}"], [=canonicalize a pathname=], and [=pathname options=]. 1. Else set [=this=]'s [=URLPattern/pathname component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/pathname}}"], [=canonicalize a cannot-be-a-base-URL pathname=], and [=default options=] 1. Set [=this=]'s [=URLPattern/search component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/search}}"], [=canonicalize a search=], and [=default options=]. 1. Set [=this=]'s [=URLPattern/hash component=] to the result of [=compiling a component=] given |processedInit|["{{URLPatternInit/hash}}"], [=canonicalize a hash=], and [=default options=]. @@ -452,7 +452,7 @@ The default options is an [=options=] [=struct=] with [=options/delim The hostname options is an [=options=] [=struct=] with [=options/delimiter code point=] set "`.`" and [=options/prefix code point=] set to the empty string. -The standard pathname options is an [=options=] [=struct=] with [=options/delimiter code point=] set "`/`" and [=options/prefix code point=] set to "`/`". +The pathname options is an [=options=] [=struct=] with [=options/delimiter code point=] set "`/`" and [=options/prefix code point=] set to "`/`".
To determine if a protocol component matches a special scheme given a [=component=] |protocol component|: @@ -482,7 +482,7 @@ A [=constructor string parser=] has an associated group depth, a number, initially set to 0. -A [=constructor string parser=] has an associated should treat as a standard URL, a boolean, initially set to false. +A [=constructor string parser=] has an associated protocol matches a special scheme flag, a boolean, initially set to false. A [=constructor string parser=] has an associated state, a string, initially set to "`init`". It must be one of the following: @@ -574,15 +574,15 @@ To parse a constructor string given a string |input|:
"`protocol`"
1. If the result of running [=is a protocol suffix=] given |parser| is true: - 1. Run [=compute should treat as a standard URL=] given |parser|. -

We must eagerly compile the protocol component to determine if it matches any [=special schemes=]. If it does then we treat the URLPattern constructor string as a "standard URL". The determines if the pathname defaults to a "`/`" and also whether we should look for the username, password, hostname, and port components. Authority slashes may also cause us to look for these components as well. Otherwise we treat this as a "cannot be a base URL" and go straight to the pathname component. - 1. If |parser|'s [=constructor string parser/should treat as a standard URL=] is true, then set |parser|'s [=constructor string parser/result=]["{{URLPatternInit/pathname}}"] to "`/`". + 1. Run [=compute protocol matches a special scheme flag=] given |parser|. +

We need to eagerly compile the protocol component to determine if it matches any [=special schemes=]. If it does then certain special rules apply. It determines if the pathname defaults to a "`/`" and also whether we will look for the username, password, hostname, and port components. Authority slashes can also cause us to look for these components as well. Otherwise we treat this as a "cannot be a base URL" and go straight to the pathname component. + 1. If |parser|'s [=constructor string parser/protocol matches a special scheme flag=] is true, then set |parser|'s [=constructor string parser/result=]["{{URLPatternInit/pathname}}"] to "`/`". 1. Let |next state| be "`pathname`". 1. Let |skip| be 1. 1. If the result of running [=next is authority slashes=] given |parser| is true: 1. Set |next state| to "`authority`". 1. Set |skip| to 3. - 1. Else if |parser|'s [=constructor string parser/should treat as a standard URL=] is true, then set |next state| to "`authority`". + 1. Else if |parser|'s [=constructor string parser/protocol matches a special scheme flag=] is true, then set |next state| to "`authority`". 1. Run [=change state=] given |parser|, |next state|, and |skip|.

"`authority`"
@@ -775,11 +775,11 @@ To run make a component string given a [=constructor string parser=]
-To compute should treat as a standard URL given a [=constructor string parser=] |parser|: +To compute protocol matches a special scheme flag given a [=constructor string parser=] |parser|: 1. Let |protocol string| be the result of running [=make a component string=] given |parser|. 1. Let |protocol component| be the result of [=compiling a component=] given |protocol string|, [=canonicalize a protocol=], and [=default options=]. - 1. If the result of running [=protocol component matches a special scheme=] given |protocol component| is true, then set |parser|'s [=constructor string parser/should treat as a standard URL=] to true. + 1. If the result of running [=protocol component matches a special scheme=] given |protocol component| is true, then set |parser|'s [=constructor string parser/protocol matches a special scheme flag=] to true.

Patterns

@@ -1518,7 +1518,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier
- To canonicalize a standard pathname given a string |value|: + To canonicalize a pathname given a string |value|: 1. Let |dummyURL| be a new [=URL record=]. 1. Let |parseResult| be the result of running [=basic URL parser=] given |value| with |dummyURL| as [=basic URL parser/url=] and [=path start state=] as [=basic URL parser/state override=]. @@ -1659,7 +1659,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier To process pathname for init given a string |pathnameValue|, a string |protocolValue|, and a string |type|: 1. If |type| is "`pattern`" then return |pathnameValue|. - 1. If |protocolValue| is a [=special scheme=], then return the result of running [=canonicalize a standard pathname=] given |pathnameValue|. + 1. If |protocolValue| is a [=special scheme=], then return the result of running [=canonicalize a pathname=] given |pathnameValue|. 1. Else return the result of running [=canonicalize a cannot-be-a-base-URL pathname=] given |pathnameValue|.