2001-04-27 17:03:17 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2005-08-23 04:24:57 +04:00
|
|
|
* vim: set ts=4 sw=4 et tw=80:
|
1999-10-26 05:44:00 +04:00
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* ***** 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.
|
|
|
|
*
|
1999-10-26 05:44:00 +04:00
|
|
|
* The Original Code is the Mozilla browser.
|
2004-04-18 01:52:36 +04:00
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications, Inc.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1999
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
1999-10-26 05:44:00 +04:00
|
|
|
* Contributor(s):
|
|
|
|
* Travis Bogard <travis@netscape.com>
|
2004-04-18 01:52:36 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of 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 ***** */
|
1999-10-26 05:44:00 +04:00
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
#ifndef nsDocShell_h__
|
|
|
|
#define nsDocShell_h__
|
1999-10-26 05:44:00 +04:00
|
|
|
|
1999-10-28 06:20:44 +04:00
|
|
|
#include "nsIDOMNode.h"
|
|
|
|
#include "nsIDOMNodeList.h"
|
1999-10-30 06:30:13 +04:00
|
|
|
#include "nsIContentViewer.h"
|
2004-09-06 23:31:22 +04:00
|
|
|
#include "nsIPrefBranch.h"
|
2006-05-19 09:57:36 +04:00
|
|
|
#include "nsInterfaceHashtable.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsIScriptContext.h"
|
2002-09-07 09:38:16 +04:00
|
|
|
#include "nsITimer.h"
|
1999-10-27 02:56:59 +04:00
|
|
|
|
2009-05-07 23:21:53 +04:00
|
|
|
#include "nsIDocShell.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDocShellTreeNode.h"
|
|
|
|
#include "nsIBaseWindow.h"
|
|
|
|
#include "nsIScrollable.h"
|
|
|
|
#include "nsITextScroll.h"
|
1999-12-12 13:15:26 +03:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
1999-11-11 03:34:41 +03:00
|
|
|
#include "nsIContentViewerContainer.h"
|
|
|
|
|
2004-12-08 20:32:06 +03:00
|
|
|
#include "nsDocLoader.h"
|
2001-10-27 06:52:39 +04:00
|
|
|
#include "nsIURILoader.h"
|
2002-02-02 08:13:56 +03:00
|
|
|
#include "nsIEditorDocShell.h"
|
1999-11-11 03:34:41 +03:00
|
|
|
|
2000-05-28 13:25:55 +04:00
|
|
|
#include "nsWeakReference.h"
|
2000-03-29 14:29:58 +04:00
|
|
|
|
|
|
|
// Local Includes
|
|
|
|
#include "nsDSURIContentListener.h"
|
2002-02-02 08:13:56 +03:00
|
|
|
#include "nsDocShellEditorData.h"
|
2000-03-29 14:29:58 +04:00
|
|
|
|
2000-04-16 12:39:15 +04:00
|
|
|
// Helper Classes
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsPoint.h" // mCurrent/mDefaultScrollbarPreferences
|
|
|
|
#include "nsString.h"
|
2005-02-18 21:20:42 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2006-05-10 21:30:15 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2000-04-16 12:39:15 +04:00
|
|
|
|
2001-02-15 22:10:16 +03:00
|
|
|
// Threshold value in ms for META refresh based redirects
|
|
|
|
#define REFRESH_REDIRECT_TIMER 15000
|
2000-06-22 09:36:13 +04:00
|
|
|
|
2000-02-17 05:03:02 +03:00
|
|
|
// Interfaces Needed
|
2000-04-12 04:07:04 +04:00
|
|
|
#include "nsIDocumentCharsetInfo.h"
|
2001-05-17 06:12:51 +04:00
|
|
|
#include "nsIDocCharset.h"
|
2004-02-11 05:10:04 +03:00
|
|
|
#include "nsIGlobalHistory2.h"
|
2000-04-16 12:39:15 +04:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2000-04-22 03:31:40 +04:00
|
|
|
#include "nsIPrompt.h"
|
2000-04-13 07:11:44 +04:00
|
|
|
#include "nsIRefreshURI.h"
|
2000-04-16 12:39:15 +04:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsIScriptGlobalObjectOwner.h"
|
2000-02-17 05:03:02 +03:00
|
|
|
#include "nsISHistory.h"
|
2003-05-30 04:21:01 +04:00
|
|
|
#include "nsILayoutHistoryState.h"
|
2000-04-13 07:11:44 +04:00
|
|
|
#include "nsIStringBundle.h"
|
2000-04-16 12:39:15 +04:00
|
|
|
#include "nsISupportsArray.h"
|
2000-02-14 09:40:28 +03:00
|
|
|
#include "nsIWebNavigation.h"
|
2002-04-02 01:22:27 +04:00
|
|
|
#include "nsIWebPageDescriptor.h"
|
2011-06-14 02:02:28 +04:00
|
|
|
#include "nsIWebProgressListener.h"
|
2000-06-21 10:40:08 +04:00
|
|
|
#include "nsISHContainer.h"
|
2000-06-22 11:22:23 +04:00
|
|
|
#include "nsIDocShellLoadInfo.h"
|
2000-07-06 03:10:29 +04:00
|
|
|
#include "nsIDocShellHistory.h"
|
2000-11-09 00:00:37 +03:00
|
|
|
#include "nsIURIFixup.h"
|
2001-04-28 01:11:03 +04:00
|
|
|
#include "nsIWebBrowserFind.h"
|
2001-11-28 02:14:15 +03:00
|
|
|
#include "nsIHttpChannel.h"
|
2003-04-17 17:16:05 +04:00
|
|
|
#include "nsDocShellTransferableHooks.h"
|
2004-09-02 09:13:25 +04:00
|
|
|
#include "nsIAuthPromptProvider.h"
|
2005-05-05 00:22:32 +04:00
|
|
|
#include "nsISecureBrowserUI.h"
|
2005-09-23 00:38:56 +04:00
|
|
|
#include "nsIObserver.h"
|
2006-02-11 03:17:36 +03:00
|
|
|
#include "nsDocShellLoadTypes.h"
|
2007-02-16 02:04:33 +03:00
|
|
|
#include "nsPIDOMEventTarget.h"
|
2008-11-24 21:32:04 +03:00
|
|
|
#include "nsILoadContext.h"
|
2009-04-02 01:59:02 +04:00
|
|
|
#include "nsIWidget.h"
|
2009-05-07 23:21:53 +04:00
|
|
|
#include "nsIWebShellServices.h"
|
|
|
|
#include "nsILinkHandler.h"
|
|
|
|
#include "nsIClipboardCommands.h"
|
|
|
|
#include "nsICommandManager.h"
|
|
|
|
#include "nsCRT.h"
|
2000-09-20 16:23:53 +04:00
|
|
|
|
2008-09-08 17:19:49 +04:00
|
|
|
class nsDocShell;
|
2009-05-07 23:21:53 +04:00
|
|
|
class nsIController;
|
|
|
|
class OnLinkClickEvent;
|
2009-09-09 09:40:02 +04:00
|
|
|
class nsIScrollableFrame;
|
2007-02-12 22:17:33 +03:00
|
|
|
|
2002-04-05 02:10:10 +04:00
|
|
|
/* load commands were moved to nsIDocShell.h */
|
2006-02-11 03:17:36 +03:00
|
|
|
/* load types were moved to nsDocShellLoadTypes.h */
|
2000-09-20 16:23:53 +04:00
|
|
|
|
2001-04-17 00:17:36 +04:00
|
|
|
/* internally used ViewMode types */
|
|
|
|
enum ViewMode {
|
2001-04-27 17:03:17 +04:00
|
|
|
viewNormal = 0x0,
|
|
|
|
viewSource = 0x1
|
2001-04-17 00:17:36 +04:00
|
|
|
};
|
2000-09-20 16:23:53 +04:00
|
|
|
|
2000-04-13 07:11:44 +04:00
|
|
|
//*****************************************************************************
|
|
|
|
//*** nsRefreshTimer
|
|
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
class nsRefreshTimer : public nsITimerCallback
|
|
|
|
{
|
|
|
|
public:
|
2001-04-27 17:03:17 +04:00
|
|
|
nsRefreshTimer();
|
2000-04-13 07:11:44 +04:00
|
|
|
|
2001-04-27 17:03:17 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
2002-09-07 09:38:16 +04:00
|
|
|
NS_DECL_NSITIMERCALLBACK
|
|
|
|
|
2002-02-09 01:46:09 +03:00
|
|
|
PRInt32 GetDelay() { return mDelay ;}
|
2000-04-13 07:11:44 +04:00
|
|
|
|
2008-09-08 17:19:49 +04:00
|
|
|
nsRefPtr<nsDocShell> mDocShell;
|
2001-04-27 17:03:17 +04:00
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
PRInt32 mDelay;
|
2004-02-11 09:09:51 +03:00
|
|
|
PRPackedBool mRepeat;
|
|
|
|
PRPackedBool mMetaRefresh;
|
2002-02-09 01:46:09 +03:00
|
|
|
|
2000-04-13 07:11:44 +04:00
|
|
|
protected:
|
2001-04-27 17:03:17 +04:00
|
|
|
virtual ~nsRefreshTimer();
|
2000-04-13 07:11:44 +04:00
|
|
|
};
|
|
|
|
|
2009-05-07 23:21:53 +04:00
|
|
|
#define NS_ERROR_DOCSHELL_REQUEST_REJECTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GENERAL,1001)
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
eCharsetReloadInit,
|
|
|
|
eCharsetReloadRequested,
|
|
|
|
eCharsetReloadStopOrigional
|
|
|
|
} eCharsetReloadState;
|
|
|
|
|
2000-04-13 07:11:44 +04:00
|
|
|
//*****************************************************************************
|
|
|
|
//*** nsDocShell
|
|
|
|
//*****************************************************************************
|
|
|
|
|
2004-12-08 20:32:06 +03:00
|
|
|
class nsDocShell : public nsDocLoader,
|
|
|
|
public nsIDocShell,
|
1999-12-03 13:29:08 +03:00
|
|
|
public nsIDocShellTreeItem,
|
2000-07-06 03:10:29 +04:00
|
|
|
public nsIDocShellHistory,
|
2000-02-14 09:40:28 +03:00
|
|
|
public nsIWebNavigation,
|
1999-11-19 10:35:27 +03:00
|
|
|
public nsIBaseWindow,
|
|
|
|
public nsIScrollable,
|
|
|
|
public nsITextScroll,
|
2001-05-17 06:12:51 +04:00
|
|
|
public nsIDocCharset,
|
1999-11-23 13:15:10 +03:00
|
|
|
public nsIContentViewerContainer,
|
2000-04-13 07:11:44 +04:00
|
|
|
public nsIScriptGlobalObjectOwner,
|
2000-05-28 13:25:55 +04:00
|
|
|
public nsIRefreshURI,
|
2000-06-20 11:59:45 +04:00
|
|
|
public nsIWebProgressListener,
|
2002-02-02 08:13:56 +03:00
|
|
|
public nsIEditorDocShell,
|
2002-04-02 01:22:27 +04:00
|
|
|
public nsIWebPageDescriptor,
|
2005-09-23 00:38:56 +04:00
|
|
|
public nsIAuthPromptProvider,
|
2008-11-24 21:32:04 +03:00
|
|
|
public nsIObserver,
|
2009-01-13 08:52:00 +03:00
|
|
|
public nsILoadContext,
|
2009-05-07 23:21:53 +04:00
|
|
|
public nsIWebShellServices,
|
|
|
|
public nsILinkHandler,
|
2011-03-25 18:03:34 +03:00
|
|
|
public nsIClipboardCommands
|
1999-10-26 05:44:00 +04:00
|
|
|
{
|
2009-05-07 23:21:53 +04:00
|
|
|
friend class nsDSURIContentListener;
|
1999-11-07 13:03:51 +03:00
|
|
|
|
1999-10-26 05:44:00 +04:00
|
|
|
public:
|
2001-04-27 17:03:17 +04:00
|
|
|
// Object Management
|
|
|
|
nsDocShell();
|
|
|
|
|
2009-05-07 23:21:53 +04:00
|
|
|
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
|
|
|
|
2004-12-08 20:32:06 +03:00
|
|
|
virtual nsresult Init();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2001-04-27 17:03:17 +04:00
|
|
|
|
|
|
|
NS_DECL_NSIDOCSHELL
|
|
|
|
NS_DECL_NSIDOCSHELLTREEITEM
|
|
|
|
NS_DECL_NSIDOCSHELLTREENODE
|
|
|
|
NS_DECL_NSIDOCSHELLHISTORY
|
|
|
|
NS_DECL_NSIWEBNAVIGATION
|
|
|
|
NS_DECL_NSIBASEWINDOW
|
|
|
|
NS_DECL_NSISCROLLABLE
|
|
|
|
NS_DECL_NSITEXTSCROLL
|
2001-05-17 06:12:51 +04:00
|
|
|
NS_DECL_NSIDOCCHARSET
|
2001-04-27 17:03:17 +04:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
|
|
|
NS_DECL_NSIREFRESHURI
|
|
|
|
NS_DECL_NSICONTENTVIEWERCONTAINER
|
2002-02-02 08:13:56 +03:00
|
|
|
NS_DECL_NSIEDITORDOCSHELL
|
2002-04-02 01:22:27 +04:00
|
|
|
NS_DECL_NSIWEBPAGEDESCRIPTOR
|
2004-09-02 09:13:25 +04:00
|
|
|
NS_DECL_NSIAUTHPROMPTPROVIDER
|
2005-09-23 00:38:56 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
2008-11-24 21:32:04 +03:00
|
|
|
NS_DECL_NSILOADCONTEXT
|
2009-05-07 23:21:53 +04:00
|
|
|
NS_DECL_NSICLIPBOARDCOMMANDS
|
|
|
|
NS_DECL_NSIWEBSHELLSERVICES
|
2001-04-27 17:03:17 +04:00
|
|
|
|
2004-12-08 20:32:06 +03:00
|
|
|
NS_IMETHOD Stop() {
|
|
|
|
// Need this here because otherwise nsIWebNavigation::Stop
|
|
|
|
// overrides the docloader's Stop()
|
|
|
|
return nsDocLoader::Stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Need to implement (and forward) nsISecurityEventSink, because
|
|
|
|
// nsIWebProgressListener has methods with identical names...
|
|
|
|
NS_FORWARD_NSISECURITYEVENTSINK(nsDocLoader::)
|
|
|
|
|
2009-05-07 23:21:53 +04:00
|
|
|
// nsILinkHandler
|
|
|
|
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
|
|
|
nsIURI* aURI,
|
|
|
|
const PRUnichar* aTargetSpec,
|
|
|
|
nsIInputStream* aPostDataStream = 0,
|
|
|
|
nsIInputStream* aHeadersDataStream = 0);
|
|
|
|
NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
|
|
|
|
nsIURI* aURI,
|
|
|
|
const PRUnichar* aTargetSpec,
|
|
|
|
nsIInputStream* aPostDataStream = 0,
|
|
|
|
nsIInputStream* aHeadersDataStream = 0,
|
|
|
|
nsIDocShell** aDocShell = 0,
|
2010-10-01 03:55:11 +04:00
|
|
|
nsIRequest** aRequest = 0);
|
2009-05-07 23:21:53 +04:00
|
|
|
NS_IMETHOD OnOverLink(nsIContent* aContent,
|
|
|
|
nsIURI* aURI,
|
|
|
|
const PRUnichar* aTargetSpec);
|
|
|
|
NS_IMETHOD OnLeaveLink();
|
|
|
|
|
2001-12-01 01:35:33 +03:00
|
|
|
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(PRUint32 aLoadType);
|
2001-04-27 17:03:17 +04:00
|
|
|
PRUint32 ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType);
|
2000-06-20 11:59:45 +04:00
|
|
|
|
2004-07-16 21:03:10 +04:00
|
|
|
// nsIScriptGlobalObjectOwner methods
|
|
|
|
virtual nsIScriptGlobalObject* GetScriptGlobalObject();
|
2005-08-02 22:35:07 +04:00
|
|
|
|
|
|
|
// Restores a cached presentation from history (mLSHE).
|
|
|
|
// This method swaps out the content viewer and simulates loads for
|
|
|
|
// subframes. It then simulates the completion of the toplevel load.
|
|
|
|
nsresult RestoreFromHistory();
|
|
|
|
|
2008-09-08 17:19:49 +04:00
|
|
|
// Perform a URI load from a refresh timer. This is just like the
|
|
|
|
// ForceRefreshURI method on nsIRefreshURI, but makes sure to take
|
|
|
|
// the timer involved out of mRefreshURIList if it's there.
|
|
|
|
// aTimer must not be null.
|
|
|
|
nsresult ForceRefreshURIFromTimer(nsIURI * aURI, PRInt32 aDelay,
|
|
|
|
PRBool aMetaRefresh, nsITimer* aTimer);
|
|
|
|
|
2009-05-07 23:21:53 +04:00
|
|
|
friend class OnLinkClickEvent;
|
|
|
|
|
2011-06-14 02:02:28 +04:00
|
|
|
// We need dummy OnLocationChange in some cases to update the UI.
|
2010-09-05 22:10:35 +04:00
|
|
|
void FireDummyOnLocationChange()
|
|
|
|
{
|
2011-06-14 02:02:28 +04:00
|
|
|
FireOnLocationChange(this, nsnull, mCurrentURI);
|
2010-09-05 22:10:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult HistoryTransactionRemoved(PRInt32 aIndex);
|
1999-10-26 05:44:00 +04:00
|
|
|
protected:
|
2001-04-27 17:03:17 +04:00
|
|
|
// Object Management
|
|
|
|
virtual ~nsDocShell();
|
2004-12-08 20:32:06 +03:00
|
|
|
virtual void DestroyChildren();
|
2001-04-27 17:03:17 +04:00
|
|
|
|
|
|
|
// Content Viewer Management
|
|
|
|
NS_IMETHOD EnsureContentViewer();
|
2006-11-22 21:27:54 +03:00
|
|
|
// aPrincipal can be passed in if the caller wants. If null is
|
|
|
|
// passed in, the about:blank principal will end up being used.
|
2009-04-10 05:36:42 +04:00
|
|
|
nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
2011-01-18 22:55:04 +03:00
|
|
|
nsIURI* aBaseURI,
|
|
|
|
PRBool aTryToSaveOldPresentation = PR_TRUE);
|
2001-04-27 17:03:17 +04:00
|
|
|
NS_IMETHOD CreateContentViewer(const char * aContentType,
|
|
|
|
nsIRequest * request, nsIStreamListener ** aContentHandler);
|
|
|
|
NS_IMETHOD NewContentViewerObj(const char * aContentType,
|
|
|
|
nsIRequest * request, nsILoadGroup * aLoadGroup,
|
|
|
|
nsIStreamListener ** aContentHandler, nsIContentViewer ** aViewer);
|
|
|
|
NS_IMETHOD SetupNewViewer(nsIContentViewer * aNewViewer);
|
|
|
|
|
2005-04-05 07:28:54 +04:00
|
|
|
void SetupReferrerFromChannel(nsIChannel * aChannel);
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD GetEldestPresContext(nsPresContext** aPresContext);
|
2006-08-15 21:31:16 +04:00
|
|
|
|
|
|
|
// Get the principal that we'll set on the channel if we're inheriting. If
|
|
|
|
// aConsiderCurrentDocument is true, we try to use the current document if
|
|
|
|
// at all possible. If that fails, we fall back on the parent document.
|
|
|
|
// If that fails too, we force creation of a content viewer and use the
|
|
|
|
// resulting principal. If aConsiderCurrentDocument is false, we just look
|
|
|
|
// at the parent.
|
|
|
|
nsIPrincipal* GetInheritedPrincipal(PRBool aConsiderCurrentDocument);
|
|
|
|
|
2008-10-20 08:12:25 +04:00
|
|
|
// True if when loading aURI into this docshell, the channel should look
|
|
|
|
// for an appropriate application cache.
|
|
|
|
PRBool ShouldCheckAppCache(nsIURI * aURI);
|
|
|
|
|
2006-08-15 21:31:16 +04:00
|
|
|
// Actually open a channel and perform a URI load. Note: whatever owner is
|
|
|
|
// passed to this function will be set on the channel. Callers who wish to
|
|
|
|
// not have an owner on the channel should just pass null.
|
2001-05-14 06:16:27 +04:00
|
|
|
virtual nsresult DoURILoad(nsIURI * aURI,
|
|
|
|
nsIURI * aReferrer,
|
2005-01-05 09:04:46 +03:00
|
|
|
PRBool aSendReferrer,
|
2001-05-14 06:16:27 +04:00
|
|
|
nsISupports * aOwner,
|
2003-10-04 02:11:47 +04:00
|
|
|
const char * aTypeHint,
|
2001-05-14 06:16:27 +04:00
|
|
|
nsIInputStream * aPostData,
|
2002-03-02 04:26:49 +03:00
|
|
|
nsIInputStream * aHeadersData,
|
2002-03-13 09:08:56 +03:00
|
|
|
PRBool firstParty,
|
|
|
|
nsIDocShell ** aDocShell,
|
2006-07-05 00:48:33 +04:00
|
|
|
nsIRequest ** aRequest,
|
2008-01-30 02:49:20 +03:00
|
|
|
PRBool aIsNewWindowTarget,
|
2009-06-16 18:30:25 +04:00
|
|
|
PRBool aBypassClassifier,
|
2010-10-01 03:55:11 +04:00
|
|
|
PRBool aForceAllowCookies);
|
2001-04-27 17:03:17 +04:00
|
|
|
NS_IMETHOD AddHeadersToChannel(nsIInputStream * aHeadersData,
|
|
|
|
nsIChannel * aChannel);
|
2001-05-14 06:16:27 +04:00
|
|
|
virtual nsresult DoChannelLoad(nsIChannel * aChannel,
|
2008-01-30 02:49:20 +03:00
|
|
|
nsIURILoader * aURILoader,
|
|
|
|
PRBool aBypassClassifier);
|
2007-09-01 03:18:46 +04:00
|
|
|
|
2011-03-31 20:35:04 +04:00
|
|
|
nsresult ScrollToAnchor(nsACString & curHash, nsACString & newHash,
|
|
|
|
PRUint32 aLoadType);
|
2009-06-26 21:16:50 +04:00
|
|
|
|
2011-04-25 06:30:54 +04:00
|
|
|
// Tries to serialize a given variant using structured clone. This only
|
2009-09-01 20:45:05 +04:00
|
|
|
// works if the variant is backed by a JSVal.
|
2011-04-25 06:30:54 +04:00
|
|
|
nsresult SerializeJSValVariant(JSContext *aCx, nsIVariant *aData,
|
2011-03-03 14:55:55 +03:00
|
|
|
nsAString &aResult);
|
2009-09-01 20:45:05 +04:00
|
|
|
|
2005-03-30 08:22:00 +04:00
|
|
|
// Returns PR_TRUE if would have called FireOnLocationChange,
|
|
|
|
// but did not because aFireOnLocationChange was false on entry.
|
|
|
|
// In this case it is the caller's responsibility to ensure
|
|
|
|
// FireOnLocationChange is called.
|
|
|
|
// In all other cases PR_FALSE is returned.
|
|
|
|
PRBool OnLoadingSite(nsIChannel * aChannel,
|
2005-07-27 16:38:38 +04:00
|
|
|
PRBool aFireOnLocationChange,
|
|
|
|
PRBool aAddToGlobalHistory = PR_TRUE);
|
2005-03-30 08:22:00 +04:00
|
|
|
|
|
|
|
// Returns PR_TRUE if would have called FireOnLocationChange,
|
|
|
|
// but did not because aFireOnLocationChange was false on entry.
|
|
|
|
// In this case it is the caller's responsibility to ensure
|
|
|
|
// FireOnLocationChange is called.
|
|
|
|
// In all other cases PR_FALSE is returned.
|
2008-12-11 22:16:05 +03:00
|
|
|
// Either aChannel or aOwner must be null. If aChannel is
|
|
|
|
// present, the owner should be gotten from it.
|
2011-03-30 21:40:48 +04:00
|
|
|
// If OnNewURI calls AddToSessionHistory, it will pass its
|
|
|
|
// aCloneSHChildren argument as aCloneChildren.
|
2008-12-11 22:16:05 +03:00
|
|
|
PRBool OnNewURI(nsIURI * aURI, nsIChannel * aChannel, nsISupports* aOwner,
|
|
|
|
PRUint32 aLoadType,
|
2005-07-27 16:38:38 +04:00
|
|
|
PRBool aFireOnLocationChange,
|
2011-03-30 21:40:48 +04:00
|
|
|
PRBool aAddToGlobalHistory,
|
|
|
|
PRBool aCloneSHChildren);
|
2001-04-27 17:03:17 +04:00
|
|
|
|
|
|
|
virtual void SetReferrerURI(nsIURI * aURI);
|
|
|
|
|
|
|
|
// Session History
|
|
|
|
virtual PRBool ShouldAddToSessionHistory(nsIURI * aURI);
|
2008-12-11 22:16:05 +03:00
|
|
|
// Either aChannel or aOwner must be null. If aChannel is
|
|
|
|
// present, the owner should be gotten from it.
|
2011-03-30 21:40:48 +04:00
|
|
|
// If aCloneChildren is true, then our current session history's
|
|
|
|
// children will be cloned onto the new entry. This should be
|
|
|
|
// used when we aren't actually changing the document while adding
|
|
|
|
// the new session history entry.
|
2001-04-27 17:03:17 +04:00
|
|
|
virtual nsresult AddToSessionHistory(nsIURI * aURI, nsIChannel * aChannel,
|
2008-12-11 22:16:05 +03:00
|
|
|
nsISupports* aOwner,
|
2011-03-30 21:40:48 +04:00
|
|
|
PRBool aCloneChildren,
|
2008-12-11 22:16:05 +03:00
|
|
|
nsISHEntry ** aNewEntry);
|
2011-03-30 21:40:48 +04:00
|
|
|
nsresult DoAddChildSHEntry(nsISHEntry* aNewEntry, PRInt32 aChildOffset,
|
|
|
|
PRBool aCloneChildren);
|
2001-04-27 17:03:17 +04:00
|
|
|
|
|
|
|
NS_IMETHOD LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType);
|
|
|
|
NS_IMETHOD PersistLayoutHistoryState();
|
2005-08-04 02:32:10 +04:00
|
|
|
|
|
|
|
// Clone a session history tree for subframe navigation.
|
|
|
|
// The tree rooted at |aSrcEntry| will be cloned into |aDestEntry|, except
|
|
|
|
// for the entry with id |aCloneID|, which will be replaced with
|
|
|
|
// |aReplaceEntry|. |aSrcShell| is a (possibly null) docshell which
|
|
|
|
// corresponds to |aSrcEntry| via its mLSHE or mOHE pointers, and will
|
|
|
|
// have that pointer updated to point to the cloned history entry.
|
2011-02-03 20:27:39 +03:00
|
|
|
// If aCloneChildren is true then the children of the entry with id
|
|
|
|
// |aCloneID| will be cloned into |aReplaceEntry|.
|
2005-08-04 02:32:10 +04:00
|
|
|
static nsresult CloneAndReplace(nsISHEntry *aSrcEntry,
|
|
|
|
nsDocShell *aSrcShell,
|
|
|
|
PRUint32 aCloneID,
|
|
|
|
nsISHEntry *aReplaceEntry,
|
2011-02-03 20:27:39 +03:00
|
|
|
PRBool aCloneChildren,
|
2005-08-04 02:32:10 +04:00
|
|
|
nsISHEntry **aDestEntry);
|
|
|
|
|
|
|
|
// Child-walking callback for CloneAndReplace
|
|
|
|
static nsresult CloneAndReplaceChild(nsISHEntry *aEntry,
|
|
|
|
nsDocShell *aShell,
|
|
|
|
PRInt32 aChildIndex, void *aData);
|
|
|
|
|
2001-11-20 23:14:02 +03:00
|
|
|
nsresult GetRootSessionHistory(nsISHistory ** aReturn);
|
2001-11-28 02:14:15 +03:00
|
|
|
nsresult GetHttpChannel(nsIChannel * aChannel, nsIHttpChannel ** aReturn);
|
2002-05-10 00:32:35 +04:00
|
|
|
PRBool ShouldDiscardLayoutState(nsIHttpChannel * aChannel);
|
2005-08-04 02:32:10 +04:00
|
|
|
|
|
|
|
// Determine whether this docshell corresponds to the given history entry,
|
|
|
|
// via having a pointer to it in mOSHE or mLSHE.
|
|
|
|
PRBool HasHistoryEntry(nsISHEntry *aEntry) const
|
|
|
|
{
|
|
|
|
return aEntry && (aEntry == mOSHE || aEntry == mLSHE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update any pointers (mOSHE or mLSHE) to aOldEntry to point to aNewEntry
|
|
|
|
void SwapHistoryEntries(nsISHEntry *aOldEntry, nsISHEntry *aNewEntry);
|
|
|
|
|
|
|
|
// Call this method to swap in a new history entry to m[OL]SHE, rather than
|
|
|
|
// setting it directly. This completes the navigation in all docshells
|
|
|
|
// in the case of a subframe navigation.
|
|
|
|
void SetHistoryEntry(nsCOMPtr<nsISHEntry> *aPtr, nsISHEntry *aEntry);
|
|
|
|
|
|
|
|
// Child-walking callback for SetHistoryEntry
|
|
|
|
static nsresult SetChildHistoryEntry(nsISHEntry *aEntry,
|
|
|
|
nsDocShell *aShell,
|
|
|
|
PRInt32 aEntryIndex, void *aData);
|
|
|
|
|
|
|
|
// Callback prototype for WalkHistoryEntries.
|
|
|
|
// aEntry is the child history entry, aShell is its corresponding docshell,
|
|
|
|
// aChildIndex is the child's index in its parent entry, and aData is
|
|
|
|
// the opaque pointer passed to WalkHistoryEntries.
|
|
|
|
typedef nsresult (*WalkHistoryEntriesFunc)(nsISHEntry *aEntry,
|
|
|
|
nsDocShell *aShell,
|
|
|
|
PRInt32 aChildIndex,
|
|
|
|
void *aData);
|
|
|
|
|
|
|
|
// For each child of aRootEntry, find the corresponding docshell which is
|
|
|
|
// a child of aRootShell, and call aCallback. The opaque pointer aData
|
|
|
|
// is passed to the callback.
|
|
|
|
static nsresult WalkHistoryEntries(nsISHEntry *aRootEntry,
|
|
|
|
nsDocShell *aRootShell,
|
|
|
|
WalkHistoryEntriesFunc aCallback,
|
|
|
|
void *aData);
|
|
|
|
|
2006-02-06 23:52:18 +03:00
|
|
|
// overridden from nsDocLoader, this provides more information than the
|
|
|
|
// normal OnStateChange with flags STATE_REDIRECTING
|
2010-10-01 03:55:11 +04:00
|
|
|
virtual void OnRedirectStateChange(nsIChannel* aOldChannel,
|
|
|
|
nsIChannel* aNewChannel,
|
|
|
|
PRUint32 aRedirectFlags,
|
|
|
|
PRUint32 aStateFlags);
|
2006-02-06 23:52:18 +03:00
|
|
|
|
2010-07-14 05:00:33 +04:00
|
|
|
/**
|
|
|
|
* Helper function that determines if channel is an HTTP POST.
|
|
|
|
*
|
|
|
|
* @param aChannel
|
|
|
|
* The channel to test
|
|
|
|
*
|
|
|
|
* @return True iff channel is an HTTP post.
|
|
|
|
*/
|
2010-10-01 03:55:11 +04:00
|
|
|
bool ChannelIsPost(nsIChannel* aChannel);
|
2009-09-01 20:45:05 +04:00
|
|
|
|
2010-07-14 05:00:33 +04:00
|
|
|
/**
|
|
|
|
* Helper function that finds the last URI and its transition flags for a
|
|
|
|
* channel.
|
|
|
|
*
|
|
|
|
* This method first checks the channel's property bag to see if previous
|
|
|
|
* info has been saved. If not, it gives back the referrer of the channel.
|
|
|
|
*
|
|
|
|
* @param aChannel
|
|
|
|
* The channel we are transitioning to
|
|
|
|
* @param aURI
|
|
|
|
* Output parameter with the previous URI, not addref'd
|
|
|
|
* @param aChannelRedirectFlags
|
|
|
|
* If a redirect, output parameter with the previous redirect flags
|
|
|
|
* from nsIChannelEventSink
|
|
|
|
*/
|
|
|
|
void ExtractLastVisit(nsIChannel* aChannel,
|
|
|
|
nsIURI** aURI,
|
|
|
|
PRUint32* aChannelRedirectFlags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper function that caches a URI and a transition for saving later.
|
|
|
|
*
|
|
|
|
* @param aChannel
|
|
|
|
* Channel that will have these properties saved
|
|
|
|
* @param aURI
|
|
|
|
* The URI to save for later
|
|
|
|
* @param aChannelRedirectFlags
|
|
|
|
* The nsIChannelEventSink redirect flags to save for later
|
|
|
|
*/
|
|
|
|
void SaveLastVisit(nsIChannel* aChannel,
|
|
|
|
nsIURI* aURI,
|
|
|
|
PRUint32 aChannelRedirectFlags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper function for adding a URI visit using IHistory. If IHistory is
|
|
|
|
* not available, the method tries nsIGlobalHistory2.
|
|
|
|
*
|
|
|
|
* The IHistory API maintains chains of visits, tracking both HTTP referrers
|
|
|
|
* and redirects for a user session. VisitURI requires the current URI and
|
|
|
|
* the previous URI in the chain.
|
|
|
|
*
|
|
|
|
* Visits can be saved either during a redirect or when the request has
|
|
|
|
* reached its final destination. The previous URI in the visit may be
|
|
|
|
* from another redirect or it may be the referrer.
|
|
|
|
*
|
|
|
|
* @pre aURI is not null.
|
|
|
|
*
|
|
|
|
* @param aURI
|
|
|
|
* The URI that was just visited
|
|
|
|
* @param aReferrerURI
|
|
|
|
* The referrer URI of this request
|
|
|
|
* @param aPreviousURI
|
|
|
|
* The previous URI of this visit (may be the same as aReferrerURI)
|
|
|
|
* @param aChannelRedirectFlags
|
|
|
|
* For redirects, the redirect flags from nsIChannelEventSink
|
|
|
|
* (0 otherwise)
|
|
|
|
*/
|
|
|
|
void AddURIVisit(nsIURI* aURI,
|
|
|
|
nsIURI* aReferrerURI,
|
|
|
|
nsIURI* aPreviousURI,
|
|
|
|
PRUint32 aChannelRedirectFlags);
|
2001-04-27 17:03:17 +04:00
|
|
|
|
|
|
|
// Helper Routines
|
2006-11-07 06:28:50 +03:00
|
|
|
nsresult ConfirmRepost(PRBool * aRepost);
|
2001-04-27 17:03:17 +04:00
|
|
|
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
|
|
|
nsIStringBundle ** aStringBundle);
|
|
|
|
NS_IMETHOD GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
|
|
|
|
PRInt32 * aOffset);
|
2009-09-09 09:40:02 +04:00
|
|
|
nsIScrollableFrame* GetRootScrollFrame();
|
2001-04-27 17:03:17 +04:00
|
|
|
NS_IMETHOD EnsureScriptEnvironment();
|
2002-02-02 08:13:56 +03:00
|
|
|
NS_IMETHOD EnsureEditorData();
|
2003-04-17 17:16:05 +04:00
|
|
|
nsresult EnsureTransferableHookData();
|
2001-04-28 01:11:03 +04:00
|
|
|
NS_IMETHOD EnsureFind();
|
2005-05-05 00:22:32 +04:00
|
|
|
nsresult RefreshURIFromQueue();
|
2005-01-31 14:26:31 +03:00
|
|
|
NS_IMETHOD DisplayLoadError(nsresult aError, nsIURI *aURI,
|
|
|
|
const PRUnichar *aURL,
|
|
|
|
nsIChannel* aFailedChannel = nsnull);
|
|
|
|
NS_IMETHOD LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
2007-10-29 21:29:14 +03:00
|
|
|
const char *aErrorPage,
|
|
|
|
const PRUnichar *aErrorType,
|
2005-01-31 14:26:31 +03:00
|
|
|
const PRUnichar *aDescription,
|
2007-09-01 03:18:46 +04:00
|
|
|
const char *aCSSClass,
|
2005-01-31 14:26:31 +03:00
|
|
|
nsIChannel* aFailedChannel);
|
2007-06-14 22:18:05 +04:00
|
|
|
PRBool IsNavigationAllowed(PRBool aDisplayPrintErrorDialog = PR_TRUE);
|
2002-10-08 17:17:56 +04:00
|
|
|
PRBool IsPrintingOrPP(PRBool aDisplayErrorDialog = PR_TRUE);
|
2001-04-27 17:03:17 +04:00
|
|
|
|
2002-09-20 01:59:34 +04:00
|
|
|
nsresult SetBaseUrlForWyciwyg(nsIContentViewer * aContentViewer);
|
|
|
|
|
2001-09-08 02:06:08 +04:00
|
|
|
static inline PRUint32
|
|
|
|
PRTimeToSeconds(PRTime t_usec)
|
|
|
|
{
|
|
|
|
PRTime usec_per_sec;
|
|
|
|
PRUint32 t_sec;
|
|
|
|
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
|
|
|
|
LL_DIV(t_usec, t_usec, usec_per_sec);
|
|
|
|
LL_L2I(t_sec, t_usec);
|
|
|
|
return t_sec;
|
|
|
|
}
|
|
|
|
|
2001-04-27 17:03:17 +04:00
|
|
|
PRBool IsFrame();
|
|
|
|
|
|
|
|
//
|
|
|
|
// Helper method that is called when a new document (including any
|
|
|
|
// sub-documents - ie. frames) has been completely loaded.
|
|
|
|
//
|
2001-07-18 00:17:38 +04:00
|
|
|
virtual nsresult EndPageLoad(nsIWebProgress * aProgress,
|
|
|
|
nsIChannel * aChannel,
|
|
|
|
nsresult aResult);
|
2004-06-15 12:28:52 +04:00
|
|
|
|
2011-02-17 23:44:04 +03:00
|
|
|
// Sets the current document's current state object to the given SHEntry's
|
|
|
|
// state object. The current state object is eventually given to the page
|
2009-09-01 20:45:05 +04:00
|
|
|
// in the PopState event.
|
2011-02-17 23:44:04 +03:00
|
|
|
nsresult SetDocCurrentStateObj(nsISHEntry *shEntry);
|
2009-09-01 20:45:05 +04:00
|
|
|
|
2004-06-23 21:42:31 +04:00
|
|
|
nsresult CheckLoadingPermissions();
|
2004-06-15 12:28:52 +04:00
|
|
|
|
2005-01-21 19:58:45 +03:00
|
|
|
// Security checks to prevent frameset spoofing. See comments at
|
|
|
|
// implementation sites.
|
|
|
|
static PRBool CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
|
|
|
nsIDocShellTreeItem* aAccessingItem,
|
|
|
|
PRBool aConsiderOpener = PR_TRUE);
|
|
|
|
static PRBool ValidateOrigin(nsIDocShellTreeItem* aOriginTreeItem,
|
|
|
|
nsIDocShellTreeItem* aTargetTreeItem);
|
|
|
|
|
2005-03-30 08:22:00 +04:00
|
|
|
// Returns PR_TRUE if would have called FireOnLocationChange,
|
|
|
|
// but did not because aFireOnLocationChange was false on entry.
|
|
|
|
// In this case it is the caller's responsibility to ensure
|
|
|
|
// FireOnLocationChange is called.
|
|
|
|
// In all other cases PR_FALSE is returned.
|
|
|
|
PRBool SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
|
2011-06-14 02:02:28 +04:00
|
|
|
PRBool aFireOnLocationChange);
|
2005-01-12 03:00:53 +03:00
|
|
|
|
2005-05-05 00:22:32 +04:00
|
|
|
// The following methods deal with saving and restoring content viewers
|
|
|
|
// in session history.
|
|
|
|
|
|
|
|
// mContentViewer points to the current content viewer associated with
|
|
|
|
// this docshell. When loading a new document, the content viewer is
|
|
|
|
// either destroyed or stored into a session history entry. To make sure
|
|
|
|
// that destruction happens in a controlled fashion, a given content viewer
|
|
|
|
// is always owned in exactly one of these ways:
|
|
|
|
// 1) The content viewer is active and owned by a docshell's
|
|
|
|
// mContentViewer.
|
|
|
|
// 2) The content viewer is still being displayed while we begin loading
|
|
|
|
// a new document. The content viewer is owned by the _new_
|
|
|
|
// content viewer's mPreviousViewer, and has a pointer to the
|
|
|
|
// nsISHEntry where it will eventually be stored. The content viewer
|
|
|
|
// has been close()d by the docshell, which detaches the document from
|
|
|
|
// the window object.
|
|
|
|
// 3) The content viewer is cached in session history. The nsISHEntry
|
|
|
|
// has the only owning reference to the content viewer. The viewer
|
|
|
|
// has released its nsISHEntry pointer to prevent circular ownership.
|
|
|
|
//
|
|
|
|
// When restoring a content viewer from session history, open() is called
|
|
|
|
// to reattach the document to the window object. The content viewer is
|
|
|
|
// then placed into mContentViewer and removed from the history entry.
|
|
|
|
// (mContentViewer is put into session history as described above, if
|
|
|
|
// applicable).
|
|
|
|
|
|
|
|
// Determines whether we can safely cache the current mContentViewer in
|
|
|
|
// session history. This checks a number of factors such as cache policy,
|
2005-06-25 00:53:43 +04:00
|
|
|
// pending requests, and unload handlers.
|
|
|
|
// |aLoadType| should be the load type that will replace the current
|
|
|
|
// presentation. |aNewRequest| should be the request for the document to
|
|
|
|
// be loaded in place of the current document, or null if such a request
|
2005-08-23 04:24:57 +04:00
|
|
|
// has not been created yet. |aNewDocument| should be the document that will
|
|
|
|
// replace the current document.
|
|
|
|
PRBool CanSavePresentation(PRUint32 aLoadType,
|
|
|
|
nsIRequest *aNewRequest,
|
|
|
|
nsIDocument *aNewDocument);
|
2005-05-05 00:22:32 +04:00
|
|
|
|
|
|
|
// Captures the state of the supporting elements of the presentation
|
|
|
|
// (the "window" object, docshell tree, meta-refresh loads, and security
|
|
|
|
// state) and stores them on |mOSHE|.
|
|
|
|
nsresult CaptureState();
|
|
|
|
|
2005-08-02 22:35:07 +04:00
|
|
|
// Begin the toplevel restore process for |aSHEntry|.
|
|
|
|
// This simulates a channel open, and defers the real work until
|
|
|
|
// RestoreFromHistory is called from a PLEvent.
|
|
|
|
nsresult RestorePresentation(nsISHEntry *aSHEntry, PRBool *aRestoring);
|
2005-05-05 00:22:32 +04:00
|
|
|
|
2005-07-14 20:24:32 +04:00
|
|
|
// Call BeginRestore(nsnull, PR_FALSE) for each child of this shell.
|
|
|
|
nsresult BeginRestoreChildren();
|
|
|
|
|
2007-05-03 00:34:41 +04:00
|
|
|
// Method to get our current position and size without flushing
|
|
|
|
void DoGetPositionAndSize(PRInt32 * x, PRInt32 * y, PRInt32 * cx,
|
|
|
|
PRInt32 * cy);
|
|
|
|
|
2006-05-02 22:54:19 +04:00
|
|
|
// Check whether aURI should inherit our security context
|
|
|
|
static nsresult URIInheritsSecurityContext(nsIURI* aURI, PRBool* aResult);
|
2006-08-15 21:31:16 +04:00
|
|
|
|
2008-03-21 07:39:08 +03:00
|
|
|
// Check whether aURI is a URI_IS_LOCAL_FILE or not
|
|
|
|
static PRBool URIIsLocalFile(nsIURI *aURI);
|
|
|
|
|
2006-08-15 21:31:16 +04:00
|
|
|
// Check whether aURI is about:blank
|
|
|
|
static PRBool IsAboutBlank(nsIURI* aURI);
|
2008-01-25 23:31:44 +03:00
|
|
|
|
|
|
|
// Call this when a URI load is handed to us (via OnLinkClick or
|
|
|
|
// InternalLoad). This makes sure that we're not inside unload, or that if
|
|
|
|
// we are it's still OK to load this URI.
|
|
|
|
PRBool IsOKToLoadURI(nsIURI* aURI);
|
2006-05-02 22:54:19 +04:00
|
|
|
|
2008-05-02 15:36:29 +04:00
|
|
|
void ReattachEditorToWindow(nsISHEntry *aSHEntry);
|
2008-04-24 01:36:17 +04:00
|
|
|
|
2009-01-13 08:52:00 +03:00
|
|
|
nsresult GetSessionStorageForURI(nsIURI* aURI,
|
2010-01-28 17:53:53 +03:00
|
|
|
const nsSubstring& aDocumentURI,
|
2009-01-13 08:52:00 +03:00
|
|
|
PRBool create,
|
2009-05-21 02:27:31 +04:00
|
|
|
nsIDOMStorage** aStorage);
|
2009-05-07 23:21:53 +04:00
|
|
|
|
|
|
|
// helpers for executing commands
|
|
|
|
nsresult GetControllerForCommand(const char *inCommand,
|
|
|
|
nsIController** outController);
|
|
|
|
nsresult IsCommandEnabled(const char * inCommand, PRBool* outEnabled);
|
|
|
|
nsresult DoCommand(const char * inCommand);
|
|
|
|
nsresult EnsureCommandHandler();
|
2010-01-23 14:41:41 +03:00
|
|
|
|
|
|
|
nsIChannel* GetCurrentDocChannel();
|
1999-10-26 05:44:00 +04:00
|
|
|
protected:
|
2004-12-08 20:32:06 +03:00
|
|
|
// Override the parent setter from nsDocLoader
|
|
|
|
virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
|
|
|
|
|
2010-08-17 18:13:55 +04:00
|
|
|
void ClearFrameHistory(nsISHEntry* aEntry);
|
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
// Event type dispatched by RestorePresentation
|
|
|
|
class RestorePresentationEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
RestorePresentationEvent(nsDocShell *ds) : mDocShell(ds) {}
|
|
|
|
void Revoke() { mDocShell = nsnull; }
|
|
|
|
private:
|
2009-06-16 13:05:09 +04:00
|
|
|
nsRefPtr<nsDocShell> mDocShell;
|
2006-05-10 21:30:15 +04:00
|
|
|
};
|
|
|
|
|
2009-05-13 12:26:47 +04:00
|
|
|
// hash of session storages, keyed by domain
|
2009-05-21 02:27:31 +04:00
|
|
|
nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorage> mStorages;
|
|
|
|
|
|
|
|
// Dimensions of the docshell
|
|
|
|
nsIntRect mBounds;
|
2004-05-11 04:12:09 +04:00
|
|
|
nsString mName;
|
|
|
|
nsString mTitle;
|
2009-05-21 02:27:31 +04:00
|
|
|
|
2004-07-01 21:04:31 +04:00
|
|
|
/**
|
|
|
|
* Content-Type Hint of the most-recently initiated load. Used for
|
|
|
|
* session history entries.
|
|
|
|
*/
|
|
|
|
nsCString mContentTypeHint;
|
2009-05-13 12:26:47 +04:00
|
|
|
nsIntPoint mDefaultScrollbarPref; // persistent across doc loads
|
|
|
|
|
2004-05-11 04:12:09 +04:00
|
|
|
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
2005-08-12 00:14:00 +04:00
|
|
|
nsCOMPtr<nsISupportsArray> mSavedRefreshURIList;
|
2005-02-18 21:20:42 +03:00
|
|
|
nsRefPtr<nsDSURIContentListener> mContentListener;
|
2004-05-11 04:12:09 +04:00
|
|
|
nsCOMPtr<nsIContentViewer> mContentViewer;
|
|
|
|
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
|
|
|
|
nsCOMPtr<nsIWidget> mParentWidget;
|
2004-09-06 23:31:22 +04:00
|
|
|
nsCOMPtr<nsIPrefBranch> mPrefs;
|
2006-05-31 21:57:14 +04:00
|
|
|
|
|
|
|
// mCurrentURI should be marked immutable on set if possible.
|
2004-05-11 04:12:09 +04:00
|
|
|
nsCOMPtr<nsIURI> mCurrentURI;
|
|
|
|
nsCOMPtr<nsIURI> mReferrerURI;
|
|
|
|
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
|
|
|
|
nsCOMPtr<nsISHistory> mSessionHistory;
|
|
|
|
nsCOMPtr<nsIGlobalHistory2> mGlobalHistory;
|
|
|
|
nsCOMPtr<nsIWebBrowserFind> mFind;
|
2009-05-13 12:26:47 +04:00
|
|
|
nsCOMPtr<nsICommandManager> mCommandManager;
|
2004-05-11 04:12:09 +04:00
|
|
|
// Reference to the SHEntry for this docshell until the page is destroyed.
|
|
|
|
// Somebody give me better name
|
2009-05-13 12:26:47 +04:00
|
|
|
nsCOMPtr<nsISHEntry> mOSHE;
|
2004-05-11 04:12:09 +04:00
|
|
|
// Reference to the SHEntry for this docshell until the page is loaded
|
|
|
|
// Somebody give me better name
|
|
|
|
nsCOMPtr<nsISHEntry> mLSHE;
|
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
// 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<RestorePresentationEvent> mRestorePresentationEvent;
|
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
// Editor data, if this document is designMode or contentEditable.
|
|
|
|
nsAutoPtr<nsDocShellEditorData> mEditorData;
|
2002-02-02 08:13:56 +03:00
|
|
|
|
2003-04-17 17:16:05 +04:00
|
|
|
// Transferable hooks/callbacks
|
2009-05-13 12:26:47 +04:00
|
|
|
nsCOMPtr<nsIClipboardDragDropHookList> mTransferableHookData;
|
2003-04-17 17:16:05 +04:00
|
|
|
|
2005-05-05 00:22:32 +04:00
|
|
|
// Secure browser UI object
|
|
|
|
nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
|
|
|
|
|
2008-01-25 23:31:44 +03:00
|
|
|
// 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.
|
2009-05-13 12:26:47 +04:00
|
|
|
nsCOMPtr<nsIURI> mLoadingURI;
|
2008-01-25 23:31:44 +03:00
|
|
|
|
2009-11-11 23:39:34 +03:00
|
|
|
// Set in LoadErrorPage from the method argument and used later
|
|
|
|
// in CreateContentViewer. We have to delay an shistory entry creation
|
|
|
|
// for which these objects are needed.
|
|
|
|
nsCOMPtr<nsIURI> mFailedURI;
|
|
|
|
nsCOMPtr<nsIChannel> mFailedChannel;
|
|
|
|
PRUint32 mFailedLoadType;
|
|
|
|
|
2001-04-27 17:03:17 +04:00
|
|
|
// 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
|
2007-02-16 02:04:33 +03:00
|
|
|
nsPIDOMEventTarget * mChromeEventHandler; //Weak Reference
|
2002-02-06 10:26:26 +03:00
|
|
|
|
2009-05-13 12:26:47 +04:00
|
|
|
eCharsetReloadState mCharsetReloadState;
|
2009-05-07 23:21:53 +04:00
|
|
|
|
2009-05-13 12:26:47 +04:00
|
|
|
// Offset in the parent's child list.
|
2010-08-17 18:13:55 +04:00
|
|
|
// -1 if the docshell is added dynamically to the parent shell.
|
2009-05-13 12:26:47 +04:00
|
|
|
PRUint32 mChildOffset;
|
|
|
|
PRUint32 mBusyFlags;
|
|
|
|
PRUint32 mAppType;
|
|
|
|
PRUint32 mLoadType;
|
|
|
|
|
|
|
|
PRInt32 mMarginWidth;
|
|
|
|
PRInt32 mMarginHeight;
|
2010-07-14 05:00:33 +04:00
|
|
|
|
|
|
|
// This can either be a content docshell or a chrome docshell. After
|
|
|
|
// Create() is called, the type is not expected to change.
|
2009-05-13 12:26:47 +04:00
|
|
|
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;
|
|
|
|
PRPackedBool mAllowMetaRedirects;
|
|
|
|
PRPackedBool mAllowImages;
|
|
|
|
PRPackedBool mAllowDNSPrefetch;
|
|
|
|
PRPackedBool mCreatingDocument; // (should be) debugging only
|
|
|
|
PRPackedBool mUseErrorPages;
|
|
|
|
PRPackedBool mObserveErrorPages;
|
|
|
|
PRPackedBool mAllowAuth;
|
|
|
|
PRPackedBool mAllowKeywordFixup;
|
|
|
|
PRPackedBool mIsOffScreenBrowser;
|
2010-08-05 19:27:52 +04:00
|
|
|
PRPackedBool mIsActive;
|
2010-10-29 02:00:31 +04:00
|
|
|
PRPackedBool mIsAppTab;
|
2011-01-28 17:29:01 +03:00
|
|
|
PRPackedBool mUseGlobalHistory;
|
2009-05-13 12:26:47 +04:00
|
|
|
|
|
|
|
// This boolean is set to true right before we fire pagehide and generally
|
|
|
|
// unset when we embed a new content viewer. While it's true no navigation
|
|
|
|
// is allowed in this docshell.
|
|
|
|
PRPackedBool mFiredUnloadEvent;
|
|
|
|
|
|
|
|
// this flag is for bug #21358. a docshell may load many urls
|
|
|
|
// 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 mURIResultedInDocument;
|
|
|
|
|
|
|
|
PRPackedBool mIsBeingDestroyed;
|
|
|
|
|
|
|
|
PRPackedBool mIsExecutingOnLoadHandler;
|
|
|
|
|
|
|
|
// Indicates that a DocShell in this "docshell tree" is printing
|
|
|
|
PRPackedBool mIsPrintingOrPP;
|
|
|
|
|
|
|
|
// Indicates to CreateContentViewer() that it is safe to cache the old
|
|
|
|
// presentation of the page, and to SetupNewViewer() that the old viewer
|
|
|
|
// should be passed a SHEntry to save itself into.
|
|
|
|
PRPackedBool mSavingOldViewer;
|
2010-08-17 18:13:55 +04:00
|
|
|
|
|
|
|
// @see nsIDocShellHistory::createdDynamically
|
|
|
|
PRPackedBool mDynamicallyCreated;
|
2007-11-12 08:48:24 +03:00
|
|
|
#ifdef DEBUG
|
2009-05-13 12:26:47 +04:00
|
|
|
PRPackedBool mInEnsureScriptEnv;
|
2007-11-12 08:48:24 +03:00
|
|
|
#endif
|
2010-08-17 18:13:55 +04:00
|
|
|
PRUint64 mHistoryID;
|
2007-11-12 08:48:24 +03:00
|
|
|
|
2004-05-11 04:12:09 +04:00
|
|
|
static nsIURIFixup *sURIFixup;
|
|
|
|
|
2009-05-07 23:21:53 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
private:
|
|
|
|
// We're counting the number of |nsDocShells| to help find leaks
|
|
|
|
static unsigned long gNumberOfDocShells;
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2002-02-06 17:39:42 +03:00
|
|
|
public:
|
2002-02-06 10:26:26 +03:00
|
|
|
class InterfaceRequestorProxy : public nsIInterfaceRequestor {
|
|
|
|
public:
|
|
|
|
InterfaceRequestorProxy(nsIInterfaceRequestor* p);
|
|
|
|
virtual ~InterfaceRequestorProxy();
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
|
2002-02-06 17:39:42 +03:00
|
|
|
protected:
|
2002-02-06 10:26:26 +03:00
|
|
|
InterfaceRequestorProxy() {}
|
|
|
|
nsWeakPtr mWeakPtr;
|
|
|
|
};
|
1999-10-26 05:44:00 +04:00
|
|
|
};
|
|
|
|
|
1999-11-12 10:28:25 +03:00
|
|
|
#endif /* nsDocShell_h__ */
|