Allow NSFileCoordinator to be called from WebContent process
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 May 2019 14:55:11 +0000 (14:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 May 2019 14:55:11 +0000 (14:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197895
<rdar://problem/50107679>

Patch by Alex Christensen <achristensen@webkit.org> on 2019-05-15
Reviewed by Brent Fulgham.

Source/WebKit:

* WebProcess/com.apple.WebProcess.sb.in:
Expand sandbox to allow use of com.apple.FileCoordination mach service like we do on iOS.

Tools:

Add a unit test that verifies calling the block succeeds.

* TestWebKitAPI/Tests/WebKitCocoa/AdditionalReadAccessAllowedURLsPlugin.mm:
(-[AdditionalReadAccessAllowedURLsPlugIn webProcessPlugIn:didCreateBrowserContextController:]):

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

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/com.apple.WebProcess.sb.in
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/AdditionalReadAccessAllowedURLsPlugin.mm

index 5df2e3d..b25a8b5 100644 (file)
@@ -1,3 +1,14 @@
+2019-05-15  Alex Christensen  <achristensen@webkit.org>
+
+        Allow NSFileCoordinator to be called from WebContent process
+        https://bugs.webkit.org/show_bug.cgi?id=197895
+        <rdar://problem/50107679>
+
+        Reviewed by Brent Fulgham.
+
+        * WebProcess/com.apple.WebProcess.sb.in:
+        Expand sandbox to allow use of com.apple.FileCoordination mach service like we do on iOS.
+
 2019-05-15  Devin Rousso  <drousso@apple.com>
 
         Web Automation: elements larger than the viewport have incorrect in-view center point
index eab254e..af6f30a 100644 (file)
 (allow mach-lookup
        (global-name "com.apple.webinspector"))
 
+(allow mach-lookup
+    (global-name "com.apple.FileCoordination"))
+
 ;; Various services required by AppKit and other frameworks
 (allow mach-lookup
 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 101400
         (syscall-number SYS_quotactl) ;; <rdar://problem/49945031>
         (syscall-number SYS_stat64_extended) ;; <rdar://problem/50473330>
         (syscall-number SYS_lstat64_extended)
+        (syscall-number SYS_iopolicysys)
+        (syscall-number SYS_workq_open)
+        (syscall-number SYS_getgroups)
     )
 )
 
index 40a60b5..63db5da 100644 (file)
@@ -1,3 +1,16 @@
+2019-05-15  Alex Christensen  <achristensen@webkit.org>
+
+        Allow NSFileCoordinator to be called from WebContent process
+        https://bugs.webkit.org/show_bug.cgi?id=197895
+        <rdar://problem/50107679>
+
+        Reviewed by Brent Fulgham.
+
+        Add a unit test that verifies calling the block succeeds.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/AdditionalReadAccessAllowedURLsPlugin.mm:
+        (-[AdditionalReadAccessAllowedURLsPlugIn webProcessPlugIn:didCreateBrowserContextController:]):
+
 2019-05-14  Andy Estes  <aestes@apple.com>
 
         [Apple Pay] Payment APIs should be completely disabled in web views into which clients have injected user scripts
index 1083367..f99e1ac 100644 (file)
 
     _interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(AdditionalReadAccessAllowedURLsProtocol)];
     [[browserContextController _remoteObjectRegistry] registerExportedObject:self interface:_interface.get()];
+
+    __block bool blockCalled = false;
+    NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
+    [coordinator coordinateReadingItemAtURL:[NSURL fileURLWithPath:@"/Applications/Safari.app"] options:NSFileCoordinatorReadingWithoutChanges error:nil byAccessor:^(NSURL *newURL) {
+        blockCalled = true;
+    }];
+    ASSERT(blockCalled);
 }
 
 - (void)dealloc