Back to index

lightning-sunbird  0.9+nobinonly
nsDocShell.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  * vim: set ts=4 sw=4 et tw=80:
00003  *
00004  * ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is the Mozilla browser.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications, Inc.
00021  * Portions created by the Initial Developer are Copyright (C) 1999
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   Travis Bogard <travis@netscape.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef nsDocShell_h__
00042 #define nsDocShell_h__
00043 
00044 #include "nsIPresShell.h"
00045 #include "nsIDOMNode.h"
00046 #include "nsIDOMNodeList.h"
00047 #include "nsIViewManager.h"
00048 #include "nsIScrollableView.h"
00049 #include "nsIContentViewer.h"
00050 #include "nsIPrefBranch.h"
00051 #include "nsVoidArray.h"
00052 #include "nsInterfaceHashtable.h"
00053 #include "nsIScriptContext.h"
00054 #include "nsITimer.h"
00055 
00056 #include "nsCDocShell.h"
00057 #include "nsIDocShellTreeOwner.h"
00058 #include "nsIContentViewerContainer.h"
00059 #include "nsIDeviceContext.h"
00060 
00061 #include "nsDocLoader.h"
00062 #include "nsIURILoader.h"
00063 #include "nsIEditorDocShell.h"
00064 
00065 #include "nsWeakReference.h"
00066 
00067 // Local Includes
00068 #include "nsDSURIContentListener.h"
00069 #include "nsDocShellEditorData.h"
00070 
00071 // Helper Classes
00072 #include "nsCOMPtr.h"
00073 #include "nsPoint.h" // mCurrent/mDefaultScrollbarPreferences
00074 #include "nsString.h"
00075 #include "nsAutoPtr.h"
00076 
00077 // Threshold value in ms for META refresh based redirects
00078 #define REFRESH_REDIRECT_TIMER 15000
00079 
00080 // Interfaces Needed
00081 #include "nsIDocumentCharsetInfo.h"
00082 #include "nsIDocCharset.h"
00083 #include "nsIGlobalHistory2.h"
00084 #include "nsIInterfaceRequestor.h"
00085 #include "nsIInterfaceRequestorUtils.h"
00086 #include "nsIPrompt.h"
00087 #include "nsIRefreshURI.h"
00088 #include "nsIScriptGlobalObject.h"
00089 #include "nsIScriptGlobalObjectOwner.h"
00090 #include "nsISHistory.h"
00091 #include "nsILayoutHistoryState.h"
00092 #include "nsIStringBundle.h"
00093 #include "nsISupportsArray.h"
00094 #include "nsIWebNavigation.h"
00095 #include "nsIWebPageDescriptor.h"
00096 #include "nsIWebProgressListener.h"
00097 #include "nsISHContainer.h"
00098 #include "nsIDocShellLoadInfo.h"
00099 #include "nsIDocShellHistory.h"
00100 #include "nsIURIFixup.h"
00101 #include "nsIWebBrowserFind.h"
00102 #include "nsIHttpChannel.h"
00103 #include "nsDocShellTransferableHooks.h"
00104 #include "nsIAuthPromptProvider.h"
00105 #include "nsISecureBrowserUI.h"
00106 #include "nsDocShellLoadTypes.h"
00107 
00108 /* internally used ViewMode types */
00109 enum ViewMode {
00110     viewNormal = 0x0,
00111     viewSource = 0x1
00112 };
00113 
00114 //*****************************************************************************
00115 //***    nsRefreshTimer
00116 //*****************************************************************************
00117 
00118 class nsRefreshTimer : public nsITimerCallback
00119 {
00120 public:
00121     nsRefreshTimer();
00122 
00123     NS_DECL_ISUPPORTS
00124     NS_DECL_NSITIMERCALLBACK
00125 
00126     PRInt32 GetDelay() { return mDelay ;}
00127 
00128     nsCOMPtr<nsIDocShell> mDocShell;
00129     nsCOMPtr<nsIURI>      mURI;
00130     PRInt32               mDelay;
00131     PRPackedBool          mRepeat;
00132     PRPackedBool          mMetaRefresh;
00133     
00134 protected:
00135     virtual ~nsRefreshTimer();
00136 };
00137 
00138 //*****************************************************************************
00139 //***    nsDocShell
00140 //*****************************************************************************
00141 
00142 class nsDocShell : public nsDocLoader,
00143                    public nsIDocShell,
00144                    public nsIDocShell_MOZILLA_1_8_BRANCH,
00145                    public nsIDocShell_MOZILLA_1_8_BRANCH2,
00146                    public nsIDocShell_MOZILLA_1_8_BRANCH3,
00147                    public nsIDocShellTreeItem, 
00148                    public nsIDocShellTreeNode,
00149                    public nsIDocShellHistory,
00150                    public nsIWebNavigation,
00151                    public nsIBaseWindow, 
00152                    public nsIScrollable, 
00153                    public nsITextScroll, 
00154                    public nsIDocCharset, 
00155                    public nsIContentViewerContainer,
00156                    public nsIScriptGlobalObjectOwner,
00157                    public nsIRefreshURI,
00158                    public nsIWebProgressListener,
00159                    public nsIEditorDocShell,
00160                    public nsIWebPageDescriptor,
00161                    public nsIAuthPromptProvider
00162 {
00163 friend class nsDSURIContentListener;
00164 
00165 public:
00166     // Object Management
00167     nsDocShell();
00168 
00169     virtual nsresult Init();
00170 
00171     NS_DECL_ISUPPORTS_INHERITED
00172 
00173     NS_DECL_NSIDOCSHELL
00174     NS_DECL_NSIDOCSHELL_MOZILLA_1_8_BRANCH
00175     NS_DECL_NSIDOCSHELL_MOZILLA_1_8_BRANCH2
00176     NS_DECL_NSIDOCSHELL_MOZILLA_1_8_BRANCH3
00177     NS_DECL_NSIDOCSHELLTREEITEM
00178     NS_DECL_NSIDOCSHELLTREENODE
00179     NS_DECL_NSIDOCSHELLHISTORY
00180     NS_DECL_NSIWEBNAVIGATION
00181     NS_DECL_NSIBASEWINDOW
00182     NS_DECL_NSISCROLLABLE
00183     NS_DECL_NSITEXTSCROLL
00184     NS_DECL_NSIDOCCHARSET
00185     NS_DECL_NSIINTERFACEREQUESTOR
00186     NS_DECL_NSIWEBPROGRESSLISTENER
00187     NS_DECL_NSIREFRESHURI
00188     NS_DECL_NSICONTENTVIEWERCONTAINER
00189     NS_DECL_NSIEDITORDOCSHELL
00190     NS_DECL_NSIWEBPAGEDESCRIPTOR
00191     NS_DECL_NSIAUTHPROMPTPROVIDER
00192 
00193     NS_IMETHOD Stop() {
00194         // Need this here because otherwise nsIWebNavigation::Stop
00195         // overrides the docloader's Stop()
00196         return nsDocLoader::Stop();
00197     }
00198 
00199     // Need to implement (and forward) nsISecurityEventSink, because
00200     // nsIWebProgressListener has methods with identical names...
00201     NS_FORWARD_NSISECURITYEVENTSINK(nsDocLoader::)
00202 
00203     nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType);
00204     PRUint32 ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType);
00205 
00206     // nsIScriptGlobalObjectOwner methods
00207     virtual nsIScriptGlobalObject* GetScriptGlobalObject();
00208 
00209     // Restores a cached presentation from history (mLSHE).
00210     // This method swaps out the content viewer and simulates loads for
00211     // subframes.  It then simulates the completion of the toplevel load.
00212     nsresult RestoreFromHistory();
00213 
00214 protected:
00215     // Object Management
00216     virtual ~nsDocShell();
00217     virtual void DestroyChildren();
00218 
00219     // Content Viewer Management
00220     NS_IMETHOD EnsureContentViewer();
00221     NS_IMETHOD EnsureDeviceContext();
00222     nsresult CreateAboutBlankContentViewer();
00223     NS_IMETHOD CreateContentViewer(const char * aContentType, 
00224         nsIRequest * request, nsIStreamListener ** aContentHandler);
00225     NS_IMETHOD NewContentViewerObj(const char * aContentType, 
00226         nsIRequest * request, nsILoadGroup * aLoadGroup, 
00227         nsIStreamListener ** aContentHandler, nsIContentViewer ** aViewer);
00228     NS_IMETHOD SetupNewViewer(nsIContentViewer * aNewViewer);
00229 
00230     void SetupReferrerFromChannel(nsIChannel * aChannel);
00231     
00232     NS_IMETHOD GetEldestPresContext(nsPresContext** aPresContext);
00233 
00234     // Get the principal that we'll set on the channel if we're inheriting.  If
00235     // aConsiderCurrentDocument is true, we try to use the current document if
00236     // at all possible.  If that fails, we fall back on the parent document.
00237     // If that fails too, we force creation of a content viewer and use the
00238     // resulting principal.  If aConsiderCurrentDocument is false, we just look
00239     // at the parent.
00240     nsIPrincipal* GetInheritedPrincipal(PRBool aConsiderCurrentDocument);
00241 
00242     // Actually open a channel and perform a URI load.  Note: whatever owner is
00243     // passed to this function will be set on the channel.  Callers who wish to
00244     // not have an owner on the channel should just pass null.
00245     virtual nsresult DoURILoad(nsIURI * aURI,
00246                                nsIURI * aReferrer,
00247                                PRBool aSendReferrer,
00248                                nsISupports * aOwner,
00249                                const char * aTypeHint,
00250                                nsIInputStream * aPostData,
00251                                nsIInputStream * aHeadersData,
00252                                PRBool firstParty,
00253                                nsIDocShell ** aDocShell,
00254                                nsIRequest ** aRequest,
00255                                PRBool aIsNewWindowTarget);
00256     NS_IMETHOD AddHeadersToChannel(nsIInputStream * aHeadersData, 
00257                                   nsIChannel * aChannel);
00258     virtual nsresult DoChannelLoad(nsIChannel * aChannel,
00259                                    nsIURILoader * aURILoader);
00260     NS_IMETHOD ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor,
00261                               PRUint32 aLoadType, nscoord *cx, nscoord *cy);
00262 
00263     // Returns PR_TRUE if would have called FireOnLocationChange,
00264     // but did not because aFireOnLocationChange was false on entry.
00265     // In this case it is the caller's responsibility to ensure
00266     // FireOnLocationChange is called.
00267     // In all other cases PR_FALSE is returned.
00268     PRBool OnLoadingSite(nsIChannel * aChannel,
00269                          PRBool aFireOnLocationChange,
00270                          PRBool aAddToGlobalHistory = PR_TRUE);
00271 
00272     // Returns PR_TRUE if would have called FireOnLocationChange,
00273     // but did not because aFireOnLocationChange was false on entry.
00274     // In this case it is the caller's responsibility to ensure
00275     // FireOnLocationChange is called.
00276     // In all other cases PR_FALSE is returned.
00277     PRBool OnNewURI(nsIURI * aURI, nsIChannel * aChannel, PRUint32 aLoadType,
00278                     PRBool aFireOnLocationChange,
00279                     PRBool aAddToGlobalHistory = PR_TRUE);
00280 
00281     virtual void SetReferrerURI(nsIURI * aURI);
00282 
00283     // Session History
00284     virtual PRBool ShouldAddToSessionHistory(nsIURI * aURI);
00285     virtual nsresult AddToSessionHistory(nsIURI * aURI, nsIChannel * aChannel,
00286         nsISHEntry ** aNewEntry);
00287     nsresult DoAddChildSHEntry(nsISHEntry* aNewEntry, PRInt32 aChildOffset);
00288 
00289     NS_IMETHOD LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType);
00290     NS_IMETHOD PersistLayoutHistoryState();
00291 
00292     // Clone a session history tree for subframe navigation.
00293     // The tree rooted at |aSrcEntry| will be cloned into |aDestEntry|, except
00294     // for the entry with id |aCloneID|, which will be replaced with
00295     // |aReplaceEntry|.  |aSrcShell| is a (possibly null) docshell which
00296     // corresponds to |aSrcEntry| via its mLSHE or mOHE pointers, and will
00297     // have that pointer updated to point to the cloned history entry.
00298     static nsresult CloneAndReplace(nsISHEntry *aSrcEntry,
00299                                     nsDocShell *aSrcShell,
00300                                     PRUint32 aCloneID,
00301                                     nsISHEntry *aReplaceEntry,
00302                                     nsISHEntry **aDestEntry);
00303 
00304     // Child-walking callback for CloneAndReplace
00305     static nsresult CloneAndReplaceChild(nsISHEntry *aEntry,
00306                                          nsDocShell *aShell,
00307                                          PRInt32 aChildIndex, void *aData);
00308 
00309     nsresult GetRootSessionHistory(nsISHistory ** aReturn);
00310     nsresult GetHttpChannel(nsIChannel * aChannel, nsIHttpChannel ** aReturn);
00311     PRBool ShouldDiscardLayoutState(nsIHttpChannel * aChannel);
00312 
00313     // Determine whether this docshell corresponds to the given history entry,
00314     // via having a pointer to it in mOSHE or mLSHE.
00315     PRBool HasHistoryEntry(nsISHEntry *aEntry) const
00316     {
00317         return aEntry && (aEntry == mOSHE || aEntry == mLSHE);
00318     }
00319 
00320     // Update any pointers (mOSHE or mLSHE) to aOldEntry to point to aNewEntry
00321     void SwapHistoryEntries(nsISHEntry *aOldEntry, nsISHEntry *aNewEntry);
00322 
00323     // Call this method to swap in a new history entry to m[OL]SHE, rather than
00324     // setting it directly.  This completes the navigation in all docshells
00325     // in the case of a subframe navigation.
00326     void SetHistoryEntry(nsCOMPtr<nsISHEntry> *aPtr, nsISHEntry *aEntry);
00327 
00328     // Child-walking callback for SetHistoryEntry
00329     static nsresult SetChildHistoryEntry(nsISHEntry *aEntry,
00330                                          nsDocShell *aShell,
00331                                          PRInt32 aEntryIndex, void *aData);
00332 
00333     // Callback prototype for WalkHistoryEntries.
00334     // aEntry is the child history entry, aShell is its corresponding docshell,
00335     // aChildIndex is the child's index in its parent entry, and aData is
00336     // the opaque pointer passed to WalkHistoryEntries.
00337     typedef nsresult (*WalkHistoryEntriesFunc)(nsISHEntry *aEntry,
00338                                                nsDocShell *aShell,
00339                                                PRInt32 aChildIndex,
00340                                                void *aData);
00341 
00342     // For each child of aRootEntry, find the corresponding docshell which is
00343     // a child of aRootShell, and call aCallback.  The opaque pointer aData
00344     // is passed to the callback.
00345     static nsresult WalkHistoryEntries(nsISHEntry *aRootEntry,
00346                                        nsDocShell *aRootShell,
00347                                        WalkHistoryEntriesFunc aCallback,
00348                                        void *aData);
00349 
00350     // overridden from nsDocLoader, this provides more information than the
00351     // normal OnStateChange with flags STATE_REDIRECTING
00352     virtual void OnRedirectStateChange(nsIChannel* aOldChannel,
00353                                        nsIChannel* aNewChannel,
00354                                        PRUint32 aRedirectFlags,
00355                                        PRUint32 aStateFlags);
00356 
00357     // Global History
00358     nsresult AddToGlobalHistory(nsIURI * aURI, PRBool aRedirect,
00359                                 nsIChannel * aChannel);
00360 
00361     // Helper Routines
00362     NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
00363         nsIStringBundle ** aStringBundle);
00364     NS_IMETHOD GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
00365         PRInt32 * aOffset);
00366     NS_IMETHOD GetRootScrollableView(nsIScrollableView ** aOutScrollView);
00367     NS_IMETHOD EnsureScriptEnvironment();
00368     NS_IMETHOD EnsureEditorData();
00369     nsresult   EnsureTransferableHookData();
00370     NS_IMETHOD EnsureFind();
00371     nsresult   RefreshURIFromQueue();
00372     NS_IMETHOD DisplayLoadError(nsresult aError, nsIURI *aURI,
00373                                 const PRUnichar *aURL,
00374                                 nsIChannel* aFailedChannel = nsnull);
00375     NS_IMETHOD LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
00376                              const PRUnichar *aPage,
00377                              const PRUnichar *aDescription,
00378                              nsIChannel* aFailedChannel);
00379     PRBool IsNavigationAllowed(PRBool aDisplayPrintErrorDialog = PR_TRUE);
00380     PRBool IsPrintingOrPP(PRBool aDisplayErrorDialog = PR_TRUE);
00381 
00382     nsresult SetBaseUrlForWyciwyg(nsIContentViewer * aContentViewer);
00383 
00384     static  inline  PRUint32
00385     PRTimeToSeconds(PRTime t_usec)
00386     {
00387       PRTime usec_per_sec;
00388       PRUint32 t_sec;
00389       LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
00390       LL_DIV(t_usec, t_usec, usec_per_sec);
00391       LL_L2I(t_sec, t_usec);
00392       return t_sec;
00393     }
00394 
00395     PRBool IsFrame();
00396 
00397     //
00398     // Helper method that is called when a new document (including any
00399     // sub-documents - ie. frames) has been completely loaded.
00400     //
00401     virtual nsresult EndPageLoad(nsIWebProgress * aProgress,
00402                                  nsIChannel * aChannel,
00403                                  nsresult aResult);
00404 
00405     nsresult CheckLoadingPermissions();
00406 
00407     // Security checks to prevent frameset spoofing.  See comments at
00408     // implementation sites.
00409     static PRBool CanAccessItem(nsIDocShellTreeItem* aTargetItem,
00410                                 nsIDocShellTreeItem* aAccessingItem,
00411                                 PRBool aConsiderOpener = PR_TRUE);
00412     static PRBool ValidateOrigin(nsIDocShellTreeItem* aOriginTreeItem,
00413                                  nsIDocShellTreeItem* aTargetTreeItem);
00414 
00415     // Returns PR_TRUE if would have called FireOnLocationChange,
00416     // but did not because aFireOnLocationChange was false on entry.
00417     // In this case it is the caller's responsibility to ensure
00418     // FireOnLocationChange is called.
00419     // In all other cases PR_FALSE is returned.
00420     PRBool SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
00421                          PRBool aFireOnLocationChange);
00422 
00423     // The following methods deal with saving and restoring content viewers
00424     // in session history.
00425 
00426     // mContentViewer points to the current content viewer associated with
00427     // this docshell.  When loading a new document, the content viewer is
00428     // either destroyed or stored into a session history entry.  To make sure
00429     // that destruction happens in a controlled fashion, a given content viewer
00430     // is always owned in exactly one of these ways:
00431     //   1) The content viewer is active and owned by a docshell's
00432     //      mContentViewer.
00433     //   2) The content viewer is still being displayed while we begin loading
00434     //      a new document.  The content viewer is owned by the _new_
00435     //      content viewer's mPreviousViewer, and has a pointer to the
00436     //      nsISHEntry where it will eventually be stored.  The content viewer
00437     //      has been close()d by the docshell, which detaches the document from
00438     //      the window object.
00439     //   3) The content viewer is cached in session history.  The nsISHEntry
00440     //      has the only owning reference to the content viewer.  The viewer
00441     //      has released its nsISHEntry pointer to prevent circular ownership.
00442     //
00443     // When restoring a content viewer from session history, open() is called
00444     // to reattach the document to the window object.  The content viewer is
00445     // then placed into mContentViewer and removed from the history entry.
00446     // (mContentViewer is put into session history as described above, if
00447     // applicable).
00448 
00449     // Determines whether we can safely cache the current mContentViewer in
00450     // session history.  This checks a number of factors such as cache policy,
00451     // pending requests, and unload handlers.
00452     // |aLoadType| should be the load type that will replace the current
00453     // presentation.  |aNewRequest| should be the request for the document to
00454     // be loaded in place of the current document, or null if such a request
00455     // has not been created yet. |aNewDocument| should be the document that will
00456     // replace the current document.
00457     PRBool CanSavePresentation(PRUint32 aLoadType,
00458                                nsIRequest *aNewRequest,
00459                                nsIDocument *aNewDocument);
00460 
00461     // Captures the state of the supporting elements of the presentation
00462     // (the "window" object, docshell tree, meta-refresh loads, and security
00463     // state) and stores them on |mOSHE|.
00464     nsresult CaptureState();
00465 
00466     // Begin the toplevel restore process for |aSHEntry|.
00467     // This simulates a channel open, and defers the real work until
00468     // RestoreFromHistory is called from a PLEvent.
00469     nsresult RestorePresentation(nsISHEntry *aSHEntry, PRBool *aRestoring);
00470 
00471     // Call BeginRestore(nsnull, PR_FALSE) for each child of this shell.
00472     nsresult BeginRestoreChildren();
00473 
00474     // Check whether aURI is about:blank
00475     static PRBool IsAboutBlank(nsIURI* aURI);
00476 
00477 protected:
00478     // Override the parent setter from nsDocLoader
00479     virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
00480 
00481     PRPackedBool               mAllowSubframes;
00482     PRPackedBool               mAllowPlugins;
00483     PRPackedBool               mAllowJavascript;
00484     PRPackedBool               mAllowMetaRedirects;
00485     PRPackedBool               mAllowImages;
00486     PRPackedBool               mFocusDocFirst;
00487     PRPackedBool               mHasFocus;
00488     PRPackedBool               mCreatingDocument; // (should be) debugging only
00489     PRPackedBool               mUseErrorPages;
00490     PRPackedBool               mAllowAuth;
00491     PRPackedBool               mAllowKeywordFixup;
00492 
00493     PRPackedBool               mFiredUnloadEvent;
00494 
00495     // this flag is for bug #21358. a docshell may load many urls
00496     // which don't result in new documents being created (i.e. a new
00497     // content viewer) we want to make sure we don't call a on load
00498     // event more than once for a given content viewer.
00499     PRPackedBool               mEODForCurrentDocument; 
00500     PRPackedBool               mURIResultedInDocument;
00501 
00502     PRPackedBool               mIsBeingDestroyed;
00503 
00504     PRPackedBool               mIsExecutingOnLoadHandler;
00505 
00506     // Indicates that a DocShell in this "docshell tree" is printing
00507     PRPackedBool               mIsPrintingOrPP;
00508 
00509     // Indicates to CreateContentViewer() that it is safe to cache the old
00510     // presentation of the page, and to SetupNewViewer() that the old viewer
00511     // should be passed a SHEntry to save itself into.
00512     PRPackedBool               mSavingOldViewer;
00513 
00514     PRUint32                   mAppType;
00515 
00516     // Offset in the parent's child list.
00517     PRInt32                    mChildOffset;
00518 
00519     PRUint32                   mBusyFlags;
00520 
00521     PRInt32                    mMarginWidth;
00522     PRInt32                    mMarginHeight;
00523     PRInt32                    mItemType;
00524 
00525     PRUint32                   mLoadType;
00526 
00527     nsString                   mName;
00528     nsString                   mTitle;
00533     nsCString                  mContentTypeHint;
00534     nsCOMPtr<nsISupportsArray> mRefreshURIList;
00535     nsCOMPtr<nsISupportsArray> mSavedRefreshURIList;
00536     nsRefPtr<nsDSURIContentListener> mContentListener;
00537     nsRect                     mBounds; // Dimensions of the docshell
00538     nsCOMPtr<nsIContentViewer> mContentViewer;
00539     nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
00540     nsCOMPtr<nsIDeviceContext> mDeviceContext;
00541     nsCOMPtr<nsIWidget>        mParentWidget;
00542     nsCOMPtr<nsIPrefBranch>    mPrefs;
00543     nsCOMPtr<nsIURI>           mCurrentURI;
00544     nsCOMPtr<nsIURI>           mReferrerURI;
00545     nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
00546     nsCOMPtr<nsISHistory>      mSessionHistory;
00547     nsCOMPtr<nsIGlobalHistory2> mGlobalHistory;
00548     nsCOMPtr<nsIWebBrowserFind> mFind;
00549     nsPoint                    mDefaultScrollbarPref; // persistent across doc loads
00550     // Reference to the SHEntry for this docshell until the page is destroyed.
00551     // Somebody give me better name
00552     nsCOMPtr<nsISHEntry>       mOSHE; 
00553     // Reference to the SHEntry for this docshell until the page is loaded
00554     // Somebody give me better name
00555     nsCOMPtr<nsISHEntry>       mLSHE;
00556 
00557     // hash of session storages, keyed by domain
00558     nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorage> mStorages;
00559 
00560     // Index into the SHTransaction list, indicating the previous and current
00561     // transaction at the time that this DocShell begins to load
00562     PRInt32                    mPreviousTransIndex;
00563     PRInt32                    mLoadedTransIndex;
00564 
00565     // Editor stuff
00566     nsDocShellEditorData*      mEditorData;          // editor data, if any
00567 
00568     // Transferable hooks/callbacks
00569     nsCOMPtr<nsIClipboardDragDropHookList>  mTransferableHookData;
00570 
00571     // Secure browser UI object
00572     nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
00573 
00574     // WEAK REFERENCES BELOW HERE.
00575     // Note these are intentionally not addrefd.  Doing so will create a cycle.
00576     // For that reasons don't use nsCOMPtr.
00577 
00578     nsIDocShellTreeOwner *     mTreeOwner; // Weak Reference
00579     nsIChromeEventHandler *    mChromeEventHandler; //Weak Reference
00580 
00581     static nsIURIFixup *sURIFixup;
00582 
00583 
00584 public:
00585     class InterfaceRequestorProxy : public nsIInterfaceRequestor {
00586     public:
00587         InterfaceRequestorProxy(nsIInterfaceRequestor* p);
00588         virtual ~InterfaceRequestorProxy();
00589         NS_DECL_ISUPPORTS
00590         NS_DECL_NSIINTERFACEREQUESTOR
00591  
00592     protected:
00593         InterfaceRequestorProxy() {}
00594         nsWeakPtr mWeakPtr;
00595     };
00596 };
00597 
00598 #endif /* nsDocShell_h__ */