From 54400ca93cfc6e61e7245d261337e3a19897eef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 27 Nov 2019 20:05:02 +0000 Subject: [PATCH] Bug 1599843 - nsJSProtocolHandler construction should be simpler. r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D54981 --HG-- extra : moz-landing-system : lando --- dom/jsurl/nsJSProtocolHandler.cpp | 20 ++------------------ dom/jsurl/nsJSProtocolHandler.h | 4 ---- layout/build/components.conf | 2 +- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/dom/jsurl/nsJSProtocolHandler.cpp b/dom/jsurl/nsJSProtocolHandler.cpp index 8f06c9fad1c5..944c60b12321 100644 --- a/dom/jsurl/nsJSProtocolHandler.cpp +++ b/dom/jsurl/nsJSProtocolHandler.cpp @@ -1043,28 +1043,12 @@ bool nsJSChannel::GetIsDocumentLoad() { //////////////////////////////////////////////////////////////////////////////// -nsJSProtocolHandler::nsJSProtocolHandler() {} +nsJSProtocolHandler::nsJSProtocolHandler() = default; -nsresult nsJSProtocolHandler::Init() { return NS_OK; } - -nsJSProtocolHandler::~nsJSProtocolHandler() {} +nsJSProtocolHandler::~nsJSProtocolHandler() = default; NS_IMPL_ISUPPORTS(nsJSProtocolHandler, nsIProtocolHandler) -nsresult nsJSProtocolHandler::Create(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { - if (aOuter) return NS_ERROR_NO_AGGREGATION; - - nsJSProtocolHandler* ph = new nsJSProtocolHandler(); - NS_ADDREF(ph); - nsresult rv = ph->Init(); - if (NS_SUCCEEDED(rv)) { - rv = ph->QueryInterface(aIID, aResult); - } - NS_RELEASE(ph); - return rv; -} - /* static */ nsresult nsJSProtocolHandler::EnsureUTF8Spec( const nsCString& aSpec, const char* aCharset, nsACString& aUTF8Spec) { aUTF8Spec.Truncate(); diff --git a/dom/jsurl/nsJSProtocolHandler.h b/dom/jsurl/nsJSProtocolHandler.h index 9f4fa69c50d8..42e7049bd330 100644 --- a/dom/jsurl/nsJSProtocolHandler.h +++ b/dom/jsurl/nsJSProtocolHandler.h @@ -49,10 +49,6 @@ class nsJSProtocolHandler : public nsIProtocolHandler { // nsJSProtocolHandler methods: nsJSProtocolHandler(); - static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult); - - nsresult Init(); - static nsresult CreateNewURI(const nsACString& aSpec, const char* aCharset, nsIURI* aBaseURI, nsIURI** result); diff --git a/layout/build/components.conf b/layout/build/components.conf index ff0c9e3a07c4..93e5a99931c1 100644 --- a/layout/build/components.conf +++ b/layout/build/components.conf @@ -300,7 +300,7 @@ Classes = [ { 'cid': '{bfc310d2-38a0-11d3-8cd3-0060b0fc14a3}', 'contract_ids': ['@mozilla.org/network/protocol;1?name=javascript'], - 'legacy_constructor': 'nsJSProtocolHandler::Create', + 'type': 'nsJSProtocolHandler', 'headers': ['nsJSProtocolHandler.h'], }, {