Changes to loadURI & reload methods on nsIDocShell, nsIWebNavigation. b=50949, r=radha, a=radha

This commit is contained in:
locka%iol.ie 2000-09-20 12:23:53 +00:00
parent 2867755dc0
commit b78abdf560
38 changed files with 298 additions and 227 deletions

View File

@ -96,9 +96,9 @@ NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
mDocShell->StopLoad();
// ack...we don't want to reuse the previous documents load type,
// try to reset it to loadNormal...
nsDocShellInfoLoadType loadType = nsIDocShellLoadInfo::loadNormal;
LoadType loadType = LOAD_NORMAL;
if (aCommand == nsIURILoader::viewUserClick)
loadType = nsIDocShellLoadInfo::loadLink;
loadType = LOAD_LINK;
mDocShell->SetLoadType(loadType);
}

View File

@ -265,7 +265,7 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
//*****************************************************************************
NS_IMETHODIMP
nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo)
nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo, PRUint32 aLoadFlags)
{
nsresult rv;
nsCOMPtr<nsIURI> referrer;
@ -273,21 +273,55 @@ nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo)
PRBool inheritOwner = PR_FALSE;
PRBool stopActiveDoc = PR_FALSE;
nsCOMPtr<nsISHEntry> shEntry;
nsDocShellInfoLoadType loadType = nsIDocShellLoadInfo::loadNormal;
LoadType loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
NS_ENSURE_ARG(aURI);
// Extract the info from the DocShellLoadInfo struct...
if(aLoadInfo) {
aLoadInfo->GetReferrer(getter_AddRefs(referrer));
aLoadInfo->GetLoadType(&loadType);
nsDocShellInfoLoadType lt = nsIDocShellLoadInfo::loadNormal;
aLoadInfo->GetLoadType(&lt);
switch (lt)
{
case nsIDocShellLoadInfo::loadNormal:
loadType = LOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadNormalReplace:
loadType = LOAD_NORMAL_REPLACE;
break;
case nsIDocShellLoadInfo::loadHistory:
loadType = LOAD_HISTORY;
break;
case nsIDocShellLoadInfo::loadReloadNormal:
loadType = LOAD_RELOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadReloadBypassCache:
loadType = LOAD_RELOAD_BYPASS_CACHE;
break;
case nsIDocShellLoadInfo::loadReloadBypassProxy:
loadType = LOAD_RELOAD_BYPASS_PROXY;
break;
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
loadType = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
break;
case nsIDocShellLoadInfo::loadLink:
loadType = LOAD_LINK;
break;
case nsIDocShellLoadInfo::loadRefresh:
loadType = LOAD_REFRESH;
break;
}
aLoadInfo->GetOwner(getter_AddRefs(owner));
aLoadInfo->GetInheritOwner(&inheritOwner);
aLoadInfo->GetStopActiveDocument(&stopActiveDoc);
aLoadInfo->GetSHEntry(getter_AddRefs(shEntry));
}
if (!shEntry && loadType != nsIDocShellLoadInfo::loadNormalReplace) {
if (!shEntry && loadType != LOAD_NORMAL_REPLACE) {
/* Check if we are in the middle of loading a subframe whose parent
* was originally loaded thro' Session History. ie., you were in a frameset
* page, went somewhere else and clicked 'back'. The loading of the root page
@ -304,7 +338,7 @@ nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo)
if (parent) {
parent->GetChildSHEntry(mChildOffset, getter_AddRefs(shEntry));
if (shEntry) {
loadType = nsIDocShellLoadInfo::loadHistory;
loadType = LOAD_HISTORY;
}
}
}
@ -341,10 +375,42 @@ NS_IMETHODIMP nsDocShell::LoadStream(nsIInputStream *aStream, nsIURI *aURI,
if (NS_FAILED(rv)) return rv;
}
nsDocShellInfoLoadType loadType = nsIDocShellLoadInfo::loadNormal;
LoadType loadType = LOAD_NORMAL;
if(aLoadInfo)
(void)aLoadInfo->GetLoadType(&loadType);
{
nsDocShellInfoLoadType lt= nsIDocShellLoadInfo::loadNormal;
(void)aLoadInfo->GetLoadType(&lt);
switch (lt)
{
case nsIDocShellLoadInfo::loadNormal:
loadType = LOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadNormalReplace:
loadType = LOAD_NORMAL_REPLACE;
break;
case nsIDocShellLoadInfo::loadHistory:
loadType = LOAD_HISTORY;
break;
case nsIDocShellLoadInfo::loadReloadNormal:
loadType = LOAD_RELOAD_NORMAL;
break;
case nsIDocShellLoadInfo::loadReloadBypassCache:
loadType = LOAD_RELOAD_BYPASS_CACHE;
break;
case nsIDocShellLoadInfo::loadReloadBypassProxy:
loadType = LOAD_RELOAD_BYPASS_PROXY;
break;
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
loadType = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
break;
case nsIDocShellLoadInfo::loadLink:
loadType = LOAD_LINK;
break;
case nsIDocShellLoadInfo::loadRefresh:
loadType = LOAD_REFRESH;
break;
}
}
NS_ENSURE_SUCCESS(StopLoad(), NS_ERROR_FAILURE);
// Cancel any timers that were set for this loader.
@ -557,7 +623,9 @@ NS_IMETHODIMP nsDocShell::SetViewMode(PRInt32 aViewMode)
mViewMode = aViewMode;
if(reload)
Reload(nsIDocShellLoadInfo::loadReloadNormal);
{
Reload(LOAD_FLAGS_NONE);
}
return NS_OK;
}
@ -1268,7 +1336,7 @@ nsDocShell::GotoIndex(PRInt32 aIndex)
}
NS_IMETHODIMP nsDocShell::LoadURI(const PRUnichar* aURI)
NS_IMETHODIMP nsDocShell::LoadURI(const PRUnichar* aURI, PRUint32 aLoadFlags)
{
nsCOMPtr<nsIURI> uri;
@ -1306,20 +1374,23 @@ NS_IMETHODIMP nsDocShell::LoadURI(const PRUnichar* aURI)
if(!uri)
return NS_ERROR_FAILURE;
NS_ENSURE_SUCCESS(LoadURI(uri, nsnull), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(LoadURI(uri, nsnull, aLoadFlags), NS_ERROR_FAILURE);
return NS_OK;
}
NS_IMETHODIMP nsDocShell::Reload(PRInt32 aReloadType)
{
NS_IMETHODIMP nsDocShell::Reload(PRUint32 aReloadFlags)
{
NS_ASSERTION(((aReloadFlags & 0xf) == 0), "Reload command not updated to use load flags!");
#ifdef SH_IN_FRAMES
// XXX Honor the reload type
//NS_ENSURE_STATE(mCurrentURI);
// XXXTAB Convert reload type to our type
nsDocShellInfoLoadType type = nsIDocShellLoadInfo::loadReloadNormal;
if ( aReloadType == nsIWebNavigation::loadReloadBypassProxyAndCache )
type = nsIDocShellLoadInfo::loadReloadBypassProxyAndCache;
LoadType type = LOAD_RELOAD_NORMAL;
if ( aReloadFlags & LOAD_FLAGS_BYPASS_CACHE &&
aReloadFlags & LOAD_FLAGS_BYPASS_PROXY )
type = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
#if 0
nsCOMPtr<nsISHEntry> entry;
if (OSHE) {
@ -1361,9 +1432,10 @@ NS_IMETHODIMP nsDocShell::Reload(PRInt32 aReloadType)
NS_ENSURE_STATE(mCurrentURI);
// XXXTAB Convert reload type to our type
nsDocShellInfoLoadType type = nsIDocShellLoadInfo::loadReloadNormal;
if ( aReloadType == nsIWebNavigation::loadReloadBypassProxyAndCache )
type = nsIDocShellLoadInfo::loadReloadBypassProxyAndCache;
LoadType type = LOAD_RELOAD_NORMAL;
if ( aReloadFlags & LOAD_FLAGS_BYPASS_CACHE &&
aReloadFlags & LOAD_FLAGS_BYPASS_PROXY )
type = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
UpdateCurrentSessionHistory();
@ -2345,10 +2417,10 @@ NS_IMETHODIMP nsDocShell::Embed(nsIContentViewer* aContentViewer,
// Determine if this type of load should update history
switch(mLoadType)
{
case nsIDocShellLoadInfo::loadNormalReplace:
case nsIDocShellLoadInfo::loadReloadBypassCache:
case nsIDocShellLoadInfo::loadReloadBypassProxy:
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
case LOAD_NORMAL_REPLACE:
case LOAD_RELOAD_BYPASS_CACHE:
case LOAD_RELOAD_BYPASS_PROXY:
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
updateHistory = PR_FALSE;
break;
default:
@ -2717,11 +2789,11 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
// Determine if this type of load should update history
switch(mLoadType)
{
case nsIDocShellLoadInfo::loadHistory:
case nsIDocShellLoadInfo::loadReloadNormal:
case nsIDocShellLoadInfo::loadReloadBypassCache:
case nsIDocShellLoadInfo::loadReloadBypassProxy:
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
case LOAD_HISTORY:
case LOAD_RELOAD_NORMAL:
case LOAD_RELOAD_BYPASS_CACHE:
case LOAD_RELOAD_BYPASS_PROXY:
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
updateHistory = PR_FALSE;
break;
default:
@ -2767,20 +2839,20 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer,
nsISupports* aOwner, PRBool aInheritOwner, PRBool aStopActiveDoc, const char* aWindowTarget,
nsIInputStream* aPostData, nsIInputStream* aHeadersData,
nsDocShellInfoLoadType aLoadType, nsISHEntry * aSHEntry)
PRUint32 aLoadType, nsISHEntry * aSHEntry)
#else
NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer,
nsISupports* aOwner, PRBool aInheritOwner, PRBool aStopActiveDoc, const char* aWindowTarget,
nsIInputStream* aPostData, nsIInputStream* aHeadersData,
nsDocShellInfoLoadType aLoadType)
PRUint32 aLoadType)
#endif
{
mURIResultedInDocument = PR_FALSE; // reset the clock...
// Check to see if the new URI is an anchor in the existing document.
if ((aLoadType == nsIDocShellLoadInfo::loadNormal ||
aLoadType == nsIDocShellLoadInfo::loadNormalReplace ||
aLoadType == nsIDocShellLoadInfo::loadHistory ||
aLoadType == nsIDocShellLoadInfo::loadLink) && (aPostData == nsnull))
if ((aLoadType == LOAD_NORMAL ||
aLoadType == LOAD_NORMAL_REPLACE ||
aLoadType == LOAD_HISTORY ||
aLoadType == LOAD_LINK) && (aPostData == nsnull))
{
PRBool wasAnchor = PR_FALSE;
NS_ENSURE_SUCCESS(ScrollIfAnchor(aURI, &wasAnchor), NS_ERROR_FAILURE);
@ -2834,7 +2906,7 @@ NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer,
#endif
nsURILoadCommand loadCmd = nsIURILoader::viewNormal;
if(nsIDocShellLoadInfo::loadLink == aLoadType)
if(LOAD_LINK == aLoadType)
loadCmd = nsIURILoader::viewUserClick;
NS_ENSURE_SUCCESS(DoURILoad(aURI, aReferrer, aOwner, aInheritOwner,
loadCmd, aWindowTarget,
@ -3394,22 +3466,22 @@ NS_IMETHODIMP nsDocShell::DoChannelLoad(nsIChannel *aChannel, nsURILoadCommand a
switch ( mLoadType )
{
case nsIDocShellLoadInfo::loadHistory:
case LOAD_HISTORY:
loadAttribs |= nsIChannel::VALIDATE_NEVER;
break;
case nsIDocShellLoadInfo::loadReloadNormal:
case LOAD_RELOAD_NORMAL:
loadAttribs |= nsIChannel::FORCE_VALIDATION;
break;
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
loadAttribs |= nsIChannel::FORCE_RELOAD;
break;
case nsIDocShellLoadInfo::loadRefresh:
case LOAD_REFRESH:
loadAttribs |= nsIChannel::FORCE_RELOAD;
break;
case nsIDocShellLoadInfo::loadNormal:
case nsIDocShellLoadInfo::loadLink:
case LOAD_NORMAL:
case LOAD_LINK:
// Set cache checking flags
if ( mPrefs )
{
@ -3565,34 +3637,19 @@ NS_IMETHODIMP nsDocShell::ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor)
NS_IMETHODIMP
nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType aLoadType)
nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, PRUint32 aLoadType)
{
NS_ASSERTION(aURI, "uri is null");
UpdateCurrentGlobalHistory();
PRBool updateHistory = PR_TRUE;
// Determine if this type of load should update history
switch(aLoadType)
// Determine if this type of load should update history
if (aLoadType & LOAD_FLAGS_BYPASS_HISTORY ||
aLoadType & LOAD_CMD_RELOAD || aLoadType & LOAD_CMD_HISTORY)
{
case nsIDocShellLoadInfo::loadHistory:
case nsIDocShellLoadInfo::loadReloadNormal:
case nsIDocShellLoadInfo::loadReloadBypassCache:
case nsIDocShellLoadInfo::loadReloadBypassProxy:
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
updateHistory = PR_FALSE;
break;
case nsIDocShellLoadInfo::loadNormal:
case nsIDocShellLoadInfo::loadRefresh:
case nsIDocShellLoadInfo::loadNormalReplace:
case nsIDocShellLoadInfo::loadLink:
break;
default:
NS_ERROR("Need to update case");
break;
}
updateHistory = PR_FALSE;
}
if (updateHistory) { // Page load not from SH
// Update session history if necessary...
@ -3777,7 +3834,7 @@ nsresult nsDocShell::AddToSessionHistory(nsIURI *aURI,
// If the entry is being replaced in SH, then just use the
// current entry...
//
if(mSessionHistory && nsIDocShellLoadInfo::loadNormalReplace == mLoadType) {
if(mSessionHistory && LOAD_NORMAL_REPLACE == mLoadType) {
PRInt32 index = 0;
mSessionHistory->GetIndex(&index);
mSessionHistory->GetEntryAtIndex(index, PR_FALSE, getter_AddRefs(entry));
@ -3814,7 +3871,7 @@ nsresult nsDocShell::AddToSessionHistory(nsIURI *aURI,
// heirarchy, then AddChildSHEntry(...) will fail and the new entry
// will be deleted when it loses scope...
//
if (mLoadType != nsIDocShellLoadInfo::loadNormalReplace) {
if (mLoadType != LOAD_NORMAL_REPLACE) {
if (mSessionHistory)
rv = mSessionHistory->AddEntry(entry, shouldPersist);
else
@ -3868,7 +3925,7 @@ NS_IMETHODIMP nsDocShell::UpdateCurrentSessionHistory()
}
#ifdef SH_IN_FRAMES
NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, nsDocShellInfoLoadType aLoadType)
NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, PRUint32 aLoadType)
#else
NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry)
#endif
@ -3911,7 +3968,7 @@ NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry)
#else
NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, nsnull, PR_TRUE, PR_FALSE,
postData, nsnull,
nsIDocShellLoadInfo::loadHistory),
LOAD_HISTORY),
NS_ERROR_FAILURE);
#endif
@ -4205,7 +4262,7 @@ nsresult nsDocShell::GetLoadCookie(nsISupports **aResult)
return NS_OK;
}
nsresult nsDocShell::SetLoadType(nsDocShellInfoLoadType aLoadType)
nsresult nsDocShell::SetLoadType(PRUint32 aLoadType)
{
mLoadType = aLoadType;
return NS_OK;
@ -4373,10 +4430,10 @@ NS_IMETHODIMP_(void) nsRefreshTimer::Notify(nsITimer *aTimer)
if(mDocShell)
{
nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
mDocShell -> CreateLoadInfo (getter_AddRefs (loadInfo));
mDocShell->CreateLoadInfo (getter_AddRefs (loadInfo));
loadInfo -> SetLoadType(nsIDocShellLoadInfo::loadRefresh);
mDocShell -> LoadURI(mURI, loadInfo);
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadRefresh);
mDocShell->LoadURI(mURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
}
/*

View File

@ -71,6 +71,29 @@
#include "nsIDocShellLoadInfo.h"
#include "nsIDocShellHistory.h"
#define MAKE_LOAD_TYPE(type, flags) ((type) | ((flags) << 16))
/* load commands */
enum LoadCmd {
LOAD_CMD_NORMAL = 0x1, // Normal load
LOAD_CMD_RELOAD = 0x2, // Reload
LOAD_CMD_HISTORY = 0x4 // Load from history
};
/* load types are legal combinations of load commands and flags*/
enum LoadType {
LOAD_NORMAL = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_NONE),
LOAD_NORMAL_REPLACE = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY),
LOAD_HISTORY = MAKE_LOAD_TYPE(LOAD_CMD_HISTORY, nsIWebNavigation::LOAD_FLAGS_NONE),
LOAD_RELOAD_NORMAL = MAKE_LOAD_TYPE(LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_NONE),
LOAD_RELOAD_BYPASS_CACHE = MAKE_LOAD_TYPE(LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE),
LOAD_RELOAD_BYPASS_PROXY = MAKE_LOAD_TYPE(LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY),
LOAD_RELOAD_BYPASS_PROXY_AND_CACHE = MAKE_LOAD_TYPE(LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY),
LOAD_LINK = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_IS_LINK),
LOAD_REFRESH = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_IS_REFRESH)
};
//*****************************************************************************
//*** nsRefreshTimer
//*****************************************************************************
@ -153,7 +176,7 @@ public:
nsresult GetLoadCookie(nsISupports **aResult);
// used when the docshell gets content that's being redirected (so we don't go through
// our own InternalLoad method) to reset the load type...
nsresult SetLoadType(nsDocShellInfoLoadType aLoadType);
nsresult SetLoadType(PRUint32 aLoadType);
protected:
// Object Management
@ -175,12 +198,12 @@ protected:
NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI,
nsISupports* owner, PRBool inheritOwnerFromDocument, PRBool stopActiveDoc,
const char* aWindowTarget=nsnull,
nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, nsDocShellInfoLoadType aLoadType=nsIDocShellLoadInfo::loadNormal, nsISHEntry * aSHEntry = nsnull);
nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, PRUint32 aLoadType=LOAD_NORMAL, nsISHEntry * aSHEntry = nsnull);
#else
NS_IMETHOD InternalLoad(nsIURI* aURI, nsIURI* aReferrerURI,
nsISupports* owner, PRBool inheritOwnerFromDocument, PRBool stopActiveDoc,
const char* aWindowTarget=nsnull,
nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, nsDocShellInfoLoadType aLoadType=nsIDocShellLoadInfo::loadNormal);
nsIInputStream* aPostData=nsnull, nsIInputStream* aHeadersData=nsnull, PRUint32 aLoadType=LOAD_NORMAL);
#endif
NS_IMETHOD CreateFixupURI(const PRUnichar* aStringURI, nsIURI** aURI);
@ -200,7 +223,7 @@ protected:
NS_IMETHOD ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor);
NS_IMETHOD OnLoadingSite(nsIChannel* aChannel);
NS_IMETHOD OnNewURI(nsIURI *aURI, nsIChannel* aChannel, nsDocShellInfoLoadType aLoadType);
NS_IMETHOD OnNewURI(nsIURI *aURI, nsIChannel* aChannel, PRUint32 aLoadType);
virtual void SetCurrentURI(nsIURI* aURI);
virtual void SetReferrerURI(nsIURI* aURI);
@ -212,7 +235,7 @@ protected:
NS_IMETHOD UpdateCurrentSessionHistory();
#ifdef SH_IN_FRAMES
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry, nsDocShellInfoLoadType aLoadType);
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry, PRUint32 aLoadType);
#else
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry);
#endif
@ -263,7 +286,7 @@ protected:
PRInt32 mItemType;
nsPoint mCurrentScrollbarPref; // this document only
nsPoint mDefaultScrollbarPref; // persistent across doc loads
nsDocShellInfoLoadType mLoadType;
PRUint32 mLoadType;
PRBool mInitialPageLoad;
PRBool mAllowPlugins;
PRInt32 mViewMode;

