From c5532ad19d43d7e8239bae88b654d059fc5bd2ea Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Wed, 3 Jul 2002 22:12:29 +0000 Subject: [PATCH] Remove nsDOMWalker & nsIDOMWalker altogether. b=155066 r=sicking@bigfoot.com sr=jst@netscape.com git-svn-id: svn://10.0.0.236/trunk@124635 18797224-902f-48f8-a5cc-f745e15eee43 --- .../build/macbuild/EmbedComponents.xml | 40 ++---------- .../build/macbuild/EmbedComponentsIDL.xml | 64 +------------------ .../embedding/components/build/nsModule.cpp | 3 - .../webbrowserpersist/public/MANIFEST_IDL | 2 - .../webbrowserpersist/public/makefile.win | 2 - .../webbrowserpersist/src/Makefile.in | 1 - .../webbrowserpersist/src/makefile.win | 1 - .../src/nsWebBrowserPersist.cpp | 24 +++++-- .../src/nsWebBrowserPersist.h | 4 +- 9 files changed, 26 insertions(+), 115 deletions(-) diff --git a/mozilla/embedding/components/build/macbuild/EmbedComponents.xml b/mozilla/embedding/components/build/macbuild/EmbedComponents.xml index 4362890b0cb..a958bfa266c 100644 --- a/mozilla/embedding/components/build/macbuild/EmbedComponents.xml +++ b/mozilla/embedding/components/build/macbuild/EmbedComponents.xml @@ -143,8 +143,8 @@ MWRuntimeSettings_WorkingDirectory MWRuntimeSettings_CommandLine MWRuntimeSettings_HostApplication - Path - PathFormatGeneric + PathMacintosh HD:mozilla-dev:source:mozilla:dist:viewer_debug:MozillaDebug + PathFormatMacOS PathRootAbsolute MWRuntimeSettings_EnvVars @@ -544,7 +544,7 @@ MWFTP_Post_hostName MWFTP_Post_username - MWFTP_Post_password264jrwaw64jreeaÀÑ“( + MWFTP_Post_password253qsan53qae2 MWFTP_Post_remoteDir MWFTP_Post_ftp_PathVersion0 MWFTP_Post_ftp_PathType0 @@ -1066,13 +1066,6 @@ Text - - Name - nsDOMWalker.cpp - MacOS - Text - - Name nsWebBrowserPersist.cpp @@ -1093,7 +1086,7 @@ MacOS Library Debug - + Name nsCommandGroup.cpp @@ -1216,11 +1209,6 @@ nsJSConsoleService.cpp MacOS - - Name - nsDOMWalker.cpp - MacOS - Name nsWebBrowserPersist.cpp @@ -1754,7 +1742,7 @@ MWFTP_Post_hostName MWFTP_Post_username - MWFTP_Post_password263k6tfg0ýzø ñ + MWFTP_Post_password146tf8 MWFTP_Post_remoteDir MWFTP_Post_ftp_PathVersion0 MWFTP_Post_ftp_PathType0 @@ -2276,13 +2264,6 @@ Text - - Name - nsDOMWalker.cpp - MacOS - Text - - Name nsWebBrowserPersist.cpp @@ -2426,11 +2407,6 @@ nsJSConsoleService.cpp MacOS - - Name - nsDOMWalker.cpp - MacOS - Name nsWebBrowserPersist.cpp @@ -2488,12 +2464,6 @@ nsWebBrowserPersist.cpp MacOS - - EmbedComponentsDebug.shlb - Name - nsDOMWalker.cpp - MacOS - AppStartup diff --git a/mozilla/embedding/components/build/macbuild/EmbedComponentsIDL.xml b/mozilla/embedding/components/build/macbuild/EmbedComponentsIDL.xml index 6b5ce78e83b..817b8978148 100644 --- a/mozilla/embedding/components/build/macbuild/EmbedComponentsIDL.xml +++ b/mozilla/embedding/components/build/macbuild/EmbedComponentsIDL.xml @@ -327,7 +327,7 @@ MWFTP_Post_hostName MWFTP_Post_username - MWFTP_Post_password2635rsan635rae2p'!ˆK ¿ÿÙ0 + MWFTP_Post_password264jywsn64jyew2p'!€ðŒ¿ÿÙ0 MWFTP_Post_remoteDir MWFTP_Post_ftp_PathVersion0 MWFTP_Post_ftp_PathType0 @@ -856,20 +856,6 @@ Text - - Name - nsCDOMWalker.idl - MacOS - Text - - - - Name - nsIDOMWalker.idl - MacOS - Text - - @@ -962,16 +948,6 @@ nsIProgressDialog.idl MacOS - - Name - nsCDOMWalker.idl - MacOS - - - Name - nsIDOMWalker.idl - MacOS - @@ -1248,7 +1224,7 @@ MWFTP_Post_hostName MWFTP_Post_username - MWFTP_Post_password2655qsan655qae2p'!ˆK ¿ÿÙ0 + MWFTP_Post_password253qsan53qae2 MWFTP_Post_remoteDir MWFTP_Post_ftp_PathVersion0 MWFTP_Post_ftp_PathType0 @@ -1777,20 +1753,6 @@ Text - - Name - nsCDOMWalker.idl - MacOS - Text - - - - Name - nsIDOMWalker.idl - MacOS - Text - - @@ -1883,16 +1845,6 @@ nsIProgressDialog.idl MacOS - - Name - nsCDOMWalker.idl - MacOS - - - Name - nsIDOMWalker.idl - MacOS - @@ -2011,18 +1963,6 @@ nsIAuthPromptWrapper.idl MacOS - - headers - Name - nsCDOMWalker.idl - MacOS - - - headers - Name - nsIDOMWalker.idl - MacOS - diff --git a/mozilla/embedding/components/build/nsModule.cpp b/mozilla/embedding/components/build/nsModule.cpp index b5119658d26..26498c62ea0 100644 --- a/mozilla/embedding/components/build/nsModule.cpp +++ b/mozilla/embedding/components/build/nsModule.cpp @@ -45,7 +45,6 @@ #include "nsFind.h" #include "nsWebBrowserFind.h" #include "nsWebBrowserPersist.h" -#include "nsDOMWalker.h" #include "nsCommandManager.h" #include "nsControllerCommandManager.h" #include "nsCommandParams.h" @@ -60,7 +59,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSConsoleService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFind) NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserFind) NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserPersist) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMWalker) NS_GENERIC_FACTORY_CONSTRUCTOR(nsControllerCommandManager) NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandManager) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCommandParams, Init) @@ -77,7 +75,6 @@ static const nsModuleComponentInfo gComponents[] = { { "WebBrowserFind", NS_WEB_BROWSER_FIND_CID, NS_WEB_BROWSER_FIND_CONTRACTID, nsWebBrowserFindConstructor }, { NS_APPSTARTUPNOTIFIER_CLASSNAME, NS_APPSTARTUPNOTIFIER_CID, NS_APPSTARTUPNOTIFIER_CONTRACTID, nsAppStartupNotifierConstructor }, { "WebBrowserPersist Component", NS_WEBBROWSERPERSIST_CID, NS_WEBBROWSERPERSIST_CONTRACTID, nsWebBrowserPersistConstructor }, - { "DOM Walker", NS_DOMWALKER_CID, NS_DOMWALKER_CONTRACTID, nsDOMWalkerConstructor }, { "Controller Command Manager", NS_CONTROLLERCOMMANDMANAGER_CID, NS_CONTROLLERCOMMANDMANAGER_CONTRACTID, nsControllerCommandManagerConstructor }, { "Command Manager", NS_COMMAND_MANAGER_CID, NS_COMMAND_MANAGER_CONTRACTID, nsCommandManagerConstructor }, { "Command Params", NS_COMMAND_PARAMS_CID, NS_COMMAND_PARAMS_CONTRACTID, nsCommandParamsConstructor }, diff --git a/mozilla/embedding/components/webbrowserpersist/public/MANIFEST_IDL b/mozilla/embedding/components/webbrowserpersist/public/MANIFEST_IDL index 622c6d374cb..78158d14de1 100644 --- a/mozilla/embedding/components/webbrowserpersist/public/MANIFEST_IDL +++ b/mozilla/embedding/components/webbrowserpersist/public/MANIFEST_IDL @@ -1,4 +1,2 @@ nsCWebBrowserPersist.idl nsIWebBrowserPersist.idl -nsCDOMWalker.idl -nsIDOMWalker.idl diff --git a/mozilla/embedding/components/webbrowserpersist/public/makefile.win b/mozilla/embedding/components/webbrowserpersist/public/makefile.win index 9512829e0fb..d0f33b4439b 100644 --- a/mozilla/embedding/components/webbrowserpersist/public/makefile.win +++ b/mozilla/embedding/components/webbrowserpersist/public/makefile.win @@ -25,8 +25,6 @@ MODULE=webbrowserpersist XPIDLSRCS = \ .\nsIWebBrowserPersist.idl \ .\nsCWebBrowserPersist.idl \ - .\nsIDOMWalker.idl \ - .\nsCDOMWalker.idl \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/embedding/components/webbrowserpersist/src/Makefile.in b/mozilla/embedding/components/webbrowserpersist/src/Makefile.in index 7787991138b..510e8c9248b 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/Makefile.in +++ b/mozilla/embedding/components/webbrowserpersist/src/Makefile.in @@ -41,7 +41,6 @@ REQUIRES = xpcom \ $(NULL) CPPSRCS = nsWebBrowserPersist.cpp \ - nsDOMWalker.cpp \ $(NULL) # we don't want the shared lib, but we want to force the creation of a diff --git a/mozilla/embedding/components/webbrowserpersist/src/makefile.win b/mozilla/embedding/components/webbrowserpersist/src/makefile.win index fb67b688619..7408a81870e 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/makefile.win +++ b/mozilla/embedding/components/webbrowserpersist/src/makefile.win @@ -39,7 +39,6 @@ LIBRARY_NAME=webbrowserpersist_s CPP_OBJS= \ .\$(OBJDIR)\nsWebBrowserPersist.obj \ - .\$(OBJDIR)\nsDOMWalker.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index c024685d995..7928300701d 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -49,6 +49,8 @@ #include "nsIFileURL.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" +#include "nsIDOMDocumentTraversal.h" +#include "nsIDOMTreeWalker.h" #include "nsIDOMNode.h" #include "nsIDOMNamedNodeMap.h" #include "nsIDOMNodeList.h" @@ -57,6 +59,7 @@ #include "nsIAuthPrompt.h" #include "nsIPrompt.h" +#include "nsIDOMNodeFilter.h" #include "nsIDOMHTMLBodyElement.h" #include "nsIDOMHTMLTableElement.h" #include "nsIDOMHTMLTableRowElement.h" @@ -203,7 +206,6 @@ NS_INTERFACE_MAP_BEGIN(nsWebBrowserPersist) NS_INTERFACE_MAP_ENTRY(nsIStreamListener) NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink) - NS_INTERFACE_MAP_ENTRY(nsIDOMWalkerCallback) NS_INTERFACE_MAP_END @@ -1371,10 +1373,21 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal( mDocList.AppendElement(docData); // Walk the DOM gathering a list of externally referenced URIs in the uri map - nsCOMPtr walker = - do_CreateInstance(NS_DOMWALKER_CONTRACTID, &rv); + nsCOMPtr trav = do_QueryInterface(docData->mDocument, &rv); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); - walker->WalkDOM(docAsNode, this); + nsCOMPtr walker; + rv = trav->CreateTreeWalker(docAsNode, + nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_DOCUMENT, + nsnull, PR_TRUE, getter_AddRefs(walker)); + NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); + + nsCOMPtr currentNode; + walker->GetCurrentNode(getter_AddRefs(currentNode)); + while (currentNode) + { + OnWalkDOMNode(currentNode); + walker->NextNode(getter_AddRefs(currentNode)); + } // If there are things to persist, create a directory to hold them if (mCurrentThingsToPersist > 0) @@ -2154,8 +2167,7 @@ nsWebBrowserPersist::EnumCleanupUploadList(nsHashKey *aKey, void *aData, void* c } -nsresult -nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode, PRBool *aAbort) +nsresult nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode) { // Test the node to see if it's an image, frame, iframe, css, js nsCOMPtr nodeAsImage = do_QueryInterface(aNode); diff --git a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h index 5d40d857d9e..3f6be011031 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h +++ b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h @@ -43,7 +43,6 @@ #include "nsVoidArray.h" #include "nsCWebBrowserPersist.h" -#include "nsDOMWalker.h" class nsEncoderNodeFixup; class nsIStorageStream; @@ -53,7 +52,6 @@ struct URIData; class nsWebBrowserPersist : public nsIInterfaceRequestor, public nsIWebBrowserPersist, public nsIStreamListener, - public nsIDOMWalkerCallback, public nsIProgressEventSink, public nsSupportsWeakReference { @@ -69,7 +67,6 @@ public: NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER NS_DECL_NSIPROGRESSEVENTSINK - NS_DECL_NSIDOMWALKERCALLBACK // Protected members protected: @@ -127,6 +124,7 @@ private: nsresult SetDocumentBase(nsIDOMDocument *aDocument, nsIURI *aBaseURI); nsresult SendErrorStatusChange( PRBool aIsReadError, nsresult aResult, nsIRequest *aRequest, nsIURI *aURI); + nsresult OnWalkDOMNode(nsIDOMNode *aNode); nsresult FixRedirectedChannelEntry(nsIChannel *aNewChannel);