try: -b d -p all -u all -t none
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Tue, 04 Jul 2017 23:19:29 +0300
changeset 1175980 939a561f5fd658c5ceffb52e25c4536f96a889ba
parent 1175864 e0a690f5b9efb29594ca1179f7b3f42131d0cc8d
child 1247885 5728aeeb0c9875ea2e447bdba5c2f4e846feaebd
push id202565
push useropettay@mozilla.com
push dateTue, 04 Jul 2017 20:19:56 +0000
treeherdertry@939a561f5fd6 [default view] [failures only]
milestone56.0a1
try: -b d -p all -u all -t none
dom/base/Link.cpp
dom/base/Link.h
--- a/dom/base/Link.cpp
+++ b/dom/base/Link.cpp
@@ -192,17 +192,18 @@ Link::LinkState() const
   // We are a constant method, but we are just lazily doing things and have to
   // track that state.  Cast away that constness!
   Link *self = const_cast<Link *>(this);
 
   Element *element = self->mElement;
 
   // If we have not yet registered for notifications and need to,
   // due to our href changing, register now!
-  if (!mRegistered && mNeedsRegistration && element->IsInComposedDoc()) {
+  if (!mRegistered && mNeedsRegistration && element->IsInComposedDoc() &&
+      !HasPendingLinkUpdate()) {
     // Only try and register once.
     self->mNeedsRegistration = false;
 
     nsCOMPtr<nsIURI> hrefURI(GetURI());
 
     // Assume that we are not visited until we are told otherwise.
     self->mLinkState = eLinkState_Unvisited;
 
--- a/dom/base/Link.h
+++ b/dom/base/Link.h
@@ -121,17 +121,17 @@ public:
   void TryDNSPrefetch();
   void CancelDNSPrefetch(nsWrapperCache::FlagsType aDeferredFlag,
                          nsWrapperCache::FlagsType aRequestedFlag);
 
   // This is called by HTMLLinkElement.
   void TryDNSPrefetchPreconnectOrPrefetchOrPrerender();
   void CancelPrefetch();
 
-  bool HasPendingLinkUpdate() { return mHasPendingLinkUpdate; }
+  bool HasPendingLinkUpdate() const { return mHasPendingLinkUpdate; }
   void SetHasPendingLinkUpdate() { mHasPendingLinkUpdate = true; }
   void ClearHasPendingLinkUpdate() { mHasPendingLinkUpdate = false; }
 
   // To ensure correct mHasPendingLinkUpdate handling, we have this method
   // similar to the one in Element. Overriders must call
   // ClearHasPendingLinkUpdate().
   // If you change this, change also the method in Element.
   virtual void NodeInfoChanged(nsIDocument* aOldDoc) = 0;