Added a new method to nsIURIContentListener to allow the windowContext listener to get a crack at cancelling a new load that is about to occur.

git-svn-id: svn://10.0.0.236/trunk@63947 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tbogard%aol.net
2000-03-24 00:23:40 +00:00
parent 0130b3e5e7
commit 6a0120def8
2 changed files with 28 additions and 0 deletions

View File

@@ -38,6 +38,17 @@ interface nsIURI;
[scriptable, uuid(94928AB3-8B63-11d3-989D-001083010E9B)]
interface nsIURIContentListener : nsISupports
{
/*
Gives the content listener first crack at stopping a load before it
happens.
aURI --> the uri we are going to try and open.
aWindowTarget --> the window target passed to the uriloader to open.
aAbortOpen --> specifies that the open should be aborted.
*/
void onStartURIOpen(in nsIURI aURI, in string aWindowTarget,
out boolean aAbortOpen);
/* Give the content listener first crack at forcing us to use
a specific content handler. Content listener's do not need to
support this method if they want the uri dispatcher to find the

View File

@@ -575,6 +575,23 @@ NS_IMETHODIMP nsURILoader::OpenURIVia(nsIChannel * aChannel,
if (!aChannel) return NS_ERROR_NULL_POINTER;
// Let the window context's uriListener know that the open is starting. This
// gives that window a chance to abort the load process.
nsCOMPtr<nsIURIContentListener> winContextListener(do_GetInterface(aOriginalWindowContext));
if(winContextListener)
{
nsCOMPtr<nsIURI> uri;
aChannel->GetURI(getter_AddRefs(uri));
if(uri)
{
PRBool abort = PR_FALSE;
winContextListener->OnStartURIOpen(uri, aWindowTarget, &abort);
if(abort)
return NS_OK;
}
}
nsCOMPtr<nsISupports> retargetedWindowContext;
NS_ENSURE_SUCCESS(GetTarget(aWindowTarget, aOriginalWindowContext, getter_AddRefs(retargetedWindowContext)), NS_ERROR_FAILURE);