Use a MIG call when creating a plug-in property list file
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2012 22:19:50 +0000 (22:19 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2012 22:19:50 +0000 (22:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84084
<rdar://problem/11197341>

Reviewed by Sam Weinig.

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::createPropertyListFile):
Get a plug-in host and call _WKPHCreatePluginMIMETypesPreferences instead.

* Plugins/Hosted/WebKitPluginHost.defs:
Add PHCreatePluginMIMETypesPreferences.

* Plugins/WebNetscapePluginPackage.mm:
(-[WebNetscapePluginPackage createPropertyListFile]):
NetscapePluginHostManager::createPropertyListFile is no longer a static member function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114307 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm

index f09e978..079f8c3 100644 (file)
@@ -1,3 +1,22 @@
+2012-04-16  Anders Carlsson  <andersca@apple.com>
+
+        Use a MIG call when creating a plug-in property list file
+        https://bugs.webkit.org/show_bug.cgi?id=84084
+        <rdar://problem/11197341>
+
+        Reviewed by Sam Weinig.
+
+        * Plugins/Hosted/NetscapePluginHostManager.mm:
+        (WebKit::NetscapePluginHostManager::createPropertyListFile):
+        Get a plug-in host and call _WKPHCreatePluginMIMETypesPreferences instead.
+
+        * Plugins/Hosted/WebKitPluginHost.defs:
+        Add PHCreatePluginMIMETypesPreferences.
+
+        * Plugins/WebNetscapePluginPackage.mm:
+        (-[WebNetscapePluginPackage createPropertyListFile]):
+        NetscapePluginHostManager::createPropertyListFile is no longer a static member function.
+
 2012-04-12  Andy Estes  <aestes@apple.com>
 
         REGRESSION (r102262): iAd Producer relies on CSSStyleDeclaration property setters respecting '!important'
index 4e59456..64e37e1 100644 (file)
@@ -48,7 +48,7 @@ public:
 
     void pluginHostDied(NetscapePluginHostProxy*);
 
-    static void createPropertyListFile(const WTF::String& pluginPath, cpu_type_t pluginArchitecture);
+    void createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier);
     
     void didCreateWindow();
     
index c510a9a..e49d50f 100644 (file)
@@ -272,31 +272,13 @@ PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePl
     return instance.release();
 }
 
-void NetscapePluginHostManager::createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture)
-{   
-    NSString *pluginHostAppPath = [[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] pathForAuxiliaryExecutable:pluginHostAppName];
-    NSString *pluginHostAppExecutablePath = [[NSBundle bundleWithPath:pluginHostAppPath] executablePath];
-    NSString *bundlePath = pluginPath;
+void NetscapePluginHostManager::createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier)
+{
+    NetscapePluginHostProxy* hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier);
+    if (!hostProxy)
+        return;
 
-    pid_t pid;
-    posix_spawnattr_t attr;
-    posix_spawnattr_init(&attr);
-    
-    // Set the architecture.
-    size_t ocount = 0;
-    int cpuTypes[] = { pluginArchitecture };
-    posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &ocount);
-    
-    // Spawn the plug-in host and tell it to call the registration function.
-    const char* args[] = { [pluginHostAppExecutablePath fileSystemRepresentation], "-createPluginMIMETypesPreferences", [bundlePath fileSystemRepresentation], 0 };
-    
-    int result = posix_spawn(&pid, args[0], 0, &attr, const_cast<char* const*>(args), 0);
-    posix_spawnattr_destroy(&attr);
-    
-    if (!result && pid > 0) {
-        // Wait for the process to finish.
-        while (waitpid(pid, 0,  0) == -1) { }
-    }
+    _WKPHCreatePluginMIMETypesPreferences(hostProxy->port());
 }
     
 void NetscapePluginHostManager::didCreateWindow()
index 59b7a8f..ecf01b3 100644 (file)
@@ -246,3 +246,5 @@ simpleroutine PHPluginInstanceSnapshot(pluginHostPort :mach_port_t;
                                     requestID :uint32_t;
                                     width :uint32_t;
                                     height :uint32_t);
+
+routine PHCreatePluginMIMETypesPreferences(pluginHostPort :mach_port_t);
index 5bcff24..533b539 100644 (file)
@@ -321,7 +321,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 - (void)createPropertyListFile
 {
-    NetscapePluginHostManager::createPropertyListFile(path, pluginHostArchitecture);
+    NetscapePluginHostManager::shared().createPropertyListFile(path, pluginHostArchitecture, [self bundleIdentifier]);
 }
 
 #endif