mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1883138 - Ensure HasParserNotified returns true only when parser has actually notified, r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D203324
This commit is contained in:
parent
43e6b85dbe
commit
f575c3bb9f
@ -3878,7 +3878,12 @@ class Document : public nsINode,
|
||||
void SetAllowDeclarativeShadowRoots(bool aAllowDeclarativeShadowRoots);
|
||||
bool AllowsDeclarativeShadowRoots() const;
|
||||
|
||||
void SuspendDOMNotifications() { mSuspendDOMNotifications = true; }
|
||||
void SuspendDOMNotifications() {
|
||||
MOZ_ASSERT(IsHTMLDocument(),
|
||||
"Currently suspending DOM notifications is supported only on "
|
||||
"HTML documents.");
|
||||
mSuspendDOMNotifications = true;
|
||||
}
|
||||
|
||||
void ResumeDOMNotifications() { mSuspendDOMNotifications = false; }
|
||||
|
||||
|
@ -81,9 +81,6 @@ template <NotifyPresShell aNotifyPresShell = NotifyPresShell::After,
|
||||
static inline void Notify(nsINode* aNode, NotifyObserver&& aNotify,
|
||||
uint32_t aCallback) {
|
||||
Document* doc = aNode->OwnerDoc();
|
||||
if (doc->DOMNotificationsSuspended()) {
|
||||
return;
|
||||
}
|
||||
nsDOMMutationEnterLeave enterLeave(doc);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -257,9 +257,10 @@ nsresult nsHtml5TreeOperation::Append(nsIContent* aNode, nsIContent* aParent,
|
||||
MOZ_ASSERT(aBuilder);
|
||||
MOZ_ASSERT(aBuilder->IsInDocUpdate());
|
||||
ErrorResult rv;
|
||||
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(), aBuilder->GetDocument());
|
||||
Document* ownerDoc = aParent->OwnerDoc();
|
||||
nsHtml5OtherDocUpdate update(ownerDoc, aBuilder->GetDocument());
|
||||
aParent->AppendChildTo(aNode, false, rv);
|
||||
if (!rv.Failed()) {
|
||||
if (!rv.Failed() && !ownerDoc->DOMNotificationsSuspended()) {
|
||||
aNode->SetParserHasNotified();
|
||||
MutationObservers::NotifyContentAppended(aParent, aNode);
|
||||
}
|
||||
@ -303,8 +304,10 @@ nsresult nsHtml5TreeOperation::AppendToDocument(
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
aNode->SetParserHasNotified();
|
||||
MutationObservers::NotifyContentInserted(doc, aNode);
|
||||
if (!doc->DOMNotificationsSuspended()) {
|
||||
aNode->SetParserHasNotified();
|
||||
MutationObservers::NotifyContentInserted(doc, aNode);
|
||||
}
|
||||
|
||||
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
|
||||
"Someone forgot to block scripts");
|
||||
|
Loading…
Reference in New Issue
Block a user