another patch for bug #65777. This one removes the intermediate window that is created for mailto:// URLs that are explicitly target to a new window...

This commit is contained in:
rpotts%netscape.com 2001-05-21 06:50:51 +00:00
parent 271cc39fd9
commit 44626befc1
2 changed files with 52 additions and 2 deletions

View File

@ -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<nsIDocShellTreeItem> treeItem;
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
treeItem = do_QueryInterface(targetDocShell);
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
if (treeOwner) {
nsCOMPtr<nsIBaseWindow> 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;
}

View File

@ -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)