Modified: branches/safari-601.1.32-branch/Source/WebKit2/ChangeLog (184276 => 184277)
--- branches/safari-601.1.32-branch/Source/WebKit2/ChangeLog 2015-05-13 07:01:03 UTC (rev 184276)
+++ branches/safari-601.1.32-branch/Source/WebKit2/ChangeLog 2015-05-13 07:02:48 UTC (rev 184277)
@@ -1,3 +1,22 @@
+2015-05-13 Babak Shafiei <[email protected]>
+
+ Merge r184125.
+
+ 2015-05-11 Anders Carlsson <[email protected]>
+
+ Simplify shim path computation
+ https://bugs.webkit.org/show_bug.cgi?id=144884
+ Part of rdar://problem/19708579.
+
+ Reviewed by Sam Weinig.
+
+ Factor the code that computes the shim path out into a separate function. Also make this mac only
+ since we don't have any shims on iOS.
+
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::computeProcessShimPath):
+ (WebKit::addDYLDEnvironmentAdditions):
+
2015-05-12 Babak Shafiei <[email protected]>
Merge r184061.
Modified: branches/safari-601.1.32-branch/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (184276 => 184277)
--- branches/safari-601.1.32-branch/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2015-05-13 07:01:03 UTC (rev 184276)
+++ branches/safari-601.1.32-branch/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2015-05-13 07:02:48 UTC (rev 184277)
@@ -93,44 +93,52 @@
}
#endif
-static void addDYLDEnvironmentAdditions(const ProcessLauncher::LaunchOptions& launchOptions, bool isWebKitDevelopmentBuild, EnvironmentVariables& environmentVariables)
+#if PLATFORM(MAC)
+static RetainPtr<NSString> computeProcessShimPath(const ProcessLauncher::LaunchOptions& launchOptions, NSBundle *webKitBundle)
{
- DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], _NSGetMachExecuteHeader()->cputype);
- environmentExtractor.getExtractedEnvironmentVariables(environmentVariables);
-
- NSBundle *webKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"];
- NSString *frameworksPath = [[webKitBundle bundlePath] stringByDeletingLastPathComponent];
-
- // To make engineering builds work, if the path is outside of /System set up
- // DYLD_FRAMEWORK_PATH to pick up other frameworks, but don't do it for the
- // production configuration because it involves extra file system access.
- if (isWebKitDevelopmentBuild)
- environmentVariables.appendValue("DYLD_FRAMEWORK_PATH", [frameworksPath fileSystemRepresentation], ':');
-
- NSString *processShimPathNSString = nil;
#if ENABLE(NETSCAPE_PLUGIN_API)
if (launchOptions.processType == ProcessLauncher::PluginProcess) {
NSString *processPath = [webKitBundle pathForAuxiliaryExecutable:@"PluginProcess.app"];
NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath];
- processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
- } else
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
+ return [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
+ }
+#endif
+
#if ENABLE(NETWORK_PROCESS)
if (launchOptions.processType == ProcessLauncher::NetworkProcess) {
NSString *processPath = [webKitBundle pathForAuxiliaryExecutable:@"NetworkProcess.app"];
NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath];
- processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"SecItemShim.dylib"];
- } else
-#endif // ENABLE(NETWORK_PROCESS)
+ return [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"SecItemShim.dylib"];
+ }
+#endif
+
if (launchOptions.processType == ProcessLauncher::WebProcess) {
NSString *processPath = [webKitBundle pathForAuxiliaryExecutable:@"WebProcess.app"];
NSString *processAppExecutablePath = [[NSBundle bundleWithPath:processPath] executablePath];
- processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"WebProcessShim.dylib"];
+ return [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"WebProcessShim.dylib"];
}
+ return nil;
+}
+#endif
+
+static void addDYLDEnvironmentAdditions(const ProcessLauncher::LaunchOptions& launchOptions, bool isWebKitDevelopmentBuild, EnvironmentVariables& environmentVariables)
+{
+ DynamicLinkerEnvironmentExtractor environmentExtractor([[NSBundle mainBundle] executablePath], _NSGetMachExecuteHeader()->cputype);
+ environmentExtractor.getExtractedEnvironmentVariables(environmentVariables);
+
+ NSBundle *webKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"];
+ NSString *frameworksPath = [[webKitBundle bundlePath] stringByDeletingLastPathComponent];
+
+ // To make engineering builds work, if the path is outside of /System set up
+ // DYLD_FRAMEWORK_PATH to pick up other frameworks, but don't do it for the
+ // production configuration because it involves extra file system access.
+ if (isWebKitDevelopmentBuild)
+ environmentVariables.appendValue("DYLD_FRAMEWORK_PATH", [frameworksPath fileSystemRepresentation], ':');
+
#if ASAN_ENABLED
static const char* asanLibraryPath = copyASanDynamicLibraryPath();
ASSERT(asanLibraryPath); // ASan runtime library was not found in the current process. This code may need to be updated if the library name has changed.
@@ -139,14 +147,15 @@
environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", asanLibraryPath, ':');
#endif
- // Make sure that the shim library file exists and insert it.
- if (processShimPathNSString) {
- const char* processShimPath = [processShimPathNSString fileSystemRepresentation];
+#if PLATFORM(MAC)
+ if (auto shimPath = computeProcessShimPath(launchOptions, webKitBundle)) {
+ // Make sure that the shim library file exists and insert it.
+ const char* processShimPath = [shimPath fileSystemRepresentation];
struct stat statBuf;
if (stat(processShimPath, &statBuf) == 0 && (statBuf.st_mode & S_IFMT) == S_IFREG)
environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", processShimPath, ':');
}
-
+#endif
}
typedef void (ProcessLauncher::*DidFinishLaunchingProcessFunction)(PlatformProcessIdentifier, IPC::Connection::Identifier);