Bug 1378218 - Don't register visited callback if we have pending link update, r=ehsan,baku
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 07 Jul 2017 13:06:52 +0300
changeset 418884 3b8cf0ecd1840b2cfa46f23ab79947c9b470dd6c
parent 418883 07d5b41dcaef2a629649f74db899ea7fd737c2e5
child 418885 767a79ebc4467ffd89734ba3e8d765cc18fa70b4
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, baku
bugs1378218
milestone56.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 1378218 - Don't register visited callback if we have pending link update, r=ehsan,baku
dom/base/Link.cpp
dom/base/Link.h
storage/mozStorageService.cpp
--- 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;
--- a/storage/mozStorageService.cpp
+++ b/storage/mozStorageService.cpp
@@ -283,18 +283,17 @@ Service::~Service()
     NS_WARNING("Failed to unregister sqlite vfs wrapper.");
 
   // Shutdown the sqlite3 API.  Warn if shutdown did not turn out okay, but
   // there is nothing actionable we can do in that case.
   rc = ::sqlite3_shutdown();
   if (rc != SQLITE_OK)
     NS_WARNING("sqlite3 did not shutdown cleanly.");
 
-  DebugOnly<bool> shutdownObserved = !sXPConnect;
-  NS_ASSERTION(shutdownObserved, "Shutdown was not observed!");
+  shutdown(); // To release sXPConnect.
 
   gService = nullptr;
   delete mSqliteVFS;
   mSqliteVFS = nullptr;
 }
 
 void
 Service::registerConnection(Connection *aConnection)