Verified Commit a3205d37 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez Committed by ma1
Browse files

Bug 2060048 - Force revalidation of Vary: cookie subresources. a=diannaS

I think this would fix the image, css, and script caches.

Original Revision: https://phabricator.services.mozilla.com/D315988

Differential Revision: https://phabricator.services.mozilla.com/D317319
parent f4c87ed0
Loading
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -12177,6 +12177,23 @@ nsContentUtils::GetSubresourceCacheValidationInfo(nsIRequest* aRequest,
    if (!info.mMustRevalidate) {
      Unused << httpChannel->IsNoCacheResponse(&info.mMustRevalidate);
    }

    if (!info.mMustRevalidate) {
      nsAutoCString vary;
      (void)httpChannel->GetResponseHeader("vary"_ns, vary);
      info.mMustRevalidate = [&] {
        for (const nsACString& token :
             nsCCharSeparatedTokenizer(vary, ',').ToRange()) {
          if (token.EqualsLiteral("*")) {
            return true;
          }
          if (token.EqualsIgnoreCase("cookie")) {
            return true;
          }
        }
        return false;
      }();
    }
  }

  // data: URIs are safe to cache across documents under any circumstance, so we