bug #94205. Adding flags to nsIWebNavigation::Stop().
git-svn-id: svn://10.0.0.236/trunk@101001 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -114,7 +114,8 @@ nsDSURIContentListener::DoContent(const char* aContentType,
|
||||
|
||||
if(loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
|
||||
{
|
||||
mDocShell->StopLoad();
|
||||
// XXX: Why does this not stop the content too?
|
||||
mDocShell->Stop(nsIWebNavigation::STOP_NETWORK);
|
||||
}
|
||||
|
||||
rv = mDocShell->CreateContentViewer(aContentType, request, aContentHandler);
|
||||
|
||||
@@ -454,7 +454,6 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
||||
nsCOMPtr<nsIInputStream> postStream;
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
PRBool inheritOwner = PR_FALSE;
|
||||
PRBool stopActiveDoc = PR_FALSE;
|
||||
nsCOMPtr<nsISHEntry> shEntry;
|
||||
nsXPIDLCString target;
|
||||
PRUint32 loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
|
||||
@@ -502,7 +501,6 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
||||
|
||||
aLoadInfo->GetOwner(getter_AddRefs(owner));
|
||||
aLoadInfo->GetInheritOwner(&inheritOwner);
|
||||
aLoadInfo->GetStopActiveDocument(&stopActiveDoc);
|
||||
aLoadInfo->GetSHEntry(getter_AddRefs(shEntry));
|
||||
aLoadInfo->GetTarget(getter_Copies(target));
|
||||
aLoadInfo->GetPostDataStream(getter_AddRefs(postStream));
|
||||
@@ -594,7 +592,6 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
||||
referrer,
|
||||
owner,
|
||||
inheritOwner,
|
||||
stopActiveDoc,
|
||||
windowTarget.get(),
|
||||
postStream,
|
||||
nsnull, // No headers stream
|
||||
@@ -669,9 +666,7 @@ nsDocShell::LoadStream(nsIInputStream * aStream, nsIURI * aURI,
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(StopLoad(), NS_ERROR_FAILURE);
|
||||
// Cancel any timers that were set for this loader.
|
||||
(void) CancelRefreshURITimers();
|
||||
NS_ENSURE_SUCCESS(Stop(nsIWebNavigation::STOP_NETWORK), NS_ERROR_FAILURE);
|
||||
|
||||
mLoadType = loadType;
|
||||
|
||||
@@ -703,32 +698,6 @@ nsDocShell::CreateLoadInfo(nsIDocShellLoadInfo ** aLoadInfo)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::StopLoad()
|
||||
{
|
||||
// Cancel any timers that were set for this loader.
|
||||
CancelRefreshURITimers();
|
||||
|
||||
if (mLoadCookie) {
|
||||
nsCOMPtr<nsIURILoader> uriLoader =
|
||||
do_GetService(NS_URI_LOADER_CONTRACTID);
|
||||
if (uriLoader)
|
||||
uriLoader->Stop(mLoadCookie);
|
||||
}
|
||||
|
||||
PRInt32 n;
|
||||
PRInt32 count = mChildren.Count();
|
||||
for (n = 0; n < count; n++) {
|
||||
nsIDocShellTreeItem *shellItem =
|
||||
(nsIDocShellTreeItem *) mChildren.ElementAt(n);
|
||||
nsCOMPtr<nsIDocShell> shell(do_QueryInterface(shellItem));
|
||||
if (shell)
|
||||
shell->StopLoad();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reset state to a new content model within the current document and the document
|
||||
@@ -2286,7 +2255,6 @@ nsDocShell::Reload(PRUint32 aReloadFlags)
|
||||
mReferrerURI,
|
||||
nsnull, // No owner
|
||||
PR_TRUE, // Inherit owner from document
|
||||
PR_FALSE, // Do not stop active document
|
||||
nsnull, // No window target
|
||||
nsnull, // No post data
|
||||
nsnull, // No headers data
|
||||
@@ -2296,19 +2264,25 @@ nsDocShell::Reload(PRUint32 aReloadFlags)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::Stop()
|
||||
nsDocShell::Stop(PRUint32 aStopFlags)
|
||||
{
|
||||
// Cancel any timers that were set for this loader.
|
||||
CancelRefreshURITimers();
|
||||
if (nsIWebNavigation::STOP_CONTENT & aStopFlags) {
|
||||
if (mContentViewer)
|
||||
mContentViewer->Stop();
|
||||
|
||||
if (mContentViewer)
|
||||
mContentViewer->Stop();
|
||||
}
|
||||
|
||||
if (mLoadCookie) {
|
||||
nsCOMPtr<nsIURILoader> uriLoader =
|
||||
do_GetService(NS_URI_LOADER_CONTRACTID);
|
||||
if (uriLoader)
|
||||
uriLoader->Stop(mLoadCookie);
|
||||
if (nsIWebNavigation::STOP_NETWORK & aStopFlags) {
|
||||
// Cancel any timers that were set for this loader.
|
||||
CancelRefreshURITimers();
|
||||
|
||||
if (mLoadCookie) {
|
||||
nsCOMPtr<nsIURILoader> uriLoader;
|
||||
|
||||
uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID);
|
||||
if (uriLoader)
|
||||
uriLoader->Stop(mLoadCookie);
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 n;
|
||||
@@ -2318,7 +2292,7 @@ nsDocShell::Stop()
|
||||
(nsIDocShellTreeItem *) mChildren.ElementAt(n);
|
||||
nsCOMPtr<nsIWebNavigation> shellAsNav(do_QueryInterface(shell));
|
||||
if (shellAsNav)
|
||||
shellAsNav->Stop();
|
||||
shellAsNav->Stop(aStopFlags);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@@ -2442,7 +2416,7 @@ nsDocShell::Destroy()
|
||||
mIsBeingDestroyed = PR_TRUE;
|
||||
|
||||
// Stop any URLs that are currently being loaded...
|
||||
Stop();
|
||||
Stop(nsIWebNavigation::STOP_ALL);
|
||||
if (mDocLoader) {
|
||||
mDocLoader->Destroy();
|
||||
mDocLoader->SetContainer(nsnull);
|
||||
@@ -4196,7 +4170,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
nsIURI * aReferrer,
|
||||
nsISupports * aOwner,
|
||||
PRBool aInheritOwner,
|
||||
PRBool aStopActiveDoc,
|
||||
const PRUnichar *aWindowTarget,
|
||||
nsIInputStream * aPostData,
|
||||
nsIInputStream * aHeadersData,
|
||||
@@ -4307,7 +4280,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
aReferrer,
|
||||
owner,
|
||||
aInheritOwner,
|
||||
aStopActiveDoc,
|
||||
nsnull, // No window target
|
||||
aPostData,
|
||||
aHeadersData,
|
||||
@@ -4400,14 +4372,12 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(StopLoad(), NS_ERROR_FAILURE);
|
||||
// Cancel any timers that were set for this loader.
|
||||
CancelRefreshURITimers();
|
||||
|
||||
if (aStopActiveDoc && mContentViewer) {
|
||||
mContentViewer->Stop();
|
||||
}
|
||||
//
|
||||
// Stop any current network activity. Do not stop the content until
|
||||
// data starts arriving from the new URI...
|
||||
//
|
||||
rv = Stop(nsIWebNavigation::STOP_NETWORK);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mLoadType = aLoadType;
|
||||
|
||||
@@ -5540,7 +5510,6 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
|
||||
referrerURI,
|
||||
nsnull, // No owner
|
||||
PR_FALSE, // Do not inherit owner from document (security-critical!)
|
||||
PR_FALSE, // Do not stop active document
|
||||
nsnull, // No window target
|
||||
postData, // Post data stream
|
||||
nsnull, // No headers stream
|
||||
|
||||
@@ -34,7 +34,6 @@ nsDocShellLoadInfo::nsDocShellLoadInfo()
|
||||
mLoadType = nsIDocShellLoadInfo::loadNormal;
|
||||
mInheritOwner = PR_FALSE;
|
||||
mTarget.Assign("");
|
||||
mStopActiveDocument = PR_FALSE;
|
||||
}
|
||||
|
||||
nsDocShellLoadInfo::~nsDocShellLoadInfo()
|
||||
@@ -101,20 +100,6 @@ NS_IMETHODIMP nsDocShellLoadInfo::SetInheritOwner(PRBool aInheritOwner)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellLoadInfo::GetStopActiveDocument(PRBool* aStopDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStopDocument);
|
||||
|
||||
*aStopDocument = mStopActiveDocument;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellLoadInfo::SetStopActiveDocument(PRBool aStopDocument)
|
||||
{
|
||||
mStopActiveDocument = aStopDocument;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType * aLoadType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLoadType);
|
||||
|
||||
@@ -49,7 +49,6 @@ protected:
|
||||
nsCOMPtr<nsIURI> mReferrer;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
PRBool mInheritOwner;
|
||||
PRBool mStopActiveDocument;
|
||||
nsDocShellInfoLoadType mLoadType;
|
||||
nsCOMPtr<nsISHEntry> mSHEntry;
|
||||
nsCString mTarget;
|
||||
|
||||
@@ -118,7 +118,6 @@ interface nsIDocShell : nsISupports
|
||||
in nsIURI aReferrer,
|
||||
in nsISupports aOwner,
|
||||
in boolean aInheritOwner,
|
||||
in boolean aStopActiveDoc,
|
||||
in wstring aWindowTarget,
|
||||
in nsIInputStream aPostDataStream,
|
||||
in nsIInputStream aHeadersStream,
|
||||
@@ -131,13 +130,6 @@ interface nsIDocShell : nsISupports
|
||||
*/
|
||||
void createLoadInfo(out nsIDocShellLoadInfo loadInfo);
|
||||
|
||||
/**
|
||||
* Stops a current load. This simply stops the network portion of the load.
|
||||
* If you wish to do a complete stop, then you should us the
|
||||
* nsIWebNavigation::Stop() method.
|
||||
*/
|
||||
void stopLoad();
|
||||
|
||||
/**
|
||||
* Reset state to a new content model within the current document and the document
|
||||
* viewer. Called by the document before initiating an out of band document.write().
|
||||
|
||||
@@ -54,8 +54,6 @@ interface nsIDocShellLoadInfo : nsISupports
|
||||
*/
|
||||
attribute boolean inheritOwner;
|
||||
|
||||
attribute boolean stopActiveDocument;
|
||||
|
||||
/* these are load type enums... */
|
||||
const long loadNormal = 0; // Normal Load
|
||||
const long loadNormalReplace = 1; // Normal Load but replaces current history slot
|
||||
|
||||
@@ -19,11 +19,8 @@
|
||||
* Contributor(s):
|
||||
* Travis Bogard <travis@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDocument;
|
||||
|
||||
|
||||
/**
|
||||
* The nsIWebNavigation interface defines an interface for navigating the web.
|
||||
@@ -33,103 +30,164 @@ interface nsIDOMDocument;
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
|
||||
interface nsISHistory;
|
||||
|
||||
interface nsIDOMDocument;
|
||||
interface nsIInputStream;
|
||||
interface nsISHistory;
|
||||
interface nsISHEntry;
|
||||
interface nsIURI;
|
||||
|
||||
[scriptable, uuid(F5D9E7B0-D930-11d3-B057-00A024FFC08C)]
|
||||
interface nsIWebNavigation : nsISupports
|
||||
{
|
||||
/*
|
||||
Indicates if the object can go back. If true this indicates that
|
||||
there is back session history available to navigate to.
|
||||
*/
|
||||
readonly attribute boolean canGoBack;
|
||||
/**
|
||||
* Indicates if the object can go back. If true this indicates that
|
||||
* there is back session history available for navigation.
|
||||
*/
|
||||
readonly attribute boolean canGoBack;
|
||||
|
||||
/*
|
||||
Indicates if the object can go forward. If true this indicates that
|
||||
there is forward session history available to navigate to.
|
||||
*/
|
||||
readonly attribute boolean canGoForward;
|
||||
/**
|
||||
* Indicates if the object can go forward. If true this indicates that
|
||||
* there is forward session history available for navigation
|
||||
*/
|
||||
readonly attribute boolean canGoForward;
|
||||
|
||||
/*
|
||||
Tells the object to navigate to the next Back session history item.
|
||||
@return NS_OK - Back was successfull
|
||||
NS_ERROR_UNEXPECTED - This call was unexpected at this time. Most
|
||||
likely you can't go back right now.
|
||||
*/
|
||||
void goBack();
|
||||
/**
|
||||
* Tells the object to navigate to the previous session history item. When
|
||||
* a page is loaded from session history, all content is loaded from the
|
||||
* cache (if available) and page state (such as form values, scroll position)
|
||||
* is restored.
|
||||
*
|
||||
* @return NS_OK - Backward navigation was successful.
|
||||
* NS_ERROR_UNEXPECTED - This call was unexpected at this time. Most
|
||||
* likely you can't go back right now.
|
||||
*/
|
||||
void goBack();
|
||||
|
||||
/*
|
||||
Tells the object to navigate to the next Forward session history item.
|
||||
@return NS_OK - Forward was successfull
|
||||
NS_ERROR_UNEXPECTED - This call was unexpected at this time. Most
|
||||
likely you can't go forward right now.
|
||||
*/
|
||||
void goForward();
|
||||
/**
|
||||
* Tells the object to navigate to the next Forward session history item.
|
||||
* When a page is loaded from session history, all content is loaded from
|
||||
* the cache (if available) and page state (such as form values, scroll
|
||||
* position) is restored.
|
||||
*
|
||||
* @return NS_OK - Forward was successful.
|
||||
* NS_ERROR_UNEXPECTED - This call was unexpected at this time. Most
|
||||
* likely you can't go forward right now.
|
||||
*/
|
||||
void goForward();
|
||||
|
||||
/*
|
||||
Tells the object to navigate to the session history item at index.
|
||||
@return NS_OK - Gotoindex was successfull
|
||||
NS_ERROR_UNEXPECTED - This call was unexpected at this time. Most
|
||||
likely you can't goto that index
|
||||
*/
|
||||
void gotoIndex(in long index);
|
||||
/**
|
||||
* Tells the object to navigate to the session history item at index.
|
||||
*
|
||||
* @return NS_OK - GotoIndex was successful.
|
||||
* NS_ERROR_UNEXPECTED - This call was unexpected at this time. Most
|
||||
* likely you can't goto that index
|
||||
*/
|
||||
void gotoIndex(in long index);
|
||||
|
||||
/*
|
||||
Load flags for use with loadURI() and reload()
|
||||
*/
|
||||
const unsigned long LOAD_FLAGS_NONE = 0x0000;
|
||||
const unsigned long LOAD_FLAGS_MASK = 0xffff;
|
||||
/**
|
||||
* Load flags for use with loadURI() and reload()
|
||||
*/
|
||||
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() specific flags
|
||||
*/
|
||||
|
||||
/* 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
|
||||
const unsigned long LOAD_FLAGS_CHARSET_CHANGE = 0x0400; // Reload because of charset change,
|
||||
/*
|
||||
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.
|
||||
/**
|
||||
* Normal load flag.
|
||||
*/
|
||||
const unsigned long LOAD_FLAGS_NONE = 0x0000;
|
||||
|
||||
@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, in unsigned long loadFlags);
|
||||
/**
|
||||
* Meta-refresh flag. The cache is bypassed. This type of load is
|
||||
* usually the result of a meta-refresh tag, or a HTTP
|
||||
* 'refresh' header.
|
||||
*/
|
||||
const unsigned long LOAD_FLAGS_IS_REFRESH = 0x0010;
|
||||
|
||||
/*
|
||||
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 unsigned long reloadFlags);
|
||||
/**
|
||||
* Link-click flag.
|
||||
*/
|
||||
const unsigned long LOAD_FLAGS_IS_LINK = 0x0020;
|
||||
|
||||
/*
|
||||
Stops a load of a URI.
|
||||
*/
|
||||
void stop();
|
||||
/**
|
||||
* Bypass history flag.
|
||||
*/
|
||||
const unsigned long LOAD_FLAGS_BYPASS_HISTORY = 0x0040;
|
||||
|
||||
/*
|
||||
Retrieves the current Document for the WebBrowser. When setting
|
||||
this will simulate the normal load process.
|
||||
*/
|
||||
readonly attribute nsIDOMDocument document;
|
||||
|
||||
/*
|
||||
The current URI that is loaded.
|
||||
*/
|
||||
readonly attribute nsIURI currentURI;
|
||||
|
||||
/*
|
||||
The session history object used to store the session history for the session.
|
||||
*/
|
||||
attribute nsISHistory sessionHistory;
|
||||
/**
|
||||
* Replace history entry flag.
|
||||
*/
|
||||
const unsigned long LOAD_FLAGS_REPLACE_HISTORY = 0x0080;
|
||||
|
||||
/* 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
|
||||
const unsigned long LOAD_FLAGS_CHARSET_CHANGE = 0x0400; // Reload because of charset change,
|
||||
|
||||
/**
|
||||
* 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 string to load.
|
||||
* @param loadFlags - Flags modifying load behaviour. Generally you will pass
|
||||
* LOAD_FLAGS_NONE for this parameter.
|
||||
* @param postData - nsIInputStream containing POST data for the request.
|
||||
*/
|
||||
void loadURI(in wstring uri, in unsigned long loadFlags);
|
||||
|
||||
/**
|
||||
* Tells the Object to reload the current page.
|
||||
*
|
||||
* @param reloadFlags - Flags modifying reload behaviour. Generally you will
|
||||
* pass LOAD_FLAGS_NONE for this parameter.
|
||||
*/
|
||||
void reload(in unsigned long reloadFlags);
|
||||
|
||||
/**
|
||||
* Stop() flags:
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stop all network activity. This includes both active network loads and
|
||||
* pending meta-refreshes.
|
||||
*/
|
||||
const unsigned long STOP_NETWORK = 0x01;
|
||||
|
||||
/**
|
||||
* Stop all content activity. This includes animated images, plugins and
|
||||
* pending Javascript timeouts.
|
||||
*/
|
||||
const unsigned long STOP_CONTENT = 0x02;
|
||||
|
||||
/**
|
||||
* Stop all activity.
|
||||
*/
|
||||
const unsigned long STOP_ALL = 0x03;
|
||||
|
||||
/**
|
||||
* Stops a load of a URI.
|
||||
*
|
||||
* @param stopFlags - Flags indicating the stop behavior.
|
||||
*/
|
||||
void stop(in unsigned long stopFlags);
|
||||
|
||||
/**
|
||||
* Retrieves the current DOM document for the WebBrowser.
|
||||
*/
|
||||
readonly attribute nsIDOMDocument document;
|
||||
|
||||
/**
|
||||
* The current URI that is loaded.
|
||||
*/
|
||||
readonly attribute nsIURI currentURI;
|
||||
|
||||
/**
|
||||
* The session history object used to store the session history for the
|
||||
* session.
|
||||
*/
|
||||
attribute nsISHistory sessionHistory;
|
||||
};
|
||||
|
||||
@@ -597,7 +597,7 @@ nsWebShell::StopDocumentLoad(void)
|
||||
{
|
||||
if(eCharsetReloadRequested != mCharsetReloadState)
|
||||
{
|
||||
Stop();
|
||||
Stop(nsIWebNavigation::STOP_ALL);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -777,7 +777,6 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent,
|
||||
mCurrentURI, // Referer URI
|
||||
nsnull, // No onwer
|
||||
PR_TRUE, // Inherit owner from document
|
||||
PR_FALSE, // Do not stop active document
|
||||
target.get(), // Window target
|
||||
aPostDataStream, // Post data stream
|
||||
aHeadersDataStream, // Headers stream
|
||||
@@ -1123,7 +1122,6 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
||||
referrer, // Refering URI
|
||||
nsnull, // Owner
|
||||
PR_TRUE, // Inherit owner
|
||||
PR_FALSE, // Do not stop active Doc
|
||||
nsnull, // No window target
|
||||
inputStream, // Post data stream
|
||||
nsnull, // No headers stream
|
||||
|
||||
Reference in New Issue
Block a user