Bug 1538968 - don't register link updates for localization links in system-principal docs, r=smaug
☠☠ backed out by 2e6a1dcc4205 ☠ ☠
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 27 Mar 2019 17:30:54 +0000
changeset 466500 56e336b27bcb388ab4b0d04cd502224af26aa1d7
parent 466499 09efa187c2cdd1d49a1726f7188858a412851cc5
child 466501 afc9e5ce9971595f7fe6f46ed81f0a89ee65aeea
push id81645
push usergijskruitbosch@gmail.com
push dateThu, 28 Mar 2019 02:32:26 +0000
treeherderautoland@afc9e5ce9971 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1538968
milestone68.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 1538968 - don't register link updates for localization links in system-principal docs, r=smaug Differential Revision: https://phabricator.services.mozilla.com/D24909
dom/html/HTMLLinkElement.cpp
--- a/dom/html/HTMLLinkElement.cpp
+++ b/dom/html/HTMLLinkElement.cpp
@@ -112,28 +112,33 @@ bool HTMLLinkElement::HasDeferredDNSPref
 nsresult HTMLLinkElement::BindToTree(Document* aDocument, nsIContent* aParent,
                                      nsIContent* aBindingParent) {
   Link::ResetLinkState(false, Link::ElementHasHref());
 
   nsresult rv =
       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();
   }
 
   void (HTMLLinkElement::*update)() =
       &HTMLLinkElement::UpdateStyleSheetInternal;
   nsContentUtils::AddScriptRunner(
       NewRunnableMethod("dom::HTMLLinkElement::BindToTree", this, update));
 
-  if (aDocument && this->AttrValueIs(kNameSpaceID_None, nsGkAtoms::rel,
-                                     nsGkAtoms::localization, eIgnoreCase)) {
+  if (isLocalizationLink) {
     aDocument->LocalizationLinkAdded(this);
   }
 
   CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded"));
 
   return rv;
 }