From 4d4116d281ebc35834f7a084047f7aa5805bfee2 Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Thu, 16 May 2002 20:57:37 +0000 Subject: [PATCH] bug #46856 (r=valeski, sr=darin). API Changes to nsIWebProgress/nsIWebProgressListener) --- accessible/src/base/nsRootAccessible.cpp | 13 +- .../html/content/src/nsHTMLFormElement.cpp | 10 +- docshell/base/nsDocShell.cpp | 19 +- editor/composer/src/nsEditingSession.cp | 681 ------------------ editor/composer/src/nsEditingSession.cpp | 10 +- editor/composer/src/nsEditorShell.cpp | 11 +- editor/composer/src/nsEditorShell.h | 1 + .../activex/src/control/MozillaBrowser.cpp | 16 +- .../src/control/WebBrowserContainer.cpp | 14 +- embedding/browser/chrome/content/mini-nav.js | 2 +- .../browser/photon/src/EmbedPrintListener.cpp | 10 +- .../browser/photon/src/EmbedProgress.cpp | 2 +- .../src/nsUnknownContentTypeHandler.cpp | 2 +- .../powerplant/source/CBrowserMsgDefs.h | 153 ---- .../powerplant/source/CBrowserShell.cpp | 2 +- .../powerplant/source/CWebBrowserChrome.cpp | 10 +- .../webBrowser/nsDocShellTreeOwner.cpp | 12 +- embedding/browser/webBrowser/nsWebBrowser.cpp | 10 +- .../printingui/src/mac/nsPrintProgress.cpp | 12 +- .../src/mac/nsPrintingPromptService.cpp | 4 +- .../printingui/src/os2/nsPrintProgress.cpp | 12 +- .../src/os2/nsPrintingPromptService.cpp | 6 +- .../src/unixshared/nsPrintProgress.cpp | 10 +- .../unixshared/nsPrintingPromptService.cpp | 8 +- .../printingui/src/win/nsPrintProgress.cpp | 12 +- .../src/win/nsPrintingPromptService.cpp | 8 +- .../qa/testembed/BrowserImplWebPrgrsLstnr.cpp | 4 +- .../qa/testembed/PrintProgressDialog.cpp | 4 +- .../mfcembed/BrowserImplWebPrgrsLstnr.cpp | 113 +-- .../tests/mfcembed/PrintProgressDialog.cpp | 14 +- .../mfcembed/components/HelperAppDlg.cpp | 12 +- embedding/tests/winEmbed/WebBrowserChrome.cpp | 6 +- .../accessproxy/nsAccessProxy.cpp | 27 +- extensions/cookie/nsCookieService.cpp | 19 +- extensions/help/resources/content/help.js | 2 +- extensions/pics/src/nsPICS.cpp | 29 +- extensions/wallet/src/nsWalletService.cpp | 19 +- extensions/xmlterm/base/mozXMLTerminal.cpp | 19 +- htmlparser/robot/nsDebugRobot.cpp | 31 +- mailnews/base/src/nsMsgPrintEngine.cpp | 29 +- mailnews/base/src/nsMsgProgress.cpp | 36 +- mailnews/base/src/nsMsgStatusFeedback.cpp | 6 +- mailnews/base/src/nsMsgWindow.cpp | 2 +- mailnews/base/util/nsMsgMailNewsUrl.cpp | 3 +- mailnews/compose/src/nsMsgCompose.cpp | 10 +- mailnews/compose/src/nsMsgComposeProgress.cpp | 28 +- mailnews/compose/src/nsURLFetcher.cpp | 11 +- netwerk/base/public/nsISecureBrowserUI.idl | 2 +- netwerk/base/public/nsISecurityEventSink.idl | 2 +- .../socket/base/nsITransportSecurityInfo.idl | 2 +- parser/htmlparser/robot/nsDebugRobot.cpp | 31 +- .../boot/src/nsSecureBrowserUIImpl.cpp | 38 +- .../manager/boot/src/nsSecureBrowserUIImpl.h | 2 +- security/manager/ssl/src/nsNSSIOLayer.cpp | 4 +- security/manager/ssl/src/nsNSSIOLayer.h | 4 +- uriloader/base/nsDocLoader.cpp | 312 +++++--- uriloader/base/nsDocLoader.h | 11 +- uriloader/base/nsIWebProgress.idl | 18 +- uriloader/base/nsIWebProgressListener.idl | 223 +++--- webshell/tests/viewer/nsWebBrowserChrome.cpp | 7 +- webshell/tests/viewer/nsWebBrowserChrome.h | 1 + webshell/tests/viewer/nsWebCrawler.cpp | 22 +- xpfe/appshell/src/nsChromeTreeOwner.cpp | 6 +- xpfe/appshell/src/nsWebShellWindow.cpp | 10 +- xpfe/browser/resources/content/fastnav.js | 2 +- xpfe/browser/resources/content/navigator.js | 2 +- .../public/nsIDownloadProgressListener.idl | 6 +- .../src/nsDownloadManager.cpp | 6 +- .../download-manager/src/nsDownloadProxy.h | 14 +- .../history/src/nsHistoryLoadListener.cpp | 31 +- .../resources/content/bindings/browser.xml | 2 +- 71 files changed, 785 insertions(+), 1447 deletions(-) diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 7f368dcbc9c..cee85e34d9d 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -456,12 +456,12 @@ NS_IMETHODIMP nsRootAccessible::AddAccessibleEventListener(nsIAccessibleEventLis nsCOMPtr docShell(do_QueryInterface(container)); if (docShell) { mWebProgress = do_GetInterface(docShell); - mWebProgress->AddProgressListener(this); + mWebProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_LOCATION | + nsIWebProgress::NOTIFY_STATE_DOCUMENT); } } } NS_ASSERTION(mWebProgress, "Could not get nsIWebProgress for nsRootAccessible"); - mWebProgress->AddProgressListener(this); } return NS_OK; @@ -704,7 +704,7 @@ NS_IMETHODIMP nsRootAccessible::GetDocument(nsIDocument **doc) } NS_IMETHODIMP nsRootAccessible::OnStateChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) + nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if ((aStateFlags & STATE_IS_DOCUMENT) && (aStateFlags & STATE_STOP)) { // Set up scroll position listener @@ -730,6 +730,7 @@ NS_IMETHODIMP nsRootAccessible::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -765,13 +766,15 @@ NS_IMETHODIMP nsRootAccessible::OnLocationChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP nsRootAccessible::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP nsRootAccessible::OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 state) + nsIRequest *aRequest, PRUint32 state) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index a2a98661005..cc36cc14021 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -793,7 +793,7 @@ nsHTMLFormElement::DoSubmit(nsIPresContext* aPresContext, nsEvent* aEvent) if (docShell) { nsCOMPtr webProgress = do_GetInterface(docShell); NS_ASSERTION(webProgress, "nsIDocShell not converted to nsIWebProgress!"); - rv = webProgress->AddProgressListener(this); + rv = webProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_ALL); NS_ENSURE_SUBMIT_SUCCESS(rv); } else { @@ -1204,7 +1204,7 @@ nsHTMLFormElement::GetLength(PRInt32* aLength) NS_IMETHODIMP nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - PRInt32 aStateFlags, + PRUint32 aStateFlags, PRUint32 aStatus) { // If STATE_STOP is never fired for any reason (redirect? Failed state @@ -1229,6 +1229,7 @@ nsHTMLFormElement::OnProgressChange(nsIWebProgress* aWebProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -1237,6 +1238,7 @@ nsHTMLFormElement::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI* location) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -1246,14 +1248,16 @@ nsHTMLFormElement::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP nsHTMLFormElement::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - PRInt32 state) + PRUint32 state) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index cc00dbbc289..877a9ef6235 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1861,7 +1861,8 @@ nsDocShell::SetTreeOwner(nsIDocShellTreeOwner * aTreeOwner) } if (newListener) { - webProgress->AddProgressListener(newListener); + webProgress->AddProgressListener(newListener, + nsIWebProgress::NOTIFY_ALL); } } } @@ -3812,7 +3813,7 @@ nsDocShell::OnProgressChange(nsIWebProgress * aProgress, NS_IMETHODIMP nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, - PRInt32 aStateFlags, nsresult aStatus) + PRUint32 aStateFlags, nsresult aStatus) { nsresult rv; @@ -3865,14 +3866,11 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, mainWidget->SetCursor(eCursor_standard); } } - if ((~aStateFlags & (STATE_IS_DOCUMENT | STATE_STOP)) == 0) { nsCOMPtr webProgress(do_QueryInterface(mLoadCookie)); - // Is the document stop notification for this document? if (aProgress == webProgress.get()) { nsCOMPtr channel(do_QueryInterface(aRequest)); - EndPageLoad(aProgress, channel, aStatus); } } @@ -3919,6 +3917,7 @@ NS_IMETHODIMP nsDocShell::OnLocationChange(nsIWebProgress * aProgress, nsIRequest * aRequest, nsIURI * aURI) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -3927,14 +3926,16 @@ nsDocShell::OnStatusChange(nsIWebProgress * aWebProgress, nsIRequest * aRequest, nsresult aStatus, const PRUnichar * aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP nsDocShell::OnSecurityChange(nsIWebProgress * aWebProgress, - nsIRequest * aRequest, PRInt32 state) + nsIRequest * aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -6053,7 +6054,9 @@ nsDocShell::SetLoadCookie(nsISupports * aCookie) nsCOMPtr webProgress(do_QueryInterface(mLoadCookie)); if (webProgress) { - webProgress->AddProgressListener(this); + webProgress->AddProgressListener(this, + nsIWebProgress::NOTIFY_STATE_DOCUMENT | + nsIWebProgress::NOTIFY_STATE_NETWORK); } nsCOMPtr loadGroup(do_GetInterface(mLoadCookie)); diff --git a/editor/composer/src/nsEditingSession.cp b/editor/composer/src/nsEditingSession.cp index 0df36105852..e69de29bb2d 100644 --- a/editor/composer/src/nsEditingSession.cp +++ b/editor/composer/src/nsEditingSession.cp @@ -1,681 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsIDOMWindow.h" -#include "nsIDOMWindowInternal.h" -#include "nsIDOMDocument.h" -#include "nsIScriptGlobalObject.h" -#include "nsISelectionPrivate.h" -#include "nsITransactionManager.h" - -#include "nsIEditorDocShell.h" - -#include "nsIChannel.h" -#include "nsIWebProgress.h" - -#include "nsIControllers.h" -#include "nsIController.h" -#include "nsIEditorController.h" - -#include "nsIPresShell.h" - -#include "nsComposerCommandsUpdater.h" - -#include "nsEditingSession.h" - -#include "nsIComponentManager.h" -#include "nsIInterfaceRequestor.h" -#include "nsIInterfaceRequestorUtils.h" - -#if DEBUG -#define NOISY_DOC_LOADING 1 -#endif - -/*--------------------------------------------------------------------------- - - nsEditingSession - -----------------------------------------------------------------------------*/ -nsEditingSession::nsEditingSession() -: mDoneSetup(PR_FALSE) -{ - NS_INIT_ISUPPORTS(); -} - -/*--------------------------------------------------------------------------- - - ~nsEditingSession - -----------------------------------------------------------------------------*/ -nsEditingSession::~nsEditingSession() -{ - NS_IF_RELEASE(mStateMaintainer); -} - -NS_IMPL_ISUPPORTS3(nsEditingSession, nsIEditingSession, nsIWebProgressListener, nsISupportsWeakReference) - -/*--------------------------------------------------------------------------- - - GetEditingShell - - void init (in nsIDOMWindow aWindow) -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::Init(nsIDOMWindow *aWindow) -{ - nsCOMPtr docShell; - nsresult rv = GetDocShellFromWindow(aWindow, getter_AddRefs(docShell)); - if (NS_FAILED(rv)) return rv; - - mEditingShell = getter_AddRefs(NS_GetWeakReference(docShell)); - if (!mEditingShell) return NS_ERROR_NO_INTERFACE; - - return NS_OK; -} - - -/*--------------------------------------------------------------------------- - - MakeWindowEditable - - void makeWindowEditable (in nsIDOMWindow aWindow, in boolean inDoAfterUriLoad); -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow, PRBool inDoAfterUriLoad) -{ - nsresult rv = PrepareForEditing(); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr editorDocShell; - rv = GetEditorDocShellFromWindow(aWindow, getter_AddRefs(editorDocShell)); - if (NS_FAILED(rv)) return rv; - - // set the flag on the docShell to say that it's editable - rv = editorDocShell->MakeEditable(inDoAfterUriLoad); - if (NS_FAILED(rv)) return rv; - - rv = SetupFrameControllers(aWindow); - if (NS_FAILED(rv)) return rv; - - // make an editor immediately - if (!inDoAfterUriLoad) - { - rv = SetupEditorOnWindow(aWindow); - if (NS_FAILED(rv)) return rv; - } - - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - WindowIsEditable - - boolean windowIsEditable (in nsIDOMWindow aWindow); -----------------------------------------------------------------------------*/ -NS_IMETHODIMP nsEditingSession::WindowIsEditable(nsIDOMWindow *aWindow, PRBool *outIsEditable) -{ - nsCOMPtr editorDocShell; - nsresult rv = GetEditorDocShellFromWindow(aWindow, getter_AddRefs(editorDocShell)); - if (NS_FAILED(rv)) return rv; - - return editorDocShell->GetEditable(outIsEditable); -} - -/*--------------------------------------------------------------------------- - - SetupEditorOnWindow - - nsIEditor setupEditorOnWindow (in nsIDOMWindow aWindow); -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow) -{ - nsresult rv = PrepareForEditing(); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr docShell; - rv = GetDocShellFromWindow(aWindow, getter_AddRefs(docShell)); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr editorDocShell(do_QueryInterface(docShell, &rv)); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr editor(do_CreateInstance("@mozilla.org/editor/htmleditor;1", &rv)); - if (NS_FAILED(rv)) return rv; - - // set the editor on the docShell. The docShell now owns it. - rv = editorDocShell->SetEditor(editor); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr presShell; - rv = docShell->GetPresShell(getter_AddRefs(presShell)); - if (NS_FAILED(rv)) return rv; - if (!presShell) return NS_ERROR_FAILURE; - - nsCOMPtr contentViewer; - rv = docShell->GetContentViewer(getter_AddRefs(contentViewer)); - if (NS_FAILED(rv)) return rv; - if (!contentViewer) return NS_ERROR_FAILURE; - - nsCOMPtr domDoc; - rv = contentViewer->GetDOMDocument(getter_AddRefs(domDoc)); - if (NS_FAILED(rv)) return rv; - if (!domDoc) return NS_ERROR_FAILURE; - - nsCOMPtr selCon = do_QueryInterface(presShell); - - rv = editor->Init(domDoc, presShell, nsnull /* root content */, selCon, 0); - if (NS_FAILED(rv)) return rv; - - rv = editor->PostCreate(); - if (NS_FAILED(rv)) return rv; - - // set the editor on the controller - rv = SetEditorOnControllers(aWindow, editor); - if (NS_FAILED(rv)) return rv; - - // make the UI state maintainer - NS_NEWXPCOM(mStateMaintainer, nsComposerCommandsUpdater); - if (!mStateMaintainer) return NS_ERROR_OUT_OF_MEMORY; - mStateMaintainer->AddRef(); // the owning reference - - // now init the state maintainer - // XXX this needs to swap out editors - rv = mStateMaintainer->Init(editor); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr selection; - editor->GetSelection(getter_AddRefs(selection)); - nsCOMPtr selPriv = do_QueryInterface(selection); - if (!selPriv) return NS_ERROR_FAILURE; - - rv = selPriv->AddSelectionListener(mStateMaintainer); - if (NS_FAILED(rv)) return rv; - - // and set it up as a doc state listener - rv = editor->AddDocumentStateListener(NS_STATIC_CAST(nsIDocumentStateListener*, mStateMaintainer)); - if (NS_FAILED(rv)) return rv; - - // and as a transaction listener - nsCOMPtr txnMgr; - editor->GetTransactionManager(getter_AddRefs(txnMgr)); - if (txnMgr) - { - txnMgr->AddListener(NS_STATIC_CAST(nsITransactionListener*, mStateMaintainer)); - } - - return NS_OK; -} - - -/*--------------------------------------------------------------------------- - - TearDownEditorOnWindow - - void tearDownEditorOnWindow (in nsIDOMWindow aWindow); -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::TearDownEditorOnWindow(nsIDOMWindow *aWindow) -{ - nsresult rv; - - // null out the editor on the controller - rv = SetEditorOnControllers(aWindow, nsnull); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr editorDocShell; - rv = GetEditorDocShellFromWindow(aWindow, getter_AddRefs(editorDocShell)); - if (NS_FAILED(rv)) return rv; - - // null out the editor on the docShell - rv = editorDocShell->SetEditor(nsnull); - if (NS_FAILED(rv)) return rv; - - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - GetEditorForFrame - - nsIEditor getEditorForFrame (in nsIDOMWindow aWindow); -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::GetEditorForWindow(nsIDOMWindow *aWindow, nsIEditor **outEditor) -{ - nsCOMPtr editorDocShell; - nsresult rv = GetEditorDocShellFromWindow(aWindow, getter_AddRefs(editorDocShell)); - if (NS_FAILED(rv)) return rv; - - return editorDocShell->GetEditor(outEditor); -} - -#ifdef XP_MAC -#pragma mark - -#endif - -/*--------------------------------------------------------------------------- - - OnStateChange - -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) -{ - // - // A Request has started... - // - if (aStateFlags & nsIWebProgressListener::STATE_START) - { - // Page level notification... - if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) - { - StartPageLoad(aWebProgress); - } - - // Document level notification... - if (aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) - { - if (NotifyingCurrentDocument(aWebProgress)) - (void)StartDocumentLoad(aWebProgress); - } - } - // - // A Request is being processed - // - else if (aStateFlags & nsIWebProgressListener::STATE_TRANSFERRING) - { - if (aStateFlags * nsIWebProgressListener::STATE_IS_DOCUMENT) - { - // document transfer started - } - } - // - // Got a redirection - // - else if (aStateFlags & nsIWebProgressListener::STATE_REDIRECTING) - { - if (aStateFlags * nsIWebProgressListener::STATE_IS_DOCUMENT) - { - // got a redirect - } - } - // - // A network or document Request as finished... - // - else if (aStateFlags & nsIWebProgressListener::STATE_STOP) - { - - // Document level notification... - if (aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) - { - if (NotifyingCurrentDocument(aWebProgress)) - { - nsCOMPtr channel(do_QueryInterface(aRequest)); - (void)EndDocumentLoad(aWebProgress, channel, aStatus); - } - } - - // Page level notification... - if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) - { - nsCOMPtr channel(do_QueryInterface(aRequest)); - (void)EndPageLoad(aWebProgress, channel, aStatus); - } - } - - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - OnProgressChange - -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) -{ - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - OnLocationChange - -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) -{ - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - OnStatusChange - -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) -{ - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - OnSecurityChange - -----------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsEditingSession::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) -{ - return NS_OK; -} - - -#ifdef XP_MAC -#pragma mark - -#endif - -/*--------------------------------------------------------------------------- - - NotifyingCurrentDocument - - Check that this notification is for our document. Necessary? -----------------------------------------------------------------------------*/ - -PRBool -nsEditingSession::NotifyingCurrentDocument(nsIWebProgress *aWebProgress) -{ - return PR_TRUE; -} - - -/*--------------------------------------------------------------------------- - - StartDocumentLoad - - Called on start of load in a single frame -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::StartDocumentLoad(nsIWebProgress *aWebProgress) -{ -#ifdef NOISY_DOC_LOADING - printf("Editing session StartDocumentLoad\n"); -#endif - - NS_ENSURE_ARG(aWebProgress); - - // If we have an editor here, then we got a reload after making the editor. - // We need to blow it away and make a new one at the end of the load. - nsCOMPtr domWindow; - aWebProgress->GetDOMWindow(getter_AddRefs(domWindow)); - - if (domWindow) - { - nsresult rv = TearDownEditorOnWindow(domWindow); - } - - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - EndDocumentLoad - - Called on end of load in a single frame -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress, nsIChannel* aChannel, nsresult aStatus) -{ - NS_ENSURE_ARG(aWebProgress); - -#ifdef NOISY_DOC_LOADING - printf("Editing shell EndDocumentLoad\n"); -#endif - // we want to call the base class EndDocumentLoad, but avoid some of the stuff - // that nsWebShell does (need to refactor). - - // OK, time to make an editor on this document - nsCOMPtr domWindow; - aWebProgress->GetDOMWindow(getter_AddRefs(domWindow)); - - nsCOMPtr docShell; - nsresult rv = GetDocShellFromWindow(domWindow, getter_AddRefs(docShell)); - if (NS_FAILED(rv)) return rv; // better error handling? - - nsCOMPtr editorDocShell(do_QueryInterface(docShell)); - // did someone set the flag to make this shell editable? - if (editorDocShell) - { - PRBool makeEditable; - editorDocShell->GetEditable(&makeEditable); - - if (makeEditable) - { - nsresult rv = SetupEditorOnWindow(domWindow); - } - } - - return NS_OK; -} - - -/*--------------------------------------------------------------------------- - - StartPageLoad - - Called on start load of the entire page (incl. subframes) -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::StartPageLoad(nsIWebProgress *aWebProgress) -{ - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - EndPageLoad - - Called on end load of the entire page (incl. subframes) -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::EndPageLoad(nsIWebProgress *aWebProgress, nsIChannel* aChannel, nsresult aStatus) -{ - return NS_OK; -} - - -#ifdef XP_MAC -#pragma mark - -#endif - -/*--------------------------------------------------------------------------- - - GetDocShellFromWindow - - Utility method. This will always return an error if no docShell - is returned. -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::GetDocShellFromWindow(nsIDOMWindow *inWindow, nsIDocShell** outDocShell) -{ - nsCOMPtr scriptGO(do_QueryInterface(inWindow)); - if (!scriptGO) return NS_ERROR_FAILURE; - - nsresult rv = scriptGO->GetDocShell(outDocShell); - if (NS_FAILED(rv)) return rv; - if (!*outDocShell) return NS_ERROR_FAILURE; - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - GetEditorDocShellFromWindow - - Utility method. This will always return an error if no docShell - is returned. -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::GetEditorDocShellFromWindow(nsIDOMWindow *inWindow, nsIEditorDocShell** outDocShell) -{ - nsCOMPtr docShell; - nsresult rv = GetDocShellFromWindow(inWindow, getter_AddRefs(docShell)); - if (NS_FAILED(rv)) return rv; - - return docShell->QueryInterface(NS_GET_IID(nsIEditorDocShell), outDocShell); -} - -/*--------------------------------------------------------------------------- - - PrepareForEditing - - Set up this editing session for one or more editors -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::PrepareForEditing() -{ - if (mDoneSetup) - return NS_OK; - - mDoneSetup = PR_TRUE; - - nsCOMPtr docShell = do_QueryReferent(mEditingShell); - if (!docShell) return NS_ERROR_NOT_INITIALIZED; - - nsCOMPtr domWindow = do_GetInterface(docShell); - if (!domWindow) return NS_ERROR_FAILURE; - - // register callback - nsCOMPtr webProgress = do_GetInterface(docShell); - if (!webProgress) return NS_ERROR_FAILURE; - - nsresult rv = webProgress->AddProgressListener(this); - if (NS_FAILED(rv)) return rv; - - return NS_OK; -} - - -/*--------------------------------------------------------------------------- - - SetupFrameControllers - - Set up the controller for this frame. -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::SetupFrameControllers(nsIDOMWindow *inWindow) -{ - nsresult rv; - - nsCOMPtr domWindowInt(do_QueryInterface(inWindow, &rv)); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr controllers; - rv = domWindowInt->GetControllers(getter_AddRefs(controllers)); - if (NS_FAILED(rv)) return rv; - - // the first is an editor controller, and takes an nsIEditor as the refCon - nsCOMPtr controller(do_CreateInstance("@mozilla.org/editor/editorcontroller;1", &rv)); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr editorController(do_QueryInterface(controller)); - rv = editorController->Init(nsnull); // we set the editor later when we have one - if (NS_FAILED(rv)) return rv; - - rv = controllers->InsertControllerAt(0, controller); - if (NS_FAILED(rv)) return rv; - - // the second is an composer controller, and also takes an nsIEditor as the refCon - controller = do_CreateInstance("@mozilla.org/editor/composercontroller;1", &rv); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr composerController(do_QueryInterface(controller)); - rv = composerController->Init(nsnull); // we set the editor later when we have one - if (NS_FAILED(rv)) return rv; - - rv = controllers->InsertControllerAt(1, controller); - if (NS_FAILED(rv)) return rv; - - return NS_OK; -} - -/*--------------------------------------------------------------------------- - - SetEditorOnControllers - - Set the editor on the controller(s) for this window -----------------------------------------------------------------------------*/ -nsresult -nsEditingSession::SetEditorOnControllers(nsIDOMWindow *inWindow, nsIEditor* inEditor) -{ - nsresult rv; - - // set the editor on the controller - nsCOMPtr domWindowInt(do_QueryInterface(inWindow, &rv)); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr controllers; - rv = domWindowInt->GetControllers(getter_AddRefs(controllers)); - if (NS_FAILED(rv)) return rv; - - // find the editor controllers by QIing each one. This sucks. - // Controllers need to have IDs of some kind. - PRUint32 numControllers; - rv = controllers->GetControllerCount(&numControllers); - if (NS_FAILED(rv)) return rv; - - for (PRUint32 i = 0; i < numControllers; i ++) - { - nsCOMPtr thisController; - controllers->GetControllerAt(i, getter_AddRefs(thisController)); - - nsCOMPtr editorController(do_QueryInterface(thisController)); // ok with nil controller - if (editorController) - { - rv = editorController->SetCommandRefCon(inEditor); - if (NS_FAILED(rv)) break; - } - } - if (NS_FAILED(rv)) return rv; - - return NS_OK; -} - - diff --git a/editor/composer/src/nsEditingSession.cpp b/editor/composer/src/nsEditingSession.cpp index 4a9b6098153..52fa87251d3 100644 --- a/editor/composer/src/nsEditingSession.cpp +++ b/editor/composer/src/nsEditingSession.cpp @@ -301,7 +301,7 @@ nsEditingSession::GetEditorForWindow(nsIDOMWindow *aWindow, nsIEditor **outEdito ----------------------------------------------------------------------------*/ NS_IMETHODIMP -nsEditingSession::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +nsEditingSession::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { // // A Request has started... @@ -376,6 +376,7 @@ nsEditingSession::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aReque NS_IMETHODIMP nsEditingSession::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -387,6 +388,7 @@ nsEditingSession::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRe NS_IMETHODIMP nsEditingSession::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -398,6 +400,7 @@ nsEditingSession::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRe NS_IMETHODIMP nsEditingSession::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -407,8 +410,9 @@ nsEditingSession::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequ ----------------------------------------------------------------------------*/ NS_IMETHODIMP -nsEditingSession::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +nsEditingSession::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -590,7 +594,7 @@ nsEditingSession::PrepareForEditing() nsCOMPtr webProgress = do_GetInterface(docShell); if (!webProgress) return NS_ERROR_FAILURE; - nsresult rv = webProgress->AddProgressListener(this); + nsresult rv = webProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_ALL); if (NS_FAILED(rv)) return rv; return NS_OK; diff --git a/editor/composer/src/nsEditorShell.cpp b/editor/composer/src/nsEditorShell.cpp index a8bfc84219d..68420376e5b 100644 --- a/editor/composer/src/nsEditorShell.cpp +++ b/editor/composer/src/nsEditorShell.cpp @@ -651,7 +651,10 @@ nsEditorShell::SetContentWindow(nsIDOMWindowInternal* aWin) // Attach a WebProgress listener to the new docShell webProgress = do_GetInterface(docShell, &rv); if (webProgress) { - rv = webProgress->AddProgressListener(this); + rv = webProgress->AddProgressListener(this, + (nsIWebProgress::NOTIFY_STATE_NETWORK | + nsIWebProgress::NOTIFY_STATE_DOCUMENT | + nsIWebProgress::NOTIFY_LOCATION)); } if (NS_FAILED(rv)) return rv; @@ -4390,7 +4393,7 @@ nsEditorShell::OnProgressChange(nsIWebProgress *aProgress, NS_IMETHODIMP nsEditorShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest, - PRInt32 aStateFlags, + PRUint32 aStateFlags, nsresult aStatus) { NS_ENSURE_ARG_POINTER(aProgress); @@ -4502,14 +4505,16 @@ nsEditorShell::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP nsEditorShell::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } diff --git a/editor/composer/src/nsEditorShell.h b/editor/composer/src/nsEditorShell.h index 5fb132f7aa0..91ae7da190e 100644 --- a/editor/composer/src/nsEditorShell.h +++ b/editor/composer/src/nsEditorShell.h @@ -68,6 +68,7 @@ class nsIDOMElement; class nsIDOMNode; class nsIDOMHTMLDocument; class nsIURI; +class nsIChannel; class nsIPresShell; class nsIOutputStream; class nsISupportsArray; diff --git a/embedding/browser/activex/src/control/MozillaBrowser.cpp b/embedding/browser/activex/src/control/MozillaBrowser.cpp index 58117342a34..f96c6dd32c1 100644 --- a/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ b/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -3308,8 +3308,8 @@ void PrintListener::WaitForComplete() ::CloseHandle(hFakeEvent); } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP PrintListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP PrintListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (aStatus == nsIWebProgressListener::STATE_STOP) { mComplete = PR_TRUE; @@ -3320,23 +3320,23 @@ NS_IMETHODIMP PrintListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequ /* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ NS_IMETHODIMP PrintListener::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP PrintListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP PrintListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP PrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP PrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } diff --git a/embedding/browser/activex/src/control/WebBrowserContainer.cpp b/embedding/browser/activex/src/control/WebBrowserContainer.cpp index 5c73decbda8..67f70cca4ae 100644 --- a/embedding/browser/activex/src/control/WebBrowserContainer.cpp +++ b/embedding/browser/activex/src/control/WebBrowserContainer.cpp @@ -134,8 +134,8 @@ NS_IMETHODIMP CWebBrowserContainer::OnProgressChange(nsIWebProgress *aProgress, -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest request, in long progressStateFlags, in unsinged long aStatus); */ -NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, PRInt32 progressStateFlags, nsresult aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest request, in unsigned long progressStateFlags, in unsinged long aStatus); */ +NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, PRUint32 progressStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -186,11 +186,11 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress, if (!aChannel) return NS_ERROR_NULL_POINTER; rv = aChannel->GetURI(getter_AddRefs(pURI)); - if (NS_FAILED(rv)) return rv; + if (NS_FAILED(rv)) return NS_OK; nsCAutoString aURI; rv = pURI->GetAsciiSpec(aURI); - if (NS_FAILED(rv)) return rv; + if (NS_FAILED(rv)) return NS_OK; USES_CONVERSION; BSTR bstrURI = SysAllocString(A2OLE(aURI.get())); @@ -279,7 +279,7 @@ NS_IMETHODIMP CWebBrowserContainer::OnLocationChange(nsIWebProgress* aWebProgres { // nsXPIDLCString aPath; // location->GetPath(getter_Copies(aPath)); - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } NS_IMETHODIMP @@ -301,9 +301,9 @@ CWebBrowserContainer::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP CWebBrowserContainer::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } diff --git a/embedding/browser/chrome/content/mini-nav.js b/embedding/browser/chrome/content/mini-nav.js index 6d76e3c3c97..b95c6779505 100644 --- a/embedding/browser/chrome/content/mini-nav.js +++ b/embedding/browser/chrome/content/mini-nav.js @@ -131,7 +131,7 @@ function MiniNavStartup() var interfaceRequestor = getBrowser().docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor); var webProgress = interfaceRequestor.getInterface(Components.interfaces.nsIWebProgress); - webProgress.addProgressListener(gBrowserStatusHandler); + webProgress.addProgressListener(gBrowserStatusHandler, Components.interfaces.nsIWebProgress.NOTIFY_LOCATION); } catch (e) { alert("Error opening a mini-nav window"); dump(e+"\n"); diff --git a/embedding/browser/photon/src/EmbedPrintListener.cpp b/embedding/browser/photon/src/EmbedPrintListener.cpp index 8cef35d113d..baa1127e8fd 100644 --- a/embedding/browser/photon/src/EmbedPrintListener.cpp +++ b/embedding/browser/photon/src/EmbedPrintListener.cpp @@ -94,17 +94,17 @@ NS_IMETHODIMP EmbedPrintListener::OnProgressChange(nsIWebProgress *aWebProgress, /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP EmbedPrintListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP EmbedPrintListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP EmbedPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP EmbedPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } diff --git a/embedding/browser/photon/src/EmbedProgress.cpp b/embedding/browser/photon/src/EmbedProgress.cpp index 26c9dbe11ed..f99ad45e504 100644 --- a/embedding/browser/photon/src/EmbedProgress.cpp +++ b/embedding/browser/photon/src/EmbedProgress.cpp @@ -320,7 +320,7 @@ EmbedProgress::OnStatusChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP EmbedProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 aState) + PRUint32 aState) { return NS_OK; } diff --git a/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp b/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp index cb246f84991..a52da34095f 100644 --- a/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp +++ b/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp @@ -188,7 +188,7 @@ NS_IMETHODIMP nsWebProgressListener::OnLocationChange(nsIWebProgress* aWebProgre NS_IMETHODIMP nsWebProgressListener::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, const PRUnichar* aMessage) { return NS_OK; } -NS_IMETHODIMP nsWebProgressListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) { +NS_IMETHODIMP nsWebProgressListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { return NS_OK; } diff --git a/embedding/browser/powerplant/source/CBrowserMsgDefs.h b/embedding/browser/powerplant/source/CBrowserMsgDefs.h index 8dd008aad01..e69de29bb2d 100644 --- a/embedding/browser/powerplant/source/CBrowserMsgDefs.h +++ b/embedding/browser/powerplant/source/CBrowserMsgDefs.h @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Conrad Carlen - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef __CBrowserShellMsgDefs__ -#define __CBrowserShellMsgDefs__ - -#pragma once - -// Messages sent by CBrowserShell - -#ifndef EMBED_MSG_BASE_ID -#define EMBED_MSG_BASE_ID 1000 -#endif - -enum { - msg_OnNetStartChange = EMBED_MSG_BASE_ID + 0, - msg_OnNetStopChange = EMBED_MSG_BASE_ID + 1, - msg_OnProgressChange = EMBED_MSG_BASE_ID + 2, - msg_OnLocationChange = EMBED_MSG_BASE_ID + 3, - msg_OnStatusChange = EMBED_MSG_BASE_ID + 4, - msg_OnSecurityChange = EMBED_MSG_BASE_ID + 5, - - msg_OnChromeStatusChange = EMBED_MSG_BASE_ID + 6 -}; - - -/** - * CBrowserShell and CBrowserChrome broadcast changes using LBroadcaster::BroadcastMessage() - * A pointer to one of the following types is passed as the ioParam. - */ - -// msg_OnNetStartChange -struct MsgNetStartInfo -{ - MsgNetStartInfo(CBrowserShell* broadcaster) : - mBroadcaster(broadcaster) - { } - - CBrowserShell *mBroadcaster; -}; - -// msg_OnNetStopChange -struct MsgNetStopInfo -{ - MsgNetStopInfo(CBrowserShell* broadcaster) : - mBroadcaster(broadcaster) - { } - - CBrowserShell *mBroadcaster; -}; - -// msg_OnProgressChange -struct MsgOnProgressChangeInfo -{ - MsgOnProgressChangeInfo(CBrowserShell* broadcaster, PRInt32 curProgress, PRInt32 maxProgress) : - mBroadcaster(broadcaster), mCurProgress(curProgress), mMaxProgress(maxProgress) - { } - - CBrowserShell *mBroadcaster; - PRInt32 mCurProgress, mMaxProgress; -}; - -// msg_OnLocationChange -struct MsgLocationChangeInfo -{ - MsgLocationChangeInfo(CBrowserShell* broadcaster, - const char* urlSpec) : - mBroadcaster(broadcaster), mURLSpec(urlSpec) - { } - - CBrowserShell *mBroadcaster; - const char *mURLSpec; -}; - -// msg_OnStatusChange -struct MsgStatusChangeInfo -{ - MsgStatusChangeInfo(CBrowserShell* broadcaster, - nsresult status, const PRUnichar *message) : - mBroadcaster(broadcaster), - mStatus(status), mMessage(message) - { } - - CBrowserShell *mBroadcaster; - nsresult mStatus; - const PRUnichar *mMessage; -}; - -// msg_OnSecurityChange -struct MsgSecurityChangeInfo -{ - MsgSecurityChangeInfo(CBrowserShell* broadcaster, - PRInt32 state) : - mBroadcaster(broadcaster), - mState(state) - { } - - CBrowserShell *mBroadcaster; - PRInt32 mState; -}; - -// msg_OnChromeStatusChange -// See nsIWebBrowserChrome::SetStatus -struct MsgChromeStatusChangeInfo -{ - MsgChromeStatusChangeInfo(CBrowserShell* broadcaster, - PRUint32 statusType, - const PRUnichar* status) : - mBroadcaster(broadcaster), - mStatusType(statusType), mStatus(status) - { } - - CBrowserShell *mBroadcaster; - PRUint32 mStatusType; - const PRUnichar *mStatus; -}; - -#endif // __CBrowserShellMsgDefs__ diff --git a/embedding/browser/powerplant/source/CBrowserShell.cpp b/embedding/browser/powerplant/source/CBrowserShell.cpp index 3502e23b5f1..420a1549b8e 100644 --- a/embedding/browser/powerplant/source/CBrowserShell.cpp +++ b/embedding/browser/powerplant/source/CBrowserShell.cpp @@ -230,7 +230,7 @@ NS_IMETHODIMP CBrowserShellProgressListener::OnStatusChange(nsIWebProgress *aWeb return NS_OK; } -NS_IMETHODIMP CBrowserShellProgressListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +NS_IMETHODIMP CBrowserShellProgressListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { NS_ENSURE_TRUE(mpOwner, NS_ERROR_NULL_POINTER); diff --git a/embedding/browser/powerplant/source/CWebBrowserChrome.cpp b/embedding/browser/powerplant/source/CWebBrowserChrome.cpp index f47ad4e7140..8edf0138a25 100644 --- a/embedding/browser/powerplant/source/CWebBrowserChrome.cpp +++ b/embedding/browser/powerplant/source/CWebBrowserChrome.cpp @@ -234,7 +234,7 @@ NS_IMETHODIMP CWebBrowserChrome::OnProgressChange(nsIWebProgress *progress, nsIR PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress) { - NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED); + NS_ENSURE_TRUE(mBrowserWindow, NS_OK); return mBrowserWindow->OnProgressChange(progress, request, curSelfProgress, maxSelfProgress, @@ -244,7 +244,7 @@ NS_IMETHODIMP CWebBrowserChrome::OnProgressChange(nsIWebProgress *progress, nsIR NS_IMETHODIMP CWebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIRequest *request, PRInt32 progressStateFlags, PRUint32 status) { - NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED); + NS_ENSURE_TRUE(mBrowserWindow, NS_OK); if (progressStateFlags & STATE_IS_NETWORK) { if (progressStateFlags & STATE_START) @@ -261,7 +261,7 @@ NS_IMETHODIMP CWebBrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *location) { - NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED); + NS_ENSURE_TRUE(mBrowserWindow, NS_OK); char *buf = nsnull; @@ -291,9 +291,9 @@ CWebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP CWebBrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp index cf597a1eda1..f95def0e8e5 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp @@ -686,17 +686,17 @@ nsDocShellTreeOwner::OnProgressChange(nsIWebProgress* aProgress, NS_IMETHODIMP nsDocShellTreeOwner::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest, - PRInt32 aProgressStateFlags, + PRUint32 aProgressStateFlags, nsresult aStatus) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } NS_IMETHODIMP nsDocShellTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI* aURI) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } NS_IMETHODIMP @@ -705,15 +705,15 @@ nsDocShellTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } NS_IMETHODIMP nsDocShellTreeOwner::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } diff --git a/embedding/browser/webBrowser/nsWebBrowser.cpp b/embedding/browser/webBrowser/nsWebBrowser.cpp index b9492dd5680..00242fd1a9b 100644 --- a/embedding/browser/webBrowser/nsWebBrowser.cpp +++ b/embedding/browser/webBrowser/nsWebBrowser.cpp @@ -234,7 +234,7 @@ NS_IMETHODIMP nsWebBrowser::BindListener(nsISupports *aListener, const nsIID& aI if (aIID.Equals(NS_GET_IID(nsIWebProgressListener))) { nsCOMPtr listener = do_QueryInterface(aListener, &rv); if (NS_FAILED(rv)) return rv; - rv = mWebProgress->AddProgressListener(listener); + rv = mWebProgress->AddProgressListener(listener, nsIWebProgress::NOTIFY_ALL); } else if (aIID.Equals(NS_GET_IID(nsISHistoryListener))) { nsCOMPtr shistory(do_GetInterface(mDocShell, &rv)); @@ -757,8 +757,8 @@ NS_IMETHODIMP nsWebBrowser::SetProperty(PRUint32 aId, PRUint32 aValue) // nsWebBrowser::nsIWebProgressListener //***************************************************************************** -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP nsWebBrowser::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP nsWebBrowser::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (mPersist) { @@ -809,8 +809,8 @@ NS_IMETHODIMP nsWebBrowser::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequ return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsWebBrowser::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsWebBrowser::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { if (mProgressListener) { diff --git a/embedding/components/printingui/src/mac/nsPrintProgress.cpp b/embedding/components/printingui/src/mac/nsPrintProgress.cpp index 982f0ba38ac..37252ef3a9b 100644 --- a/embedding/components/printingui/src/mac/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/mac/nsPrintProgress.cpp @@ -189,8 +189,8 @@ NS_IMETHODIMP nsPrintProgress::DoneIniting() return NS_OK; } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -253,7 +253,7 @@ NS_IMETHODIMP nsPrintProgress::OnProgressChange(nsIWebProgress *aWebProgress, ns /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ @@ -287,10 +287,10 @@ NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIR return rv; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } nsresult nsPrintProgress::ReleaseListeners() diff --git a/embedding/components/printingui/src/mac/nsPrintingPromptService.cpp b/embedding/components/printingui/src/mac/nsPrintingPromptService.cpp index d318953e617..3ed1fd246cb 100644 --- a/embedding/components/printingui/src/mac/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/mac/nsPrintingPromptService.cpp @@ -505,7 +505,7 @@ nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUni //***************************************************************************** NS_IMETHODIMP -nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (aStateFlags & STATE_STOP) { @@ -535,7 +535,7 @@ nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest } NS_IMETHODIMP -nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state); } diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.cpp b/embedding/components/printingui/src/os2/nsPrintProgress.cpp index 982f0ba38ac..37252ef3a9b 100644 --- a/embedding/components/printingui/src/os2/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/os2/nsPrintProgress.cpp @@ -189,8 +189,8 @@ NS_IMETHODIMP nsPrintProgress::DoneIniting() return NS_OK; } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -253,7 +253,7 @@ NS_IMETHODIMP nsPrintProgress::OnProgressChange(nsIWebProgress *aWebProgress, ns /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ @@ -287,10 +287,10 @@ NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIR return rv; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } nsresult nsPrintProgress::ReleaseListeners() diff --git a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp index 679e628eb3c..4bcaf228a28 100644 --- a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp @@ -279,9 +279,9 @@ nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent, // nsIWebProgressListener ////////////////////////////////////////////////////////////////////// -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ NS_IMETHODIMP -nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (aStateFlags & STATE_STOP) { mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); @@ -312,7 +312,7 @@ nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) { diff --git a/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp b/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp index 982f0ba38ac..8b126ede70c 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp @@ -189,8 +189,8 @@ NS_IMETHODIMP nsPrintProgress::DoneIniting() return NS_OK; } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -287,10 +287,10 @@ NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIR return rv; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } nsresult nsPrintProgress::ReleaseListeners() diff --git a/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp b/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp index 120fc8d84ae..a2af56112c7 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp @@ -285,9 +285,9 @@ nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent, // nsIWebProgressListener ////////////////////////////////////////////////////////////////////// -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ NS_IMETHODIMP -nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (aStateFlags & STATE_STOP) { mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); @@ -318,9 +318,9 @@ nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP -nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state); } diff --git a/embedding/components/printingui/src/win/nsPrintProgress.cpp b/embedding/components/printingui/src/win/nsPrintProgress.cpp index 32fc0e7fde9..516e075b2e4 100644 --- a/embedding/components/printingui/src/win/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/win/nsPrintProgress.cpp @@ -190,8 +190,8 @@ NS_IMETHODIMP nsPrintProgress::DoneIniting() return NS_OK; } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -254,7 +254,7 @@ NS_IMETHODIMP nsPrintProgress::OnProgressChange(nsIWebProgress *aWebProgress, ns /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ @@ -288,10 +288,10 @@ NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIR return rv; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } nsresult nsPrintProgress::ReleaseListeners() diff --git a/embedding/components/printingui/src/win/nsPrintingPromptService.cpp b/embedding/components/printingui/src/win/nsPrintingPromptService.cpp index 9b4c6c98a13..eee5218ac41 100644 --- a/embedding/components/printingui/src/win/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/win/nsPrintingPromptService.cpp @@ -317,9 +317,9 @@ nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent, // nsIWebProgressListener ////////////////////////////////////////////////////////////////////// -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in nsresult aStatus); */ NS_IMETHODIMP -nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (aStateFlags & STATE_STOP) { @@ -351,9 +351,9 @@ nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP -nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state); } diff --git a/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp b/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp index a1d93a48eff..ac08da58462 100644 --- a/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp +++ b/embedding/qa/testembed/BrowserImplWebPrgrsLstnr.cpp @@ -112,7 +112,7 @@ NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIReques } NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest *request, - PRInt32 progressStateFlags, PRUint32 status) + PRUint32 progressStateFlags, nsresult status) { char theDocType[100]; char theStateType[100]; @@ -315,7 +315,7 @@ CBrowserImpl::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP CBrowserImpl::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { nsCString stringMsg; diff --git a/embedding/qa/testembed/PrintProgressDialog.cpp b/embedding/qa/testembed/PrintProgressDialog.cpp index 49ed72f9019..852af0f307e 100644 --- a/embedding/qa/testembed/PrintProgressDialog.cpp +++ b/embedding/qa/testembed/PrintProgressDialog.cpp @@ -89,9 +89,9 @@ CDlgPrintListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aReq return NS_ERROR_NOT_IMPLEMENTED; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP -CDlgPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +CDlgPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/embedding/tests/mfcembed/BrowserImplWebPrgrsLstnr.cpp b/embedding/tests/mfcembed/BrowserImplWebPrgrsLstnr.cpp index 3fce9e49ab3..0e3405f7df4 100644 --- a/embedding/tests/mfcembed/BrowserImplWebPrgrsLstnr.cpp +++ b/embedding/tests/mfcembed/BrowserImplWebPrgrsLstnr.cpp @@ -50,56 +50,63 @@ // - Implements browser progress update functionality // while loading a page into the embedded browser // -// - Calls methods via the IBrowserFrameGlue interace -// (available thru' the m_pBrowserFrameGlue member var) -// to do the actual statusbar/progress bar updates. +// - Calls methods via the IBrowserFrameGlue interace +// (available thru' the m_pBrowserFrameGlue member var) +// to do the actual statusbar/progress bar updates. // -NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, nsIRequest *request, - PRInt32 curSelfProgress, PRInt32 maxSelfProgress, - PRInt32 curTotalProgress, PRInt32 maxTotalProgress) +NS_IMETHODIMP CBrowserImpl::OnProgressChange(nsIWebProgress *progress, + nsIRequest *request, + PRInt32 curSelfProgress, + PRInt32 maxSelfProgress, + PRInt32 curTotalProgress, + PRInt32 maxTotalProgress) { - if(! m_pBrowserFrameGlue) - return NS_ERROR_FAILURE; - - PRInt32 nProgress = curTotalProgress; - PRInt32 nProgressMax = maxTotalProgress; - - if (nProgressMax == 0) - nProgressMax = LONG_MAX; - - if (nProgress > nProgressMax) - nProgress = nProgressMax; // Progress complete - - m_pBrowserFrameGlue->UpdateProgress(nProgress, nProgressMax); - + if(! m_pBrowserFrameGlue) { + // always return NS_OK return NS_OK; + } + + PRInt32 nProgress = curTotalProgress; + PRInt32 nProgressMax = maxTotalProgress; + + if (nProgressMax == 0) + nProgressMax = LONG_MAX; + + if (nProgress > nProgressMax) + nProgress = nProgressMax; // Progress complete + + m_pBrowserFrameGlue->UpdateProgress(nProgress, nProgressMax); + + return NS_OK; } -NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, nsIRequest *request, - PRInt32 progressStateFlags, PRUint32 status) +NS_IMETHODIMP CBrowserImpl::OnStateChange(nsIWebProgress *progress, + nsIRequest *request, + PRUint32 progressStateFlags, + nsresult status) { - if(! m_pBrowserFrameGlue) - return NS_ERROR_FAILURE; - - if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT)) - { - // Navigation has begun - - if(m_pBrowserFrameGlue) - m_pBrowserFrameGlue->UpdateBusyState(PR_TRUE); - } - - if ((progressStateFlags & STATE_STOP) && (progressStateFlags & STATE_IS_DOCUMENT)) - { - // We've completed the navigation - - m_pBrowserFrameGlue->UpdateBusyState(PR_FALSE); - m_pBrowserFrameGlue->UpdateProgress(0, 100); // Clear the prog bar - m_pBrowserFrameGlue->UpdateStatusBarText(nsnull); // Clear the status bar - } - + if(! m_pBrowserFrameGlue) { + // always return NS_OK return NS_OK; + } + + if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT)) + { + // Navigation has begun + m_pBrowserFrameGlue->UpdateBusyState(PR_TRUE); + } + + if ((progressStateFlags & STATE_STOP) && (progressStateFlags & STATE_IS_DOCUMENT)) + { + // We've completed the navigation + + m_pBrowserFrameGlue->UpdateBusyState(PR_FALSE); + m_pBrowserFrameGlue->UpdateProgress(0, 100); // Clear the prog bar + m_pBrowserFrameGlue->UpdateStatusBarText(nsnull); // Clear the status bar + } + + return NS_OK; } @@ -107,8 +114,10 @@ NS_IMETHODIMP CBrowserImpl::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *location) { - if(! m_pBrowserFrameGlue) - return NS_ERROR_FAILURE; + if(! m_pBrowserFrameGlue) { + // always return NS_OK + return NS_OK; + } PRBool isSubFrameLoad = PR_FALSE; // Is this a subframe load if (aWebProgress) { @@ -124,7 +133,7 @@ NS_IMETHODIMP CBrowserImpl::OnLocationChange(nsIWebProgress* aWebProgress, } if (!isSubFrameLoad) // Update urlbar only if it is not a subframe load - m_pBrowserFrameGlue->UpdateCurrentURI(location); + m_pBrowserFrameGlue->UpdateCurrentURI(location); return NS_OK; } @@ -135,12 +144,10 @@ CBrowserImpl::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { - if(! m_pBrowserFrameGlue) - return NS_ERROR_FAILURE; + if(m_pBrowserFrameGlue) + m_pBrowserFrameGlue->UpdateStatusBarText(aMessage); - m_pBrowserFrameGlue->UpdateStatusBarText(aMessage); - - return NS_OK; + return NS_OK; } @@ -148,9 +155,9 @@ CBrowserImpl::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP CBrowserImpl::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - m_pBrowserFrameGlue->UpdateSecurityStatus(state); + m_pBrowserFrameGlue->UpdateSecurityStatus(state); - return NS_OK; + return NS_OK; } diff --git a/embedding/tests/mfcembed/PrintProgressDialog.cpp b/embedding/tests/mfcembed/PrintProgressDialog.cpp index 6440f0f4c54..a87adc7210b 100644 --- a/embedding/tests/mfcembed/PrintProgressDialog.cpp +++ b/embedding/tests/mfcembed/PrintProgressDialog.cpp @@ -49,9 +49,9 @@ CDlgPrintListener::CDlgPrintListener(CPrintProgressDialog* aDlg) : //NS_ADDREF_THIS(); } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ NS_IMETHODIMP -CDlgPrintListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +CDlgPrintListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (m_PrintDlg) { if (aStateFlags == (nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT)) { @@ -78,21 +78,21 @@ CDlgPrintListener::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aR NS_IMETHODIMP CDlgPrintListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP CDlgPrintListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP -CDlgPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +CDlgPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } diff --git a/embedding/tests/mfcembed/components/HelperAppDlg.cpp b/embedding/tests/mfcembed/components/HelperAppDlg.cpp index 32d7f1be953..5af6d924267 100644 --- a/embedding/tests/mfcembed/components/HelperAppDlg.cpp +++ b/embedding/tests/mfcembed/components/HelperAppDlg.cpp @@ -530,8 +530,8 @@ CProgressDlg::~CProgressDlg() } NS_IMETHODIMP CProgressDlg::OnStateChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 aStateFlags, - PRUint32 aStatus) + nsIRequest *aRequest, PRUint32 aStateFlags, + nsresult aStatus) { if((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_DOCUMENT)) { @@ -565,20 +565,20 @@ NS_IMETHODIMP CProgressDlg::OnProgressChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP CProgressDlg::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } NS_IMETHODIMP CProgressDlg::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } NS_IMETHODIMP CProgressDlg::OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 state) + nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } BOOL CProgressDlg::OnInitDialog() diff --git a/embedding/tests/winEmbed/WebBrowserChrome.cpp b/embedding/tests/winEmbed/WebBrowserChrome.cpp index dfe59dc5c0f..b521ff85a85 100644 --- a/embedding/tests/winEmbed/WebBrowserChrome.cpp +++ b/embedding/tests/winEmbed/WebBrowserChrome.cpp @@ -250,7 +250,7 @@ NS_IMETHODIMP WebBrowserChrome::OnProgressChange(nsIWebProgress *progress, nsIRe } NS_IMETHODIMP WebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIRequest *request, - PRInt32 progressStateFlags, PRUint32 status) + PRUint32 progressStateFlags, nsresult status) { if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT)) { @@ -304,9 +304,9 @@ WebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP WebBrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } //***************************************************************************** diff --git a/extensions/access-builtin/accessproxy/nsAccessProxy.cpp b/extensions/access-builtin/accessproxy/nsAccessProxy.cpp index 2ab673c3257..08077f2b772 100644 --- a/extensions/access-builtin/accessproxy/nsAccessProxy.cpp +++ b/extensions/access-builtin/accessproxy/nsAccessProxy.cpp @@ -185,7 +185,8 @@ NS_IMETHODIMP nsAccessProxy::Observe(nsISupports *aSubject, const char *aTopic, nsCOMPtr progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID)); rv = NS_ERROR_FAILURE; if (progress) { - rv = progress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this)); + rv = progress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this), + nsIWebProgress::NOTIFY_STATE_DOCUMENT); if (NS_SUCCEEDED(rv)) AddRef(); } @@ -201,9 +202,9 @@ NS_IMETHODIMP nsAccessProxy::Observe(nsISupports *aSubject, const char *aTopic, NS_IMETHODIMP nsAccessProxy::OnStateChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) + nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { -/* PRInt32 aStateFlags ... +/* PRUint32 aStateFlags ... * * ===== What has happened ===== * STATE_START, STATE_REDIRECTING, STATE_TRANSFERRING, @@ -259,9 +260,7 @@ NS_IMETHODIMP nsAccessProxy::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { // We can use this to report the percentage done - #ifdef NS_DEBUG_ACCESS_BUILTIN - // printf ("** nsAccessProxy ** OnProgressChange ** \n"); - #endif + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -270,9 +269,7 @@ NS_IMETHODIMP nsAccessProxy::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { // Load has been verified, it will occur, about to commence - #ifdef NS_DEBUG_ACCESS_BUILTIN - // printf ("** nsAccessProxy ** OnLocationChange ** \n"); - #endif + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -281,20 +278,16 @@ NS_IMETHODIMP nsAccessProxy::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { // Status bar has changed - #ifdef NS_DEBUG_ACCESS_BUILTIN - // printf ("** nsAccessProxy ** OnStatusChange ** \n"); - #endif + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP nsAccessProxy::OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 state) + nsIRequest *aRequest, PRUint32 state) { // Security setting has changed - #ifdef NS_DEBUG_ACCESS_BUILTIN - printf ("** nsAccessProxy ** OnSecurityChange ** \n"); - #endif + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } diff --git a/extensions/cookie/nsCookieService.cpp b/extensions/cookie/nsCookieService.cpp index 5dbb7c5bafe..d4167f0d15b 100644 --- a/extensions/cookie/nsCookieService.cpp +++ b/extensions/cookie/nsCookieService.cpp @@ -99,7 +99,8 @@ nsresult nsCookieService::Init() if (NS_SUCCEEDED(rv) && docLoaderService) { nsCOMPtr progress(do_QueryInterface(docLoaderService)); if (progress) - (void) progress->AddProgressListener((nsIWebProgressListener*)this); + (void) progress->AddProgressListener((nsIWebProgressListener*)this, + nsIWebProgress::NOTIFY_STATE_DOCUMENT); } else { NS_ASSERTION(PR_FALSE, "Could not get nsIDocumentLoader"); } @@ -116,13 +117,14 @@ nsCookieService::OnProgressChange(nsIWebProgress *aProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsCookieService::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, - PRInt32 progressStateFlags, + PRUint32 progressStateFlags, nsresult aStatus) { if (progressStateFlags & STATE_IS_DOCUMENT) @@ -137,7 +139,8 @@ NS_IMETHODIMP nsCookieService::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP @@ -146,15 +149,17 @@ nsCookieService::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsCookieService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } diff --git a/extensions/help/resources/content/help.js b/extensions/help/resources/content/help.js index b76f4bcbf53..b61db3efa87 100644 --- a/extensions/help/resources/content/help.js +++ b/extensions/help/resources/content/help.js @@ -110,7 +110,7 @@ function init() { // hook up UI through progress listener var interfaceRequestor = helpBrowser.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor); var webProgress = interfaceRequestor.getInterface(Components.interfaces.nsIWebProgress); - webProgress.addProgressListener(window.XULBrowserWindow); + webProgress.addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL); } function normalizeURI(uri) { diff --git a/extensions/pics/src/nsPICS.cpp b/extensions/pics/src/nsPICS.cpp index f5f23dcd115..7014a9495e3 100644 --- a/extensions/pics/src/nsPICS.cpp +++ b/extensions/pics/src/nsPICS.cpp @@ -467,7 +467,8 @@ nsPICS::Init() if (NS_SUCCEEDED(rv)) { nsCOMPtr progress(do_QueryInterface(mDocLoaderService, &rv)); if (NS_SUCCEEDED(rv)) { - (void) process->AddProgressListener((nsIWebProgressListener*)this); + (void) process->AddProgressListener((nsIWebProgressListener*)this, + nsIWebProgress::NOTIFY_STATE_ALL); } } @@ -694,7 +695,7 @@ nsPICS::ParsePICSLabel(char * label) NS_IMETHODIMP nsPICS::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, - PRInt32 progressStateFlags, + PRUint32 progressStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -872,15 +873,19 @@ nsPICS::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, - PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + PRInt32 aMaxTotalProgress) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsPICS::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + nsIURI *location) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -888,16 +893,20 @@ NS_IMETHODIMP nsPICS::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + const PRUnichar* aMessage) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsPICS::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + PRUint32 state) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } void diff --git a/extensions/wallet/src/nsWalletService.cpp b/extensions/wallet/src/nsWalletService.cpp index 689fbdc8b47..b4e644c5df9 100644 --- a/extensions/wallet/src/nsWalletService.cpp +++ b/extensions/wallet/src/nsWalletService.cpp @@ -389,7 +389,8 @@ nsresult nsWalletlibService::Init() if (NS_SUCCEEDED(rv) && docLoaderService) { nsCOMPtr progress(do_QueryInterface(docLoaderService, &rv)); if (NS_SUCCEEDED(rv)) - (void) progress->AddProgressListener((nsIWebProgressListener*)this); + (void) progress->AddProgressListener((nsIWebProgressListener*)this, + nsIWebProgress::NOTIFY_STATE_DOCUMENT); } else NS_ASSERTION(PR_FALSE, "Could not get nsIDocumentLoader"); @@ -408,7 +409,7 @@ nsresult nsWalletlibService::Init() NS_IMETHODIMP nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, - PRInt32 progressStateFlags, + PRUint32 progressStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -564,7 +565,8 @@ nsWalletlibService::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP @@ -572,7 +574,8 @@ nsWalletlibService::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -582,16 +585,18 @@ nsWalletlibService::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsWalletlibService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } diff --git a/extensions/xmlterm/base/mozXMLTerminal.cpp b/extensions/xmlterm/base/mozXMLTerminal.cpp index 3f54472b15d..a0006e24038 100644 --- a/extensions/xmlterm/base/mozXMLTerminal.cpp +++ b/extensions/xmlterm/base/mozXMLTerminal.cpp @@ -224,7 +224,8 @@ NS_IMETHODIMP mozXMLTerminal::Init(nsIDocShell* aDocShell, nsCOMPtr progress(do_GetInterface(aDocShell, &result)); if (NS_FAILED(result)) return result; - result = progress->AddProgressListener((nsIWebProgressListener*)this); + result = progress->AddProgressListener((nsIWebProgressListener*)this, + nsIWebProgress::NOTIFY_STATE_REQUEST); if (NS_FAILED(result)) return NS_ERROR_FAILURE; @@ -1035,7 +1036,7 @@ NS_IMETHODIMP mozXMLTerminal::ExportHTML(const PRUnichar* aFilename, NS_IMETHODIMP mozXMLTerminal::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, - PRInt32 progressStateFlags, + PRUint32 progressStateFlags, nsresult aStatus) { if (progressStateFlags & nsIWebProgressListener::STATE_IS_REQUEST) if (progressStateFlags & nsIWebProgressListener::STATE_START) { @@ -1055,14 +1056,16 @@ mozXMLTerminal::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP mozXMLTerminal::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -1071,13 +1074,15 @@ mozXMLTerminal::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP mozXMLTerminal::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + PRUint32 state) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } diff --git a/htmlparser/robot/nsDebugRobot.cpp b/htmlparser/robot/nsDebugRobot.cpp index 8340d4fbc12..d5f744969f5 100644 --- a/htmlparser/robot/nsDebugRobot.cpp +++ b/htmlparser/robot/nsDebugRobot.cpp @@ -165,8 +165,9 @@ public: NS_IMETHODIMP CStreamListener::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, - PRInt32 progressStateFlags, - nsresult aStatus) { + PRUint32 progressStateFlags, + nsresult aStatus) +{ if (progressStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) if (progressStateFlags & nsIWebProgressListener::STATE_STOP) { fputs("done.\n",stdout); @@ -181,15 +182,19 @@ CStreamListener::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, - PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + PRInt32 aMaxTotalProgress) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP CStreamListener::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + nsIURI *location) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -197,16 +202,20 @@ NS_IMETHODIMP CStreamListener::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + const PRUnichar* aMessage) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP CStreamListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + PRUint32 state) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMPL_ISUPPORTS2(CStreamListener, @@ -329,7 +338,7 @@ extern "C" NS_EXPORT int DebugRobot( nsCOMPtr progress(do_GetInterface(docShell, &rv)); if (NS_FAILED(rv)) return rv; - (void) progress->AddProgressListener(pl); + (void) progress->AddProgressListener(pl, nsIWebProgress::NOTIFY_STATE_DOCUMENT); nsCAutoString spec; (void)url->GetSpec(spec); diff --git a/mailnews/base/src/nsMsgPrintEngine.cpp b/mailnews/base/src/nsMsgPrintEngine.cpp index af85b54ad42..2fd4c98c82f 100644 --- a/mailnews/base/src/nsMsgPrintEngine.cpp +++ b/mailnews/base/src/nsMsgPrintEngine.cpp @@ -82,7 +82,7 @@ NS_IMPL_ISUPPORTS3(nsMsgPrintEngine, NS_IMETHODIMP nsMsgPrintEngine::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, - PRInt32 progressStateFlags, + PRUint32 progressStateFlags, nsresult aStatus) { nsresult rv = NS_OK; @@ -200,15 +200,19 @@ nsMsgPrintEngine::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, - PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + PRInt32 aMaxTotalProgress) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsMsgPrintEngine::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + nsIURI *location) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -216,16 +220,20 @@ NS_IMETHODIMP nsMsgPrintEngine::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + const PRUnichar* aMessage) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsMsgPrintEngine::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + PRUint32 state) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP @@ -465,7 +473,8 @@ nsMsgPrintEngine::SetupObserver() nsCOMPtr progress(do_GetInterface(mDocShell)); NS_ASSERTION(progress, "we were expecting a nsIWebProgress"); if (progress) { - (void) progress->AddProgressListener((nsIWebProgressListener *)this); + (void) progress->AddProgressListener((nsIWebProgressListener *)this, + nsIWebProgress::NOTIFY_STATE_DOCUMENT); } } } diff --git a/mailnews/base/src/nsMsgProgress.cpp b/mailnews/base/src/nsMsgProgress.cpp index 1d592a69307..d0ac3b27d6d 100644 --- a/mailnews/base/src/nsMsgProgress.cpp +++ b/mailnews/base/src/nsMsgProgress.cpp @@ -179,23 +179,21 @@ NS_IMETHODIMP nsMsgProgress::UnregisterListener(nsIWebProgressListener *listener return NS_OK; } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP nsMsgProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP nsMsgProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { - nsresult rv = NS_OK; + nsresult rv; m_pendingStateFlags = aStateFlags; m_pendingStateValue = aStatus; if (m_listenerList) { - PRUint32 count; + PRUint32 count = 0; PRInt32 i; rv = m_listenerList->Count(&count); NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed"); - if (NS_FAILED(rv)) - return rv; nsCOMPtr aSupports; nsCOMPtr aProgressListener; @@ -208,23 +206,21 @@ NS_IMETHODIMP nsMsgProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequ } } - return rv; + return NS_OK; } /* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ NS_IMETHODIMP nsMsgProgress::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { - nsresult rv = NS_OK; + nsresult rv; if (m_listenerList) { - PRUint32 count; + PRUint32 count = 0; PRInt32 i; rv = m_listenerList->Count(&count); NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed"); - if (NS_FAILED(rv)) - return rv; nsCOMPtr aSupports; nsCOMPtr aProgressListener; @@ -237,31 +233,29 @@ NS_IMETHODIMP nsMsgProgress::OnProgressChange(nsIWebProgress *aWebProgress, nsIR } } - return rv; + return NS_OK; } /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP nsMsgProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP nsMsgProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - nsresult rv = NS_OK; + nsresult rv; if (aMessage && *aMessage) m_pendingStatus = aMessage; if (m_listenerList) { - PRUint32 count; + PRUint32 count = 0; PRInt32 i; rv = m_listenerList->Count(&count); NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed"); - if (NS_FAILED(rv)) - return rv; nsCOMPtr aSupports; nsCOMPtr aProgressListener; @@ -274,13 +268,13 @@ NS_IMETHODIMP nsMsgProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIReq } } - return rv; + return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsMsgProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsMsgProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } nsresult nsMsgProgress::ReleaseListeners() diff --git a/mailnews/base/src/nsMsgStatusFeedback.cpp b/mailnews/base/src/nsMsgStatusFeedback.cpp index 9ff07bde972..dbccbbf29ff 100644 --- a/mailnews/base/src/nsMsgStatusFeedback.cpp +++ b/mailnews/base/src/nsMsgStatusFeedback.cpp @@ -114,7 +114,7 @@ nsMsgStatusFeedback::OnProgressChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - PRInt32 aProgressStateFlags, + PRUint32 aProgressStateFlags, nsresult aStatus) { nsresult rv; @@ -171,9 +171,9 @@ nsMsgStatusFeedback::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP nsMsgStatusFeedback::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } diff --git a/mailnews/base/src/nsMsgWindow.cpp b/mailnews/base/src/nsMsgWindow.cpp index 842874f3cff..fd8c2cb4efc 100644 --- a/mailnews/base/src/nsMsgWindow.cpp +++ b/mailnews/base/src/nsMsgWindow.cpp @@ -209,7 +209,7 @@ NS_IMETHODIMP nsMsgWindow::SetStatusFeedback(nsIMsgStatusFeedback * aStatusFeedb if (webProgress && mStatusFeedback && messageWindowDocShell) { nsCOMPtr webProgressListener = do_QueryInterface(mStatusFeedback); - webProgress->AddProgressListener(webProgressListener); + webProgress->AddProgressListener(webProgressListener, nsIWebProgress::NOTIFY_ALL); } return NS_OK; diff --git a/mailnews/base/util/nsMsgMailNewsUrl.cpp b/mailnews/base/util/nsMsgMailNewsUrl.cpp index 44a469b2262..f468e0eee9a 100644 --- a/mailnews/base/util/nsMsgMailNewsUrl.cpp +++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp @@ -307,7 +307,8 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetLoadGroup(nsILoadGroup **aLoadGroup) if (statusFeedback && docShell) { webProgressListener = do_QueryInterface(statusFeedback); - webProgress->AddProgressListener(webProgressListener); + webProgress->AddProgressListener(webProgressListener, + nsIWebProgress::NOTIFY_ALL); } } #endif diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp index 7ac80127893..a0d0d4ca429 100644 --- a/mailnews/compose/src/nsMsgCompose.cpp +++ b/mailnews/compose/src/nsMsgCompose.cpp @@ -1009,7 +1009,7 @@ nsresult nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *ide } } - mProgress->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_START, 0); + mProgress->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_START, NS_OK); } rv = _SendMsg(deliverMode, identity, entityConversionDone); @@ -2886,8 +2886,8 @@ nsMsgComposeSendListener::GetMessageId(nsCString* aMessageId) return NS_OK; } -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP nsMsgComposeSendListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus) +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ +NS_IMETHODIMP nsMsgComposeSendListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { if (aStateFlags == nsIWebProgressListener::STATE_STOP) { @@ -2944,8 +2944,8 @@ NS_IMETHODIMP nsMsgComposeSendListener::OnStatusChange(nsIWebProgress *aWebProgr return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsMsgComposeSendListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsMsgComposeSendListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { /* Ignore this call */ return NS_OK; diff --git a/mailnews/compose/src/nsMsgComposeProgress.cpp b/mailnews/compose/src/nsMsgComposeProgress.cpp index 80719410d7e..c1fc17ac3cc 100644 --- a/mailnews/compose/src/nsMsgComposeProgress.cpp +++ b/mailnews/compose/src/nsMsgComposeProgress.cpp @@ -194,13 +194,11 @@ NS_IMETHODIMP nsMsgComposeProgress::OnStateChange(nsIWebProgress *aWebProgress, if (m_listenerList) { - PRUint32 count; + PRUint32 count = 0; PRInt32 i; rv = m_listenerList->Count(&count); NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed"); - if (NS_FAILED(rv)) - return rv; nsCOMPtr aSupports; nsCOMPtr aProgressListener; @@ -213,7 +211,7 @@ NS_IMETHODIMP nsMsgComposeProgress::OnStateChange(nsIWebProgress *aWebProgress, } } - return rv; + return NS_OK; } /* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ @@ -223,13 +221,11 @@ NS_IMETHODIMP nsMsgComposeProgress::OnProgressChange(nsIWebProgress *aWebProgres if (m_listenerList) { - PRUint32 count; + PRUint32 count = 0; PRInt32 i; rv = m_listenerList->Count(&count); NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed"); - if (NS_FAILED(rv)) - return rv; nsCOMPtr aSupports; nsCOMPtr aProgressListener; @@ -242,30 +238,28 @@ NS_IMETHODIMP nsMsgComposeProgress::OnProgressChange(nsIWebProgress *aWebProgres } } - return rv; + return NS_OK; } /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP nsMsgComposeProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP nsMsgComposeProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - nsresult rv = NS_OK; + nsresult rv; m_pendingStatus = aMessage; if (m_listenerList) { - PRUint32 count; + PRUint32 count = 0; PRInt32 i; rv = m_listenerList->Count(&count); NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed"); - if (NS_FAILED(rv)) - return rv; nsCOMPtr aSupports; nsCOMPtr aProgressListener; @@ -278,13 +272,13 @@ NS_IMETHODIMP nsMsgComposeProgress::OnStatusChange(nsIWebProgress *aWebProgress, } } - return rv; + return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsMsgComposeProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsMsgComposeProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } nsresult nsMsgComposeProgress::ReleaseListeners() diff --git a/mailnews/compose/src/nsURLFetcher.cpp b/mailnews/compose/src/nsURLFetcher.cpp index c14560cd219..ecf6c3f78e9 100644 --- a/mailnews/compose/src/nsURLFetcher.cpp +++ b/mailnews/compose/src/nsURLFetcher.cpp @@ -213,7 +213,7 @@ nsURLFetcher::SetLoadCookie(nsISupports * aLoadCookie) nsCOMPtr webProgress(do_QueryInterface(mLoadCookie)); if (webProgress) - webProgress->AddProgressListener(this); + webProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_ALL); } return NS_OK; @@ -408,7 +408,7 @@ nsURLFetcher::OnProgressChange(nsIWebProgress *aProgress, nsIRequest *aRequest, NS_IMETHODIMP nsURLFetcher::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest, - PRInt32 aStateFlags, nsresult aStatus) + PRUint32 aStateFlags, nsresult aStatus) { // all we care about is the case where an error occurred (as in we were unable to locate the // the url.... @@ -424,6 +424,7 @@ nsURLFetcher::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *aURI) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -433,15 +434,17 @@ nsURLFetcher::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP nsURLFetcher::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } diff --git a/netwerk/base/public/nsISecureBrowserUI.idl b/netwerk/base/public/nsISecureBrowserUI.idl index 197dd917812..8b4e462a06e 100644 --- a/netwerk/base/public/nsISecureBrowserUI.idl +++ b/netwerk/base/public/nsISecureBrowserUI.idl @@ -32,7 +32,7 @@ interface nsISecureBrowserUI : nsISupports { void init(in nsIDOMWindow window); - readonly attribute long state; + readonly attribute unsigned long state; readonly attribute AString tooltipText; }; diff --git a/netwerk/base/public/nsISecurityEventSink.idl b/netwerk/base/public/nsISecurityEventSink.idl index 199a8b7ca99..a4ef4674e1a 100644 --- a/netwerk/base/public/nsISecurityEventSink.idl +++ b/netwerk/base/public/nsISecurityEventSink.idl @@ -50,7 +50,7 @@ interface nsISecurityEventSink : nsISupports * changed. State flags are in nsIWebProgressListener.idl */ - void onSecurityChange(in nsISupports i_Context, in long state); + void onSecurityChange(in nsISupports i_Context, in unsigned long state); }; diff --git a/netwerk/socket/base/nsITransportSecurityInfo.idl b/netwerk/socket/base/nsITransportSecurityInfo.idl index 48da9d8803b..c8c57afe3ab 100644 --- a/netwerk/socket/base/nsITransportSecurityInfo.idl +++ b/netwerk/socket/base/nsITransportSecurityInfo.idl @@ -26,7 +26,7 @@ [noscript, uuid(68e21b66-1dd2-11b2-aa67-e2b87175e792)] interface nsITransportSecurityInfo : nsISupports { - readonly attribute long securityState; + readonly attribute unsigned long securityState; readonly attribute wstring shortSecurityDescription; }; diff --git a/parser/htmlparser/robot/nsDebugRobot.cpp b/parser/htmlparser/robot/nsDebugRobot.cpp index 8340d4fbc12..d5f744969f5 100644 --- a/parser/htmlparser/robot/nsDebugRobot.cpp +++ b/parser/htmlparser/robot/nsDebugRobot.cpp @@ -165,8 +165,9 @@ public: NS_IMETHODIMP CStreamListener::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, - PRInt32 progressStateFlags, - nsresult aStatus) { + PRUint32 progressStateFlags, + nsresult aStatus) +{ if (progressStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) if (progressStateFlags & nsIWebProgressListener::STATE_STOP) { fputs("done.\n",stdout); @@ -181,15 +182,19 @@ CStreamListener::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, - PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + PRInt32 aMaxTotalProgress) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP CStreamListener::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + nsIURI *location) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -197,16 +202,20 @@ NS_IMETHODIMP CStreamListener::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, - const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + const PRUnichar* aMessage) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP CStreamListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + PRUint32 state) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMPL_ISUPPORTS2(CStreamListener, @@ -329,7 +338,7 @@ extern "C" NS_EXPORT int DebugRobot( nsCOMPtr progress(do_GetInterface(docShell, &rv)); if (NS_FAILED(rv)) return rv; - (void) progress->AddProgressListener(pl); + (void) progress->AddProgressListener(pl, nsIWebProgress::NOTIFY_STATE_DOCUMENT); nsCAutoString spec; (void)url->GetSpec(spec); diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 88a36926527..89a971fb643 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -156,13 +156,17 @@ nsSecureBrowserUIImpl::Init(nsIDOMWindow *window) if (!wp) return NS_ERROR_FAILURE; /* end GetWebProgress */ - wp->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this)); + wp->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this), + nsIWebProgress::NOTIFY_STATE_ALL | + nsIWebProgress::NOTIFY_LOCATION | + nsIWebProgress::NOTIFY_SECURITY); + return NS_OK; } NS_IMETHODIMP -nsSecureBrowserUIImpl::GetState(PRInt32* aState) +nsSecureBrowserUIImpl::GetState(PRUint32* aState) { NS_ENSURE_ARG(aState); @@ -237,10 +241,10 @@ static nsresult IsChildOfDomWindow(nsIDOMWindow *parent, nsIDOMWindow *child, return NS_OK; } -static PRInt32 GetSecurityStateFromChannel(nsIChannel* aChannel) +static PRUint32 GetSecurityStateFromChannel(nsIChannel* aChannel) { nsresult res; - PRInt32 securityState; + PRUint32 securityState; // qi for the psm information about this channel load. nsCOMPtr info; @@ -313,6 +317,7 @@ nsSecureBrowserUIImpl::OnProgressChange(nsIWebProgress* aWebProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -331,7 +336,7 @@ void nsSecureBrowserUIImpl::ResetStateTracking() NS_IMETHODIMP nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - PRInt32 aProgressStateFlags, + PRUint32 aProgressStateFlags, nsresult aStatus) { /* @@ -545,7 +550,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, const char *_status = NS_SUCCEEDED(aStatus) ? "1" : "0"; nsCString info; - PRInt32 f = aProgressStateFlags; + PRUint32 f = aProgressStateFlags; if (f & nsIWebProgressListener::STATE_START) { f -= nsIWebProgressListener::STATE_START; @@ -764,15 +769,15 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, // if we arrive here, LOAD_DOCUMENT_URI is not set - PRInt32 aState = nsIWebProgressListener::STATE_IS_INSECURE; + PRUint32 reqState = nsIWebProgressListener::STATE_IS_INSECURE; if (channel) { - aState = GetSecurityStateFromChannel(channel); + reqState = GetSecurityStateFromChannel(channel); } - if (aState & STATE_IS_SECURE) + if (reqState & STATE_IS_SECURE) { - if (aState & STATE_SECURE_LOW || aState & STATE_SECURE_MED) + if (reqState & STATE_SECURE_LOW || reqState & STATE_SECURE_MED) { PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: OnStateChange: subreq LOW\n", this)); @@ -785,7 +790,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, ++mSubRequestsHighSecurity; } } - else if (aState & STATE_IS_BROKEN) + else if (reqState & STATE_IS_BROKEN) { PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: OnStateChange: subreq BROKEN\n", this)); @@ -969,7 +974,7 @@ nsresult nsSecureBrowserUIImpl::FinishedLoadingStateChange(nsIRequest* aRequest) if (mToplevelEventSink) { - PRInt32 newState = STATE_IS_INSECURE; + PRUint32 newState = STATE_IS_INSECURE; switch (newSecurityState) { @@ -1042,20 +1047,19 @@ nsSecureBrowserUIImpl::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } nsresult nsSecureBrowserUIImpl::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - nsresult res = NS_OK; - #if defined(DEBUG) nsCOMPtr channel(do_QueryInterface(aRequest)); if (!channel) - return NS_ERROR_FAILURE; + return NS_OK; nsCOMPtr aURI; channel->GetURI(getter_AddRefs(aURI)); @@ -1067,7 +1071,7 @@ nsSecureBrowserUIImpl::OnSecurityChange(nsIWebProgress *aWebProgress, state, temp.get())); #endif - return res; + return NS_OK; } // nsISSLStatusProvider methods diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.h b/security/manager/boot/src/nsSecureBrowserUIImpl.h index 35868d5867d..28632c6a0b0 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.h +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.h @@ -96,7 +96,7 @@ protected: lockIconState mPreviousSecurityState; void ResetStateTracking(); - PRInt32 mNewToplevelSecurityState; + PRUint32 mNewToplevelSecurityState; nsXPIDLString mInfoTooltip; PRInt32 mDocumentRequestsInProgress; PRInt32 mSubRequestsInProgress; diff --git a/security/manager/ssl/src/nsNSSIOLayer.cpp b/security/manager/ssl/src/nsNSSIOLayer.cpp index e19282defff..2789717e042 100644 --- a/security/manager/ssl/src/nsNSSIOLayer.cpp +++ b/security/manager/ssl/src/nsNSSIOLayer.cpp @@ -256,14 +256,14 @@ nsNSSSocketInfo::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks) } NS_IMETHODIMP -nsNSSSocketInfo::GetSecurityState(PRInt32* state) +nsNSSSocketInfo::GetSecurityState(PRUint32* state) { *state = mSecurityState; return NS_OK; } nsresult -nsNSSSocketInfo::SetSecurityState(PRInt32 aState) +nsNSSSocketInfo::SetSecurityState(PRUint32 aState) { mSecurityState = aState; return NS_OK; diff --git a/security/manager/ssl/src/nsNSSIOLayer.h b/security/manager/ssl/src/nsNSSIOLayer.h index 571f32b422c..d76e89e66f3 100644 --- a/security/manager/ssl/src/nsNSSIOLayer.h +++ b/security/manager/ssl/src/nsNSSIOLayer.h @@ -53,7 +53,7 @@ public: NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSISSLSTATUSPROVIDER - nsresult SetSecurityState(PRInt32 aState); + nsresult SetSecurityState(PRUint32 aState); nsresult SetShortSecurityDescription(const PRUnichar *aText); nsresult SetForTLSStepUp(PRBool useTLS); @@ -82,7 +82,7 @@ public: protected: nsCOMPtr mCallbacks; PRFileDesc* mFd; - PRInt32 mSecurityState; + PRUint32 mSecurityState; nsString mShortDesc; PRBool mForTLSStepUp; PRBool mFirstWrite; diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index 48c0da02046..ca6a18f142c 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -107,7 +107,23 @@ struct nsRequestInfo { }; +struct nsListenerInfo { + nsListenerInfo(nsIWeakReference *aListener, unsigned long aNotifyMask) + : mWeakListener(aListener), + mNotifyMask(aNotifyMask) + { + } + + // Weak pointer for the nsIWebProgressListener... + nsWeakPtr mWeakListener; + + // Mask indicating which notifications the listener wants to receive. + unsigned long mNotifyMask; +}; + + nsDocLoaderImpl::nsDocLoaderImpl() + : mListenerInfoList(8) { NS_INIT_REFCNT(); @@ -145,10 +161,7 @@ nsDocLoaderImpl::Init() PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, ("DocLoader:%p: load group %x.\n", this, mLoadGroup.get())); - rv = NS_NewISupportsArray(getter_AddRefs(mChildList)); - if (NS_FAILED(rv)) return rv; - - return NS_NewISupportsArray(getter_AddRefs(mListenerList)); + return NS_NewISupportsArray(getter_AddRefs(mChildList)); } NS_IMETHODIMP nsDocLoaderImpl::ClearParentDocLoader() @@ -410,8 +423,22 @@ nsDocLoaderImpl::Destroy() mParent = nsnull; } + // Release all the information about network requests... ClearRequestInfoList(); + // Release all the information about registered listeners... + nsListenerInfo *info; + PRInt32 i, count; + + count = mListenerInfoList.Count(); + for(i=0; iSetGroupObserver(nsnull); @@ -723,7 +750,7 @@ void nsDocLoaderImpl::doStopDocumentLoad(nsIRequest *request, #endif /* DEBUG */ // - // Fire an OnStatusChange(...) notification indicating the the + // Fire an OnStateChange(...) notification indicating the the // current document has finished loading... // FireOnStateChange(this, @@ -733,7 +760,7 @@ void nsDocLoaderImpl::doStopDocumentLoad(nsIRequest *request, aStatus); // - // Fire a final OnStatusChange(...) notification indicating the the + // Fire a final OnStateChange(...) notification indicating the the // current document has finished loading... // FireOnStateChange(this, @@ -760,32 +787,49 @@ nsresult nsDocLoaderImpl::GetParentWebProgressListener(nsDocLoaderImpl * aDocLoa } NS_IMETHODIMP -nsDocLoaderImpl::AddProgressListener(nsIWebProgressListener *aListener) +nsDocLoaderImpl::AddProgressListener(nsIWebProgressListener *aListener, + PRUint32 aNotifyMask) { nsresult rv; - nsWeakPtr listener = getter_AddRefs(NS_GetWeakReference(aListener)); - if (!listener) return NS_ERROR_INVALID_ARG; - - if (mListenerList->IndexOf(listener) == -1) { - - // XXX this method incorrectly returns a bool - rv = mListenerList->AppendElement(listener) ? NS_OK : NS_ERROR_FAILURE; - } else { - // The listener is already in the list... - rv = NS_ERROR_FAILURE; + if (!listener) { + return NS_ERROR_INVALID_ARG; } + + nsListenerInfo* info = GetListenerInfo(listener); + if (info) { + // The listener is already registered! + return NS_ERROR_FAILURE; + } + + info = new nsListenerInfo(listener, aNotifyMask); + if (!info) { + return NS_ERROR_OUT_OF_MEMORY; + } + + // XXX this method incorrectly returns a bool + rv = mListenerInfoList.AppendElement(info) ? NS_OK : NS_ERROR_FAILURE; return rv; } NS_IMETHODIMP nsDocLoaderImpl::RemoveProgressListener(nsIWebProgressListener *aListener) { + nsresult rv; nsWeakPtr listener = getter_AddRefs(NS_GetWeakReference(aListener)); - if (!listener) return NS_ERROR_INVALID_ARG; + if (!listener) { + return NS_ERROR_INVALID_ARG; + } - // XXX this method incorrectly returns a bool - return mListenerList->RemoveElement(listener) ? NS_OK : NS_ERROR_FAILURE; + nsListenerInfo* info = GetListenerInfo(listener); + if (info) { + rv = mListenerInfoList.RemoveElement(info) ? NS_OK : NS_ERROR_FAILURE; + delete info; + } else { + // The listener is not registered! + rv = NS_ERROR_FAILURE; + } + return rv; } NS_IMETHODIMP @@ -810,30 +854,6 @@ nsDocLoaderImpl::GetDOMWindow(nsIDOMWindow **aResult) return rv; } -nsresult nsDocLoaderImpl::GetProgressStatusFlags(PRInt32 *aProgressStateFlags) -{ - *aProgressStateFlags = mProgressStateFlags; - return NS_OK; -} - -nsresult nsDocLoaderImpl::GetCurSelfProgress(PRInt32 *aCurSelfProgress) -{ - *aCurSelfProgress = mCurrentSelfProgress; - return NS_OK; -} - -nsresult nsDocLoaderImpl::GetMaxSelfProgress(PRInt32 *aMaxSelfProgress) -{ - *aMaxSelfProgress = mMaxSelfProgress; - return NS_OK; -} - -nsresult nsDocLoaderImpl::GetCurTotalProgress(PRInt32 *aCurTotalProgress) -{ - *aCurTotalProgress = mCurrentTotalProgress; - return NS_OK; -} - nsresult nsDocLoaderImpl::GetMaxTotalProgress(PRInt32 *aMaxTotalProgress) { PRUint32 count = 0; @@ -991,8 +1011,6 @@ void nsDocLoaderImpl::FireOnProgressChange(nsDocLoaderImpl *aLoadInitiator, PRInt32 aTotalProgress, PRInt32 aMaxTotalProgress) { - PRUint32 count; - if (mIsLoadingDocument) { mCurrentTotalProgress += aProgressDelta; GetMaxTotalProgress(&mMaxTotalProgress); @@ -1016,19 +1034,23 @@ void nsDocLoaderImpl::FireOnProgressChange(nsDocLoaderImpl *aLoadInitiator, * Operate the elements from back to front so that if items get * get removed from the list it won't affect our iteration */ - (void)mListenerList->Count(&count); - while (count > 0) { - nsCOMPtr supports; - nsresult rv = mListenerList->GetElementAt(--count, getter_AddRefs(supports)); - if (NS_FAILED(rv)) return; - nsWeakPtr weakPtr = do_QueryInterface(supports); + nsCOMPtr listener; + PRInt32 count = mListenerInfoList.Count(); - nsCOMPtr listener; - listener = do_QueryReferent(weakPtr); + while (--count >= 0) { + nsListenerInfo *info; + + info = NS_STATIC_CAST(nsListenerInfo*,mListenerInfoList.ElementAt(count)); + if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_PROGRESS)) { + continue; + } + + listener = do_QueryReferent(info->mWeakListener); if (!listener) { - // the listener went away. gracefully pull it out of the list. - mListenerList->RemoveElementAt(count); - continue; + // the listener went away. gracefully pull it out of the list. + mListenerInfoList.RemoveElementAt(count); + delete info; + continue; } listener->OnProgressChange(aLoadInitiator,request, @@ -1036,7 +1058,7 @@ void nsDocLoaderImpl::FireOnProgressChange(nsDocLoaderImpl *aLoadInitiator, aTotalProgress, aMaxTotalProgress); } - mListenerList->Compact(); + mListenerInfoList.Compact(); // Pass the notification up to the parent... if (mParent) { @@ -1054,8 +1076,6 @@ void nsDocLoaderImpl::FireOnStateChange(nsIWebProgress *aProgress, PRInt32 aStateFlags, nsresult aStatus) { - PRUint32 count; - // // Remove the STATE_IS_NETWORK bit if necessary. // @@ -1086,25 +1106,29 @@ void nsDocLoaderImpl::FireOnStateChange(nsIWebProgress *aProgress, * Operate the elements from back to front so that if items get * get removed from the list it won't affect our iteration */ - (void)mListenerList->Count(&count); - while (count > 0) { - nsCOMPtr supports; - nsresult rv = mListenerList->GetElementAt(--count, getter_AddRefs(supports)); - if (NS_FAILED(rv)) return; - nsWeakPtr weakPtr = do_QueryInterface(supports); + nsCOMPtr listener; + PRInt32 count = mListenerInfoList.Count(); - nsCOMPtr listener; - listener = do_QueryReferent(weakPtr); + while (--count >= 0) { + nsListenerInfo *info; + + info = NS_STATIC_CAST(nsListenerInfo*,mListenerInfoList.ElementAt(count)); + if (!(info->mNotifyMask & (aStateFlags >>16))) { + continue; + } + + listener = do_QueryReferent(info->mWeakListener); if (!listener) { - // the listener went away, gracefully pull it out of the list. - mListenerList->RemoveElementAt(count); - continue; + // the listener went away. gracefully pull it out of the list. + mListenerInfoList.RemoveElementAt(count); + delete info; + continue; } listener->OnStateChange(aProgress, aRequest, aStateFlags, aStatus); } - mListenerList->Compact(); + mListenerInfoList.Compact(); // Pass the notification up to the parent... if (mParent) { @@ -1119,27 +1143,36 @@ nsDocLoaderImpl::FireOnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *aUri) { - PRUint32 count; + /* + * First notify any listeners of the new state info... + * + * Operate the elements from back to front so that if items get + * get removed from the list it won't affect our iteration + */ + nsCOMPtr listener; + PRInt32 count = mListenerInfoList.Count(); - (void)mListenerList->Count(&count); - while (count > 0) { - nsCOMPtr supports; - nsresult rv = mListenerList->GetElementAt(--count, getter_AddRefs(supports)); - if (NS_FAILED(rv)) return rv; - nsWeakPtr weakPtr = do_QueryInterface(supports); + while (--count >= 0) { + nsListenerInfo *info; - nsCOMPtr listener; - listener = do_QueryReferent(weakPtr); + info = NS_STATIC_CAST(nsListenerInfo*,mListenerInfoList.ElementAt(count)); + if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_LOCATION)) { + continue; + } + + listener = do_QueryReferent(info->mWeakListener); if (!listener) { - // the listener went away. gracefully pull it out of the list. - mListenerList->RemoveElementAt(count); - continue; + // the listener went away. gracefully pull it out of the list. + mListenerInfoList.RemoveElementAt(count); + delete info; + continue; } listener->OnLocationChange(aWebProgress, aRequest, aUri); } - mListenerList->Compact(); + mListenerInfoList.Compact(); + // Pass the notification up to the parent... if (mParent) { mParent->FireOnLocationChange(aWebProgress, aRequest, aUri); @@ -1154,30 +1187,60 @@ nsDocLoaderImpl::FireOnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { - PRUint32 count; + /* + * First notify any listeners of the new state info... + * + * Operate the elements from back to front so that if items get + * get removed from the list it won't affect our iteration + */ + nsCOMPtr listener; + PRInt32 count = mListenerInfoList.Count(); - (void)mListenerList->Count(&count); - while (count > 0) { - nsCOMPtr supports; - nsresult rv = mListenerList->GetElementAt(--count, getter_AddRefs(supports)); - if (NS_FAILED(rv)) return rv; - nsWeakPtr weakPtr = do_QueryInterface(supports); + while (--count >= 0) { + nsListenerInfo *info; - nsCOMPtr listener; - listener = do_QueryReferent(weakPtr); + info = NS_STATIC_CAST(nsListenerInfo*,mListenerInfoList.ElementAt(count)); + if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_STATUS)) { + continue; + } + + listener = do_QueryReferent(info->mWeakListener); if (!listener) { - // the listener went away. gracefully pull it out of the list. - mListenerList->RemoveElementAt(count); - continue; + // the listener went away. gracefully pull it out of the list. + mListenerInfoList.RemoveElementAt(count); + delete info; + continue; } listener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); } - mListenerList->Compact(); + mListenerInfoList.Compact(); + + // Pass the notification up to the parent... + if (mParent) { + mParent->FireOnStatusChange(aWebProgress, aRequest, aStatus, aMessage); + } + return NS_OK; } +nsListenerInfo * +nsDocLoaderImpl::GetListenerInfo(nsIWeakReference *aListener) +{ + PRInt32 i, count; + nsListenerInfo *info; + + count = mListenerInfoList.Count(); + for (i=0; imWeakListener) { + return info; + } + } + return nsnull; +} + nsresult nsDocLoaderImpl::AddRequestInfo(nsIRequest *aRequest) { nsresult rv; @@ -1200,7 +1263,7 @@ nsRequestInfo * nsDocLoaderImpl::GetRequestInfo(nsIRequest *aRequest) count = mRequestInfoList.Count(); for(i=0; imKey) { return info; } @@ -1216,7 +1279,7 @@ nsresult nsDocLoaderImpl::ClearRequestInfoList(void) count = mRequestInfoList.Count(); for(i=0; imCurrentProgress; if (max >= 0) { @@ -1296,8 +1359,12 @@ NS_IMETHODIMP nsDocLoaderImpl::OnRedirect(nsIHttpChannel *aOldChannel, nsIChanne return NS_OK; } +/* + * Implementation of nsISecurityEventSink method... + */ + NS_IMETHODIMP nsDocLoaderImpl::OnSecurityChange(nsISupports * aContext, - PRInt32 state) + PRUint32 aState) { // // Fire progress notifications out to any registered nsIWebProgressListeners. @@ -1306,30 +1373,39 @@ NS_IMETHODIMP nsDocLoaderImpl::OnSecurityChange(nsISupports * aContext, nsCOMPtr request = do_QueryInterface(aContext); nsIWebProgress* webProgress = NS_STATIC_CAST(nsIWebProgress*, this); - PRUint32 count; - (void)mListenerList->Count(&count); + /* + * First notify any listeners of the new state info... + * + * Operate the elements from back to front so that if items get + * get removed from the list it won't affect our iteration + */ + nsCOMPtr listener; + PRInt32 count = mListenerInfoList.Count(); - while (count > 0) { - nsCOMPtr supports; - nsresult rv = mListenerList->GetElementAt(--count, getter_AddRefs(supports)); - if (NS_FAILED(rv)) return rv; - nsWeakPtr weakPtr = do_QueryInterface(supports); + while (--count >= 0) { + nsListenerInfo *info; - nsCOMPtr listener; - listener = do_QueryReferent(weakPtr); - if (!listener) { - // the listener went away. gracefully pull it out of the list. - mListenerList->RemoveElementAt(count); - continue; + info = NS_STATIC_CAST(nsListenerInfo*,mListenerInfoList.ElementAt(count)); + if (!(info->mNotifyMask & nsIWebProgress::NOTIFY_SECURITY)) { + continue; } - listener->OnSecurityChange(webProgress, request, state); + + listener = do_QueryReferent(info->mWeakListener); + if (!listener) { + // the listener went away. gracefully pull it out of the list. + mListenerInfoList.RemoveElementAt(count); + delete info; + continue; + } + + listener->OnSecurityChange(webProgress, request, aState); } - mListenerList->Compact(); + mListenerInfoList.Compact(); // Pass the notification up to the parent... if (mParent) { - mParent->OnSecurityChange(aContext, state); + mParent->OnSecurityChange(aContext, aState); } return NS_OK; } diff --git a/uriloader/base/nsDocLoader.h b/uriloader/base/nsDocLoader.h index 5abd75c70d0..5d00532b35a 100644 --- a/uriloader/base/nsDocLoader.h +++ b/uriloader/base/nsDocLoader.h @@ -59,6 +59,7 @@ #include "nsCOMPtr.h" struct nsRequestInfo; +struct nsListenerInfo; /**************************************************************************** * nsDocLoaderImpl implementation... @@ -137,13 +138,11 @@ protected: // class, please make the ownership explicit (pinkerton, scc). nsCOMPtr mDocumentRequest; // [OWNER] ???compare with document - nsCOMPtr mListenerList; nsISupports* mContainer; // [WEAK] it owns me! nsDocLoaderImpl* mParent; // [WEAK] - nsCString mCommand; - + nsVoidArray mListenerInfoList; /* * This flag indicates that the loader is loading a document. It is set * from the call to LoadDocument(...) until the OnConnectionsComplete(...) @@ -168,10 +167,8 @@ protected: nsAutoVoidArray mRequestInfoList; private: - nsresult GetProgressStatusFlags(PRInt32* aProgressStatusFlags); - nsresult GetCurSelfProgress(PRInt32* aCurSelfProgress); - nsresult GetMaxSelfProgress(PRInt32* aMaxSelfProgress); - nsresult GetCurTotalProgress(PRInt32* aCurTotalProgress); + nsListenerInfo *GetListenerInfo(nsIWeakReference* aListener); + nsresult GetMaxTotalProgress(PRInt32* aMaxTotalProgress); nsresult AddRequestInfo(nsIRequest* aRequest); diff --git a/uriloader/base/nsIWebProgress.idl b/uriloader/base/nsIWebProgress.idl index 910033fe1b8..930d77006c7 100644 --- a/uriloader/base/nsIWebProgress.idl +++ b/uriloader/base/nsIWebProgress.idl @@ -35,18 +35,34 @@ interface nsIWebProgressListener; [scriptable, uuid(570F39D0-EFD0-11d3-B093-00A024FFC08C)] interface nsIWebProgress : nsISupports { + const unsigned long NOTIFY_STATE_REQUEST = 0x00000001; + const unsigned long NOTIFY_STATE_DOCUMENT = 0x00000002; + const unsigned long NOTIFY_STATE_NETWORK = 0x00000004; + const unsigned long NOTIFY_STATE_WINDOW = 0x00000008; + const unsigned long NOTIFY_STATE_ALL = 0x0000000f; + + const unsigned long NOTIFY_PROGRESS = 0x00000010; + const unsigned long NOTIFY_STATUS = 0x00000020; + const unsigned long NOTIFY_SECURITY = 0x00000040; + const unsigned long NOTIFY_LOCATION = 0x00000080; + + const unsigned long NOTIFY_ALL = 0x000000ff; + /** * Registers a listener to be notified of Progress Events * * @param listener - The listener interface to be called when a progress * event occurs. * + * @param aNotifyMask - The types of notifications to receive. + * * @return NS_OK - Listener was registered successfully. * NS_INVALID_ARG - The listener passed in was either nsnull, * or was already registered with this progress * interface. */ - void addProgressListener(in nsIWebProgressListener listener); + void addProgressListener(in nsIWebProgressListener listener, + in unsigned long aNotifyMask); /** * Removes a previously registered listener of Progress Events diff --git a/uriloader/base/nsIWebProgressListener.idl b/uriloader/base/nsIWebProgressListener.idl index 3d067384091..e8ed460d7ce 100644 --- a/uriloader/base/nsIWebProgressListener.idl +++ b/uriloader/base/nsIWebProgressListener.idl @@ -29,129 +29,138 @@ * @status UNDER_REVIEW */ -interface nsIRequest; interface nsIWebProgress; -interface nsIChannel; +interface nsIRequest; interface nsIURI; [scriptable, uuid(570F39D1-EFD0-11d3-B093-00A024FFC08C)] interface nsIWebProgressListener : nsISupports { - /** - * Progress state transition bits. - * These flags indicate the various states that documents and requests - * may transition through as they are being loaded. - */ - const unsigned long STATE_START = 0x00000001; - const unsigned long STATE_REDIRECTING = 0x00000002; - const unsigned long STATE_TRANSFERRING = 0x00000004; - const unsigned long STATE_NEGOTIATING = 0x00000008; - const unsigned long STATE_STOP = 0x00000010; + /** + * Progress state transition bits. + * These flags indicate the various states that documents and requests + * may transition through as they are being loaded. + */ + const unsigned long STATE_START = 0x00000001; + const unsigned long STATE_REDIRECTING = 0x00000002; + const unsigned long STATE_TRANSFERRING = 0x00000004; + const unsigned long STATE_NEGOTIATING = 0x00000008; + const unsigned long STATE_STOP = 0x00000010; - /** - * Progress type bits. - * These flags indicate whether the transition is occuring on a document - * or an individual request within the document. - */ - const unsigned long STATE_IS_REQUEST = 0x00010000; - const unsigned long STATE_IS_DOCUMENT = 0x00020000; - const unsigned long STATE_IS_NETWORK = 0x00040000; - const unsigned long STATE_IS_WINDOW = 0x00080000; - - /** - * Security state bits - */ - const unsigned long STATE_IS_INSECURE = 0x00000000; - const unsigned long STATE_IS_BROKEN = 0x00000001; - const unsigned long STATE_IS_SECURE = 0x00000002; + /** + * Progress State type bits. + * These flags indicate whether the transition is occuring on a document + * or an individual request within the document. + */ + const unsigned long STATE_IS_REQUEST = 0x00010000; + const unsigned long STATE_IS_DOCUMENT = 0x00020000; + const unsigned long STATE_IS_NETWORK = 0x00040000; + const unsigned long STATE_IS_WINDOW = 0x00080000; - const unsigned long STATE_SECURE_HIGH = 0x00000000; - const unsigned long STATE_SECURE_MED = 0x00010000; - const unsigned long STATE_SECURE_LOW = 0x00020000; + /** + * Security state bits + */ + const unsigned long STATE_IS_INSECURE = 0x00000004; + const unsigned long STATE_IS_BROKEN = 0x00000001; + const unsigned long STATE_IS_SECURE = 0x00000002; + + const unsigned long STATE_SECURE_HIGH = 0x00040000; + const unsigned long STATE_SECURE_MED = 0x00010000; + const unsigned long STATE_SECURE_LOW = 0x00020000; - /** - * Notification indicating the state has changed for one of the requests - * associated with the document loaded. - * - * @param aWebProgress The nsIWebProgress instance that fired the - * notification - * - * @param aRequest The nsIRequest which has changed state. - * - * @param aStateFlags Flags indicating the state change. - * - * @param aStatus Status code for the state change. - */ - void onStateChange(in nsIWebProgress aWebProgress, - in nsIRequest aRequest, - in long aStateFlags, // XXX TODO unsigned long - in unsigned long aStatus); + /** + * Notification indicating the state has changed for one of the requests + * associated with the document loaded. + * + * @param aWebProgress The nsIWebProgress instance that fired the + * notification + * + * @param aRequest The nsIRequest which has changed state. + * + * @param aStateFlags Flags indicating the state change. + * + * @param aStatus Status code for the state change. + * + * @return NS_OK should always be returned. + */ + void onStateChange(in nsIWebProgress aWebProgress, + in nsIRequest aRequest, + in unsigned long aStateFlags, + in nsresult aStatus); - /** - * Notification that the progress has changed for one of the requests being - * monitored. - * - * @param aWebProgress The nsIWebProgress instance that fired the - * notification - * - * @param aRequest The nsIRequest that has new progress. - * - * @param aCurSelfProgress The current progress for aRequest. - * - * @param aMaxSelfProgress The maximum progress for aRequest. If this - * value is not known then -1 is passed. - * - * @param aCurTotalProgress The current progress for all the requests - * being monitored. - * - * @param aMaxTotalProgress The total progress for all the requests being - * monitored. If this value is not known then - * -1 is passed. - */ - void onProgressChange(in nsIWebProgress aWebProgress, - in nsIRequest aRequest, - in long aCurSelfProgress, - in long aMaxSelfProgress, - in long aCurTotalProgress, - in long aMaxTotalProgress); - /* - Called when the window being watched changes the location that is currently. - This is not when a load is requested, but rather once it is verified that - the load is going to occur in the given window. For instance, a load that - starts in a window might send progress and status messages, for the new site - but it will not send the onLocationChange until we are sure we are loading - this new page here. - - @param location - The URI of the location that is being loaded. - */ - void onLocationChange(in nsIWebProgress aWebProgress, - in nsIRequest aRequest, - in nsIURI location); - - /** - * Notification that the status has changed. The status message is usually - * printed in the status bar of the browser. - */ - void onStatusChange(in nsIWebProgress aWebProgress, + /** + * Notification that the progress has changed for one of the requests being + * monitored. + * + * @param aWebProgress The nsIWebProgress instance that fired the + * notification + * + * @param aRequest The nsIRequest that has new progress. + * + * @param aCurSelfProgress The current progress for aRequest. + * + * @param aMaxSelfProgress The maximum progress for aRequest. If this + * value is not known then -1 is passed. + * + * @param aCurTotalProgress The current progress for all the requests + * being monitored. + * + * @param aMaxTotalProgress The total progress for all the requests being + * monitored. If this value is not known then + * -1 is passed. + * + * @return NS_OK should always be returned. + */ + void onProgressChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, - in nsresult aStatus, - in wstring aMessage); + in long aCurSelfProgress, + in long aMaxSelfProgress, + in long aCurTotalProgress, + in long aMaxTotalProgress); + /** + * Called when the window being watched changes the location that is currently. + * This is not when a load is requested, but rather once it is verified that + * the load is going to occur in the given window. For instance, a load that + * starts in a window might send progress and status messages, for the new site + * but it will not send the onLocationChange until we are sure we are loading + * this new page here. + * + * @param location The URI of the location that is being loaded. + * + * @return NS_OK should always be returned. + */ + void onLocationChange(in nsIWebProgress aWebProgress, + in nsIRequest aRequest, + in nsIURI location); + + /** + * Notification that the status has changed. The status message is usually + * printed in the status bar of the browser. + * + * @return NS_OK should always be returned. + */ + void onStatusChange(in nsIWebProgress aWebProgress, + in nsIRequest aRequest, + in nsresult aStatus, + in wstring aMessage); - /** - * Notification called for security progress. - * This method will be called on security transitions (eg HTTP -> HTTPS, - * HTTPS -> HTTP, FOO -> https) and after document load completion. - * It might also be called if an error occurs during network loading. - * - * These notification will only occur if a security package is installed. - */ + /** + * Notification called for security progress. + * This method will be called on security transitions (eg HTTP -> HTTPS, + * HTTPS -> HTTP, FOO -> https) and after document load completion. + * It might also be called if an error occurs during network loading. + * + * These notification will only occur if a security package is installed. + * + * @return NS_OK should always be returned. + */ - void onSecurityChange(in nsIWebProgress aWebProgress, - in nsIRequest aRequest, - in long state); + void onSecurityChange(in nsIWebProgress aWebProgress, + in nsIRequest aRequest, + in unsigned long state); }; diff --git a/webshell/tests/viewer/nsWebBrowserChrome.cpp b/webshell/tests/viewer/nsWebBrowserChrome.cpp index 588b38816cd..b7d59cf06ed 100644 --- a/webshell/tests/viewer/nsWebBrowserChrome.cpp +++ b/webshell/tests/viewer/nsWebBrowserChrome.cpp @@ -35,7 +35,6 @@ // Interfaces needed to be included #include "nsIDocShellTreeItem.h" #include "nsIWebProgress.h" -#include "nsIChannel.h" #include "nsIURI.h" #include "nsIDOMWindow.h" @@ -405,7 +404,7 @@ nsWebBrowserChrome::OnProgressChange(nsIWebProgress* aProgress, NS_IMETHODIMP nsWebBrowserChrome::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest, - PRInt32 aProgressStateFlags, + PRUint32 aProgressStateFlags, nsresult aStatus) { if (aProgressStateFlags & STATE_START) { @@ -500,9 +499,9 @@ nsWebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP nsWebBrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } //***************************************************************************** diff --git a/webshell/tests/viewer/nsWebBrowserChrome.h b/webshell/tests/viewer/nsWebBrowserChrome.h index c11b205b9be..35d7141eb73 100644 --- a/webshell/tests/viewer/nsWebBrowserChrome.h +++ b/webshell/tests/viewer/nsWebBrowserChrome.h @@ -35,6 +35,7 @@ #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIWebProgressListener.h" +#include "nsIChannel.h" #include "nsTimer.h" #include "nsWeakReference.h" diff --git a/webshell/tests/viewer/nsWebCrawler.cpp b/webshell/tests/viewer/nsWebCrawler.cpp index 604493d43cb..f83b583aa81 100644 --- a/webshell/tests/viewer/nsWebCrawler.cpp +++ b/webshell/tests/viewer/nsWebCrawler.cpp @@ -361,7 +361,7 @@ nsWebCrawler::QueueExitCallback(nsITimer *aTimer, void *aClosure) NS_IMETHODIMP nsWebCrawler::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - PRInt32 progressStateFlags, + PRUint32 progressStateFlags, nsresult aStatus) { // Make sure that we're being notified for _our_ shell, and not some @@ -479,8 +479,10 @@ nsWebCrawler::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, - PRInt32 aMaxTotalProgress) { - return NS_ERROR_NOT_IMPLEMENTED; + PRInt32 aMaxTotalProgress) +{ + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP @@ -488,7 +490,8 @@ nsWebCrawler::OnLocationChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsIURI *location) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } @@ -498,16 +501,18 @@ nsWebCrawler::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } NS_IMETHODIMP nsWebCrawler::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } FILE* @@ -611,7 +616,8 @@ nsWebCrawler::Start() if (docShell) { nsCOMPtr progress(do_GetInterface(docShell)); if (progress) { - progress->AddProgressListener(this); + progress->AddProgressListener(this, + nsIWebProgress::NOTIFY_STATE_DOCUMENT); LoadNextURL(PR_FALSE); } } diff --git a/xpfe/appshell/src/nsChromeTreeOwner.cpp b/xpfe/appshell/src/nsChromeTreeOwner.cpp index 97177b0d504..bbd546c517a 100644 --- a/xpfe/appshell/src/nsChromeTreeOwner.cpp +++ b/xpfe/appshell/src/nsChromeTreeOwner.cpp @@ -353,7 +353,7 @@ nsChromeTreeOwner::OnProgressChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP nsChromeTreeOwner::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, - PRInt32 aProgressStateFlags, + PRUint32 aProgressStateFlags, nsresult aStatus) { return NS_OK; @@ -397,9 +397,9 @@ nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP nsChromeTreeOwner::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { - return NS_ERROR_NOT_IMPLEMENTED; + return NS_OK; } //***************************************************************************** diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 6388daaa636..0e1f45137d9 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -317,7 +317,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent, // Attach a WebProgress listener.during initialization... nsCOMPtr webProgress(do_GetInterface(mDocShell, &rv)); if (webProgress) { - webProgress->AddProgressListener(this); + webProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_NETWORK); } nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); @@ -1196,13 +1196,14 @@ nsWebShellWindow::OnProgressChange(nsIWebProgress *aProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP nsWebShellWindow::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest, - PRInt32 aStateFlags, + PRUint32 aStateFlags, nsresult aStatus) { // If the notification is not about a document finishing, then just @@ -1289,6 +1290,7 @@ nsWebShellWindow::OnLocationChange(nsIWebProgress *aProgress, nsIRequest *aRequest, nsIURI *aURI) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } @@ -1298,14 +1300,16 @@ nsWebShellWindow::OnStatusChange(nsIWebProgress* aWebProgress, nsresult aStatus, const PRUnichar* aMessage) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP nsWebShellWindow::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 state) + PRUint32 state) { + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } diff --git a/xpfe/browser/resources/content/fastnav.js b/xpfe/browser/resources/content/fastnav.js index 232912ff6bd..62512bdab15 100644 --- a/xpfe/browser/resources/content/fastnav.js +++ b/xpfe/browser/resources/content/fastnav.js @@ -318,7 +318,7 @@ function Startup() // hook up UI through progress listener var interfaceRequestor = getBrowser().docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor); var webProgress = interfaceRequestor.getInterface(Components.interfaces.nsIWebProgress); - webProgress.addProgressListener(window.XULBrowserWindow); + webProgress.addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL); // XXXjag see bug 68662 (needed to hook up web progress listener) getBrowser().boxObject.setPropertyAsSupports("listenerkungfu", window.XULBrowserWindow); diff --git a/xpfe/browser/resources/content/navigator.js b/xpfe/browser/resources/content/navigator.js index 66aa8170e8e..6ced2c24c51 100644 --- a/xpfe/browser/resources/content/navigator.js +++ b/xpfe/browser/resources/content/navigator.js @@ -396,7 +396,7 @@ function Startup() } // hook up UI through progress listener - getBrowser().addProgressListener(window.XULBrowserWindow); + getBrowser().addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL); // load appropriate initial page from commandline var isPageCycling = false; diff --git a/xpfe/components/download-manager/public/nsIDownloadProgressListener.idl b/xpfe/components/download-manager/public/nsIDownloadProgressListener.idl index 3dc76947827..648ae81fa29 100644 --- a/xpfe/components/download-manager/public/nsIDownloadProgressListener.idl +++ b/xpfe/components/download-manager/public/nsIDownloadProgressListener.idl @@ -64,8 +64,8 @@ interface nsIDownloadProgressListener : nsISupports { void onStateChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, - in long aStateFlags, - in unsigned long aStatus, + in unsigned long aStateFlags, + in nsresult aStatus, in nsIDownload aDownload); void onProgressChange(in nsIWebProgress aWebProgress, @@ -89,7 +89,7 @@ interface nsIDownloadProgressListener : nsISupports { void onSecurityChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, - in long aState, + in unsigned long aState, in nsIDownload aDownload); }; \ No newline at end of file diff --git a/xpfe/components/download-manager/src/nsDownloadManager.cpp b/xpfe/components/download-manager/src/nsDownloadManager.cpp index 61d34b4ee6a..4b1556c7c36 100644 --- a/xpfe/components/download-manager/src/nsDownloadManager.cpp +++ b/xpfe/components/download-manager/src/nsDownloadManager.cpp @@ -1055,8 +1055,8 @@ nsDownload::OnStatusChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP nsDownload::OnStateChange(nsIWebProgress* aWebProgress, - nsIRequest* aRequest, PRInt32 aStateFlags, - PRUint32 aStatus) + nsIRequest* aRequest, PRUint32 aStateFlags, + nsresult aStatus) { if (aStateFlags & STATE_START) mStartTime = PR_Now(); @@ -1097,7 +1097,7 @@ nsDownload::OnStateChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP nsDownload::OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 aState) + nsIRequest *aRequest, PRUint32 aState) { if (mListener) mListener->OnSecurityChange(aWebProgress, aRequest, aState); diff --git a/xpfe/components/download-manager/src/nsDownloadProxy.h b/xpfe/components/download-manager/src/nsDownloadProxy.h index 2c9e6125de6..4dee2de5451 100644 --- a/xpfe/components/download-manager/src/nsDownloadProxy.h +++ b/xpfe/components/download-manager/src/nsDownloadProxy.h @@ -148,13 +148,13 @@ public: } NS_IMETHODIMP OnStateChange(nsIWebProgress* aWebProgress, - nsIRequest* aRequest, PRInt32 aStateFlags, + nsIRequest* aRequest, PRUint32 aStateFlags, PRUint32 aStatus) { nsCOMPtr listener = do_QueryInterface(mInner); if (listener) return listener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); - return NS_ERROR_FAILURE; + return NS_OK; } NS_IMETHODIMP OnStatusChange(nsIWebProgress *aWebProgress, @@ -164,7 +164,7 @@ public: nsCOMPtr listener = do_QueryInterface(mInner); if (listener) return listener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); - return NS_ERROR_FAILURE; + return NS_OK; } NS_IMETHODIMP OnLocationChange(nsIWebProgress *aWebProgress, @@ -173,7 +173,7 @@ public: nsCOMPtr listener = do_QueryInterface(mInner); if (listener) return listener->OnLocationChange(aWebProgress, aRequest, aLocation); - return NS_ERROR_FAILURE; + return NS_OK; } NS_IMETHODIMP OnProgressChange(nsIWebProgress *aWebProgress, @@ -187,16 +187,16 @@ public: if (listener) return listener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); - return NS_ERROR_FAILURE; + return NS_OK; } NS_IMETHODIMP OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, PRInt32 aState) + nsIRequest *aRequest, PRUint32 aState) { nsCOMPtr listener = do_QueryInterface(mInner); if (listener) return listener->OnSecurityChange(aWebProgress, aRequest, aState); - return NS_ERROR_FAILURE; + return NS_OK; } private: diff --git a/xpfe/components/history/src/nsHistoryLoadListener.cpp b/xpfe/components/history/src/nsHistoryLoadListener.cpp index 6b21257c419..bb021143727 100644 --- a/xpfe/components/history/src/nsHistoryLoadListener.cpp +++ b/xpfe/components/history/src/nsHistoryLoadListener.cpp @@ -76,7 +76,8 @@ nsHistoryLoadListener::Init() NS_ADDREF_THIS(); rv = progress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*, - this)); + this), + nsIWebProgress::NOTIFY_STATE_DOCUMENT); printf("\tSuccess: %8.8X\n", rv); return NS_OK; @@ -86,11 +87,11 @@ NS_IMPL_ISUPPORTS2(nsHistoryLoadListener, nsIWebProgressListener, nsISupportsWeakReference) -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */ +/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in nsresult aStatus); */ NS_IMETHODIMP nsHistoryLoadListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 aStateFlags, PRUint32 aStatus) + PRUint32 aStateFlags, nsresult aStatus) { // we only care about finishing up documents if (! (aStateFlags & nsIWebProgressListener::STATE_STOP)) @@ -149,32 +150,28 @@ nsHistoryLoadListener::OnProgressChange(nsIWebProgress *aWebProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { - printf("nsHistoryLoadListener::OnProgressChange(w,r, %d, %d, %d, %d)\n", - aCurSelfProgress, aMaxSelfProgress, - aCurTotalProgress, aMaxTotalProgress ); - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP nsHistoryLoadListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - printf("nsHistoryLoadListener::OnLocationChange(w,r,l)\n"); - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP nsHistoryLoadListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - printf("nsHistoryLoadListener::OnStatusChange(w,r, %8.8X, %s)\n", - aStatus, NS_ConvertUCS2toUTF8(aMessage).get()); - - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */ -NS_IMETHODIMP nsHistoryLoadListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state) +/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ +NS_IMETHODIMP nsHistoryLoadListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - printf("nsHistoryLoadListener::OnSecurityChange(w,r, %d)\n", state); - return NS_ERROR_NOT_IMPLEMENTED; + NS_NOTREACHED("notification excluded in AddProgressListener(...)"); + return NS_OK; } diff --git a/xpfe/global/resources/content/bindings/browser.xml b/xpfe/global/resources/content/bindings/browser.xml index 6c8e312d1e9..920085e7692 100644 --- a/xpfe/global/resources/content/bindings/browser.xml +++ b/xpfe/global/resources/content/bindings/browser.xml @@ -257,7 +257,7 @@