From a161c6f71ac20daed983fa7869a13e11cc6e7855 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 12 Jul 2016 18:13:28 -0400 Subject: [PATCH] Use relevant settings object in protocol handlers 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 #1431. --- source | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/source b/source index 53e76dba107..b9eca16a7a8 100644 --- a/source +++ b/source @@ -90734,7 +90734,8 @@ interface NavigatorContentUtils {

User agents must throw a "SyntaxError" DOMException if parsing the url argument relative to the - entry settings object is not successful.

+ relevant settings object of this NavigatorContentUtils object is not + successful.

The resulting URL string would by definition not be a valid URL as it would include the string "%s" which is not a valid @@ -90742,8 +90743,8 @@ interface NavigatorContentUtils {

User agents must throw a "SecurityError" DOMException if the resulting URL record has an origin - that differs from the origin specified by the entry settings - object.

+ that differs from the origin specified by the relevant settings object + of this NavigatorContentUtils object.

This is forcibly the case if the %s placeholder is in the scheme, host, or port parts of the URL.

@@ -90754,10 +90755,10 @@ interface NavigatorContentUtils {

When the user agent uses this handler, it must replace the first occurrence of the exact literal string "%s" in the url argument with an escaped version of the absolute URL of the content in question (as defined below), - then parse the resulting URL, relative to the entry - settings object at the time the parse the resulting URL, relative to the relevant + settings object of the NavigatorContentUtils object on which the registerContentHandler() or registerProtocolHandler() methods were + data-x="dom-navigator-registerProtocolHandler">registerProtocolHandler() method was invoked, and then navigate an appropriate browsing context to the resulting URL.

@@ -90993,14 +90994,14 @@ interface NavigatorContentUtils {
  • If the string does not contain the substring "%s", abort these steps. There's no matching handler.

  • -
  • Parse the string relative to the entry settings - object. If this fails, then throw a "SyntaxError" - DOMException.

  • +
  • Parse the string relative to the relevant settings + object of this NavigatorContentUtils object. If this fails, then throw a + "SyntaxError" DOMException.

  • If the resulting URL record's origin - is not the same origin as the origin specified by the entry - settings object, throw a "SecurityError" - DOMException.

  • + is not the same origin as the origin of the relevant settings + object of this NavigatorContentUtils object, throw a + "SecurityError" DOMException.

  • Return the resulting URL string as the result of preprocessing the argument.