bug 410904 : add referrer in http request from npapi. r=josh
authorFabien Cellier <fabien.cellier@gmail.com>
Wed, 11 Jan 2012 14:38:19 -0500
changeset 85528 65da0d7b408d410e61dbeca98ebe559135ae0c98
parent 85527 d28ab93ab623e23eb0c58368b3205f7151fa1475
child 85529 5660fa471b73d15716a15d0b308c5aaf81a24581
child 87316 b999a4b8ad1aa4990a028ae93dd46d5b577e5e74
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh
bugs410904
milestone12.0a1
bug 410904 : add referrer in http request from npapi. r=josh
dom/plugins/base/nsPluginHost.cpp
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -3089,33 +3089,38 @@ nsresult nsPluginHost::NewPluginURLStrea
       // Plug-ins seem to depend on javascript: URIs running synchronously
       scriptChannel->SetExecuteAsync(false);
     }
   }
 
   // deal with headers and post data
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
   if (httpChannel) {
+    rv = httpChannel->SetReferrer(doc->GetDocumentURI());  
+    NS_ENSURE_SUCCESS(rv,rv);
+      
     if (aPostStream) {
       // XXX it's a bit of a hack to rewind the postdata stream
       // here but it has to be done in case the post data is
       // being reused multiple times.
       nsCOMPtr<nsISeekableStream>
       postDataSeekable(do_QueryInterface(aPostStream));
       if (postDataSeekable)
         postDataSeekable->Seek(nsISeekableStream::NS_SEEK_SET, 0);
 
       nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(httpChannel));
       NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel");
 
       uploadChannel->SetUploadStream(aPostStream, EmptyCString(), -1);
     }
 
-    if (aHeadersData)
+    if (aHeadersData) {
       rv = AddHeadersToChannel(aHeadersData, aHeadersDataLen, httpChannel);
+      NS_ENSURE_SUCCESS(rv,rv);
+    }
   }
   rv = channel->AsyncOpen(listenerPeer, nsnull);
   if (NS_SUCCEEDED(rv))
     listenerPeer->TrackRequest(channel);
   return rv;
 }
 
 // Called by GetURL and PostURL