diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 948fda81906b..06470e231209 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -682,6 +682,18 @@ DispatchPings(nsIContent *content, nsIURI *referrer) // Note: operator new zeros our memory nsDocShell::nsDocShell(): nsDocLoader(), + mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto), + mTreeOwner(nsnull), + mChromeEventHandler(nsnull), + mCharsetReloadState(eCharsetReloadInit), + mChildOffset(0), + mBusyFlags(BUSY_FLAGS_NONE), + mAppType(nsIDocShell::APP_TYPE_UNKNOWN), + mMarginWidth(-1), + mMarginHeight(-1), + mItemType(typeContent), + mPreviousTransIndex(-1), + mLoadedTransIndex(-1), mAllowSubframes(PR_TRUE), mAllowPlugins(PR_TRUE), mAllowJavascript(PR_TRUE), @@ -702,19 +714,7 @@ nsDocShell::nsDocShell(): mIsBeingDestroyed(PR_FALSE), mIsExecutingOnLoadHandler(PR_FALSE), mIsPrintingOrPP(PR_FALSE), - mSavingOldViewer(PR_FALSE), - mAppType(nsIDocShell::APP_TYPE_UNKNOWN), - mChildOffset(0), - mBusyFlags(BUSY_FLAGS_NONE), - mMarginWidth(-1), - mMarginHeight(-1), - mItemType(typeContent), - mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto), - mPreviousTransIndex(-1), - mLoadedTransIndex(-1), - mTreeOwner(nsnull), - mChromeEventHandler(nsnull), - mCharsetReloadState(eCharsetReloadInit) + mSavingOldViewer(PR_FALSE) #ifdef DEBUG , mInEnsureScriptEnv(PR_FALSE) #endif @@ -7494,11 +7494,11 @@ public: mURI(aURI), mReferrer(aReferrer), mOwner(aOwner), - mFlags(aFlags), mPostData(aPostData), mHeadersData(aHeadersData), - mLoadType(aLoadType), mSHEntry(aSHEntry), + mFlags(aFlags), + mLoadType(aLoadType), mFirstParty(aFirstParty) { // Make sure to keep null things null as needed @@ -7515,20 +7515,20 @@ public: } private: - nsRefPtr mDocShell; - nsCOMPtr mURI; - nsCOMPtr mReferrer; - nsCOMPtr mOwner; - PRUint32 mFlags; // Use IDL strings so .get() returns null by default nsXPIDLString mWindowTarget; nsXPIDLCString mTypeHint; - + + nsRefPtr mDocShell; + nsCOMPtr mURI; + nsCOMPtr mReferrer; + nsCOMPtr mOwner; nsCOMPtr mPostData; nsCOMPtr mHeadersData; - PRUint32 mLoadType; nsCOMPtr mSHEntry; + PRUint32 mFlags; + PRUint32 mLoadType; PRBool mFirstParty; }; @@ -9880,7 +9880,7 @@ nsDocShell::GetRootScrollableView(nsIScrollableView ** aOutScrollView) class nsDebugAutoBoolTrueSetter { public: - nsDebugAutoBoolTrueSetter(PRBool *aBool) + nsDebugAutoBoolTrueSetter(PRPackedBool *aBool) : mBool(aBool) { *mBool = PR_TRUE; @@ -9891,7 +9891,7 @@ public: *mBool = PR_FALSE; } protected: - PRBool *mBool; + PRPackedBool *mBool; }; #endif diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index e17c5dce7200..c1c7f8c19b2e 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -629,6 +629,98 @@ protected: nsDocShell *mDocShell; }; + // hash of session storages, keyed by domain + nsInterfaceHashtable mStorages; + nsIntRect mBounds; // Dimensions of the docshell + nsString mName; + nsString mTitle; + /** + * Content-Type Hint of the most-recently initiated load. Used for + * session history entries. + */ + nsCString mContentTypeHint; + nsIntPoint mDefaultScrollbarPref; // persistent across doc loads + + nsCOMPtr mRefreshURIList; + nsCOMPtr mSavedRefreshURIList; + nsRefPtr mContentListener; + nsCOMPtr mContentViewer; + nsCOMPtr mDocumentCharsetInfo; + nsCOMPtr mParentWidget; + nsCOMPtr mPrefs; + + // mCurrentURI should be marked immutable on set if possible. + nsCOMPtr mCurrentURI; + nsCOMPtr mReferrerURI; + nsCOMPtr mScriptGlobal; + nsCOMPtr mSessionHistory; + nsCOMPtr mGlobalHistory; + nsCOMPtr mFind; + nsCOMPtr mCommandManager; + // Reference to the SHEntry for this docshell until the page is destroyed. + // Somebody give me better name + nsCOMPtr mOSHE; + // Reference to the SHEntry for this docshell until the page is loaded + // Somebody give me better name + nsCOMPtr mLSHE; + + // Holds a weak pointer to a RestorePresentationEvent object if any that + // holds a weak pointer back to us. We use this pointer to possibly revoke + // the event whenever necessary. + nsRevocableEventPtr mRestorePresentationEvent; + + // Editor data, if this document is designMode or contentEditable. + nsAutoPtr mEditorData; + + // Transferable hooks/callbacks + nsCOMPtr mTransferableHookData; + + // Secure browser UI object + nsCOMPtr mSecurityUI; + + // Suspends/resumes channels based on the URI classifier. + nsRefPtr mClassifier; + + // The URI we're currently loading. This is only relevant during the + // firing of a pagehide/unload. The caller of FirePageHideNotification() + // is responsible for setting it and unsetting it. It may be null if the + // pagehide/unload is happening for some reason other than just loading a + // new URI. + nsCOMPtr mLoadingURI; + + // WEAK REFERENCES BELOW HERE. + // Note these are intentionally not addrefd. Doing so will create a cycle. + // For that reasons don't use nsCOMPtr. + + nsIDocShellTreeOwner * mTreeOwner; // Weak Reference + nsPIDOMEventTarget * mChromeEventHandler; //Weak Reference + + eCharsetReloadState mCharsetReloadState; + + // Offset in the parent's child list. + // XXXmats the line above is bogus, it's the offset in the parent's + // child list at the time this docshell was added to it, + // see nsDocShell::AddChild(). It isn't updated after that so if children + // with lower indices are removed this offset is no longer valid to be used + // as an index into the parent's child list (see bug 162283). It MUST not + // be used for that purpose. It's used as an index to get/add history + // entries into nsIDocShellHistory, although I very much doubt that it + // can be correct for that purpose as well... + // Try not to use it, we should get rid of it. + PRUint32 mChildOffset; + PRUint32 mBusyFlags; + PRUint32 mAppType; + PRUint32 mLoadType; + + PRInt32 mMarginWidth; + PRInt32 mMarginHeight; + PRInt32 mItemType; + + // Index into the SHTransaction list, indicating the previous and current + // transaction at the time that this DocShell begins to load + PRInt32 mPreviousTransIndex; + PRInt32 mLoadedTransIndex; + PRPackedBool mAllowSubframes; PRPackedBool mAllowPlugins; PRPackedBool mAllowJavascript; @@ -653,7 +745,7 @@ protected: // which don't result in new documents being created (i.e. a new // content viewer) we want to make sure we don't call a on load // event more than once for a given content viewer. - PRPackedBool mEODForCurrentDocument; + PRPackedBool mEODForCurrentDocument; PRPackedBool mURIResultedInDocument; PRPackedBool mIsBeingDestroyed; @@ -667,104 +759,8 @@ protected: // presentation of the page, and to SetupNewViewer() that the old viewer // should be passed a SHEntry to save itself into. PRPackedBool mSavingOldViewer; - - PRUint32 mAppType; - - // Offset in the parent's child list. - // XXXmats the line above is bogus, it's the offset in the parent's - // child list at the time this docshell was added to it, - // see nsDocShell::AddChild(). It isn't updated after that so if children - // with lower indices are removed this offset is no longer valid to be used - // as an index into the parent's child list (see bug 162283). It MUST not - // be used for that purpose. It's used as an index to get/add history - // entries into nsIDocShellHistory, although I very much doubt that it - // can be correct for that purpose as well... - // Try not to use it, we should get rid of it. - PRUint32 mChildOffset; - - PRUint32 mBusyFlags; - - PRInt32 mMarginWidth; - PRInt32 mMarginHeight; - PRInt32 mItemType; - - PRUint32 mLoadType; - - nsString mName; - nsString mTitle; - /** - * Content-Type Hint of the most-recently initiated load. Used for - * session history entries. - */ - nsCString mContentTypeHint; - nsCOMPtr mRefreshURIList; - nsCOMPtr mSavedRefreshURIList; - nsRefPtr mContentListener; - nsIntRect mBounds; // Dimensions of the docshell - nsCOMPtr mContentViewer; - nsCOMPtr mDocumentCharsetInfo; - nsCOMPtr mParentWidget; - nsCOMPtr mPrefs; - - // mCurrentURI should be marked immutable on set if possible. - nsCOMPtr mCurrentURI; - nsCOMPtr mReferrerURI; - nsCOMPtr mScriptGlobal; - nsCOMPtr mSessionHistory; - nsCOMPtr mGlobalHistory; - nsCOMPtr mFind; - nsIntPoint mDefaultScrollbarPref; // persistent across doc loads - // Reference to the SHEntry for this docshell until the page is destroyed. - // Somebody give me better name - nsCOMPtr mOSHE; - // Reference to the SHEntry for this docshell until the page is loaded - // Somebody give me better name - nsCOMPtr mLSHE; - - // Holds a weak pointer to a RestorePresentationEvent object if any that - // holds a weak pointer back to us. We use this pointer to possibly revoke - // the event whenever necessary. - nsRevocableEventPtr mRestorePresentationEvent; - - // hash of session storages, keyed by domain - nsInterfaceHashtable mStorages; - - // Index into the SHTransaction list, indicating the previous and current - // transaction at the time that this DocShell begins to load - PRInt32 mPreviousTransIndex; - PRInt32 mLoadedTransIndex; - - // Editor data, if this document is designMode or contentEditable. - nsAutoPtr mEditorData; - - // Transferable hooks/callbacks - nsCOMPtr mTransferableHookData; - - // Secure browser UI object - nsCOMPtr mSecurityUI; - - // Suspends/resumes channels based on the URI classifier. - nsRefPtr mClassifier; - - // The URI we're currently loading. This is only relevant during the - // firing of a pagehide/unload. The caller of FirePageHideNotification() - // is responsible for setting it and unsetting it. It may be null if the - // pagehide/unload is happening for some reason other than just loading a - // new URI. - nsCOMPtr mLoadingURI; - - // WEAK REFERENCES BELOW HERE. - // Note these are intentionally not addrefd. Doing so will create a cycle. - // For that reasons don't use nsCOMPtr. - - nsIDocShellTreeOwner * mTreeOwner; // Weak Reference - nsPIDOMEventTarget * mChromeEventHandler; //Weak Reference - - eCharsetReloadState mCharsetReloadState; - nsCOMPtr mCommandManager; - #ifdef DEBUG - PRBool mInEnsureScriptEnv; + PRPackedBool mInEnsureScriptEnv; #endif static nsIURIFixup *sURIFixup;