View File

@ -44,6 +44,7 @@ interface nsIChromeEventHandler;
interface nsIDocumentLoaderObserver;
interface nsIDocShellLoadInfo;
interface nsIDocumentCharsetInfo;
interface nsIWebNavigation;
[scriptable, uuid(69E5DE00-7B8B-11d3-AF61-00A024FFC08C)]
interface nsIDocShell : nsISupports
@ -55,13 +56,15 @@ interface nsIDocShell : nsISupports
loading.
@param uri - The URI to load.
@param loadInfo - This is the extended load info for this load. This most
most often will be null, but if you need to do additional setup for this
load you can get a loadInfo object by calling createLoadInfo. Once you have
this object you can set the needed properties on it and then pass it to
loadURI.
@param loadInfo - This is the extended load info for this load. This
most often will be null, but if you need to do additional setup for
this load you can get a loadInfo object by calling createLoadInfo.
Once you have this object you can set the needed properties on it and
then pass it to loadURI.
@param aLoadFlags - Flags to modify load behaviour. Flags are defined
in nsIWebNavigation.
*/
[noscript]void loadURI(in nsIURI uri, in nsIDocShellLoadInfo loadInfo);
[noscript]void loadURI(in nsIURI uri, in nsIDocShellLoadInfo loadInfo, in unsigned long aLoadFlags);
/*
Loads a given stream. This will give priority to loading the requested stream

View File

@ -74,43 +74,39 @@ interface nsIWebNavigation : nsISupports
void gotoIndex(in long index);
/*
Loads a given URI. This will give priority to loading the requested URI
Load flags for use with loadURI() and reload()
*/
const unsigned long LOAD_FLAGS_NONE = 0x0000;
const unsigned long LOAD_FLAGS_MASK = 0xffff;
/* loadURI() specific flags */
const unsigned long LOAD_FLAGS_IS_REFRESH = 0x0010; // Refresh timer
const unsigned long LOAD_FLAGS_IS_LINK = 0x0020; // Link click
const unsigned long LOAD_FLAGS_BYPASS_HISTORY = 0x0040; // Bypass the history
const unsigned long LOAD_FLAGS_REPLACE_HISTORY = 0x0080; // Replace the history entry
/* loadURI() & reload() specific flags */
const unsigned long LOAD_FLAGS_BYPASS_CACHE = 0x0100; // Bypass the cache
const unsigned long LOAD_FLAGS_BYPASS_PROXY = 0x0200; // Bypass the proxy
/*
Loads a given URI. This will give priority to loading the requested URI
in the object implementing this interface. If it can't be loaded here
however, the URL dispatcher will go through its normal process of content
loading.
@param uri - The URI to load.
@param loadFlags - Flags modifying load behaviour. Generally you will pass
LOAD_FLAGS_NONE for this parameter.
*/
void loadURI(in wstring uri);
/*
Definitions for the reload types.
*/
/* these are load type enums... */
const long LOAD_NORMAL = 0; // Normal Load
const long LOAD_NORMAL_REPLACE = 1; // Normal Load but replaces current history slot
const long LOAD_HISTORY = 2; // Load from history
const long LOAD_RELOAD_NORMAL = 3; // normal Reload
const long LOAD_RELOAD_BYPASS_CACHE = 4; // Reloads bypassing the cache
const long LOAD_RELOAD_BYPASS_PROXY = 5; // Reloads bypassing the proxy
const long LOAD_RELOAD_BYPASS_PROXY_AND_CACHE = 6;// Reloads bypassing proxy and cache
const long LOAD_LINK = 7;
const long LOAD_REFRESH = 8;
const long loadNormal = 0; // Normal Load
const long loadNormalReplace = 1; // Normal Load but replaces current history slot
const long loadHistory = 2; // Load from history
const long loadReloadNormal = 3; // normal Reload
const long loadReloadBypassCache = 4; // Reloads bypassing the cache
const long loadReloadBypassProxy = 5; // Reloads bypassing the proxy
const long loadReloadBypassProxyAndCache = 6;// Reloads bypassing proxy and cache
const long loadLink = 7;
const long loadRefresh = 8;
void loadURI(in wstring uri, in unsigned long loadFlags);
/*
Tells the Object to reload the current location.
@param reloadFlags - Flags modifying reload behaviour. Generally you will
pass LOAD_FLAGS_NONE for this parameter.
*/
void reload(in long reloadType);
void reload(in unsigned long reloadFlags);
/*
Stops a load of a URI.
@ -132,4 +128,4 @@ interface nsIWebNavigation : nsISupports
The session history object used to store the session history for the session.
*/
attribute nsISHistory sessionHistory;
};
};

