Bug 851378 - Avoid bogus assertion when trying to spawn disabled plugin. r=bsmedberg a=bbajaj
authorJohn Schoenick <jschoenick@mozilla.com>
Tue, 19 Mar 2013 15:38:58 -0700
changeset 128697 c1d39eba914547d82bc3c8b5ab9cf303461c81ab
parent 128696 6d8e9b790e81781601334047f9064c1eb52374ec
child 128698 d9aca7fdb287ec2d9278247ec97553f4325a5052
push id3561
push userjschoenick@mozilla.com
push dateWed, 27 Mar 2013 18:06:48 +0000
treeherdermozilla-aurora@d9aca7fdb287 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, bbajaj
bugs851378
milestone21.0a2
Bug 851378 - Avoid bogus assertion when trying to spawn disabled plugin. r=bsmedberg a=bbajaj
dom/plugins/base/nsPluginHost.cpp
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1045,31 +1045,32 @@ nsPluginHost::TrySetUpPluginInstance(con
 
   PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL,
         ("nsPluginHost::TrySetupPluginInstance Begin mime=%s, owner=%p, url=%s\n",
         aMimeType, aOwner, urlSpec.get()));
 
   PR_LogFlush();
 #endif
 
+  nsRefPtr<nsNPAPIPlugin> plugin;
+  GetPlugin(aMimeType, getter_AddRefs(plugin));
+  if (!plugin) {
+    return NS_ERROR_FAILURE;
+  }
+
   nsPluginTag* pluginTag = FindPluginForType(aMimeType, true);
+
   NS_ASSERTION(pluginTag, "Must have plugin tag here!");
 
 #if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER)
   if (pluginTag->mIsFlashPlugin) {
     CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FlashVersion"), pluginTag->mVersion);
   }
 #endif
 
-  nsRefPtr<nsNPAPIPlugin> plugin;
-  GetPlugin(aMimeType, getter_AddRefs(plugin));
-  if (!plugin) {
-    return NS_ERROR_FAILURE;
-  }
-
   nsRefPtr<nsNPAPIPluginInstance> instance = new nsNPAPIPluginInstance();
 
   // This will create the owning reference. The connection must be made between the
   // instance and the instance owner before initialization. Plugins can call into
   // the browser during initialization.
   aOwner->SetInstance(instance.get());
 
   // Add the instance to the instances list before we call NPP_New so that