author | Boris Zbarsky <bzbarsky@mit.edu> |
Thu, 16 Mar 2017 14:50:42 -0400 | |
changeset 348180 | 2a0e59a450209b4c0ed7679961cd9b45648a5d3d |
parent 348179 | 8adbe06476ae83f1c87bb35b2c06ad413ffa82e0 |
child 348181 | 4960128d3dc3b6fd246c1eebcad9b56f19b3cfc9 |
push id | 39092 |
push user | kwierso@gmail.com |
push date | Fri, 17 Mar 2017 18:14:05 +0000 |
treeherder | autoland@88576fd417e7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 656197 |
milestone | 55.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
|
--- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -2461,18 +2461,16 @@ Element::SetAttrAndNotify(int32_t aNames if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) { RefPtr<nsXBLBinding> binding = GetXBLBinding(); if (binding) { binding->AttributeChanged(aName, aNamespaceID, false, aNotify); } } - UpdateState(aNotify); - nsIDocument* ownerDoc = OwnerDoc(); if (ownerDoc && GetCustomElementData()) { nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom(); nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom(); LifecycleCallbackArgs args = { nsDependentAtomString(aName), aModType == nsIDOMMutationEvent::ADDITION ? NullString() : nsDependentAtomString(oldValueAtom), @@ -2488,16 +2486,18 @@ Element::SetAttrAndNotify(int32_t aNames NS_ENSURE_SUCCESS(rv, rv); if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::dir) { OnSetDirAttr(this, &valueForAfterSetAttr, hadValidDir, hadDirAuto, aNotify); } } + UpdateState(aNotify); + if (aNotify) { // Don't pass aOldValue to AttributeChanged since it may not be reliable. // Callers only compute aOldValue under certain conditions which may not // be triggered by all nsIMutationObservers. nsNodeUtils::AttributeChanged(this, aNamespaceID, aName, aModType, oldValue == &aParsedValue ? &aParsedValue : nullptr); } @@ -2699,41 +2699,41 @@ Element::UnsetAttr(int32_t aNameSpaceID, if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) { RefPtr<nsXBLBinding> binding = GetXBLBinding(); if (binding) { binding->AttributeChanged(aName, aNameSpaceID, true, aNotify); } } - UpdateState(aNotify); - nsIDocument* ownerDoc = OwnerDoc(); if (ownerDoc && GetCustomElementData()) { nsCOMPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom(); LifecycleCallbackArgs args = { nsDependentAtomString(aName), nsDependentAtomString(oldValueAtom), NullString() }; nsContentUtils::EnqueueLifecycleCallback( ownerDoc, nsIDocument::eAttributeChanged, this, &args); } + rv = AfterSetAttr(aNameSpaceID, aName, nullptr, aNotify); + NS_ENSURE_SUCCESS(rv, rv); + + UpdateState(aNotify); + if (aNotify) { // We can always pass oldValue here since there is no new value which could // have corrupted it. nsNodeUtils::AttributeChanged(this, aNameSpaceID, aName, nsIDOMMutationEvent::REMOVAL, &oldValue); } - rv = AfterSetAttr(aNameSpaceID, aName, nullptr, aNotify); - NS_ENSURE_SUCCESS(rv, rv); - if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::dir) { OnSetDirAttr(this, nullptr, hadValidDir, hadDirAuto, aNotify); } if (hasMutationListeners) { InternalMutationEvent mutation(true, eLegacyAttrModified); mutation.mRelatedNode = attrNode;