Bug 680528 - Make use of the cached UserAgent string in PluginModuleChild. r=bent
authorJim Mathies <jmathies@mozilla.com>
Fri, 19 Aug 2011 15:25:09 -0500
changeset 75580 008e94e45b29419c5e85fa7e71df10bb57278656
parent 75579 1d2621d8b9634dfd9c86b9286d792ecf6518c689
child 75581 2eb805907da1437d1b49750a20de078232602663
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersbent
bugs680528
milestone9.0a1
Bug 680528 - Make use of the cached UserAgent string in PluginModuleChild. r=bent
dom/plugins/ipc/PluginModuleChild.cpp
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -124,16 +124,17 @@ PluginModuleChild::PluginModuleChild()
   , mNestedEventHook(NULL)
   , mGlobalCallWndProcHook(NULL)
 #endif
 {
     NS_ASSERTION(!gInstance, "Something terribly wrong here!");
     memset(&mFunctions, 0, sizeof(mFunctions));
     memset(&mSavedData, 0, sizeof(mSavedData));
     gInstance = this;
+    mUserAgent.SetIsVoid(PR_TRUE);
 #ifdef XP_MACOSX
     mac_plugin_interposing::child::SetUpCocoaInterposing();
 #endif
 }
 
 PluginModuleChild::~PluginModuleChild()
 {
     NS_ASSERTION(gInstance == this, "Something terribly wrong here!");
@@ -724,17 +725,17 @@ PluginModuleChild::ActorDestroy(ActorDes
 void
 PluginModuleChild::CleanUp()
 {
 }
 
 const char*
 PluginModuleChild::GetUserAgent()
 {
-    if (!CallNPN_UserAgent(&mUserAgent))
+    if (mUserAgent.IsVoid() && !CallNPN_UserAgent(&mUserAgent))
         return NULL;
 
     return NullableStringGet(mUserAgent);
 }
 
 bool
 PluginModuleChild::RegisterActorForNPObject(NPObject* aObject,
                                             PluginScriptableObjectChild* aActor)