diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:05:28 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:05:28 -0400 |
commit | f07f8aecb8a03d33d0b90d685d85960a29543c75 (patch) | |
tree | 27046a4abd20e458e1cdb80ff1651729c8c6f781 /dom/base/Element.cpp | |
parent | 9f6cb6874e537fd4f451e507b1832b94b04d9d97 (diff) | |
download | uxp-f07f8aecb8a03d33d0b90d685d85960a29543c75.tar.gz |
Bug 1352389 -Don't push extra script blocker on stack when setting attributes
Tag #1375
Diffstat (limited to 'dom/base/Element.cpp')
-rw-r--r-- | dom/base/Element.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 055746885b..7c5029e2e2 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -2492,7 +2492,8 @@ Element::SetAttr(int32_t aNamespaceID, nsIAtom* aName, // Hold a script blocker while calling ParseAttribute since that can call // out to id-observers - nsAutoScriptBlocker scriptBlocker; + nsIDocument* document = GetComposedDoc(); + mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify); // Even the value was pre-parsed, we still need to call ParseAttribute because // it can have side effects. @@ -2502,7 +2503,7 @@ Element::SetAttr(int32_t aNamespaceID, nsIAtom* aName, return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue, attrValue, modType, hasListeners, aNotify, - kCallAfterSetAttr); + kCallAfterSetAttr, document, updateBatch); } nsresult @@ -2539,9 +2540,11 @@ Element::SetParsedAttr(int32_t aNamespaceID, nsIAtom* aName, nsresult rv = BeforeSetAttr(aNamespaceID, aName, &value, aNotify); NS_ENSURE_SUCCESS(rv, rv); + nsIDocument* document = GetComposedDoc(); + mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify); return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue, aParsedValue, modType, hasListeners, aNotify, - kCallAfterSetAttr); + kCallAfterSetAttr, document, updateBatch); } nsresult @@ -2553,13 +2556,12 @@ Element::SetAttrAndNotify(int32_t aNamespaceID, uint8_t aModType, bool aFireMutation, bool aNotify, - bool aCallAfterSetAttr) + bool aCallAfterSetAttr, + nsIDocument* aComposedDocument, + const mozAutoDocUpdate&) { nsresult rv; - nsIDocument* document = GetComposedDoc(); - mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify); - nsMutationGuard::DidMutate(); // Copy aParsedValue for later use since it will be lost when we call @@ -2581,7 +2583,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID, // XXXbz Perhaps we should push up the attribute mapping function // stuff to Element? if (!IsAttributeMapped(aName) || - !SetMappedAttribute(document, aName, aParsedValue, &rv)) { + !SetMappedAttribute(aComposedDocument, aName, aParsedValue, &rv)) { rv = mAttrsAndChildren.SetAndSwapAttr(aName, aParsedValue); } } @@ -2600,7 +2602,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID, NS_ENSURE_SUCCESS(rv, rv); - if (document || HasFlag(NODE_FORCE_XBL_BINDINGS)) { + if (aComposedDocument || HasFlag(NODE_FORCE_XBL_BINDINGS)) { RefPtr<nsXBLBinding> binding = GetXBLBinding(); if (binding) { binding->AttributeChanged(aName, aNamespaceID, false, aNotify); |