Bug 644585 - Firefox 4 cannot find plugins (on Windows) whose path contains non-ASCII characters. The path which we pass around within plugin-land (nsPluginTag.mFullPath and several similar variants) is UTF8, not a natively-encoded path. The IPC code needs to respect that. r=josh a=dveditz
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 07 Apr 2011 17:13:59 -0700
changeset 63426 ceab2e4a52b5d67a189a648568e9c57eef1d8a93
parent 63425 714b1288f956a45c084b904e09e7f69c0efb38a8
child 63427 ff4efbda1b47b4f4e34ebd81ea00afd5dfc184f7
push id68
push usereakhgari@mozilla.com
push dateWed, 13 Apr 2011 18:10:35 +0000
reviewersjosh, dveditz
bugs644585
milestone2.0.1pre
Bug 644585 - Firefox 4 cannot find plugins (on Windows) whose path contains non-ASCII characters. The path which we pass around within plugin-land (nsPluginTag.mFullPath and several similar variants) is UTF8, not a natively-encoded path. The IPC code needs to respect that. r=josh a=dveditz
dom/plugins/PluginModuleChild.cpp
dom/plugins/PluginModuleChild.h
dom/plugins/PluginModuleParent.h
--- a/dom/plugins/PluginModuleChild.cpp
+++ b/dom/plugins/PluginModuleChild.cpp
@@ -181,19 +181,19 @@ PluginModuleChild::Init(const std::strin
        return false;
     }
 
     if (!InitGraphics())
         return false;
 
     mPluginFilename = aPluginFilename.c_str();
     nsCOMPtr<nsILocalFile> pluginFile;
-    NS_NewNativeLocalFile(mPluginFilename,
-                          PR_TRUE,
-                          getter_AddRefs(pluginFile));
+    NS_NewLocalFile(NS_ConvertUTF8toUTF16(mPluginFilename),
+                    PR_TRUE,
+                    getter_AddRefs(pluginFile));
 
     PRBool exists;
     pluginFile->Exists(&exists);
     NS_ASSERTION(exists, "plugin file ain't there");
 
     nsCOMPtr<nsIFile> pluginIfile;
     pluginIfile = do_QueryInterface(pluginFile);
 
--- a/dom/plugins/PluginModuleChild.h
+++ b/dom/plugins/PluginModuleChild.h
@@ -156,16 +156,17 @@ protected:
     ActorDestroy(ActorDestroyReason why);
 
     NS_NORETURN void QuickExit();
 
 public:
     PluginModuleChild();
     virtual ~PluginModuleChild();
 
+    // aPluginFilename is UTF8, not native-charset!
     bool Init(const std::string& aPluginFilename,
               base::ProcessHandle aParentProcessHandle,
               MessageLoop* aIOLoop,
               IPC::Channel* aChannel);
 
     void CleanUp();
 
     const char* GetUserAgent();
@@ -277,17 +278,17 @@ private:
 
     NS_OVERRIDE
     virtual void EnteredCxxStack();
     NS_OVERRIDE
     virtual void ExitedCxxStack();
 #endif
 
     PRLibrary* mLibrary;
-    nsCString mPluginFilename;
+    nsCString mPluginFilename; // UTF8
     nsCString mUserAgent;
     int mQuirks;
 
     // we get this from the plugin
     NP_PLUGINSHUTDOWN mShutdownFunc;
 #ifdef OS_LINUX
     NP_PLUGINUNIXINIT mInitializeFunc;
 #elif defined(OS_WIN) || defined(OS_MACOSX)
--- a/dom/plugins/PluginModuleParent.h
+++ b/dom/plugins/PluginModuleParent.h
@@ -101,16 +101,17 @@ protected:
                          const InfallibleTArray<nsCString>& aNames,
                          const InfallibleTArray<nsCString>& aValues,
                          NPError* rv);
 
     virtual bool
     DeallocPPluginInstance(PPluginInstanceParent* aActor);
 
 public:
+    // aFilePath is UTF8, not native!
     PluginModuleParent(const char* aFilePath);
     virtual ~PluginModuleParent();
 
     NS_OVERRIDE virtual void SetPlugin(nsNPAPIPlugin* plugin)
     {
         mPlugin = plugin;
     }