diff --git a/dom/html/nsHTMLDNSPrefetch.cpp b/dom/html/nsHTMLDNSPrefetch.cpp
index 6a2d0e1d6c..6a7217021f 100644
--- a/dom/html/nsHTMLDNSPrefetch.cpp
+++ b/dom/html/nsHTMLDNSPrefetch.cpp
@@ -94,8 +94,15 @@ nsHTMLDNSPrefetch::Shutdown()
}
bool
-nsHTMLDNSPrefetch::IsAllowed (nsIDocument *aDocument)
+nsHTMLDNSPrefetch::IsAllowed(nsIDocument *aDocument)
{
+ // Do not use prefetch if the document's node principal is the system
+ // principal.
+ nsCOMPtr principal = aDocument->NodePrincipal();
+ if (nsContentUtils::IsSystemPrincipal(principal)) {
+ return false;
+ }
+
// There is no need to do prefetch on non UI scenarios such as XMLHttpRequest.
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
}