Implement protocol handler web API's behind flag (#40616)

This implements the web-facing API's behind a flag, where we further
design the embedding API in a
follow-up PR.

It passes all relevant WPT tests, since the HTML
specification leaves it up to user agents to
determine when to process these protocol handlers.

It also uses `once_cell` to lazily construct the
regex, which is what the CSP crate also uses for
its regexes [1].

Part of #40615

[1]:
db8f2e97fe/src/lib.rs (L1550-L1569)

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
Tim van der Lippe
2025-11-14 13:53:33 +01:00
committed by GitHub
parent 3d56aaa484
commit c782da762b
8 changed files with 123 additions and 772 deletions

View File

@@ -121,6 +121,7 @@ pub struct Preferences {
pub dom_microdata_testing_enabled: bool,
pub dom_uievent_which_enabled: bool,
pub dom_mutation_observer_enabled: bool,
pub dom_navigator_protocol_handlers_enabled: bool,
pub dom_navigator_sendbeacon_enabled: bool,
pub dom_notification_enabled: bool,
pub dom_offscreen_canvas_enabled: bool,
@@ -304,6 +305,7 @@ impl Preferences {
dom_microdata_testing_enabled: false,
dom_uievent_which_enabled: true,
dom_mutation_observer_enabled: true,
dom_navigator_protocol_handlers_enabled: false,
dom_navigator_sendbeacon_enabled: false,
dom_notification_enabled: false,
dom_offscreen_canvas_enabled: false,

View File

@@ -16,6 +16,7 @@ use net_traits::request::{
is_cors_safelisted_request_content_type,
};
use net_traits::{FetchMetadata, NetworkError, ResourceFetchTiming};
use regex::Regex;
use servo_config::pref;
use servo_url::ServoUrl;
@@ -62,6 +63,42 @@ pub(super) fn hardware_concurrency() -> u64 {
*CPUS
}
/// <https://html.spec.whatwg.org/multipage/#safelisted-scheme>
static SAFELISTED_SCHEMES: [&str; 24] = [
"bitcoin",
"ftp",
"ftps",
"geo",
"im",
"irc",
"ircs",
"magnet",
"mailto",
"matrix",
"mms",
"news",
"nntp",
"openpgp4fpr",
"sftp",
"sip",
"sms",
"smsto",
"ssh",
"tel",
"urn",
"webcal",
"wtai",
"xmpp",
];
/// Used in <https://html.spec.whatwg.org/multipage/#normalize-protocol-handler-parameters>
fn matches_web_plus_protocol(scheme: &str) -> bool {
static WEB_PLUS_SCHEME_GRAMMAR: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r#"^web\+[a-z]+$"#).unwrap());
WEB_PLUS_SCHEME_GRAMMAR.is_match(scheme)
}
#[dom_struct]
pub(crate) struct Navigator {
reflector_: Reflector,
@@ -172,6 +209,48 @@ impl Navigator {
pub(crate) fn set_has_gamepad_gesture(&self, has_gamepad_gesture: bool) {
self.has_gamepad_gesture.set(has_gamepad_gesture);
}
/// <https://html.spec.whatwg.org/multipage/#normalize-protocol-handler-parameters>
fn normalize_protocol_handler_parameters(
&self,
scheme: DOMString,
url: USVString,
) -> Fallible<(String, ServoUrl)> {
// Step 1. Set scheme to scheme, converted to ASCII lowercase.
let scheme = scheme.to_ascii_lowercase();
// Step 2. If scheme is neither a safelisted scheme nor
// a string starting with "web+" followed by one or more ASCII lower alphas, then throw a "SecurityError" DOMException.
if !SAFELISTED_SCHEMES.contains(&scheme.as_ref()) && !matches_web_plus_protocol(&scheme) {
return Err(Error::Security);
}
// Step 3. If url does not contain "%s", then throw a "SyntaxError" DOMException.
if !url.contains("%s") {
return Err(Error::Syntax(Some(
"Missing replacement string %s in URL".to_owned(),
)));
}
// Step 4. Let urlRecord be the result of encoding-parsing a URL given url, relative to environment.
let environment = self.global();
// Navigator is only exposed on Window, so this is safe to do
let window = environment.as_window();
let Ok(url) = window.Document().encoding_parse_a_url(&url) else {
// Step 5. If urlRecord is failure, then throw a "SyntaxError" DOMException.
return Err(Error::Syntax(Some("Cannot parse URL".to_owned())));
};
// Step 6. If urlRecord's scheme is not an HTTP(S) scheme or urlRecord's origin
// is not same origin with environment's origin, then throw a "SecurityError" DOMException.
if !matches!(url.scheme(), "http" | "https") {
return Err(Error::Security);
}
let environment_origin = environment.origin().immutable().clone();
if url.origin() != environment_origin {
return Err(Error::Security);
}
// Step 7. Assert: the result of Is url potentially trustworthy? given urlRecord is "Potentially Trustworthy".
assert!(url.is_potentially_trustworthy());
// Step 8. Return (scheme, urlRecord).
Ok((scheme, url))
}
}
impl NavigatorMethods<crate::DomTypeHolder> for Navigator {
@@ -437,6 +516,40 @@ impl NavigatorMethods<crate::DomTypeHolder> for Navigator {
self.servo_internals
.or_init(|| ServoInternals::new(&self.global(), CanGc::note()))
}
/// <https://html.spec.whatwg.org/multipage/#dom-navigator-registerprotocolhandler>
fn RegisterProtocolHandler(&self, scheme: DOMString, url: USVString) -> Fallible<()> {
// Step 1. Let (normalizedScheme, normalizedURLString) be the result of
// running normalize protocol handler parameters with scheme, url, and this's relevant settings object.
let (_normalized_scheme, _normalized_url_string) =
self.normalize_protocol_handler_parameters(scheme, url)?;
// Step 2. In parallel: register a protocol handler for normalizedScheme and normalizedURLString.
// User agents may, within the constraints described, do whatever they like. A user agent could,
// for instance, prompt the user and offer the user the opportunity to add the site to a shortlist of handlers,
// or make the handlers their default, or cancel the request. User agents could also silently collect the information,
// providing it only when relevant to the user.
// User agents should keep track of which sites have registered handlers (even if the user has declined such registrations)
// so that the user is not repeatedly prompted with the same request.
// If the registerProtocolHandler() automation mode of this's relevant global object's associated Document is not "none",
// the user agent should first verify that it is in an automation context (see WebDriver's security considerations).
// The user agent should then bypass the above communication of information and gathering of user consent,
// and instead do the following based on the value of the registerProtocolHandler() automation mode:
//
// TODO
Ok(())
}
/// <https://html.spec.whatwg.org/multipage/#dom-navigator-unregisterprotocolhandler>
fn UnregisterProtocolHandler(&self, scheme: DOMString, url: USVString) -> Fallible<()> {
// Step 1. Let (normalizedScheme, normalizedURLString) be the result of
// running normalize protocol handler parameters with scheme, url, and this's relevant settings object.
let (_normalized_scheme, _normalized_url_string) =
self.normalize_protocol_handler_parameters(scheme, url)?;
// Step 2. In parallel: unregister the handler described by normalizedScheme and normalizedURLString.
//
// TODO
Ok(())
}
}
struct BeaconFetchListener {

View File

@@ -10,7 +10,7 @@ interface Navigator {
Navigator includes NavigatorID;
Navigator includes NavigatorLanguage;
Navigator includes NavigatorOnLine;
//Navigator includes NavigatorContentUtils;
Navigator includes NavigatorContentUtils;
//Navigator includes NavigatorStorageUtils;
Navigator includes NavigatorPlugins;
Navigator includes NavigatorCookies;
@@ -87,3 +87,9 @@ partial interface Navigator {
[Throws, Pref="dom_navigator_sendbeacon_enabled"]
boolean sendBeacon(USVString url, optional BodyInit? data = null);
};
// https://html.spec.whatwg.org/multipage/#custom-handlers
interface mixin NavigatorContentUtils {
[Throws, SecureContext, Pref="dom_navigator_protocol_handlers_enabled"] undefined registerProtocolHandler(DOMString scheme, USVString url);
[Throws, SecureContext, Pref="dom_navigator_protocol_handlers_enabled"] undefined unregisterProtocolHandler(DOMString scheme, USVString url);
};

View File

@@ -29,6 +29,7 @@ pub(crate) static EXPERIMENTAL_PREFS: &[&str] = &[
"dom_fontface_enabled",
"dom_intersection_observer_enabled",
"dom_uievent_which_enabled",
"dom_navigator_protocol_handlers_enabled",
"dom_navigator_sendbeacon_enabled",
"dom_notification_enabled",
"dom_offscreen_canvas_enabled",

View File

@@ -4847,12 +4847,6 @@
[Navigator interface: attribute oscpu]
expected: FAIL
[Navigator interface: operation registerProtocolHandler(DOMString, USVString)]
expected: FAIL
[Navigator interface: operation unregisterProtocolHandler(DOMString, USVString)]
expected: FAIL
[Navigator interface: attribute pdfViewerEnabled]
expected: FAIL
@@ -4862,18 +4856,6 @@
[Navigator interface: window.navigator must inherit property "oscpu" with the proper type]
expected: FAIL
[Navigator interface: window.navigator must inherit property "registerProtocolHandler(DOMString, USVString)" with the proper type]
expected: FAIL
[Navigator interface: calling registerProtocolHandler(DOMString, USVString) on window.navigator with too few arguments must throw TypeError]
expected: FAIL
[Navigator interface: window.navigator must inherit property "unregisterProtocolHandler(DOMString, USVString)" with the proper type]
expected: FAIL
[Navigator interface: calling unregisterProtocolHandler(DOMString, USVString) on window.navigator with too few arguments must throw TypeError]
expected: FAIL
[Navigator interface: window.navigator must inherit property "pdfViewerEnabled" with the proper type]
expected: FAIL

View File

@@ -14,11 +14,5 @@
[source : unpaired surrogate codepoint should be replaced with U+FFFD]
expected: FAIL
[RegisterProtocolHandler URL: unpaired surrogate codepoint should not make any exceptions.]
expected: FAIL
[UnregisterProtocolHandler URL: unpaired surrogate codepoint should not make any exceptions.]
expected: FAIL
[RTCDataChannel.send: unpaired surrogate codepoint should be replaced with U+FFFD.]
expected: FAIL

View File

@@ -1,3 +0,0 @@
[historical.https.window.html]
[registerProtocolHandler has no third argument]
expected: FAIL

View File

@@ -1,744 +0,0 @@
[protocol.https.html]
[registerProtocolHandler: overriding the "TEL" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "http://example.com/%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mid" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "webcal" protocol should work]
expected: FAIL
[registerProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html#%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+1" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "ssh:/" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "vbscript" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "moz-icon" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "ftp" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "WEB+seeabove" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "nntp" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "http://%s.com" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "chrome" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "web+UpperCasedIsLowercased" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "https://web-platform.test:%s8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "wyciwyg" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "https" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "https://example.com/%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "fweb+oo" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "view-source" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mailto:" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%a" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Valid URL "h%sttps://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should work.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "ssh:/" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "mailto:%s" should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html?foo=%s&bar" should work.]
expected: FAIL
[registerProtocolHandler: overriding the "mailto" protocol should work]
expected: FAIL
[registerProtocolHandler: Invalid URL "http://%s.com" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Invalid URL "http://[v8.:::\]//url=%s" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Attempting to override the "http" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "smsto" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Valid URL "%shttps://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should work.]
expected: FAIL
[registerProtocolHandler: Invalid URL "https://test:test/" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: overriding the "im" protocol should work]
expected: FAIL
[registerProtocolHandler: Valid URL "%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mailto\x00" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "fweb+oo" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "operamail" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mаilto" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mocha" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+dashes-are-forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "WeB+SeEaBoVe" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "Irc" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "BitcoIn" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "livescript" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "http://example.com" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Invalid URL "blob: URL" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "javascript" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "bitcoin" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Valid URL "%shttps://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should work.]
expected: FAIL
[unregisterProtocolHandler: overriding the "geo" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "res" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s/bar/baz/" should work.]
expected: FAIL
[registerProtocolHandler: overriding the "magnet" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+digits123areforbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "http://foobar.example.com/%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "https://test:test/" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "about" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "data" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "http://example.com/%s" should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mid" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "teL" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "%S" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "ftp://web-platform.test:8443/%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mocha" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "MagneT" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s/foo/%s/" should work.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "ws" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "tel:sip" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "news" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "wss" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "unrecognized" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "ircs" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "irc" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "urn" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "BitcoIn" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html?foo=%s" should work.]
expected: FAIL
[the unregisterProtocolHandler method should exist on the navigator object]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "blob: URL" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "openpgp4fpr" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "blob" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "WTAI" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "sms" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "ftp" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: overriding the "irc" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "mailto:%s@example.com" should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "%S" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Attempting to override the "shttp" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Invalid URL "mailto:%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "res" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mailto://" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "http://example.com" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+dots.are.forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "resource" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "operamail" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Valid URL "%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "data" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "webcal" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "im" protocol should work]
expected: FAIL
[registerProtocolHandler: Invalid URL "ftp://web-platform.test:8443/%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "tcl" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "attachment" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "chrome://web-platform.test:8443/%s" should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mailtoo\x08" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "geo" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "WebCAL" protocol should work]
expected: FAIL
[registerProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s/bar/baz/?foo=1337&bar#baz" should work.]
expected: FAIL
[the registerProtocolHandler method should exist on the navigator object]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https:%s//web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should work.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "foo://web-platform.test:8443/%s" should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "wss" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Valid URL "foo/%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "chrome://web-platform.test:8443/%s" should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s/bar/baz/" should work.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "vbscript" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "foo" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Valid URL "h%sttps://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should work.]
expected: FAIL
[registerProtocolHandler: overriding the "mms" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "WEB+seeabove" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "ssh" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "WTAI" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%a" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: overriding the "magnet" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "cid" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "teL" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "tcl" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "http://" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "ws" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+dots.are.forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "resource" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "sms" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "mms" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "Irc" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "attachment" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "livescript" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "bitcoin" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "magnet:+" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "web+myprotocol" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "opera" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s/bar/baz/?foo=1337&bar#baz" should work.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "opera" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+digits123areforbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "MagneT" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "WeB+SeEaBoVe" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mailto://" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "mailto:%s@example.com" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "mailto" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "magnet:+" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "xmpp" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "wtai" protocol should work]
expected: FAIL
[registerProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html?foo=%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "tel:sip" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "foo://web-platform.test:8443/%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "chrome" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "http://[v8.:::\]//url=%s" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Attempting to override the "javascript" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "unrecognized" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "blob" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+1" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "http://" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "WebCAL" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "https" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mailto:" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "file" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "ssh" protocol should work]
expected: FAIL
[registerProtocolHandler: Invalid URL "http://%s.example.com" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Attempting to override the "file" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mаilto" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "openpgp4fpr" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mailto\x00" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mailto\n" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "sip" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "mailtoo\x08" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "https://example.com/%s" should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "http" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "wtai" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "shttp" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "TEL" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "about" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Invalid URL "http://foobar.example.com/%s" should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "wyciwyg" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Valid URL "https:%s//web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should work.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "view-source" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "cid" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "sip" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "https://%sweb-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "mailto\n" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "SmsTo" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "nntp" protocol should work]
expected: FAIL
[registerProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html/%s/foo/%s/" should work.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "foo" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "web+UpperCasedIsLowercased" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "SmsTo" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "ircs" protocol should work]
expected: FAIL
[registerProtocolHandler: Valid URL "foo/%s" should work.]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html?foo=%s&bar" should work.]
expected: FAIL
[registerProtocolHandler: overriding the "xmpp" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "web+myprotocol" protocol should work]
expected: FAIL
[registerProtocolHandler: Invalid URL "https://web-platform.test:%s8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: overriding the "news" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+dashes-are-forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "tel" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "moz-icon" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Invalid URL "http://%s.example.com" should throw (but after scheme)]
expected: FAIL
[registerProtocolHandler: Invalid URL "https://%sweb-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html" should throw (but after scheme)]
expected: FAIL
[unregisterProtocolHandler: overriding the "urn" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Valid URL "https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol.https.html#%s" should work.]
expected: FAIL
[unregisterProtocolHandler: overriding the "smsto" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "tel" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+non*alpha*are*forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+elvinsign" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+latinsmallletterlongſ" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "web+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" protocol should work]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+non*alpha*are*forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+namewithid123" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+elvinsign" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+namewithtrailingspace " protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+préfixewithaccent" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+préfixewithaccent" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+spaces are forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+spaces are forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+namewithid123" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+underscores_are_forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: Attempting to override the "web+underscores_are_forbidden" protocol should throw SECURITY_ERR.]
expected: FAIL
[unregisterProtocolHandler: overriding the "web+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" protocol should work]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+latinsmallletterlongſ" protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: Attempting to override the "web+namewithtrailingspace " protocol should throw SECURITY_ERR.]
expected: FAIL
[registerProtocolHandler: overriding the "matrix" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "matrix" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "Matrix" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "Matrix" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "ftp" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "ftp" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "ftps" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "ftps" protocol should work]
expected: FAIL
[registerProtocolHandler: overriding the "sftp" protocol should work]
expected: FAIL
[unregisterProtocolHandler: overriding the "sftp" protocol should work]
expected: FAIL