Dispatch a PluginRemoved event for actual plugins, not images/unknown/iframe-type <objects>

If a page uses or removes many <object> elements which are not actually plugins, loading the page goes to a crawl because UXP recalculates the plugin UI every time.

Only dispatch a PluginRemoved event for actual plugins.
This commit is contained in:
win7-7 2019-07-14 23:08:23 +03:00 committed by Roy Tam
commit ffb2d9d791

View file

@ -715,11 +715,13 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
/// would keep the docshell around, but trash the frameloader
UnloadObject();
}
nsIDocument* doc = thisContent->GetComposedDoc();
if (doc && doc->IsActive()) {
if (mType == eType_Plugin) {
nsIDocument* doc = thisContent->GetComposedDoc();
if (doc && doc->IsActive()) {
nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(doc,
NS_LITERAL_STRING("PluginRemoved"));
NS_DispatchToCurrentThread(ev);
}
}
}