Changeset 149619 in webkit
- Timestamp:
- May 6, 2013 11:40:29 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r149618 r149619 1 2013-05-06 Alexey Proskuryakov <ap@apple.com> 2 3 <rdar://problem/13479806> [Mac] Pass plug-in bundle ID to LaunchServices 4 https://bugs.webkit.org/show_bug.cgi?id=115483 5 6 Reviewed by Darin Adler. 7 8 * PluginProcess/PluginProcess.h: Added m_pluginBundleIdentifier. We now need it 9 in multiple places, so it's easier to pre-compute it. 10 11 * PluginProcess/mac/PluginProcessMac.mm: 12 (WebKit::loadSandboxProfileForDirectory): Changed to use precomputed bundle ID. 13 (WebKit::loadSandboxProfile): Ditto. 14 (WebKit::PluginProcess::platformInitializeProcess): Pre-compute bundle ID. 15 (WebKit::PluginProcess::initializeProcessName): Pass it to LaunchServices. 16 (WebKit::PluginProcess::initializeSandbox): Pass precomputed bundle ID instead of 17 a path. 18 1 19 2013-05-06 Anders Carlsson <andersca@apple.com> 2 20 -
trunk/Source/WebKit2/PluginProcess/PluginProcess.h
r148038 r149619 98 98 String m_pluginPath; 99 99 100 #if PLATFORM(MAC) 101 String m_pluginBundleIdentifier; 102 #endif 103 100 104 // The plug-in module. 101 105 RefPtr<NetscapePluginModule> m_pluginModule; -
trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm
r149255 r149619 45 45 using namespace WebCore; 46 46 47 const CFStringRef kLSPlugInBundleIdentifierKey = CFSTR("LSPlugInBundleIdentifierKey"); 48 47 49 namespace WebKit { 48 50 … … 281 283 } 282 284 283 static String loadSandboxProfileForDirectory(const String& pluginPath, NSString *sandboxProfileDirectoryPath) 284 { 285 RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false)); 286 if (!pluginURL) 287 return String(); 288 289 RetainPtr<CFBundleRef> pluginBundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, pluginURL.get())); 290 if (!pluginBundle) 291 return String(); 292 293 String bundleIdentifier = CFBundleGetIdentifier(pluginBundle.get()); 285 static String loadSandboxProfileForDirectory(const String& bundleIdentifier, NSString *sandboxProfileDirectoryPath) 286 { 294 287 if (bundleIdentifier.isEmpty()) 295 288 return String(); 296 289 297 290 // Fold all / characters to : to prevent the plugin bundle-id from trying to escape the profile directory 298 bundleIdentifier.replace('/', ':'); 291 String sanitizedBundleIdentifier = bundleIdentifier; 292 sanitizedBundleIdentifier.replace('/', ':'); 299 293 300 294 RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, (CFStringRef)sandboxProfileDirectoryPath, kCFURLPOSIXPathStyle, TRUE)); 301 295 302 RetainPtr<CFStringRef> sandboxFileName = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier.createCFString().get()));296 RetainPtr<CFStringRef> sandboxFileName = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), sanitizedBundleIdentifier.createCFString().get())); 303 297 RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get())); 304 298 … … 316 310 } 317 311 318 static String loadSandboxProfile(const String& pluginPath)312 static String loadSandboxProfile(const String& bundleIdentifier) 319 313 { 320 314 // First look in the WebKit2 bundle. 321 String sandboxProfile = loadSandboxProfileForDirectory( pluginPath, [[[NSBundle bundleForClass:NSClassFromString(@"WKView")] resourcePath] stringByAppendingPathComponent:@"PlugInSandboxProfiles"]);315 String sandboxProfile = loadSandboxProfileForDirectory(bundleIdentifier, [[[NSBundle bundleForClass:NSClassFromString(@"WKView")] resourcePath] stringByAppendingPathComponent:@"PlugInSandboxProfiles"]); 322 316 if (!sandboxProfile.isEmpty()) 323 317 return sandboxProfile; 324 318 325 319 // Then try /System/Library/Sandbox/Profiles/. 326 sandboxProfile = loadSandboxProfileForDirectory( pluginPath, @"/System/Library/Sandbox/Profiles/");320 sandboxProfile = loadSandboxProfileForDirectory(bundleIdentifier, @"/System/Library/Sandbox/Profiles/"); 327 321 if (!sandboxProfile.isEmpty()) 328 322 return sandboxProfile; … … 365 359 [defaults release]; 366 360 #endif 361 362 RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, m_pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false)); 363 if (!pluginURL) 364 return; 365 366 RetainPtr<CFBundleRef> pluginBundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, pluginURL.get())); 367 if (!pluginBundle) 368 return; 369 370 m_pluginBundleIdentifier = CFBundleGetIdentifier(pluginBundle.get()); 367 371 } 368 372 … … 371 375 NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ (%@ Internet plug-in)", "visible name of the plug-in host process. The first argument is the plug-in name and the second argument is the application name."), [[(NSString *)m_pluginPath lastPathComponent] stringByDeletingPathExtension], (NSString *)parameters.uiProcessName]; 372 376 WKSetVisibleApplicationName((CFStringRef)applicationName); 377 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 378 if (!m_pluginBundleIdentifier.isEmpty()) 379 WKSetApplicationInformationItem(kLSPlugInBundleIdentifierKey, m_pluginBundleIdentifier.createCFString().get()); 380 #endif 373 381 } 374 382 375 383 void PluginProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters) 376 384 { 377 String sandboxProfile = loadSandboxProfile(m_plugin Path);385 String sandboxProfile = loadSandboxProfile(m_pluginBundleIdentifier); 378 386 if (sandboxProfile.isEmpty()) 379 387 return;
Note: See TracChangeset
for help on using the changeset viewer.