From 5a2adffbe7b106a8c8a8b66a273cc170ea436771 Mon Sep 17 00:00:00 2001 From: Frederic Wang Date: Tue, 27 Oct 2020 14:10:22 +0000 Subject: [PATCH] Bug 1631464 Remove the title argument from registerProtocolHandler() r=smaug See https://groups.google.com/g/mozilla.dev.platform/c/T633aemFPJU/m/dbv5_iB8AgAJ Differential Revision: https://phabricator.services.mozilla.com/D71714 --- dom/base/Navigator.cpp | 11 +++++++---- dom/base/Navigator.h | 2 +- dom/webidl/Navigator.webidl | 2 +- .../meta/html/dom/idlharness.https.html.ini | 3 --- .../historical.https.window.js.ini | 4 ---- 5 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 testing/web-platform/meta/html/webappapis/system-state-and-capabilities/the-navigator-object/historical.https.window.js.ini diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index c6e3e16f4e49..8fa619d79a97 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -985,7 +985,6 @@ void Navigator::CheckProtocolHandlerAllowed(const nsAString& aScheme, void Navigator::RegisterProtocolHandler(const nsAString& aScheme, const nsAString& aURI, - const nsAString& aTitle, ErrorResult& aRv) { if (!mWindow || !mWindow->GetOuterWindow() || !mWindow->GetDocShell() || !mWindow->GetDoc()) { @@ -1014,9 +1013,13 @@ void Navigator::RegisterProtocolHandler(const nsAString& aScheme, return; } + // Determine a title from the document URI. + nsAutoCString docDisplayHostPort; + docURI->GetDisplayHostPort(docDisplayHostPort); + NS_ConvertASCIItoUTF16 title(docDisplayHostPort); + if (XRE_IsContentProcess()) { nsAutoString scheme(aScheme); - nsAutoString title(aTitle); RefPtr browserChild = BrowserChild::GetFrom(mWindow); browserChild->SendRegisterProtocolHandler(scheme, handlerURI, title, docURI); @@ -1026,8 +1029,8 @@ void Navigator::RegisterProtocolHandler(const nsAString& aScheme, nsCOMPtr registrar = do_GetService(NS_WEBPROTOCOLHANDLERREGISTRAR_CONTRACTID); if (registrar) { - aRv = registrar->RegisterProtocolHandler(aScheme, handlerURI, aTitle, - docURI, mWindow->GetOuterWindow()); + aRv = registrar->RegisterProtocolHandler(aScheme, handlerURI, title, docURI, + mWindow->GetOuterWindow()); } } diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 9e898052f8ee..043fa07e152c 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -123,7 +123,7 @@ class Navigator final : public nsISupports, public nsWrapperCache { nsIURI* aHandlerURI, nsIURI* aDocumentURI, ErrorResult& aRv); void RegisterProtocolHandler(const nsAString& aScheme, const nsAString& aURL, - const nsAString& aTitle, ErrorResult& aRv); + ErrorResult& aRv); nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv); nsPluginArray* GetPlugins(ErrorResult& aRv); Permissions* GetPermissions(ErrorResult& aRv); diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index 1bf3cf7e843e..5382bc56c8c6 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -84,7 +84,7 @@ interface mixin NavigatorContentUtils { [Throws, ChromeOnly] void checkProtocolHandlerAllowed(DOMString scheme, URI handlerURI, URI documentURI); [Throws, SecureContext] - void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title); + void registerProtocolHandler(DOMString scheme, DOMString url); // NOT IMPLEMENTED //void unregisterProtocolHandler(DOMString scheme, DOMString url); }; diff --git a/testing/web-platform/meta/html/dom/idlharness.https.html.ini b/testing/web-platform/meta/html/dom/idlharness.https.html.ini index a44aac102fa3..936536f61e5a 100644 --- a/testing/web-platform/meta/html/dom/idlharness.https.html.ini +++ b/testing/web-platform/meta/html/dom/idlharness.https.html.ini @@ -711,9 +711,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu [OffscreenCanvasRenderingContext2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean)] expected: FAIL - [Navigator interface: operation registerProtocolHandler(DOMString, USVString)] - expected: FAIL - [ElementInternals interface: operation setValidity(optional ValidityStateFlags, optional DOMString, optional HTMLElement)] expected: FAIL diff --git a/testing/web-platform/meta/html/webappapis/system-state-and-capabilities/the-navigator-object/historical.https.window.js.ini b/testing/web-platform/meta/html/webappapis/system-state-and-capabilities/the-navigator-object/historical.https.window.js.ini deleted file mode 100644 index 28f62390271f..000000000000 --- a/testing/web-platform/meta/html/webappapis/system-state-and-capabilities/the-navigator-object/historical.https.window.js.ini +++ /dev/null @@ -1,4 +0,0 @@ -[historical.https.window.html] - [registerProtocolHandler has no third argument] - expected: FAIL -