Bug 1272594 - Remove special cookie policy handling within InternalRequest (r=bkelly)
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Wed, 04 Jan 2017 21:43:39 +0100
changeset 327992 f67c56b193964c9d36c7a41121262a9bc66613d4
parent 327991 9b51546b47e7feffe1fb38c00898675e0a1e8f80
child 327993 f897399fb28a18b34f5200677e2d585e5d4342a2
push id31160
push userphilringnalda@gmail.com
push dateThu, 05 Jan 2017 02:33:44 +0000
treeherdermozilla-central@f13abb8ba9f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1272594
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1272594 - Remove special cookie policy handling within InternalRequest (r=bkelly)
dom/fetch/InternalRequest.cpp
--- a/dom/fetch/InternalRequest.cpp
+++ b/dom/fetch/InternalRequest.cpp
@@ -437,35 +437,17 @@ InternalRequest::MapChannelToRequestMode
 RequestCredentials
 InternalRequest::MapChannelToRequestCredentials(nsIChannel* aChannel)
 {
   MOZ_ASSERT(aChannel);
 
   nsCOMPtr<nsILoadInfo> loadInfo;
   MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
 
-
-  // TODO: Remove following code after stylesheet and image support cookie policy
-  if (loadInfo->GetSecurityMode() == nsILoadInfo::SEC_NORMAL) {
-    uint32_t loadFlags;
-    aChannel->GetLoadFlags(&loadFlags);
-
-    if (loadFlags & nsIRequest::LOAD_ANONYMOUS) {
-      return RequestCredentials::Omit;
-    } else {
-      bool includeCrossOrigin;
-      nsCOMPtr<nsIHttpChannelInternal> internalChannel = do_QueryInterface(aChannel);
-
-      internalChannel->GetCorsIncludeCredentials(&includeCrossOrigin);
-      if (includeCrossOrigin) {
-        return RequestCredentials::Include;
-      }
-    }
-    return RequestCredentials::Same_origin;
-  }
+  MOZ_DIAGNOSTIC_ASSERT(loadInfo->GetSecurityMode() != nsILoadInfo::SEC_NORMAL);
 
   uint32_t cookiePolicy = loadInfo->GetCookiePolicy();
 
   if (cookiePolicy == nsILoadInfo::SEC_COOKIES_INCLUDE) {
     return RequestCredentials::Include;
   } else if (cookiePolicy == nsILoadInfo::SEC_COOKIES_OMIT) {
     return RequestCredentials::Omit;
   } else if (cookiePolicy == nsILoadInfo::SEC_COOKIES_SAME_ORIGIN) {