Skip to content

Commit

Permalink
Use relevant settings object in protocol handlers
Browse files Browse the repository at this point in the history
The test at https://url-parsing-entry-gjqursujea.now.sh/entry/entry.html
reveals that Firefox at least uses relevant for URL parsing. Boris says
that Firefox does something nonsensical for the origin check and that he
would prefer relevant or current.

Code inspection reveals that Blink and WebKit use relevant for both URL
parsing and origin checking:

- https://chromium.googlesource.com/chromium/src/+/ee94bde91c72a046bec15436d56cfe32bb0e524c/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp#71
- https://github.com/WebKit/webkit/blob/83624b838d4fa81df77060c51b09587169f8ff19/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp#L109

Edge does not support these methods.

Helps with whatwg#1431.
  • Loading branch information
domenic authored and Alice Boxhall committed Jan 7, 2019
1 parent acd1e53 commit a161c6f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -90734,16 +90734,17 @@ interface <dfn>NavigatorContentUtils</dfn> {

<p>User agents must throw a <span>"<code>SyntaxError</code>"</span> <code>DOMException</code> if
<span data-x="parse a url">parsing</span> the <var>url</var> argument relative to the
<span>entry settings object</span> is not successful.</p>
<span>relevant settings object</span> of this <code>NavigatorContentUtils</code> object is not
successful.</p>

<p class="note">The <span>resulting URL string</span> would by definition not be a <span>valid
URL</span> as it would include the string "<code data-x="">%s</code>" which is not a valid
component in a URL.</p>

<p>User agents must throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>
if the <span>resulting URL record</span> has an <span data-x="concept-url-origin">origin</span>
that differs from the <span>origin</span> specified by the <span>entry settings
object</span>.</p>
that differs from the <span>origin</span> specified by the <span>relevant settings object</span>
of this <code>NavigatorContentUtils</code> object.</p>

<p class="note">This is forcibly the case if the <code data-x="">%s</code> placeholder is in the
scheme, host, or port parts of the URL.</p>
Expand All @@ -90754,10 +90755,10 @@ interface <dfn>NavigatorContentUtils</dfn> {
<p>When the user agent uses this handler, it must replace the first occurrence of the exact
literal string "<code data-x="">%s</code>" in the <var>url</var> argument with an
escaped version of the <span>absolute URL</span> of the content in question (as defined below),
then <span data-x="parse a url">parse</span> the resulting URL, relative to the <span>entry
settings object</span> at the time the <code
then <span data-x="parse a url">parse</span> the resulting URL, relative to the <span>relevant
settings object</span> of the <code>NavigatorContentUtils</code> object on which the <code
data-x="dom-navigator-registerContentHandler">registerContentHandler()</code> or <code
data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler()</code> methods were
data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler()</code> method was
invoked, and then <span>navigate</span><!--DONAV user--> an appropriate <span>browsing
context</span> to the resulting URL.</p>

Expand Down Expand Up @@ -90993,14 +90994,14 @@ interface <dfn>NavigatorContentUtils</dfn> {
<li><p>If the string does not contain the substring "<code data-x="">%s</code>", abort these
steps. There's no matching handler.</p></li>

<li><p><span data-x="parse a URL">Parse</span> the string relative to the <span>entry settings
object</span>. If this fails, then throw a <span>"<code>SyntaxError</code>"</span>
<code>DOMException</code>.</p></li>
<li><p><span data-x="parse a URL">Parse</span> the string relative to the <span>relevant settings
object</span> of this <code>NavigatorContentUtils</code> object. If this fails, then throw a
<span>"<code>SyntaxError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If the <span>resulting URL record</span>'s <span data-x="concept-url-origin">origin</span>
is not the <span>same origin</span> as the <span>origin</span> specified by the <span>entry
settings object</span>, throw a <span>"<code>SecurityError</code>"</span>
<code>DOMException</code>.</p></li>
is not the <span>same origin</span> as the <span>origin</span> of the <span>relevant settings
object</span> of this <code>NavigatorContentUtils</code> object, throw a
<span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Return the <span>resulting URL string</span> as the result of preprocessing the
argument.</p></li>
Expand Down

0 comments on commit a161c6f

Please sign in to comment.