Changeset 128003 in webkit
- Timestamp:
- Sep 9, 2012 3:48:00 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r127991 r128003 1 2012-09-08 Sam Weinig <sam@webkit.org> 2 3 Switch to entering the sandbox directly from main(), rather than waiting for the initialization message 4 https://bugs.webkit.org/show_bug.cgi?id=96194 5 6 Reviewed by Dan Bernstein. 7 8 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: 9 (WebKit::ProcessLauncher::launchProcess): 10 Pass a client identifier to WebProcess as a command line argument 11 so that it can be used to create private temporary and cache directories. 12 13 * WebProcess/WebProcess.h: 14 (WebProcess): 15 * WebProcess/mac/WebProcessMac.mm: 16 (WebKit::WebProcess::initializeSandbox): 17 (WebKit::WebProcess::platformInitializeWebProcess): 18 Expose the initializeSandbox() function and stop calling it from platformInitializeWebProcess() 19 since it is now going to be called from WebProcessMain. Also, move changing the current working 20 directory to sandbox initialization function and replace use of creation parameters with just 21 the client identifier. 22 23 * WebProcess/com.apple.WebProcess.sb.in: 24 Add some new exceptions that come from entering the sandbox earlier in the AppKit 25 initialization process. Don't allow access to com.apple.coreservices.appleevents. 26 27 * WebProcess/mac/WebProcessMainMac.mm: 28 (WebKit::WebProcessMainXPC): 29 (WebKit::WebProcessMain): 30 Enter the sandbox explicitly, not waiting until the initialization message. Also, 31 since we now have an extra parameter for the client identifier, make the WebProcess 32 launches the UIProcess code path work by extracting a client identifier from the 33 client executable path. 34 1 35 2012-09-09 Patrick Gansterer <paroga@webkit.org> 2 36 -
trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r125361 r128003 223 223 RetainPtr<CFStringRef> cfLocalization(AdoptCF, WKCopyCFLocalizationPreferredName(NULL)); 224 224 CString localization = String(cfLocalization.get()).utf8(); 225 225 226 NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; 227 CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname(); 228 226 229 // Make a unique, per pid, per process launcher web process service name. 227 230 CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8(); 228 231 229 const char* args[] = { [processAppExecutablePath fileSystemRepresentation], frameworkExecutablePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), 0 };232 const char* args[] = { [processAppExecutablePath fileSystemRepresentation], frameworkExecutablePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), "-client-identifier", clientIdentifier.data(), 0 }; 230 233 231 234 // Register ourselves. -
trunk/Source/WebKit2/WebProcess/WebProcess.h
r127386 r128003 129 129 #if PLATFORM(MAC) 130 130 void initializeShim(); 131 void initializeSandbox(const String& clientIdentifier); 131 132 132 133 #if USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in
r127384 r128003 52 52 (home-literal "/Library/Preferences/com.apple.security.plist") 53 53 (home-literal "/Library/Preferences/com.apple.security.revocation.plist") 54 (home-literal "/Library/Preferences/com.apple.speech.recognition.AppleSpeechRecognition.prefs.plist") 54 55 (home-literal "/Library/Application Support/SyncServices/Local/ClientsWithChanges/com.apple.Keychain") 55 56 (home-regex #"/Library/Preferences/com\.apple\.driver\.(AppleBluetoothMultitouch\.mouse|AppleBluetoothMultitouch\.trackpad|AppleHIDMouse)\.plist$") … … 71 72 (subpath "/Library/QuickTime") 72 73 73 (home-subpath "/Library/Dictionaries")) 74 (home-subpath "/Library/Dictionaries") 75 (home-subpath "/Library/Keyboard Layouts") 76 (home-subpath "/Library/Input Methods")) 74 77 75 78 ;; This should be updated when <rdar://problem/9355830> is fixed. … … 148 151 (global-name "com.apple.cfnetwork.AuthBrokerAgent") 149 152 (global-name "com.apple.PowerManagement.control") 153 (global-name "com.apple.speech.recognitionserver") 150 154 151 155 ;; FIXME: This should be removed when <rdar://problem/9276393> is fixed. … … 188 192 (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2") 189 193 (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2-journal")) 194 195 (deny mach-lookup (with no-log) 196 (global-name "com.apple.coreservices.appleevents")) -
trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
r127384 r128003 181 181 #endif 182 182 183 static void initializeSandbox(const WebProcessCreationParameters& parameters) 184 { 183 void WebProcess::initializeSandbox(const String& clientIdentifier) 184 { 185 [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] bundlePath]]; 186 185 187 #if ENABLE(WEB_PROCESS_SANDBOX) 186 188 … … 192 194 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 193 195 // Use private temporary and cache directories. 194 String systemDirectorySuffix = "com.apple.WebProcess+" + parameters.uiProcessBundleIdentifier;196 String systemDirectorySuffix = "com.apple.WebProcess+" + clientIdentifier; 195 197 setenv("DIRHELPER_USER_DIR_SUFFIX", fileSystemRepresentation(systemDirectorySuffix).data(), 0); 196 198 char temporaryDirectory[PATH_MAX]; … … 249 251 void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder*) 250 252 { 251 [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] bundlePath]];252 253 initializeSandbox(parameters);254 255 253 SandboxExtension::consumePermanently(parameters.uiProcessBundleResourcePathExtensionHandle); 256 254 SandboxExtension::consumePermanently(parameters.localStorageDirectoryExtensionHandle); -
trunk/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm
r125944 r128003 30 30 #import "EnvironmentUtilities.h" 31 31 #import "EnvironmentVariables.h" 32 #import "StringUtilities.h" 32 33 #import "WebProcess.h" 33 34 #import "WebSystemInterface.h" … … 94 95 RunLoop::initializeMainRunLoop(); 95 96 96 // Initialize the shim.97 97 // FIXME: Make the shim work. 98 98 WebProcess::shared().initializeShim(); 99 100 // Create the connection.99 // FIXME: Pass the client identifier here. 100 WebProcess::shared().initializeSandbox(String()); 101 101 WebProcess::shared().initialize(CoreIPC::Connection::Identifier(serverPort, xpcConnection), RunLoop::main()); 102 102 … … 125 125 if (serviceName.isEmpty() && clientExecutable.isEmpty()) 126 126 return EXIT_FAILURE; 127 128 String clientIdentifier; 127 129 128 130 // Get the server port. … … 133 135 WTFLogAlways("bootstrap_look_up result: %s (%x)\n", mach_error_string(kr), kr); 134 136 return 2; 137 } 138 139 clientIdentifier = commandLine["client-identifier"]; 140 if (!clientIdentifier) { 141 WTFLogAlways("No client identifier passed to the WebProcess"); 142 return EXIT_FAILURE; 135 143 } 136 144 } … … 186 194 return EXIT_FAILURE; 187 195 } 196 197 RetainPtr<NSURL> clientExecutableURL = adoptNS([[NSURL alloc] initFileURLWithPath:nsStringFromWebCoreString(clientExecutable)]); 198 RetainPtr<CFURLRef> clientBundleURL = adoptCF(WKCopyBundleURLForExecutableURL((CFURLRef)clientExecutableURL.get())); 199 RetainPtr<NSBundle> clientBundle = adoptNS([[NSBundle alloc] initWithURL:(NSURL *)clientBundleURL.get()]); 200 201 clientIdentifier = [clientBundle.get() bundleIdentifier]; 202 if (!clientIdentifier) { 203 WTFLogAlways("Failed to obtain bundle identifier from the client executable. .\n"); 204 return EXIT_FAILURE; 205 } 188 206 } 189 207 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 … … 207 225 RunLoop::initializeMainRunLoop(); 208 226 209 // Initialize the shim.210 WebProcess::shared().initializeShim();211 212 // Create the connection.213 WebProcess::shared().initialize(CoreIPC::Connection::Identifier(serverPort), RunLoop::main());214 215 [pool drain];216 217 227 #if USE(APPKIT) 218 228 // Initialize AppKit. … … 224 234 #endif 225 235 236 WebProcess::shared().initializeShim(); 237 WebProcess::shared().initializeSandbox(clientIdentifier); 238 WebProcess::shared().initialize(CoreIPC::Connection::Identifier(serverPort), RunLoop::main()); 239 226 240 WKAXRegisterRemoteApp(); 227 241 242 [pool drain]; 243 228 244 RunLoop::run(); 229 245 -
trunk/Tools/Scripts/run-test-webkit-api
r103640 r128003 27 27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 # Simplified "run" script for launching the WebKit2estWebKitAPI.29 # Simplified "run" script for launching TestWebKitAPI. 30 30 31 31 use strict; -
trunk/WebKitLibraries/ChangeLog
r127318 r128003 1 2012-09-08 Sam Weinig <sam@webkit.org> 2 3 Switch to entering the sandbox directly from main(), rather than waiting for the initialization message 4 https://bugs.webkit.org/show_bug.cgi?id=96194 5 6 Reviewed by Dan Bernstein. 7 8 Update WKSI with SPI for getting the bundle URL from an executable URL. 9 10 * WebKitSystemInterface.h: 11 * libWebKitSystemInterfaceLion.a: 12 * libWebKitSystemInterfaceMountainLion.a: 13 * libWebKitSystemInterfaceSnowLeopard.a: 14 Adds WKCopyBundleURLForExecutableURL(). 15 1 16 2012-08-29 Tony Chang <tony@chromium.org> 2 17 -
trunk/WebKitLibraries/WebKitSystemInterface.h
r124799 r128003 249 249 250 250 void WKSetVisibleApplicationName(CFStringRef); 251 252 CFURLRef WKCopyBundleURLForExecutableURL(CFURLRef); 251 253 252 254 typedef enum {
Note: See TracChangeset
for help on using the changeset viewer.