merged with tip

git-svn-id: svn://10.0.0.236/branches/HttpConnectionMagic_20010415_BRANCH@94274 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%netscape.com
2001-05-08 21:34:02 +00:00
parent 7fe1a07870
commit 7ff9289c01
2 changed files with 27 additions and 15 deletions

View File

@@ -33,6 +33,8 @@
#include "nsIPluginHost.h"
#include "nsCURILoader.h"
#include "nsLayoutCID.h"
#include "nsDOMCID.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsNetUtil.h"
#include "nsRect.h"
#include "prprf.h"
@@ -114,6 +116,8 @@ static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
static NS_DEFINE_CID(kDocumentCharsetInfoCID, NS_DOCUMENTCHARSETINFO_CID);
static NS_DEFINE_CID(kPluginManagerCID, NS_PLUGINMANAGER_CID);
static NS_DEFINE_CID(kSecurityManagerCID, NS_SCRIPTSECURITYMANAGER_CID);
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
//
// Local function prototypes
@@ -158,6 +162,7 @@ nsDocShell::nsDocShell():
mURIResultedInDocument(PR_FALSE),
mUseExternalProtocolHandler(PR_FALSE),
mDisallowPopupWindows(PR_FALSE),
mIsBeingDestroyed(PR_FALSE),
mParent(nsnull),
mTreeOwner(nsnull),
mChromeEventHandler(nsnull)
@@ -1333,7 +1338,6 @@ NS_IMETHODIMP
nsDocShell::GetChildAt(PRInt32 aIndex, nsIDocShellTreeItem ** aChild)
{
NS_ENSURE_ARG_POINTER(aChild);
NS_ENSURE_ARG_RANGE(aIndex, 0, mChildren.Count() - 1);
*aChild = (nsIDocShellTreeItem *) mChildren.ElementAt(aIndex);
NS_IF_ADDREF(*aChild);
@@ -1842,6 +1846,8 @@ nsDocShell::Create()
NS_IMETHODIMP
nsDocShell::Destroy()
{
mIsBeingDestroyed = PR_TRUE;
// Stop any URLs that are currently being loaded...
Stop();
if (mDocLoader) {
@@ -2646,6 +2652,10 @@ nsDocShell::ScrollByPages(PRInt32 numPages)
NS_IMETHODIMP
nsDocShell::GetScriptGlobalObject(nsIScriptGlobalObject ** aGlobal)
{
if (mIsBeingDestroyed) {
return NS_ERROR_NOT_AVAILABLE;
}
NS_ENSURE_ARG_POINTER(aGlobal);
NS_ENSURE_SUCCESS(EnsureScriptEnvironment(), NS_ERROR_FAILURE);
@@ -4448,7 +4458,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(aEntry->GetPostData(getter_AddRefs(postData)),
NS_ERROR_FAILURE);
#if 0
/* If there is a valid postdata *and* the user pressed
* shift-reload, take user's permission before we repost the
* data to the server.
@@ -4477,7 +4487,6 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
}
}
}
#endif /* 0 */
NS_ENSURE_SUCCESS(InternalLoad
(uri, referrerURI, nsnull, PR_TRUE, PR_FALSE, nsnull,
@@ -4813,7 +4822,15 @@ nsDocShell::EnsureScriptEnvironment()
if (mScriptContext)
return NS_OK;
NS_NewScriptGlobalObject(getter_AddRefs(mScriptGlobal));
if (mIsBeingDestroyed) {
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr<nsIDOMScriptObjectFactory> factory =
do_GetService(kDOMScriptObjectFactoryCID);
NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
factory->NewScriptGlobalObject(getter_AddRefs(mScriptGlobal));
NS_ENSURE_TRUE(mScriptGlobal, NS_ERROR_FAILURE);
mScriptGlobal->SetDocShell(NS_STATIC_CAST(nsIDocShell *, this));
@@ -4821,7 +4838,7 @@ nsDocShell::EnsureScriptEnvironment()
SetGlobalObjectOwner(NS_STATIC_CAST
(nsIScriptGlobalObjectOwner *, this));
NS_CreateScriptContext(mScriptGlobal, getter_AddRefs(mScriptContext));
factory->NewScriptContext(mScriptGlobal, getter_AddRefs(mScriptContext));
NS_ENSURE_TRUE(mScriptContext, NS_ERROR_FAILURE);
return NS_OK;