diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 7792088036f4..fa8f01d889a0 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -3752,9 +3752,46 @@ nsDocShell::InternalLoad(nsIURI * aURI, aHeadersData, aLoadType, aSHEntry); - return rv; + if (rv == NS_ERROR_NO_CONTENT) { + if (bIsNewWindow) { + // + // At this point, a new window has been created, but the + // URI did not have any data associated with it... + // + // So, the best we can do, is to tear down the new window + // that was just created! + // + nsCOMPtr treeItem; + nsCOMPtr treeOwner; + + treeItem = do_QueryInterface(targetDocShell); + treeItem->GetTreeOwner(getter_AddRefs(treeOwner)); + if (treeOwner) { + nsCOMPtr treeOwnerAsWin; + + treeOwnerAsWin = do_QueryInterface(treeOwner); + if (treeOwnerAsWin) { + treeOwnerAsWin->Destroy(); + } + } + } + // + // NS_ERROR_NO_CONTENT should not be returned to the + // caller... This is an internal error code indicating that + // the URI had no data associated with it - probably a + // helper-app style protocol (ie. mailto://) + // + rv = NS_OK; + } + else if (bIsNewWindow) { + // XXX: Once new windows are created hidden, the new + // window will need to be made visible... For now, + // do nothing. + } } + return rv; } + diff --git a/mailnews/compose/src/nsSmtpService.cpp b/mailnews/compose/src/nsSmtpService.cpp index bb69ca900675..d65b05acd6f3 100644 --- a/mailnews/compose/src/nsSmtpService.cpp +++ b/mailnews/compose/src/nsSmtpService.cpp @@ -338,7 +338,20 @@ NS_IMETHODIMP nsMailtoChannel::Open(nsIInputStream **_retval) NS_IMETHODIMP nsMailtoChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) { - return listener->OnStartRequest(this, ctxt); + mStatus = listener->OnStartRequest(this, ctxt); + + // If OnStartRequest(...) failed, then propagate the error code... + if (NS_SUCCEEDED(mStatus)) { + // Otherwise, indicate that no content is available... + mStatus = NS_ERROR_NO_CONTENT; + } + + // Call OnStopRequest(...) for correct-ness. + (void) listener->OnStopRequest(this, ctxt, mStatus); + + // Always return NS_ERROR_NO_CONTENT since this channel never provides + // data... + return NS_ERROR_NO_CONTENT; } NS_IMETHODIMP nsMailtoChannel::GetLoadFlags(nsLoadFlags *aLoadFlags)