Bug 1587767 - Assert that link flag handling is correct, and that NodeInfoChanged is only called on disconnected nodes. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D48830

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-10 15:39:20 +00:00
Родитель 02a9637658
Коммит ca0bd9ef74
2 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -21,6 +21,7 @@
#include "mozilla/dom/BindContext.h"
#include "mozilla/dom/Flex.h"
#include "mozilla/dom/Grid.h"
#include "mozilla/dom/Link.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/Text.h"
#include "mozilla/gfx/Matrix.h"
@ -4380,5 +4381,14 @@ double Element::FirstLineBoxBSize() const {
: 0.0;
}
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
void Element::AssertInvariantsOnNodeInfoChange() {
MOZ_DIAGNOSTIC_ASSERT(!IsInComposedDoc());
if (nsCOMPtr<Link> link = do_QueryInterface(this)) {
MOZ_DIAGNOSTIC_ASSERT(!link->HasPendingLinkUpdate());
}
}
#endif
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -1468,7 +1468,11 @@ class Element : public FragmentOrElement {
*
* If you change this, change also the similar method in Link.
*/
virtual void NodeInfoChanged(Document* aOldDoc) {}
virtual void NodeInfoChanged(Document* aOldDoc) {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
AssertInvariantsOnNodeInfoChange();
#endif
}
/**
* Parse a string into an nsAttrValue for a CORS attribute. This
@ -1917,6 +1921,10 @@ class Element : public FragmentOrElement {
ReparseAttributes = ReparseAttributes::Yes);
private:
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
void AssertInvariantsOnNodeInfoChange();
#endif
/**
* Slow path for GetClasses, this should only be called for SVG elements.
*/