diff --git a/mozilla/browser/components/bookmarks/src/nsBookmarkProtocolHandler.js b/mozilla/browser/components/bookmarks/src/nsBookmarkProtocolHandler.js index e6d9a6af709..85c90618aa5 100644 --- a/mozilla/browser/components/bookmarks/src/nsBookmarkProtocolHandler.js +++ b/mozilla/browser/components/bookmarks/src/nsBookmarkProtocolHandler.js @@ -172,10 +172,9 @@ nsBookmarkContentHandler.prototype = { _bundle: null, - handleContent: function (aContentType, aCommand, aWindowTarget, aRequest) + handleContent: function (aContentType, aWindowTarget, aRequest) { - var ireq = aWindowTarget.QueryInterface(Components.interfaces.nsIInterfaceRequestor); - var win = ireq.getInterface(Components.interfaces.nsIDOMWindowInternal); + var win = aWindowTarget.getInterface(Components.interfaces.nsIDOMWindowInternal); // It'd be nicer if the add bookmark dialog was parameterizable enough // to be able to open here, instead of just showing a prompt, but that can diff --git a/mozilla/calendar/resources/content/calendarService.js b/mozilla/calendar/resources/content/calendarService.js index faff3580b68..92e6eff4eb0 100644 --- a/mozilla/calendar/resources/content/calendarService.js +++ b/mozilla/calendar/resources/content/calendarService.js @@ -108,14 +108,14 @@ function (iid) { } ICALContentHandler.prototype.handleContent = -function (aContentType, aCommand, aWindowTarget, aRequest) +function (aContentType, aWindowTarget, aRequest) { var e; var channel = aRequest.QueryInterface(nsIChannel); /* dump ("ICALContentHandler.handleContent (" + aContentType + ", " + - aCommand + ", " + aWindowTarget + ", " + channel.URI.spec + ")\n"); + aWindowTarget + ", " + channel.URI.spec + ")\n"); */ var windowManager = diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index f51f7cd61e3..da0652e4ad8 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -387,8 +387,7 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink) NS_ENSURE_TRUE(uriLoader, NS_ERROR_FAILURE); nsCOMPtr docLoader; NS_ENSURE_SUCCESS(uriLoader-> - GetDocumentLoaderForContext(NS_STATIC_CAST - (nsIDocShell *, this), + GetDocumentLoaderForContext(this, getter_AddRefs (docLoader)), NS_ERROR_FAILURE); @@ -5338,8 +5337,7 @@ nsDocShell::DoURILoad(nsIURI * aURI, // we need to get the load group from our load cookie so we can pass it into open uri... nsCOMPtr loadGroup; - rv = uriLoader->GetLoadGroupForContext(NS_STATIC_CAST - (nsIDocShell *, this), + rv = uriLoader->GetLoadGroupForContext(this, getter_AddRefs(loadGroup)); if (NS_FAILED(rv)) return rv; @@ -5709,7 +5707,7 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel * aChannel, rv = aURILoader->OpenURI(aChannel, (mLoadType == LOAD_LINK), - NS_STATIC_CAST(nsIDocShell *, this)); + this); return rv; } diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index d1d5fe9b584..26c84458d6a 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -1211,7 +1211,7 @@ NS_IMETHODIMP nsWebShell::Create() nsCOMPtr uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - rv = uriLoader->GetDocumentLoaderForContext(NS_STATIC_CAST(nsIWebShell*, this), + rv = uriLoader->GetDocumentLoaderForContext(this, getter_AddRefs(mDocLoader)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/mozilla/embedding/qa/testembed/Tests.cpp b/mozilla/embedding/qa/testembed/Tests.cpp index 68c73ff7302..4d806ee7f61 100644 --- a/mozilla/embedding/qa/testembed/Tests.cpp +++ b/mozilla/embedding/qa/testembed/Tests.cpp @@ -595,8 +595,7 @@ void CTests::OnTestsAddUriContentListenerByOpenUri() return; } - nsCOMPtr mySupports = do_QueryInterface(NS_STATIC_CAST(nsIURIContentListener*, qaBrowserImpl)); - rv = myLoader->OpenURI(theChannel, PR_TRUE, mySupports); + rv = myLoader->OpenURI(theChannel, PR_TRUE, qaBrowserImpl); RvTestResult(rv, "nsIUriLoader->OpenURI() test", 2); } @@ -870,8 +869,7 @@ void CTests::OnVerifybugs169617() rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull); RvTestResult(rv, "NS_NewChannel() test for file url", 1); - nsCOMPtr mySupports = do_QueryInterface(NS_STATIC_CAST(nsIURIContentListener*, qaBrowserImpl)); - rv = myLoader->OpenURI(theChannel, PR_TRUE, mySupports); + rv = myLoader->OpenURI(theChannel, PR_TRUE, qaBrowserImpl); RvTestResult(rv, "nsIUriLoader->OpenURI() test for file url", 2); } @@ -892,8 +890,7 @@ void CTests::OnVerifybugs170274() rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull); RvTestResult(rv, "NS_NewChannel() test for data url", 1); - nsCOMPtr mySupports = do_QueryInterface(NS_STATIC_CAST(nsIURIContentListener*, qaBrowserImpl)); - rv = myLoader->OpenURI(theChannel, PR_TRUE, mySupports); + rv = myLoader->OpenURI(theChannel, PR_TRUE, qaBrowserImpl); RvTestResult(rv, "nsIUriLoader->OpenURI() test for data url", 2); } diff --git a/mozilla/extensions/irc/js/lib/chatzilla-service.js b/mozilla/extensions/irc/js/lib/chatzilla-service.js index d0e1735e0c1..09b4a088a78 100644 --- a/mozilla/extensions/irc/js/lib/chatzilla-service.js +++ b/mozilla/extensions/irc/js/lib/chatzilla-service.js @@ -115,7 +115,7 @@ function (iid) } IRCContentHandler.prototype.handleContent = -function (contentType, command, windowTarget, request) +function (contentType, windowTarget, request) { var e; var channel = request.QueryInterface(nsIChannel); diff --git a/mozilla/extensions/venkman/js/venkman-service.js b/mozilla/extensions/venkman/js/venkman-service.js index 5d7381d4088..294e2ef5f9b 100644 --- a/mozilla/extensions/venkman/js/venkman-service.js +++ b/mozilla/extensions/venkman/js/venkman-service.js @@ -415,7 +415,7 @@ function jsdh_qi(iid) } JSDContentHandler.prototype.handleContent = -function jsdh_handle(contentType, command, windowTarget, request) +function jsdh_handle(contentType, windowTarget, request) { var e; var channel = request.QueryInterface(nsIChannel); diff --git a/mozilla/extensions/xmlterm/ui/xmlterm-service.js b/mozilla/extensions/xmlterm/ui/xmlterm-service.js index 7b7f6a5d28a..cdf65ab42eb 100644 --- a/mozilla/extensions/xmlterm/ui/xmlterm-service.js +++ b/mozilla/extensions/xmlterm/ui/xmlterm-service.js @@ -114,15 +114,14 @@ function (iid) { } XMLTermContentHandler.prototype.handleContent = -function (aContentType, aCommand, aWindowContext, aRequest) +function (aContentType, aWindowContext, aRequest) { var e; var aChannel = aRequest.QueryInterface(Components.interfaces.nsIChannel); debug("XMLTermContentHandler.handleContent (" + aContentType + ", " + - aCommand + ", " + aWindowContext + ", " + - aChannel.URI.spec + ")\n"); + aWindowContext + ", " + aChannel.URI.spec + ")\n"); var xmltermChromeURL = "chrome://xmlterm/content/xmlterm.xul?"+aChannel.URI.spec; //dump("XMLTermContentHandler:xmltermChromeURL = " + xmltermChromeURL + "\n"); diff --git a/mozilla/mailnews/addrbook/src/nsAddressBook.cpp b/mozilla/mailnews/addrbook/src/nsAddressBook.cpp index 99e61d71e7a..9f8cca0947d 100644 --- a/mozilla/mailnews/addrbook/src/nsAddressBook.cpp +++ b/mozilla/mailnews/addrbook/src/nsAddressBook.cpp @@ -2009,8 +2009,9 @@ static void convertFromVObject(VObject *vObj, nsIAbCard *aCard) return; } -NS_IMETHODIMP nsAddressBook::HandleContent(const char * aContentType, const char * aCommand, - nsISupports * aWindowContext, nsIRequest *request) +NS_IMETHODIMP nsAddressBook::HandleContent(const char * aContentType, + nsIInterfaceRequestor * aWindowContext, + nsIRequest *request) { NS_ENSURE_ARG_POINTER(request); diff --git a/mozilla/mailnews/base/src/nsMessengerContentHandler.cpp b/mozilla/mailnews/base/src/nsMessengerContentHandler.cpp index f1f95cbc941..848c4d9b4f9 100644 --- a/mozilla/mailnews/base/src/nsMessengerContentHandler.cpp +++ b/mozilla/mailnews/base/src/nsMessengerContentHandler.cpp @@ -59,8 +59,8 @@ nsMessengerContentHandler::~nsMessengerContentHandler() { } -NS_IMETHODIMP nsMessengerContentHandler::HandleContent(const char * aContentType, const char * aCommand, - nsISupports * aWindowContext, nsIRequest *request) +NS_IMETHODIMP nsMessengerContentHandler::HandleContent(const char * aContentType, + nsIInterfaceRequestor* aWindowContext, nsIRequest *request) { nsresult rv = NS_OK; if (!request) diff --git a/mozilla/mailnews/build/nsMailModule.cpp b/mozilla/mailnews/build/nsMailModule.cpp index e8f6e8de2c8..8ce428cdc63 100644 --- a/mozilla/mailnews/build/nsMailModule.cpp +++ b/mozilla/mailnews/build/nsMailModule.cpp @@ -183,7 +183,6 @@ #include "nsSmtpServer.h" #include "nsSmtpDataSource.h" #include "nsSmtpDelegateFactory.h" -#include "nsIContentHandler.h" #include "nsMsgRecipientArray.h" #include "nsMsgComposeStringBundle.h" #include "nsMsgCompUtils.h" diff --git a/mozilla/mailnews/compose/build/nsMsgCompFactory.cpp b/mozilla/mailnews/compose/build/nsMsgCompFactory.cpp index a80f2fa08d9..78a4ca3511b 100644 --- a/mozilla/mailnews/compose/build/nsMsgCompFactory.cpp +++ b/mozilla/mailnews/compose/build/nsMsgCompFactory.cpp @@ -67,7 +67,6 @@ #include "nsSmtpServer.h" #include "nsSmtpDataSource.h" #include "nsSmtpDelegateFactory.h" -#include "nsIContentHandler.h" #include "nsMsgRecipientArray.h" #include "nsMsgComposeStringBundle.h" #include "nsMsgCompUtils.h" diff --git a/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp b/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp index da086d9d7cf..8f0637ba592 100644 --- a/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp +++ b/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp @@ -56,8 +56,8 @@ nsMsgComposeContentHandler::~nsMsgComposeContentHandler() { } -NS_IMETHODIMP nsMsgComposeContentHandler::HandleContent(const char * aContentType, const char * aCommand, - nsISupports * aWindowContext, nsIRequest *request) +NS_IMETHODIMP nsMsgComposeContentHandler::HandleContent(const char * aContentType, + nsIInterfaceRequestor* aWindowContext, nsIRequest *request) { nsresult rv = NS_OK; if (!request) diff --git a/mozilla/mailnews/compose/src/nsURLFetcher.cpp b/mozilla/mailnews/compose/src/nsURLFetcher.cpp index 871dbb7694e..2bd5aac1b54 100644 --- a/mozilla/mailnews/compose/src/nsURLFetcher.cpp +++ b/mozilla/mailnews/compose/src/nsURLFetcher.cpp @@ -356,13 +356,12 @@ nsURLFetcher::FireURLRequest(nsIURI *aURL, nsILocalFile *localFile, nsIFileOutpu nsCOMPtr pURILoader (do_GetService(NS_URI_LOADER_CONTRACTID)); NS_ENSURE_TRUE(pURILoader, NS_ERROR_FAILURE); - nsCOMPtr cntListener (do_QueryInterface(NS_STATIC_CAST(nsIStreamListener *, this))); nsCOMPtr channel; nsCOMPtr loadGroup; - pURILoader->GetLoadGroupForContext(cntListener, getter_AddRefs(loadGroup)); + pURILoader->GetLoadGroupForContext(this, getter_AddRefs(loadGroup)); NS_ENSURE_SUCCESS(NS_NewChannel(getter_AddRefs(channel), aURL, nsnull, loadGroup, this), NS_ERROR_FAILURE); - return pURILoader->OpenURI(channel, PR_FALSE, cntListener); + return pURILoader->OpenURI(channel, PR_FALSE, this); } nsresult diff --git a/mozilla/mailnews/imap/src/nsImapService.cpp b/mozilla/mailnews/imap/src/nsImapService.cpp index c860bc53cf2..fa608758720 100644 --- a/mozilla/mailnews/imap/src/nsImapService.cpp +++ b/mozilla/mailnews/imap/src/nsImapService.cpp @@ -3581,7 +3581,7 @@ NS_IMETHODIMP nsImapService::GetCacheSession(nsICacheSession **result) } NS_IMETHODIMP -nsImapService::HandleContent(const char * aContentType, const char * aCommand, nsISupports * aWindowContext, nsIRequest *request) +nsImapService::HandleContent(const char * aContentType, nsIInterfaceRequestor* aWindowContext, nsIRequest *request) { nsresult rv; NS_ENSURE_ARG_POINTER(request); diff --git a/mozilla/mailnews/news/build/nsMsgNewsFactory.cpp b/mozilla/mailnews/news/build/nsMsgNewsFactory.cpp index 33652a20aea..1324ad673e9 100644 --- a/mozilla/mailnews/news/build/nsMsgNewsFactory.cpp +++ b/mozilla/mailnews/news/build/nsMsgNewsFactory.cpp @@ -58,7 +58,6 @@ #include "nsNNTPNewsgroupList.h" #include "nsNNTPArticleList.h" #include "nsNewsDownloadDialogArgs.h" -#include "nsIContentHandler.h" #include "nsCURILoader.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsNntpUrl) diff --git a/mozilla/mailnews/news/src/nsNntpService.cpp b/mozilla/mailnews/news/src/nsNntpService.cpp index e59835d4d1a..a9332e355c2 100644 --- a/mozilla/mailnews/news/src/nsNntpService.cpp +++ b/mozilla/mailnews/news/src/nsNntpService.cpp @@ -1740,7 +1740,7 @@ NS_IMETHODIMP nsNntpService::GetChromeUrlForTask(char **aChromeUrlForTask) } NS_IMETHODIMP -nsNntpService::HandleContent(const char * aContentType, const char * aCommand, nsISupports * aWindowContext, nsIRequest *request) +nsNntpService::HandleContent(const char * aContentType, nsIInterfaceRequestor* aWindowContext, nsIRequest *request) { nsresult rv; NS_ENSURE_ARG_POINTER(request); diff --git a/mozilla/toolkit/xre/nsAppRunner.cpp b/mozilla/toolkit/xre/nsAppRunner.cpp index 73dd20cd9ab..fbc60c9620f 100644 --- a/mozilla/toolkit/xre/nsAppRunner.cpp +++ b/mozilla/toolkit/xre/nsAppRunner.cpp @@ -80,7 +80,6 @@ #include "nsXPIDLString.h" #include "nsIXULWindow.h" #include "nsIChromeRegistry.h" -#include "nsIContentHandler.h" #include "nsIEventQueueService.h" #include "nsDirectoryServiceDefs.h" #include "nsBuildID.h" diff --git a/mozilla/uriloader/base/nsIContentHandler.idl b/mozilla/uriloader/base/nsIContentHandler.idl index 5614667b125..75b164482ff 100644 --- a/mozilla/uriloader/base/nsIContentHandler.idl +++ b/mozilla/uriloader/base/nsIContentHandler.idl @@ -37,15 +37,32 @@ #include "nsISupports.idl" interface nsIRequest; +interface nsIInterfaceRequestor; -[scriptable, uuid(2F0F927A-8677-11d3-989D-001083010E9B)] +[scriptable, uuid(49439df2-b3d2-441c-bf62-866bdaf56fd2)] interface nsIContentHandler : nsISupports { - /* HandleContent works as the name implies =). - aRequest is a request whose content type is already known (aContentType) */ + /** + * Tells the content handler to take over handling the content. If this + * function succeeds, the URI Loader will leave this request alone, ignoring + * progress notifications. Failure of this method will cause the request to be + * cancelled, unless the error code is NS_ERROR_WONT_HANDLE_CONTENT (see + * below). + * + * @param aWindowContext + * Window context, used to get things like the current nsIDOMWindow + * for this request. May be null. + * @param aContentType + * The content type of aRequest + * @param aRequest + * A request whose content type is already known. + * + * @throw NS_ERROR_WONT_HANDLE_CONTENT Indicates that this handler does not + * want to handle this content. A different way for handling this + * content should be tried. + */ void handleContent(in string aContentType, - in string aCommand, - in nsISupports aWindowContext, + in nsIInterfaceRequestor aWindowContext, in nsIRequest aRequest); }; diff --git a/mozilla/uriloader/base/nsIURIContentListener.idl b/mozilla/uriloader/base/nsIURIContentListener.idl index 6a09b40bab6..d4354a6928d 100644 --- a/mozilla/uriloader/base/nsIURIContentListener.idl +++ b/mozilla/uriloader/base/nsIURIContentListener.idl @@ -35,6 +35,12 @@ * * ***** END LICENSE BLOCK ***** */ +#include "nsISupports.idl" + +interface nsIRequest; +interface nsIStreamListener; +interface nsIURI; + /** * nsIURIContentListener is an interface used by components which * want to know (and have a chance to handle) a particular content type. @@ -44,13 +50,6 @@ * * @status FROZEN */ - -#include "nsISupports.idl" - -interface nsIRequest; -interface nsIStreamListener; -interface nsIURI; - [scriptable, uuid(94928AB3-8B63-11d3-989D-001083010E9B)] interface nsIURIContentListener : nsISupports { diff --git a/mozilla/uriloader/base/nsIURILoader.idl b/mozilla/uriloader/base/nsIURILoader.idl index 0648cf09940..f4ad56bb2b3 100644 --- a/mozilla/uriloader/base/nsIURILoader.idl +++ b/mozilla/uriloader/base/nsIURILoader.idl @@ -46,6 +46,7 @@ interface nsIChannel; interface nsIRequest; interface nsIStreamListener; interface nsIInputStream; +interface nsIInterfaceRequestor; /** * The uri dispatcher is responsible for taking uri's, determining @@ -67,7 +68,7 @@ interface nsIInputStream; * or helper app. Or it may hand the url off to an OS registered * application. */ -[scriptable, uuid(40AECB53-8B65-11d3-989D-001083010E9B)] +[scriptable, uuid(59432929-288b-4fa9-83c9-a5bc8d7ca3bd)] interface nsIURILoader : nsISupports { /** @@ -96,13 +97,13 @@ interface nsIURILoader : nsISupports * If you are running the url from a doc shell or a web shell, this is * your window context. If you have a content listener you want to * give first crack to, the uri loader needs to be able to get it - * from the window context (we'll use nsIInterfaceRequestor). We will - * also be using nsIInterfaceRequestor to get at the progress event - * sink interface. + * from the window context. We will also be using the window context + * to get at the progress event sink interface. + * Must not be null! */ void openURI(in nsIChannel aChannel, in boolean aIsContentPreferred, - in nsISupports aWindowContext); + in nsIInterfaceRequestor aWindowContext); /** @@ -114,7 +115,7 @@ interface nsIURILoader : nsISupports * dirty little back door for sneaking the load group out in case you need * it to create the channel before calling openURI */ - nsILoadGroup getLoadGroupForContext(in nsISupports aWindowContext); - nsIDocumentLoader getDocumentLoaderForContext (in nsISupports aWindowContext); + nsILoadGroup getLoadGroupForContext(in nsIInterfaceRequestor aWindowContext); + nsIDocumentLoader getDocumentLoaderForContext (in nsIInterfaceRequestor aWindowContext); }; diff --git a/mozilla/uriloader/base/nsURILoader.cpp b/mozilla/uriloader/base/nsURILoader.cpp index 9cc03975fd4..c6efaef7d56 100644 --- a/mozilla/uriloader/base/nsURILoader.cpp +++ b/mozilla/uriloader/base/nsURILoader.cpp @@ -99,7 +99,7 @@ public: nsDocumentOpenInfo(); // Real constructor - nsDocumentOpenInfo(nsISupports* aWindowContext, + nsDocumentOpenInfo(nsIInterfaceRequestor* aWindowContext, PRBool aIsContentPreferred, nsURILoader* aURILoader); @@ -135,7 +135,7 @@ public: NS_DECL_NSISTREAMLISTENER protected: - virtual ~nsDocumentOpenInfo(); + ~nsDocumentOpenInfo(); protected: /** @@ -151,11 +151,10 @@ protected: nsCOMPtr m_targetStreamListener; /** - * A pointer to the entity that originated the load. This should - * implement nsIInterfaceRequestor; we depend on getting things like - * nsIURIContentListeners, nsIDOMWindows, etc off of it. + * A pointer to the entity that originated the load. We depend on getting + * things like nsIURIContentListeners, nsIDOMWindows, etc off of it. */ - nsCOMPtr m_originalContext; + nsCOMPtr m_originalContext; /** * Boolean to pass to CanHandleContent (also determines whether we @@ -189,7 +188,7 @@ nsDocumentOpenInfo::nsDocumentOpenInfo() NS_NOTREACHED("This should never be called\n"); } -nsDocumentOpenInfo::nsDocumentOpenInfo(nsISupports* aWindowContext, +nsDocumentOpenInfo::nsDocumentOpenInfo(nsIInterfaceRequestor* aWindowContext, PRBool aIsContentPreferred, nsURILoader* aURILoader) : m_originalContext(aWindowContext), @@ -510,7 +509,7 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports * do_CreateInstance(handlerContractID.get()); if (contentHandler) { LOG((" Content handler found")); - rv = contentHandler->HandleContent(mContentType.get(), "view", + rv = contentHandler->HandleContent(mContentType.get(), m_originalContext, request); // XXXbz returning an error code to represent handling the // content is just bizarre! @@ -782,7 +781,7 @@ NS_IMETHODIMP nsURILoader::UnRegisterContentListener(nsIURIContentListener * aCo NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel, PRBool aIsContentPreferred, - nsISupports * aWindowContext) + nsIInterfaceRequestor *aWindowContext) { NS_ENSURE_ARG_POINTER(channel); @@ -842,27 +841,26 @@ NS_IMETHODIMP nsURILoader::Stop(nsISupports* aLoadCookie) } NS_IMETHODIMP -nsURILoader::GetLoadGroupForContext(nsISupports * aWindowContext, +nsURILoader::GetLoadGroupForContext(nsIInterfaceRequestor* aWindowContext, nsILoadGroup ** aLoadGroup) { nsresult rv; nsCOMPtr loadCookieForWindow; // Initialize the [out] parameter... - *aLoadGroup= nsnull; + *aLoadGroup = nsnull; NS_ENSURE_ARG(aWindowContext); rv = SetupLoadCookie(aWindowContext, getter_AddRefs(loadCookieForWindow)); if (NS_FAILED(rv)) return rv; - rv = loadCookieForWindow->GetInterface(NS_GET_IID(nsILoadGroup), - (void **) aLoadGroup); + rv = CallGetInterface(loadCookieForWindow.get(), aLoadGroup); return rv; } NS_IMETHODIMP -nsURILoader::GetDocumentLoaderForContext(nsISupports * aWindowContext, +nsURILoader::GetDocumentLoaderForContext(nsIInterfaceRequestor * aWindowContext, nsIDocumentLoader ** aDocLoader) { nsresult rv; @@ -876,12 +874,11 @@ nsURILoader::GetDocumentLoaderForContext(nsISupports * aWindowContext, rv = SetupLoadCookie(aWindowContext, getter_AddRefs(loadCookieForWindow)); if (NS_FAILED(rv)) return rv; - rv = loadCookieForWindow->GetInterface(NS_GET_IID(nsIDocumentLoader), - (void **) aDocLoader); + rv = CallGetInterface(loadCookieForWindow.get(), aDocLoader); return rv; } -nsresult nsURILoader::SetupLoadCookie(nsISupports * aWindowContext, +nsresult nsURILoader::SetupLoadCookie(nsIInterfaceRequestor * aWindowContext, nsIInterfaceRequestor ** aLoadCookie) { // first, see if we have already set a load cookie on the cnt listener.. @@ -941,8 +938,7 @@ nsresult nsURILoader::SetupLoadCookie(nsISupports * aWindowContext, // loadCookie may be null - for example, if popupWin is // not a defined window. The following prevents a crash (Bug 32898) if (loadCookie) { - rv = loadCookie->QueryInterface(NS_GET_IID(nsIInterfaceRequestor), - (void**)aLoadCookie); + rv = CallQueryInterface(loadCookie, aLoadCookie); } else { rv = NS_ERROR_UNEXPECTED; } diff --git a/mozilla/uriloader/base/nsURILoader.h b/mozilla/uriloader/base/nsURILoader.h index e352f9f281d..2ee1df72d00 100644 --- a/mozilla/uriloader/base/nsURILoader.h +++ b/mozilla/uriloader/base/nsURILoader.h @@ -62,16 +62,18 @@ public: NS_DECL_ISUPPORTS nsURILoader(); - virtual ~nsURILoader(); + ~nsURILoader(); protected: - // we shouldn't need to have an owning ref count on registered - // content listeners because they are supposed to unregister themselves - // when they go away. This array stores weak references + /** + * we shouldn't need to have an owning ref count on registered + * content listeners because they are supposed to unregister themselves + * when they go away. This array stores weak references + */ nsCOMArray m_listeners; - // prepare the load cookie for the window context - nsresult SetupLoadCookie(nsISupports * aWindowContext, nsIInterfaceRequestor ** aLoadCookie); + /** prepare the load cookie for the window context */ + nsresult SetupLoadCookie(nsIInterfaceRequestor * aWindowContext, nsIInterfaceRequestor ** aLoadCookie); #ifdef PR_LOGGING /** diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp index 728cdeff6d5..b7af3687f3a 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -45,6 +45,7 @@ #include "nsReadableUtils.h" #include "nsIRequest.h" #include "nsDirectoryServiceDefs.h" +#include "nsIInterfaceRequestor.h" // used to manage our in memory data source of helper applications @@ -490,7 +491,7 @@ nsresult nsExternalHelperAppService::InitDataSource() NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeContentType, nsIRequest *aRequest, - nsISupports *aWindowContext, + nsIInterfaceRequestor *aWindowContext, nsIStreamListener ** aStreamListener) { nsAutoString fileName; @@ -622,7 +623,7 @@ nsExternalAppHandler * nsExternalHelperAppService::CreateNewExternalHandler(nsIM const nsCSubstring& aTempFileExtension, const nsAString& aFileName, PRBool aIsAttachment, - nsISupports * aWindowContext) + nsIInterfaceRequestor * aWindowContext) { nsExternalAppHandler* handler = nsnull; NS_NEWXPCOM(handler, nsExternalAppHandler); @@ -1767,7 +1768,7 @@ nsresult nsExternalAppHandler::ExecuteDesiredAction() nsresult nsExternalAppHandler::Init(nsIMIMEInfo * aMIMEInfo, const nsCSubstring& aTempFileExtension, - nsISupports * aWindowContext, + nsIInterfaceRequestor* aWindowContext, const nsAString& aSuggestedFilename, PRBool aIsAttachment) { diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.h b/mozilla/uriloader/exthandler/nsExternalHelperAppService.h index 35ec178e698..b96d3a2e273 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.h +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.h @@ -111,7 +111,7 @@ public: const nsCSubstring& aFileExtension, const nsAString& aFileName, PRBool aIsAttachment, - nsISupports * aWindowContext); + nsIInterfaceRequestor* aWindowContext); /** * Given a content type, look up the user override information to see if @@ -297,7 +297,7 @@ public: ~nsExternalAppHandler(); nsresult Init(nsIMIMEInfo * aMIMEInfo, const nsCSubstring& aFileExtension, - nsISupports * aWindowContext, + nsIInterfaceRequestor * aWindowContext, const nsAString& aFilename, PRBool aIsAttachment); @@ -307,7 +307,7 @@ protected: nsString mTempFileExtension; nsCOMPtr mMimeInfo; nsCOMPtr mOutStream; /**< output stream to the temp file */ - nsCOMPtr mWindowContext; + nsCOMPtr mWindowContext; /** * The following field is set if we were processing an http channel that had * a content disposition header which specified the SUGGESTED file name we diff --git a/mozilla/uriloader/exthandler/nsIExternalHelperAppService.idl b/mozilla/uriloader/exthandler/nsIExternalHelperAppService.idl index 1ad58c5249e..1224745f595 100644 --- a/mozilla/uriloader/exthandler/nsIExternalHelperAppService.idl +++ b/mozilla/uriloader/exthandler/nsIExternalHelperAppService.idl @@ -28,12 +28,13 @@ interface nsIStreamListener; interface nsIFile; interface nsIMIMEInfo; interface nsIWebProgressListener; +interface nsIInterfaceRequestor; /** * The external helper app service is used for finding and launching * platform specific external applications for a given mime content type. */ -[scriptable, uuid(8a902933-d1a2-48a1-93a5-da64d6a2786f)] +[scriptable, uuid(0ea90cf3-2dd9-470f-8f76-f141743c5678)] interface nsIExternalHelperAppService : nsISupports { /** @@ -49,7 +50,7 @@ interface nsIExternalHelperAppService : nsISupports * @return A nsIStreamListener which the caller should pump the data into. */ nsIStreamListener doContent (in ACString aMimeContentType, in nsIRequest aRequest, - in nsISupports aWindowContext); + in nsIInterfaceRequestor aWindowContext); /** * Returns true if data from a URL with this extension combination diff --git a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.h b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.h index 580a14017b7..2ede2d84f6e 100644 --- a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.h +++ b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.h @@ -121,12 +121,12 @@ class nsMIMEInfoBase : public nsIMIMEInfo { static NS_HIDDEN_(nsresult) LaunchWithIProcess(nsIFile* aApp, nsIFile* aFile); // member variables - nsCStringArray mExtensions; // array of file extensions associated w/ this MIME obj - nsString mDescription; // human readable description - PRUint32 mMacType, mMacCreator; // Mac file type and creator + nsCStringArray mExtensions; ///< array of file extensions associated w/ this MIME obj + nsString mDescription; ///< human readable description + PRUint32 mMacType, mMacCreator; ///< Mac file type and creator nsCString mMIMEType; - nsCOMPtr mPreferredApplication; // preferred application associated with this type. - nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type + nsCOMPtr mPreferredApplication; ///< preferred application associated with this type. + nsMIMEInfoHandleAction mPreferredAction; ///< preferred action to associate with this type nsString mPreferredAppDescription; nsString mDefaultAppDescription; PRBool mAlwaysAskBeforeHandling; @@ -150,7 +150,11 @@ class nsMIMEInfoImpl : public nsMIMEInfoBase { NS_IMETHOD GetDefaultDescription(nsAString& aDefaultDescription); // additional methods - void SetDefaultApplication(nsIFile* aApp) { mDefaultApplication = aApp; } + /** + * Sets the default application. Supposed to be only called by the OS Helper + * App Services; the default application is immutable after it is first set. + */ + void SetDefaultApplication(nsIFile* aApp) { if (!mDefaultApplication) mDefaultApplication = aApp; } protected: // nsMIMEInfoBase methods /** @@ -160,7 +164,7 @@ class nsMIMEInfoImpl : public nsMIMEInfoBase { virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile* aFile); - nsCOMPtr mDefaultApplication; // default application associated with this type. + nsCOMPtr mDefaultApplication; ///< default application associated with this type. }; #endif //__nsmimeinfoimpl_h___ diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index d50326da4d4..3ed038e3667 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -78,7 +78,6 @@ #include "nsXPIDLString.h" #include "nsIXULWindow.h" #include "nsIChromeRegistry.h" -#include "nsIContentHandler.h" #include "nsIEventQueueService.h" #include "nsDirectoryServiceDefs.h" #include "nsBuildID.h" diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index b575539a68b..ed2260bee5b 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -793,8 +793,7 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs) } NS_IMETHODIMP nsBrowserContentHandler::HandleContent(const char * aContentType, - const char * aCommand, - nsISupports * aWindowContext, + nsIInterfaceRequestor * aWindowContext, nsIRequest * aRequest) { // create a new browser window to handle the content diff --git a/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp b/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp index 89a41abcfd8..a7b6e20140d 100644 --- a/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp +++ b/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp @@ -244,7 +244,7 @@ nsresult nsDownloadManager::GetDataSource(nsIRDFDataSource** aDataSource) { *aDataSource = mDataSource; - NS_IF_ADDREF(*aDataSource); + NS_ADDREF(*aDataSource); return NS_OK; } diff --git a/mozilla/xpfe/components/xremote/src/XRemoteService.cpp b/mozilla/xpfe/components/xremote/src/XRemoteService.cpp index 938a2e2320d..470a2b6d146 100644 --- a/mozilla/xpfe/components/xremote/src/XRemoteService.cpp +++ b/mozilla/xpfe/components/xremote/src/XRemoteService.cpp @@ -811,7 +811,7 @@ XRemoteService::OpenURL(nsCString &aArgument, return NS_ERROR_FAILURE; // load it - rv = loader->OpenURI(channel, PR_TRUE, listenerRef); + rv = loader->OpenURI(channel, PR_TRUE, listener); } else if (newTab && aOpenBrowser) { diff --git a/mozilla/xpinstall/src/nsInstallTrigger.cpp b/mozilla/xpinstall/src/nsInstallTrigger.cpp index 182d358ff23..e9a9d32a5ab 100644 --- a/mozilla/xpinstall/src/nsInstallTrigger.cpp +++ b/mozilla/xpinstall/src/nsInstallTrigger.cpp @@ -111,8 +111,7 @@ nsInstallTrigger::SetScriptObject(void *aScriptObject) NS_IMETHODIMP nsInstallTrigger::HandleContent(const char * aContentType, - const char * aCommand, - nsISupports* aWindowContext, + nsIInterfaceRequestor* aWindowContext, nsIRequest* request) { nsresult rv = NS_OK;