View File

@ -105,9 +105,6 @@ typedef unsigned long HMTX;
#include "nsILocaleService.h"
#include "nsIStringBundle.h"
#include "nsIStringBundle.h"
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
#include "nsIIOService.h"
#include "nsIURL.h"
@ -142,8 +139,9 @@ static PRLogModuleInfo* gLogModule = PR_NewLogModule("webshell");
#define WEB_TRACE(_bit,_args)
#endif
static NS_DEFINE_CID(kGlobalHistoryCID, NS_GLOBALHISTORY_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
//static NS_DEFINE_CID(kGlobalHistoryCID, NS_GLOBALHISTORY_CID);
//static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
//----------------------------------------------------------------------
@ -151,31 +149,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
// Class IID's
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kChildCID, NS_CHILD_CID);
static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
// IID's
static NS_DEFINE_IID(kIContentViewerContainerIID,
NS_ICONTENTVIEWERCONTAINER_IID);
static NS_DEFINE_IID(kIDocumentLoaderIID, NS_IDOCUMENTLOADER_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kRefreshURIIID, NS_IREFRESHURI_IID);
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID);
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
static NS_DEFINE_IID(kITimerCallbackIID, NS_ITIMERCALLBACK_IID);
static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID);
static NS_DEFINE_IID(kIClipboardCommandsIID, NS_ICLIPBOARDCOMMANDS_IID);
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kIDOMHTMLDocumentIID, NS_IDOMHTMLDOCUMENT_IID);
static NS_DEFINE_CID(kCDOMRangeCID, NS_RANGE_CID);
// XXX not sure
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
//----------------------------------------------------------------------
@ -274,7 +248,7 @@ nsWebShell::FireUnloadEvent()
if (mScriptGlobal) {
nsIDocumentViewer* docViewer;
if (mContentViewer && NS_SUCCEEDED(mContentViewer->QueryInterface(kIDocumentViewerIID, (void**)&docViewer))) {
if (mContentViewer && NS_SUCCEEDED(mContentViewer->QueryInterface(NS_GET_IID(nsIDocumentViewer), (void**)&docViewer))) {
nsIPresContext *presContext;
if (NS_SUCCEEDED(docViewer->GetPresContext(presContext))) {
nsEventStatus status = nsEventStatus_eIgnore;
@ -547,7 +521,7 @@ NS_IMETHODIMP nsWebShell::GoTo(PRInt32 aIndex)
UpdateCurrentSessionHistory();
#ifdef SH_IN_FRAMES
NS_ENSURE_SUCCESS(LoadHistoryEntry(entry, nsIDocShellLoadInfo::loadHistory), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(LoadHistoryEntry(entry, LOAD_HISTORY), NS_ERROR_FAILURE);
#else
NS_ENSURE_SUCCESS(LoadHistoryEntry(entry), NS_ERROR_FAILURE);
#endif
@ -639,7 +613,7 @@ nsWebShell::LoadDocument(const char* aURL,
if(eCharsetReloadRequested != mCharsetReloadState)
{
mCharsetReloadState = eCharsetReloadRequested;
LoadURI(NS_ConvertASCIItoUCS2(aURL).GetUnicode());
LoadURI(NS_ConvertASCIItoUCS2(aURL).GetUnicode(), LOAD_FLAGS_NONE);
}
}
}
@ -669,7 +643,7 @@ nsWebShell::ReloadDocument(const char* aCharset,
if(eCharsetReloadRequested != mCharsetReloadState)
{
mCharsetReloadState = eCharsetReloadRequested;
return Reload(nsIWebNavigation::loadReloadNormal);
return Reload(LOAD_FLAGS_NONE);
}
}
}
@ -856,11 +830,10 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent,
#ifdef SH_IN_FRAMES
InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, PR_FALSE, target, aPostDataStream,
aHeadersDataStream, nsIDocShellLoadInfo::loadLink, nsnull);
aHeadersDataStream, LOAD_LINK, nsnull);
#else
InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, PR_FALSE, target,
aPostDataStream, aHeadersDataStream,
nsIDocShellLoadInfo::loadLink);
InternalLoad(uri, mCurrentURI, nsnull, PR_TRUE, target,
aPostDataStream, aHeadersDataStream, LOAD_LINK);
#endif /* SH_IN_FRAMES */
}
break;
@ -1051,7 +1024,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
// only send non-qualified hosts to the keyword server
nsAutoString keywordSpec; keywordSpec.AssignWithConversion("keyword:");
keywordSpec.Append(NS_ConvertUTF8toUCS2(host));
return LoadURI(keywordSpec.GetUnicode());
return LoadURI(keywordSpec.GetUnicode(), LOAD_FLAGS_NONE);
} // end keywordsEnabled
}
@ -1089,7 +1062,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
NS_ENSURE_SUCCESS(aURL->GetSpec(getter_Copies(aSpec)),
NS_ERROR_FAILURE);
// reload the url
return LoadURI(NS_ConvertASCIItoUCS2(aSpec).GetUnicode());
return LoadURI(NS_ConvertASCIItoUCS2(aSpec).GetUnicode(), LOAD_FLAGS_NONE);
} // retry
// throw a DNS failure dialog
@ -1303,7 +1276,7 @@ nsWebShell::SelectAll(void)
nsresult rv;
nsCOMPtr<nsIDocumentViewer> docViewer;
rv = mContentViewer->QueryInterface(kIDocumentViewerIID,
rv = mContentViewer->QueryInterface(NS_GET_IID(nsIDocumentViewer),
getter_AddRefs(docViewer));
if (NS_FAILED(rv) || !docViewer) return rv;
@ -1325,7 +1298,7 @@ nsWebShell::SelectAll(void)
nsCOMPtr<nsIDOMHTMLDocument> htmldoc;
rv = doc->QueryInterface(kIDOMHTMLDocumentIID, (void**)&htmldoc);
rv = doc->QueryInterface(NS_GET_IID(nsIDOMHTMLDocument), (void**)&htmldoc);
if (NS_FAILED(rv) || !htmldoc) return rv;
nsCOMPtr<nsIDOMHTMLElement>bodyElement;

View File

@ -1627,7 +1627,7 @@ NS_IMETHODIMP GlobalWindowImpl::Home()
homeURL = url;
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(homeURL.GetUnicode()), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(homeURL.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE), NS_ERROR_FAILURE);
return NS_OK;
}
@ -3043,7 +3043,7 @@ NS_IMETHODIMP GlobalWindowImpl::OpenInternal(JSContext *cx,
NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
loadInfo->SetOwner(owner);
}
newDocShell->LoadURI(uriToLoad, loadInfo);
newDocShell->LoadURI(uriToLoad, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
}
if (windowIsNew)

