From fe10a735c45d462dcfa465139d3ba6a99ab9c3d2 Mon Sep 17 00:00:00 2001 From: "andersca@apple.com" Date: Mon, 16 Apr 2012 22:19:50 +0000 Subject: [PATCH] Use a MIG call when creating a plug-in property list file https://bugs.webkit.org/show_bug.cgi?id=84084 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 | 19 ++++++++++++++ .../mac/Plugins/Hosted/NetscapePluginHostManager.h | 2 +- .../Plugins/Hosted/NetscapePluginHostManager.mm | 30 +++++----------------- .../mac/Plugins/Hosted/WebKitPluginHost.defs | 2 ++ .../WebKit/mac/Plugins/WebNetscapePluginPackage.mm | 2 +- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index f09e978..079f8c3 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,22 @@ +2012-04-16 Anders Carlsson + + Use a MIG call when creating a plug-in property list file + https://bugs.webkit.org/show_bug.cgi?id=84084 + + + 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 REGRESSION (r102262): iAd Producer relies on CSSStyleDeclaration property setters respecting '!important' diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h index 4e59456..64e37e1 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h @@ -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(); diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm index c510a9a..e49d50f 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm @@ -272,31 +272,13 @@ PassRefPtr 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(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() diff --git a/Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs b/Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs index 59b7a8f..ecf01b3 100644 --- a/Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs +++ b/Source/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs @@ -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); diff --git a/Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm b/Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm index 5bcff24..533b539 100644 --- a/Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm +++ b/Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm @@ -321,7 +321,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer); - (void)createPropertyListFile { - NetscapePluginHostManager::createPropertyListFile(path, pluginHostArchitecture); + NetscapePluginHostManager::shared().createPropertyListFile(path, pluginHostArchitecture, [self bundleIdentifier]); } #endif -- 2.7.4