mIOThunk = new nsJSThunk(); if (!mIOThunk) return NS_ERROR_OUT_OF_MEMORY;     nsCOMPtr<nsIChannel> channel;    rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, mIOThunk, NS_LITERAL_CSTRING("text/html")); if (NS_FAILED(rv)) return rv;  rv = mIOThunk->Init(aURI); if (NS_SUCCEEDED(rv)) { mStreamChannel = channel; }  return rv;
mURI = uri; return NS_OK;
nsresult nsJSChannel::Init(nsIURI *aURI){    nsresult rv;    // Create the nsIStreamIO layer used by the nsIStreamIOChannel.    mIOThunk = new nsJSThunk();    if (!mIOThunk)        return NS_ERROR_OUT_OF_MEMORY;    // Create a stock input stream channel...    // Remember, until AsyncOpen is called, the script will not be evaluated    // and the underlying Input Stream will not be created...    nsCOMPtr<nsIChannel> channel;    // If the resultant script evaluation actually does return a value, we    // treat it as html.    rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, mIOThunk,                                  NS_LITERAL_CSTRING("text/html"));    if (NS_FAILED(rv)) return rv;    rv = mIOThunk->Init(aURI);    if (NS_SUCCEEDED(rv)) {        mStreamChannel = channel;    }    return rv;}