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
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 07 Apr 2011 17:13:59 -0700
changeset 67685 5c7b908fc1ccef45c947b2b1495d852d0fc106f7
parent 67684 ed2f1691ff2f0606c8c8f752af13ed7c62be0b1b
child 67686 2038ba37a2e88d40dbcfee9bfe21362c6820b318
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh
bugs644585
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
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;
     }