Bug 1538968 - don't register link updates for localization links in system-principal docs, r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D24909
This commit is contained in:
Gijs Kruitbosch
2019-03-29 16:01:37 +00:00
parent 9c98d95c1e
commit e52c56a680

View File

@@ -118,8 +118,14 @@ nsresult HTMLLinkElement::BindToTree(Document* aDocument, nsIContent* aParent,
nsGenericHTMLElement::BindToTree(aDocument, aParent, aBindingParent);
NS_ENSURE_SUCCESS(rv, rv);
bool isLocalizationLink =
aDocument && this->AttrValueIs(kNameSpaceID_None, nsGkAtoms::rel,
nsGkAtoms::localization, eIgnoreCase);
if (Document* doc = GetComposedDoc()) {
doc->RegisterPendingLinkUpdate(this);
if (!isLocalizationLink || !doc->NodePrincipal()->IsSystemPrincipal()) {
doc->RegisterPendingLinkUpdate(this);
}
TryDNSPrefetchOrPreconnectOrPrefetchOrPreloadOrPrerender();
}
@@ -128,8 +134,7 @@ nsresult HTMLLinkElement::BindToTree(Document* aDocument, nsIContent* aParent,
nsContentUtils::AddScriptRunner(
NewRunnableMethod("dom::HTMLLinkElement::BindToTree", this, update));
if (aDocument && this->AttrValueIs(kNameSpaceID_None, nsGkAtoms::rel,
nsGkAtoms::localization, eIgnoreCase)) {
if (isLocalizationLink) {
aDocument->LocalizationLinkAdded(this);
}