Make compose window not invoke double form submit protection (bug 136906), r=darin, sr=rpotts, a=rjesup

git-svn-id: svn://10.0.0.236/trunk@126170 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jkeiser%netscape.com
2002-08-01 18:17:48 +00:00
parent b686adf243
commit 5be4b0641d
2 changed files with 33 additions and 12 deletions

View File

@@ -827,10 +827,18 @@ nsHTMLFormElement::DoSubmit(nsIPresContext* aPresContext, nsEvent* aEvent)
// or request; for example, if it's to a named anchor within the same page
// the submit will not really do anything.
if (docShell) {
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
NS_ASSERTION(webProgress, "nsIDocShell not converted to nsIWebProgress!");
rv = webProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_ALL);
NS_ENSURE_SUBMIT_SUCCESS(rv);
// If the channel is pending, we have to listen for web progress.
PRBool pending = PR_FALSE;
mSubmittingRequest->IsPending(&pending);
if (pending) {
nsCOMPtr<nsIWebProgress> webProgress = do_GetInterface(docShell);
NS_ASSERTION(webProgress, "nsIDocShell not converted to nsIWebProgress!");
rv = webProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_ALL);
NS_ENSURE_SUBMIT_SUCCESS(rv);
} else {
mSubmittingRequest = nsnull;
mIsSubmitting = PR_FALSE;
}
}
else {
// in case we didn't do anything, reset mIsSubmitting

View File

@@ -377,6 +377,7 @@ public:
protected:
nsCOMPtr<nsIURI> m_url;
nsresult mStatus;
nsCOMPtr<nsILoadGroup> mLoadGroup;
};
nsMailtoChannel::nsMailtoChannel(nsIURI * aURI)
@@ -392,19 +393,21 @@ NS_IMPL_ISUPPORTS2(nsMailtoChannel, nsIChannel, nsIRequest);
NS_IMETHODIMP nsMailtoChannel::GetLoadGroup(nsILoadGroup * *aLoadGroup)
{
*aLoadGroup = nsnull;
return NS_OK;
*aLoadGroup = mLoadGroup;
NS_IF_ADDREF(*aLoadGroup);
return NS_OK;
}
NS_IMETHODIMP nsMailtoChannel::SetLoadGroup(nsILoadGroup * aLoadGroup)
{
return NS_OK;
mLoadGroup = aLoadGroup;
return NS_OK;
}
NS_IMETHODIMP nsMailtoChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
{
NS_NOTREACHED("GetNotificationCallbacks");
return NS_ERROR_NOT_IMPLEMENTED;
NS_NOTREACHED("GetNotificationCallbacks");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMailtoChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
@@ -414,8 +417,8 @@ NS_IMETHODIMP nsMailtoChannel::SetNotificationCallbacks(nsIInterfaceRequestor* a
NS_IMETHODIMP nsMailtoChannel::GetOriginalURI(nsIURI* *aURI)
{
*aURI = nsnull;
return NS_OK;
*aURI = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsMailtoChannel::SetOriginalURI(nsIURI* aURI)
@@ -438,6 +441,11 @@ NS_IMETHODIMP nsMailtoChannel::Open(nsIInputStream **_retval)
NS_IMETHODIMP nsMailtoChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
{
// Add to the load group to fire start event
if (mLoadGroup) {
mLoadGroup->AddRequest(this, ctxt);
}
mStatus = listener->OnStartRequest(this, ctxt);
// If OnStartRequest(...) failed, then propagate the error code...
@@ -449,6 +457,11 @@ NS_IMETHODIMP nsMailtoChannel::AsyncOpen(nsIStreamListener *listener, nsISupport
// Call OnStopRequest(...) for correct-ness.
(void) listener->OnStopRequest(this, ctxt, mStatus);
// Remove from the load group to fire stop event
if (mLoadGroup) {
mLoadGroup->RemoveRequest(this, ctxt, mStatus);
}
// Always return NS_ERROR_NO_CONTENT since this channel never provides
// data...
return NS_ERROR_NO_CONTENT;
@@ -532,7 +545,7 @@ NS_IMETHODIMP nsMailtoChannel::GetName(nsACString &aName)
NS_IMETHODIMP nsMailtoChannel::IsPending(PRBool *result)
{
*result = PR_TRUE;
*result = PR_FALSE;
return NS_OK;
}