Bug 1080987 - navigator.sendBeacon() needs to sent origin header. r=sicking, a=sledru
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Wed, 19 Nov 2014 16:03:39 -0800
changeset 242579 ac5d2e7a585530a3d4d76029f62d49df719a0708
parent 242578 172c154b8d0568e1f8f539cae3547fa4d262c68c
child 242580 425e86d0d740ad31785a4da79083095d643cca14
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, sledru
bugs1080987
milestone36.0a2
Bug 1080987 - navigator.sendBeacon() needs to sent origin header. r=sicking, a=sledru
dom/base/Navigator.cpp
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1189,16 +1189,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) &&