View File

@ -157,7 +157,7 @@ LocationImpl::SetURL(nsIURI* aURL)
loadInfo->SetStopActiveDocument(PR_TRUE);
return mDocShell->LoadURI(aURL, loadInfo);
return mDocShell->LoadURI(aURL, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
}
else {
return NS_OK;
@ -399,7 +399,7 @@ LocationImpl::SetHrefWithBase(const nsAReadableString& aHref,
loadInfo->SetStopActiveDocument(PR_TRUE);
return mDocShell->LoadURI(newUrl, loadInfo);
return mDocShell->LoadURI(newUrl, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
}
return result;
@ -618,7 +618,7 @@ LocationImpl::Reload(PRBool aForceget)
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->Reload(nsIWebNavigation::loadReloadNormal),
NS_ENSURE_SUCCESS(webNav->Reload(nsIWebNavigation::LOAD_FLAGS_NONE),
NS_ERROR_FAILURE);
return NS_OK;

View File

@ -1503,7 +1503,7 @@ nsEditorShell::LoadUrl(const PRUnichar *url)
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mContentAreaDocShell));
NS_ENSURE_SUCCESS(webNav->LoadURI(url), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(url, nsIWebNavigation::LOAD_FLAGS_NONE), NS_ERROR_FAILURE);
return NS_OK;
}

