nsIChannel::LOAD_NORMAL, aReferringURI, 0, 0,
loadFlags, aReferringURI, 0, 0,
nsresult nsDocumentOpenInfo::Open(nsIURI *aURI,                                   nsURILoadCommand aCommand,                                  const char * aWindowTarget,                                  nsISupports * aWindowContext,                                  nsIURI * aReferringURI,                                  nsIInputStream * aPostData,                                  nsISupports * aOpenContext,                                  nsISupports ** aCurrentOpenContext){   // this method is not complete!!! Eventually, we should first go  // to the content listener and ask them for a protocol handler...  // if they don't give us one, we need to go to the registry and get  // the preferred protocol handler.   // But for now, I'm going to let necko do the work for us....  // store any local state  m_windowTarget = aWindowTarget;  mCommand = aCommand;  // get the requestor for the window context...  nsCOMPtr<nsIInterfaceRequestor> requestor = do_QueryInterface(aWindowContext);  // and get the load group out of the open context  nsCOMPtr<nsILoadGroup> aLoadGroup = do_QueryInterface(aOpenContext);  if (!aLoadGroup)  {     // i haven't implemented this yet...it's going to be hard    // because it requires a persistant stream observer (the uri loader maybe???)    // that we don't have in this architecture in order to create a new load group    return NS_ERROR_NOT_IMPLEMENTED;  }  if (aCurrentOpenContext)    aLoadGroup->QueryInterface(NS_GET_IID(nsISupports), (void **) aCurrentOpenContext);  // now we have all we need, so go get the necko channel service so we can   // open the url.   nsresult rv = NS_OK;  NS_WITH_SERVICE(nsIIOService, pNetService, kIOServiceCID, &rv);  if (NS_SUCCEEDED(rv))  {    nsCOMPtr<nsIChannel> aChannel;    rv = pNetService->NewChannelFromURI("", aURI, aLoadGroup, requestor,                                        nsIChannel::LOAD_NORMAL, aReferringURI, 0, 0,                                        getter_AddRefs(aChannel));    if (NS_FAILED(rv)) return rv; // uhoh we were unable to get a channel to handle the url!!!    // figure out if we need to set the post data stream on the channel...right now,     // this is only done for http channels.....    if (aPostData || aReferringURI)    {      nsCOMPtr<nsIHTTPChannel> httpChannel(do_QueryInterface(aChannel));      if (httpChannel)      {          if (aPostData)          {              httpChannel->SetRequestMethod(HM_POST);              httpChannel->SetPostDataStream(aPostData);          }          if (aReferringURI)           {              // Referer - misspelled, but per the HTTP spec              nsCOMPtr<nsIAtom> key = NS_NewAtom("referer");              nsXPIDLCString aSpec;              aReferringURI->GetSpec(getter_Copies(aSpec));              httpChannel->SetRequestHeader(key, aSpec);          }      }    } // if post data || a refferring uri    rv =  aChannel->AsyncRead(0, -1, nsnull, this);  }  return rv;}