DEBUG_PRINTF( PR_STDOUT, "Failed to open URI, rv=0x%X\n", (int)rv );
NS_ASSERTION(0,"Failed to open URI");
nsStreamTransfer::SelectFileAndTransferLocationSpec( char const *aURL,                                                     nsIDOMWindowInternal *parent,                                                     char const *contentType,                                                     char const *suggestedName,                                                     PRBool      doNotValidate,                                                     nsIInputStream *postData ) {    nsresult rv = NS_OK;    // Construct URI from spec.    nsCOMPtr<nsIURI> uri;    rv = NS_NewURI( getter_AddRefs( uri ), aURL );    if ( NS_SUCCEEDED( rv ) && uri ) {        // Construct channel from URI.        nsCOMPtr<nsIChannel> channel;        rv = NS_OpenURI( getter_AddRefs( channel ), uri, nsnull );        if ( NS_SUCCEEDED( rv ) && channel ) {            // See if VALIDATE_NEVER is called for.            if ( doNotValidate ) {                channel->SetLoadFlags( nsIRequest::VALIDATE_NEVER );            }            // Post data provided?            if ( postData ) {                // See if it's an http channel.                nsCOMPtr<nsIHTTPChannel> httpChannel( do_QueryInterface( channel ) );                if ( httpChannel ) {                    // Rewind stream and attach to channel.                    nsCOMPtr<nsIRandomAccessStore> stream( do_QueryInterface( postData ) );                    if ( stream ) {                        stream->Seek( PR_SEEK_SET, 0 );                        httpChannel->SetUploadStream( postData );                        nsCOMPtr<nsIAtom> method = NS_NewAtom ("POST");                        httpChannel->SetRequestMethod(method);                    }                }            }            // Transfer channel to output file chosen by user.            rv = this->SelectFileAndTransferLocation( channel, parent, contentType, suggestedName );        } else {            DEBUG_PRINTF( PR_STDOUT, "Failed to open URI, rv=0x%X\n", (int)rv );        }    } else {        DEBUG_PRINTF( PR_STDOUT, "Failed to create URI, rv=0x%X\n", (int)rv );    }    return rv;}