Bug 1508000 - Dispatch UAWidgetUnbindFromTree event before calling nsGenericHTMLElement::UnbindFromTree() r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D12205
This commit is contained in:
@@ -4693,18 +4693,24 @@ HTMLMediaElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
mUnboundFromTree = true;
|
||||
mVisibilityState = Visibility::UNTRACKED;
|
||||
|
||||
if (GetShadowRoot() && IsInComposedDoc()) {
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableFunction(
|
||||
"HTMLMediaElement::UnbindFromTree::UAWidgetUnbindFromTree",
|
||||
[self = RefPtr<Element>(this)]() {
|
||||
nsContentUtils::DispatchChromeEvent(
|
||||
self->OwnerDoc(), self,
|
||||
NS_LITERAL_STRING("UAWidgetUnbindFromTree"),
|
||||
CanBubble::eYes, Cancelable::eNo);
|
||||
self->UnattachShadow();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
|
||||
MOZ_ASSERT(IsHidden());
|
||||
NotifyDecoderActivityChanges();
|
||||
|
||||
AsyncEventDispatcher* dispatcher =
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("UAWidgetUnbindFromTree"),
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
dispatcher->RunDOMEventWhenSafe();
|
||||
|
||||
RefPtr<HTMLMediaElement> self(this);
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableFunction("dom::HTMLMediaElement::UnbindFromTree", [self]() {
|
||||
|
||||
Reference in New Issue
Block a user