Skip to content

Commit 32a7a20

Browse files
committed
Inline URLUtilsReadOnly
The URLUtils abstraction is not working out. See #164 and whatwg/url#62 for details.
1 parent 1e865ed commit 32a7a20

File tree

1 file changed

+136
-15
lines changed

1 file changed

+136
-15
lines changed

source

Lines changed: 136 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,6 +2695,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
26952695
<li>The <dfn data-noexport="" data-x="concept-url-fragment">fragment</dfn> component of a <span>parsed URL</span>
26962696
<li><dfn data-noexport="" data-x="concept-url-parse-error">Parse errors</dfn> from the <span>URL parser</span>
26972697
<li>The <dfn data-noexport="" data-x="concept-url-serialiser">URL serialiser</dfn>
2698+
<li>The <dfn data-noexport="" data-x="host serialiser" data-x-href="https://url.spec.whatwg.org/#concept-host-serializer">host serialiser</dfn>
2699+
<li>The <dfn data-noexport="" data-x="serialise an integer" data-x-href="https://url.spec.whatwg.org/#serialize-an-integer">serialise an integer</dfn>
26982700
<li><dfn data-noexport="">Default encode set</dfn>
26992701
<li><dfn data-noexport="">Percent encode</dfn>
27002702
<li><dfn data-noexport="">UTF-8 percent encode</dfn>
@@ -95256,9 +95258,13 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {
9525695258
<code>WorkerGlobalScope</code> object itself.</p>
9525795259

9525895260
<p>The <dfn><code data-x="dom-WorkerGlobalScope-location">location</code></dfn> attribute must
95259-
return the <code>WorkerLocation</code> object created for the <code>WorkerGlobalScope</code>
95260-
object when the worker was created. It represents the <code>WorkerGlobalScope</code> object's
95261-
<span data-x="concept-WorkerGlobalScope-url">url</span>.</p>
95261+
return the <code>WorkerLocation</code> object whose associated <span
95262+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span> is
95263+
the <code>WorkerGlobalScope</code> object.</p>
95264+
95265+
<p class="note">While the <code>WorkerLocation</code> object is created after the
95266+
<code>WorkerGlobalScope</code> object, this is not problematic as it cannot be observed from
95267+
script.</p>
9526295268

9526395269
<hr>
9526495270

@@ -95572,6 +95578,9 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {
9557295578
environment</span>. (In either case, by definition, it is a <span>worker
9557395579
environment</span>.)</p></li>
9557495580

95581+
<li><p>Create a new <code>WorkerLocation</code> object and associate it with <var>worker global
95582+
scope</var>.</p>
95583+
9557595584
<li><!-- SCRIPT EXEC -->
9557695585

9557795586
<p>Let <var>script</var> be a new <span data-x="concept-script">script</span>.</p>
@@ -96393,22 +96402,134 @@ interface <dfn>WorkerNavigator</dfn> {};
9639396402
<h4>Worker locations</h4>
9639496403

9639596404
<pre class="idl">[Exposed=Worker]
96396-
interface <dfn>WorkerLocation</dfn> { };
96397-
<span>WorkerLocation</span> implements <span>URLUtilsReadOnly</span>;</pre>
96405+
interface <dfn>WorkerLocation</dfn> {
96406+
stringifier readonly attribute USVString <span data-x="dom-WorkerLocation-href">href</span>;
96407+
readonly attribute USVString <span data-x="dom-WorkerLocation-origin">origin</span>;
96408+
readonly attribute USVString <span data-x="dom-WorkerLocation-protocol">protocol</span>;
96409+
readonly attribute USVString <span data-x="dom-WorkerLocation-host">host</span>;
96410+
readonly attribute USVString <span data-x="dom-WorkerLocation-hostname">hostname</span>;
96411+
readonly attribute USVString <span data-x="dom-WorkerLocation-port">port</span>;
96412+
readonly attribute USVString <span data-x="dom-WorkerLocation-pathname">pathname</span>;
96413+
readonly attribute USVString <span data-x="dom-WorkerLocation-search">search</span>;
96414+
readonly attribute USVString <span data-x="dom-WorkerLocation-hash">hash</span>;
96415+
};</pre>
96416+
96417+
<p>A <code>WorkerLocation</code> object has an associated <dfn
96418+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</dfn> (a
96419+
<code>WorkerGlobalScope</code> object).
96420+
96421+
<p>The <dfn><code data-x="dom-WorkerLocation-href">href</code></dfn> attribute's getter must
96422+
return the associated <span
96423+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span>'s
96424+
<span data-x="concept-WorkerGlobalScope-url">url</span>, <span
96425+
data-x="concept-url-serialiser">serialised</span>.</p>
96426+
96427+
<p>The <dfn><code data-x="dom-WorkerLocation-origin">origin</code></dfn> attribute's getter must
96428+
return the <span data-x="Unicode serialisation of an origin">Unicode serialization</span> of the
96429+
associated <span data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code>
96430+
object</span>'s <span data-x="concept-WorkerGlobalScope-url">url</span>'s <a
96431+
data-x="concept-url-origin">origin</a>.</p>
96432+
96433+
<p class="note no-backref">It returns the Unicode rather than the ASCII serialisation for
96434+
compatibility with <code>MessageEvent</code>.</p>
96435+
96436+
<p>The <dfn><code data-x="dom-WorkerLocation-protocol">protocol</code></dfn> attribute's getter
96437+
must run return the associated <span
96438+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span>'s
96439+
<span data-x="concept-WorkerGlobalScope-url">url</span>'s <span
96440+
data-x="concept-url-scheme">scheme</span>, followed by "<code data-x="">:</code>".</p>
96441+
96442+
<p>The <dfn><code data-x="dom-WorkerLocation-host">host</code></dfn> attribute's getter must run
96443+
these steps:</p>
96444+
96445+
<ol>
96446+
<li><p>Let <var>url</var> be the associated <span
96447+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span>'s
96448+
<span data-x="concept-WorkerGlobalScope-url">url</span>.</p></li>
96449+
96450+
<li><p>If <var>url</var>'s <span data-x="concept-url-host">host</span> is null, return the empty
96451+
string.</p></li>
96452+
96453+
<li><p>If <var>url</var>'s <span data-x="concept-url-port">port</span> is null, return
96454+
<var>url</var>'s <span data-x="concept-url-host">host</span>, <span data-x="host
96455+
serialiser">serialised</span>.</p></li>
96456+
96457+
<li><p>Return <var>url</var>'s <span data-x="concept-url-host">host</span>, <span data-x="host
96458+
serialiser">serialised</span>, followed by "<code data-x="">:</code>" and <var>url</var>'s <span
96459+
data-x="concept-url-port">port</span>, <span data-x="serialise an
96460+
integer">serialised</span>.</p></li>
96461+
</ol>
96462+
96463+
<p>The <dfn><code data-x="dom-WorkerLocation-hostname">hostname</code></dfn> attribute's getter
96464+
must run these steps:</p>
96465+
96466+
<ol>
96467+
<li><p>Let <var>host</var> be the associated <span
96468+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span>'s
96469+
<span data-x="concept-WorkerGlobalScope-url">url</span>'s <span
96470+
data-x="concept-url-host">host</span>.</p></li>
96471+
96472+
<li><p>If <var>host</var> is null, return the empty string.</p></li>
96473+
96474+
<li><p>Return <var>host</var> <span data-x="host serialiser">serialised</span>.</p></li>
96475+
</ol>
96476+
96477+
<p>The <dfn><code data-x="dom-WorkerLocation-port">port</code></dfn> attribute's getter must run
96478+
these steps:</p>
96479+
96480+
<ol>
96481+
<li><p>Let <var>port</var> be the <code>WorkerGlobalScope</code> object's <span
96482+
data-x="concept-WorkerGlobalScope-url">url</span>'s <span
96483+
data-x="concept-url-port">port</span>.</p></li>
96484+
96485+
<li><p>If <var>port</var> is null, return the empty string.</p></li>
96486+
96487+
<li><p>Return <var>port</var>, <span data-x="serialise an integer">serialised</span>.</p></li>
96488+
</ol>
96489+
96490+
<p>The <dfn><code data-x="dom-WorkerLocation-pathname">pathname</code></dfn> attribute's getter
96491+
must run these steps:</p>
96492+
96493+
<ol>
96494+
<li><p>Let <var>url</var> be the associated <span
96495+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span>'s
96496+
<span data-x="concept-WorkerGlobalScope-url">url</span>.</p></li>
96497+
96498+
<li><p>If <var>url</var>'s <span>non-relative flag</span> is set, return the first string in
96499+
<var>url</var>'s <span data-x="concept-url-path">path</span>.</p></li>
9639896500

96399-
<p>A <code>WorkerLocation</code> object represents the <code>WorkerGlobalScope</code> object's
96400-
<span data-x="concept-WorkerGlobalScope-url">url</span>.
96501+
<li><p>Return "<code data-x="">/</code>", followed by the strings in <var>url</var>'s <span
96502+
data-x="concept-url-path">path</span> (including empty strings), separated from each other by
96503+
"<code data-x="">/</code>".</p></li>
96504+
</ol>
96505+
96506+
<p>The <dfn><code data-x="dom-WorkerLocation-search">search</code></dfn> attribute's getter must
96507+
run these steps:</p>
9640196508

96402-
<p>The <code>WorkerLocation</code> interface supports the <code>URLUtilsReadOnly</code>
96403-
interface. <ref spec=URL></p>
96509+
<ol>
96510+
<li><p>Let <var>query</var> be the associated <span
96511+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span>'s
96512+
<span data-x="concept-WorkerGlobalScope-url">url</span>'s <span
96513+
data-x="concept-url-query">query</span>.</p></li>
96514+
96515+
<li><p>If <var>query</var> is either null or the empty string, return the empty string.</p></li>
9640496516

96405-
<p>When the object is created, the user agent must invoke the element's
96406-
<code>URLUtilsReadOnly</code> interface's <span data-x="concept-uu-set-the-input">set the
96407-
input</span> algorithm with the <span>absolute URL</span> that the <code>WorkerLocation</code>
96408-
object represents as the given value.</p>
96517+
<li><p>Return "<code data-x="">?</code>", followed by <var>query</var>.</p></li>
96518+
</ol>
9640996519

96410-
<p>The element's <code>URLUtilsReadOnly</code> interface's <span
96411-
data-x="concept-uu-get-the-base">get the base</span> algorithm must return null.</p>
96520+
<p>The <dfn><code data-x="dom-WorkerLocation-hash">hash</code></dfn> attribute's getter must run
96521+
these steps:</p>
96522+
96523+
<ol>
96524+
<li><p>Let <var>fragment</var> be the associated <span
96525+
data-x="concept-WorkerLocation-WorkerGlobalScope"><code>WorkerGlobalScope</code> object</span>'s
96526+
<span data-x="concept-WorkerGlobalScope-url">url</span>'s <span
96527+
data-x="concept-url-fragment">fragment</span>.</p></li>
96528+
96529+
<li><p>If <var>fragment</var> is either null or the empty string, return the empty string.</p></li>
96530+
96531+
<li><p>Return "<code data-x="">#</code>", followed by <var>fragment</var>.</p></li>
96532+
</ol>
9641296533

9641396534

9641496535
<!--REMOVE-TOPIC:Workers-->

0 commit comments

Comments
 (0)