Commit 3544dfda authored by Julian Descottes's avatar Julian Descottes Committed by Pier Angelo Vendrame
Browse files

Bug 1880374 - Disable DNS prefetching if document nodePrincipal is systemPrincipal r=valentin

parent 18cbba78
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -180,6 +180,13 @@ static bool EnsureDNSService() {
}

bool HTMLDNSPrefetch::IsAllowed(Document* aDocument) {
  // Do not use prefetch if the document's node principal is the system
  // principal.
  nsCOMPtr<nsIPrincipal> principal = aDocument->NodePrincipal();
  if (principal->IsSystemPrincipal()) {
    return false;
  }

  // There is no need to do prefetch on non UI scenarios such as XMLHttpRequest.
  return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
}