Bug 1317032 - If a page uses or removes many <object> elements which are not actually plugins, loading the page goes to a crawl because we recalculate the plugin UI every time. Don't do that by only dispatching a PluginRemoved event for actual plugins, not images/unknown/iframe-type <objects>, r?qdot
draft
Bug 1317032 - If a page uses or removes many <object> elements which are not actually plugins, loading the page goes to a crawl because we recalculate the plugin UI every time. Don't do that by only dispatching a PluginRemoved event for actual plugins, not images/unknown/iframe-type <objects>, r?qdot
MozReview-Commit-ID: I84UcPLObCA
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -637,21 +637,23 @@ nsObjectLoadingContent::UnbindFromTree(b
QueueCheckPluginStopEvent();
} else if (mType != eType_Image) {
// nsImageLoadingContent handles the image case.
// Reset state and clear pending events
/// XXX(johns): The implementation for GenericFrame notes that ideally we
/// would keep the docshell around, but trash the frameloader
UnloadObject();
}
- nsIDocument* doc = thisContent->GetComposedDoc();
- if (doc && doc->IsActive()) {
- nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(doc,
- NS_LITERAL_STRING("PluginRemoved"));
- NS_DispatchToCurrentThread(ev);
+ 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);
+ }
}
}
nsObjectLoadingContent::nsObjectLoadingContent()
: mType(eType_Loading)
, mFallbackType(eFallbackAlternate)
, mRunID(0)
, mHasRunID(false)