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