Bug 1851523 - Don't dispatch DOMHeadElementParsed on data documents, r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D187406
This commit is contained in:
Olli Pettay 2023-09-05 10:27:32 +00:00
Родитель 28647db072
Коммит 7b8bd15a92
1 изменённых файлов: 9 добавлений и 9 удалений

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

@ -49,17 +49,17 @@ void HTMLSharedElement::GetHref(nsAString& aValue) {
void HTMLSharedElement::DoneAddingChildren(bool aHaveNotified) {
if (mNodeInfo->Equals(nsGkAtoms::head)) {
nsCOMPtr<Document> doc = GetUncomposedDoc();
if (doc) {
if (nsCOMPtr<Document> doc = GetUncomposedDoc()) {
doc->OnL10nResourceContainerParsed();
if (!doc->IsLoadedAsData()) {
RefPtr<AsyncEventDispatcher> asyncDispatcher =
new AsyncEventDispatcher(this, u"DOMHeadElementParsed"_ns,
CanBubble::eYes, ChromeOnlyDispatch::eYes);
// Always run async in order to avoid running script when the content
// sink isn't expecting it.
asyncDispatcher->PostDOMEvent();
}
}
RefPtr<AsyncEventDispatcher> asyncDispatcher =
new AsyncEventDispatcher(this, u"DOMHeadElementParsed"_ns,
CanBubble::eYes, ChromeOnlyDispatch::eYes);
// Always run async in order to avoid running script when the content
// sink isn't expecting it.
asyncDispatcher->PostDOMEvent();
}
}