View File

@ -1503,7 +1503,7 @@ nsEditorShell::LoadUrl(const PRUnichar *url)
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mContentAreaDocShell));
NS_ENSURE_SUCCESS(webNav->LoadURI(url), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(url, nsIWebNavigation::LOAD_FLAGS_NONE), NS_ERROR_FAILURE);
return NS_OK;
}

View File

@ -28,17 +28,16 @@
#include "nsILocalFile.h"
#include "nsIDirectoryService.h"
/*
aPath -> the mozilla bin directory. If nsnull, the default is used
aProvider -> the application directory service provider. If nsnull, the
default (nsAppFileLocationProvider) is constructed and used.
If not nsnull, the arg must be AddRef'd already and ownership
is taken by this function.
*/
extern nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
nsIDirectoryServiceProvider *appFileLocProvider);
extern nsresult NS_TermEmbedding();
#endif

View File

@ -1557,7 +1557,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mWebBrowser);
if (spIWebNavigation)
{
res = spIWebNavigation->LoadURI(sUrl.c_str());
res = spIWebNavigation->LoadURI(sUrl.c_str(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
return res;
@ -1606,7 +1606,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level)
}
// Turn the IE refresh type into the nearest NG equivalent
nsLoadFlags type = nsIChannel::LOAD_NORMAL;
PRUint32 flags = nsIWebNavigation::LOAD_FLAGS_NONE;
switch (iRefreshLevel & OLECMDIDF_REFRESH_LEVELMASK)
{
case OLECMDIDF_REFRESH_NORMAL:
@ -1614,10 +1614,10 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level)
case OLECMDIDF_REFRESH_CONTINUE:
case OLECMDIDF_REFRESH_NO_CACHE:
case OLECMDIDF_REFRESH_RELOAD:
type = nsIChannel::LOAD_NORMAL;
flags = nsIWebNavigation::LOAD_FLAGS_NONE;
break;
case OLECMDIDF_REFRESH_COMPLETELY:
type = nsIHTTPChannel::BYPASS_CACHE | nsIHTTPChannel::BYPASS_PROXY;
flags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
break;
default:
// No idea what refresh type this is supposed to be
@ -1628,7 +1628,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level)
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mWebBrowser);
if (spIWebNavigation)
{
spIWebNavigation->Reload(type);
spIWebNavigation->Reload(flags);
}
return S_OK;

