Bug 1080987 - navigator.sendBeacon() needs to sent origin header. r=sicking, a=lsblakk
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Wed, 19 Nov 2014 16:03:39 -0800
changeset 234337 865547ed437c5d2d81dc0e6250ab0311eb603e33
parent 234336 c8504ff4aa484e6d3c785e1a9d1ac7fbb8409be0
child 234338 7db3b347535a3ff48351a6782eeb64dfd1e7a223
push id4268
push userryanvm@gmail.com
push dateMon, 22 Dec 2014 22:22:50 +0000
treeherdermozilla-beta@e83d78f377b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, lsblakk
bugs1080987
milestone35.0
Bug 1080987 - navigator.sendBeacon() needs to sent origin header. r=sicking, a=lsblakk
dom/base/Navigator.cpp
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1202,16 +1202,19 @@ Navigator::SendBeacon(const nsAString& a
   if (p) {
     p->SetPriority(nsISupportsPriority::PRIORITY_LOWEST);
   }
 
   nsRefPtr<nsCORSListenerProxy> cors = new nsCORSListenerProxy(new BeaconStreamListener(),
                                                                principal,
                                                                true);
 
+  rv = cors->Init(channel, true);
+  NS_ENSURE_SUCCESS(rv, false);
+
   // Start a preflight if cross-origin and content type is not whitelisted
   rv = secMan->CheckSameOriginURI(documentURI, uri, false);
   bool crossOrigin = NS_FAILED(rv);
   nsAutoCString contentType, parsedCharset;
   rv = NS_ParseContentType(mimeType, contentType, parsedCharset);
   if (crossOrigin &&
       contentType.Length() > 0 &&
       !contentType.Equals(APPLICATION_WWW_FORM_URLENCODED) &&