From ca6f2fd28a8463c595daf5a6598c30836bf6f0fe 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 f8401d1e17d..d8a8d34fdc6 100644 --- a/source +++ b/source @@ -91131,7 +91131,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 @@ -91139,8 +91140,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.

@@ -91151,10 +91152,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.

@@ -91390,14 +91391,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.