if (NS_FAILED(rv)) return rv;
NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarget, void *aPostData, PRUint32 aPostDataLen, void *aHeadersData,                                             PRUint32 aHeadersDataLen, PRBool isFile){  NS_ENSURE_TRUE(mOwner,NS_ERROR_NULL_POINTER);  NS_ENSURE_TRUE(mContext,NS_ERROR_NULL_POINTER);  // the container of the pres context will give us the link handler  nsCOMPtr<nsISupports> container;  nsresult rv = mContext->GetContainer(getter_AddRefs(container));  NS_ENSURE_TRUE(container,NS_ERROR_FAILURE);  nsCOMPtr<nsILinkHandler> lh = do_QueryInterface(container);  NS_ENSURE_TRUE(lh, NS_ERROR_FAILURE);  nsAutoString  uniurl; uniurl.AssignWithConversion(aURL);  nsAutoString  unitarget; unitarget.AssignWithConversion(aTarget);  nsAutoString  fullurl;  nsCOMPtr<nsIURI> baseURL;  nsCOMPtr<nsIDocument> doc;  rv = GetDocument(getter_AddRefs(doc));  if (NS_SUCCEEDED(rv) && doc) {    rv = doc->GetBaseURL(*getter_AddRefs(baseURL));  // gets the document's url  } else {    mOwner->GetFullURL(*getter_AddRefs(baseURL)); // gets the plugin's content url  }  // Create an absolute URL  NS_MakeAbsoluteURI(fullurl, uniurl, baseURL);  NS_ENSURE_TRUE(NS_SUCCEEDED(rv),NS_ERROR_FAILURE);  nsCOMPtr<nsIContent> content;  mOwner->GetContent(getter_AddRefs(content));  NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);  nsCOMPtr<nsIInputStream> postDataStream;  nsCOMPtr<nsIInputStream> headersDataStream;  // deal with post data, either in a file or raw data, and any headers  if (aPostData) {    const char * dataToPost = (const char *)aPostData;  // default to raw data    nsXPIDLCString filename;    if (isFile) {      // convert file:///c:/ to c: if needed      nsCOMPtr<nsILocalFile> aFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);      if (NS_SUCCEEDED(NS_InitFileFromURLSpec(aFile,dataToPost)) &&          NS_SUCCEEDED(aFile->GetPath(getter_Copies(filename))))          dataToPost = filename;    }    rv = NS_NewPluginPostDataStream(getter_AddRefs(postDataStream), dataToPost, aPostDataLen, isFile);    NS_ASSERTION(NS_SUCCEEDED(rv),"failed in creating plugin post data stream");    if (aHeadersData) {      rv = NS_NewPluginPostDataStream(getter_AddRefs(headersDataStream),                                       (const char *) aHeadersData,                                       aHeadersDataLen,                                      PR_FALSE,                                      PR_TRUE);  // last arg says we are headers, no /r/n/r/n fixup!      NS_ASSERTION(NS_SUCCEEDED(rv),"failed in creating plugin header data stream");    }  }  rv = lh->OnLinkClick(content, eLinkVerb_Replace,                        fullurl.get(), unitarget.get(),                        postDataStream, headersDataStream);  return rv;}