View File

@ -390,7 +390,7 @@ GtkMozEmbedPrivate::LoadChrome(void)
NS_ENSURE_TRUE(subShell, NS_ERROR_FAILURE);
mChromeLocation.AssignWithConversion("chrome://embedding/browser/content/simple-shell.xul");
mChromeNav->LoadURI(mChromeLocation.GetUnicode());
mChromeNav->LoadURI(mChromeLocation.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
subShell->Create(0, nsnull);
subShell->Spinup();
@ -536,7 +536,7 @@ GtkMozEmbedPrivate::OnChromeStateChange(nsIWebProgress *aWebProgress,
{
nsString tmpString;
tmpString.AssignWithConversion(mCurrentURI);
mContentNav->LoadURI(tmpString.GetUnicode());
mContentNav->LoadURI(tmpString.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
}
}
@ -1095,7 +1095,7 @@ gtk_moz_embed_load_url(GtkMozEmbed *embed, const char *url)
nsString uriString;
uriString.AssignWithConversion(newURI);
if (embed_private->mContentNav)
embed_private->mContentNav->LoadURI(uriString.GetUnicode());
embed_private->mContentNav->LoadURI(uriString.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
void

View File

@ -391,7 +391,7 @@ void CBrowserShell::LoadURL(Ptr urlText, SInt32 urlTextLen)
void CBrowserShell::LoadURL(const nsString& urlText)
{
nsresult rv = mWebBrowserAsWebNav->LoadURI(urlText.GetUnicode());
nsresult rv = mWebBrowserAsWebNav->LoadURI(urlText.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
if (NS_FAILED(rv))
Throw_(NS_ERROR_GET_CODE(rv));
}

View File

@ -24,3 +24,4 @@ nsCWebBrowser.idl
nsIWebBrowser.idl
nsIWebBrowserChrome.idl
nsIWebBrowserSetup.idl
nsIWebBrowserPersist.idl

View File

@ -91,14 +91,13 @@ interface nsIWebBrowserChrome : nsISupports
attribute unsigned long chromeFlags;
/*
Tells the implementer of this interface to create a new webBrowserChrome
object for it. Typically this means the implemetor will create a new
top level window that is represented by nsIWebBrowserChrome. This
most often will be called when for instance there is a need for a new
JS window, etc. Soon after this new object is returned, the webBrowser
attribute will checked, if one does not exist, one will be created and
setWebBrowser will be called with the new widget to instantiate in this
new window.
Asks the implementer of this interface to create a new webbrowser
object and return the nsIWebBrowser interface to it. The chrome
flags indicate the style of the surrounding frame window and
associated chrome. The position parameters should be ignored
unless the CHROME_WITH_POSITION chrome flags is set. The size
parameters should be ignored unless the CHROME_WITH_SIZE chrome flag
is set.
*/
nsIWebBrowser createBrowserWindow(in unsigned long chromeFlags,

View File

@ -393,18 +393,18 @@ NS_IMETHODIMP nsWebBrowser::GoForward()
return mDocShellAsNav->GoForward();
}
NS_IMETHODIMP nsWebBrowser::LoadURI(const PRUnichar* aURI)
NS_IMETHODIMP nsWebBrowser::LoadURI(const PRUnichar* aURI, PRUint32 aLoadFlags)
{
NS_ENSURE_STATE(mDocShell);
return mDocShellAsNav->LoadURI(aURI);
return mDocShellAsNav->LoadURI(aURI, aLoadFlags);
}
NS_IMETHODIMP nsWebBrowser::Reload(PRInt32 aReloadType)
NS_IMETHODIMP nsWebBrowser::Reload(PRUint32 aReloadFlags)
{
NS_ENSURE_STATE(mDocShell);
return mDocShellAsNav->Reload(aReloadType);
return mDocShellAsNav->Reload(aReloadFlags);
}
NS_IMETHODIMP nsWebBrowser::GotoIndex(PRInt32 aIndex)

View File

@ -60,7 +60,7 @@ url_activate_cb( GtkEditable *widget, nsIWebBrowserChrome *browser)
browser->GetWebBrowser(getter_AddRefs(webBrowser));
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(webBrowser));
if (webNav)
webNav->LoadURI(NS_ConvertASCIItoUCS2(text).GetUnicode());
webNav->LoadURI(NS_ConvertASCIItoUCS2(text).GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
g_free(text);
@ -108,7 +108,7 @@ nsresult OpenWebPage(char* url)
if (!webNav)
return NS_ERROR_FAILURE;
return webNav->LoadURI(NS_ConvertASCIItoUCS2(url).GetUnicode());
return webNav->LoadURI(NS_ConvertASCIItoUCS2(url).GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}

View File

@ -96,7 +96,7 @@ nsresult OpenWebPage(char* url)
ResizeEmbedding(NS_STATIC_CAST(nsIWebBrowserChrome*, chrome));
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(newBrowser));
return webNav->LoadURI(NS_ConvertASCIItoUCS2(url).GetUnicode());
return webNav->LoadURI(NS_ConvertASCIItoUCS2(url).GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
int main ()
@ -243,7 +243,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
nsCOMPtr<nsIWebBrowser> wb;
chrome->GetWebBrowser(getter_AddRefs(wb));
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(wb));
webNav->LoadURI(NS_ConvertASCIItoUCS2(gLastURI).GetUnicode());
webNav->LoadURI(NS_ConvertASCIItoUCS2(gLastURI).GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
break;

View File

@ -39,12 +39,13 @@ function onTransform()
var docShell = docShellElement.docShell;
docShell.viewMode = Components.interfaces.nsIDocShell.viewSource;
var webNav = docShell.QueryInterface(Components.interfaces.nsIWebNavigation);
webNav.loadURI(theXMLURL);
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
webNav.loadURI(theXMLURL, loadFlags);
docShellElement = document.getElementById("xsl-source");
docShell = docShellElement.docShell;
docShell.viewMode = Components.interfaces.nsIDocShell.viewSource;
webNav = docShell.QueryInterface(Components.interfaces.nsIWebNavigation);
webNav.loadURI(theXSLURL);
webNav.loadURI(theXSLURL, loadFlags);
docShellElement = document.getElementById("result-doc");
resultDocument = webNav.document;
xmlDocument = resultDocument.implementation.createDocument("", "", null);

View File

@ -330,7 +330,7 @@ extern "C" NS_EXPORT int DebugRobot(
nsAutoString theSpec; theSpec.AssignWithConversion(spec);
nsCRT::free(spec);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
webNav->LoadURI(theSpec.GetUnicode());/* XXX hook up stream listener here! */
webNav->LoadURI(theSpec.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL) {
(void)url->GetSpec(&spec);

View File

@ -921,7 +921,7 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
if (NS_FAILED(rv))
return rv; // We're not
rv = docShell->LoadURI(uri, loadInfo);
rv = docShell->LoadURI(uri, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to load URL");
return rv;

View File

@ -921,7 +921,7 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
if (NS_FAILED(rv))
return rv; // We're not
rv = docShell->LoadURI(uri, loadInfo);
rv = docShell->LoadURI(uri, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to load URL");
return rv;

View File

@ -463,7 +463,7 @@ nsMessenger::OpenURL(const char * url)
nsAutoString urlStr; urlStr.AssignWithConversion(unescapedUrl);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
if(webNav)
webNav->LoadURI(urlStr.GetUnicode());
webNav->LoadURI(urlStr.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
PL_strfree(unescapedUrl);
}

View File

@ -307,7 +307,7 @@ nsMsgPrintEngine::FireThatLoadOperation(nsString *uri)
{
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
if (webNav)
rv = webNav->LoadURI(uri->GetUnicode());
rv = webNav->LoadURI(uri->GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
PR_FREEIF(tString);

View File

@ -54,6 +54,7 @@
#include "nsIMessage.h"
#include "nsIDirectoryService.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIWebNavigation.h"
#define PREF_MAIL_ROOT_IMAP "mail.root.imap"
@ -607,7 +608,7 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl * aImapUrl,
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadLink);
}
rv = docShell->LoadURI(url, loadInfo);
rv = docShell->LoadURI(url, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
}
else
{
@ -932,7 +933,7 @@ nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aDisplayConsumer, &rv));
if (NS_SUCCEEDED(rv) && docShell)
{
rv = docShell->LoadURI(url, nsnull);
rv = docShell->LoadURI(url, nsnull, nsIWebNavigation::LOAD_FLAGS_NONE);
}
else
{

View File

@ -41,6 +41,7 @@
#include "nsIStreamConverterService.h"
#include "nsNetUtil.h"
#include "nsIDocShellLoadInfo.h"
#include "nsIWebNavigation.h"
static NS_DEFINE_CID(kIStreamConverterServiceCID,
NS_STREAMCONVERTERSERVICE_CID);
@ -164,7 +165,7 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
docShell->CreateLoadInfo(getter_AddRefs(loadInfo));
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadLink);
}
rv = docShell->LoadURI(url, loadInfo);
rv = docShell->LoadURI(url, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
}
else
rv = RunMailboxUrl(url, aDisplayConsumer);

View File

@ -56,6 +56,7 @@
#include "nsIMessengerWindowService.h"
#include "nsIMsgSearchSession.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIWebNavigation.h"
#undef GetPort // XXX Windows!
#undef SetPort // XXX Windows!
@ -198,7 +199,7 @@ nsNntpService::DisplayMessage(const char* aMessageURI, nsISupports * aDisplayCon
// run the news url like we would any other news url.
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aDisplayConsumer, &rv));
if (NS_SUCCEEDED(rv) && docShell)
rv = docShell->LoadURI(myuri, nsnull);
rv = docShell->LoadURI(myuri, nsnull, nsIWebNavigation::LOAD_FLAGS_NONE);
else
rv = RunNewsUrl(myuri, aMsgWindow, aDisplayConsumer);
}

View File

@ -330,7 +330,7 @@ extern "C" NS_EXPORT int DebugRobot(
nsAutoString theSpec; theSpec.AssignWithConversion(spec);
nsCRT::free(spec);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
webNav->LoadURI(theSpec.GetUnicode());/* XXX hook up stream listener here! */
webNav->LoadURI(theSpec.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL) {
(void)url->GetSpec(&spec);

View File

@ -837,7 +837,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
url.AppendInt(ix, 10);
url.AppendWithConversion(".html");
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(url.GetUnicode());
webNav->LoadURI(url.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
break;
@ -846,7 +846,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
nsAutoString url; url.AssignWithConversion(SAMPLES_BASE_URL);
url.AppendWithConversion("/toolbarTest1.xul");
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(url.GetUnicode());
webNav->LoadURI(url.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
break;
}
case VIEWER_XPTOOLKITTREE1:
@ -854,7 +854,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
nsAutoString url; url.AssignWithConversion(SAMPLES_BASE_URL);
url.AppendWithConversion("/treeTest1.xul");
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(url.GetUnicode());
webNav->LoadURI(url.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
break;
}
@ -1026,7 +1026,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
/* invoke the javascript wallet editor */
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(urlString.GetUnicode());
webNav->LoadURI(urlString.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
break;
#endif
@ -1076,7 +1076,7 @@ void
nsBrowserWindow::GoTo(const PRUnichar* aURL)
{
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(aURL);
webNav->LoadURI(aURL, nsIWebNavigation::LOAD_FLAGS_NONE);
}
@ -1130,7 +1130,7 @@ nsBrowserWindow::DoFileOpen()
nsFileURL fileURL(fileSpec);
// Ask the Web widget to load the file URL
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(NS_ConvertASCIItoUCS2(fileURL.GetURLString()).GetUnicode());
webNav->LoadURI(NS_ConvertASCIItoUCS2(fileURL.GetURLString()).GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
SetVisibility(PR_TRUE);
}
}

View File

@ -829,7 +829,7 @@ nsWebCrawler::LoadNextURL(PRBool aQueueLoad)
mCurrentURL = *url;
mStartLoad = PR_Now();
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(webShell));
webNav->LoadURI(url->GetUnicode());
webNav->LoadURI(url->GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
}
NS_RELEASE(webShell);
@ -1068,7 +1068,7 @@ nsWebCrawler::GoToQueuedURL(const nsString& aURL)
if (webNav) {
mCurrentURL = aURL;
mStartLoad = PR_Now();
webNav->LoadURI(aURL.GetUnicode());
webNav->LoadURI(aURL.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
NS_RELEASE(webShell);
}
mQueuedLoadURLs--;

View File

@ -376,7 +376,7 @@ NS_IMETHODIMP nsXPBaseWindow::GetTitle(const PRUnichar** aResult)
NS_IMETHODIMP nsXPBaseWindow::LoadURL(const nsString& aURL)
{
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebShell));
webNav->LoadURI(aURL.GetUnicode());
webNav->LoadURI(aURL.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
return NS_OK;
}

View File

@ -36,6 +36,7 @@
#include "nsIPref.h"
#include "nsIAllocator.h"
#include "nsXPIDLString.h"
#include "nsIWebNavigation.h"
#ifdef MOZ_MAIL_NEWS
@ -585,7 +586,7 @@ nsGtkMozRemoteHelper::OpenURL (const char *aURL, PRBool aNewWindow, PRBoo
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
// go, baby, go!
rv = docShell->LoadURI(uri, nsnull);
rv = docShell->LoadURI(uri, nsnull, nsIWebNavigation::LOAD_FLAGS_NONE);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
// raise the window, if requested

View File

@ -351,7 +351,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
nsCRT::free(tmpStr);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(urlString.GetUnicode()), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(urlString.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE), NS_ERROR_FAILURE);
}
return rv;
@ -1501,7 +1501,7 @@ void nsWebShellWindow::LoadContentAreas() {
nsUnescape(urlChar);
contentURL.AssignWithConversion(urlChar);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(contentShell));
webNav->LoadURI(contentURL.GetUnicode());
webNav->LoadURI(contentURL.GetUnicode(), nsIWebNavigation::LOAD_FLAGS_NONE);
delete [] urlChar;
}
NS_RELEASE(contentShell);

View File

@ -631,14 +631,14 @@ function BrowserStop()
function BrowserReallyReload(event)
{
var nsIWebNavigation = Components.interfaces.nsIWebNavigation;
// Default is loadReloadNormal.
var reloadType = nsIWebNavigation.loadReloadNormal;
// Default is no flags.
var reloadFlags = nsIWebNavigation.LOAD_FLAGS_NONE;
// See if the event was a shift-click.
if ( event.shiftKey ) {
// Shift key means loadReloadBypassProxyAndCache.
reloadType = nsIWebNavigation.loadReloadBypassProxyAndCache;
// Shift key means bypass proxy and cache.
reloadFlags = nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
}
appCore.reload(reloadType);
appCore.reload(reloadFlags);
}
function BrowserHome()

View File

@ -48,8 +48,8 @@ function onLoadViewSource()
dump("*** Failed to SetDocumentCharset...\n");
}
webNav.loadURI(window.arguments[0]);
var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
webNav.loadURI(window.arguments[0], loadFlags);
}

View File

@ -659,7 +659,7 @@ nsBrowserInstance::LoadUrl(const PRUnichar * urlToLoad)
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
// Normal browser.
rv = webNav->LoadURI( urlToLoad );
rv = webNav->LoadURI( urlToLoad, nsIWebNavigation::LOAD_FLAGS_NONE );
return rv;
}

View File

@ -360,11 +360,27 @@ nsSHistory::GoForward()
}
NS_IMETHODIMP
nsSHistory::Reload(PRInt32 aReloadType)
nsSHistory::Reload(PRUint32 aReloadFlags)
{
return LoadEntry(mIndex, PR_TRUE, aReloadType);
nsDocShellInfoLoadType loadType;
if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY &&
aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
{
loadType = nsIDocShellLoadInfo::loadReloadBypassProxyAndCache;
}
else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY)
{
loadType = nsIDocShellLoadInfo::loadReloadBypassProxy;
}
else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
{
loadType = nsIDocShellLoadInfo::loadReloadBypassCache;
}
else
{
loadType = nsIDocShellLoadInfo::loadReloadNormal;
}
return LoadEntry(mIndex, PR_TRUE, loadType);
}
NS_IMETHODIMP
@ -410,7 +426,7 @@ nsSHistory::GetSessionHistory(nsISHistory** aSessionHistory)
NS_IMETHODIMP
nsSHistory::LoadURI(const PRUnichar* aURI)
nsSHistory::LoadURI(const PRUnichar* aURI, PRUint32 aLoadFlags)
{
return NS_OK;
}
@ -418,7 +434,6 @@ nsSHistory::LoadURI(const PRUnichar* aURI)
NS_IMETHODIMP
nsSHistory::GotoIndex(PRInt32 aIndex)
{
return LoadEntry(aIndex, PR_FALSE, nsIDocShellLoadInfo::loadHistory);
}
@ -487,7 +502,7 @@ nsSHistory::LoadEntry(PRInt32 aIndex, PRBool aReloadFlag, long aLoadType)
loadInfo->SetLoadType(aLoadType);
loadInfo->SetSHEntry(nextEntry);
// Time to initiate a document load
return docShell->LoadURI(nexturi, loadInfo);
return docShell->LoadURI(nexturi, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
}