- Revision
- 294188
- Author
- timothy_hor...@apple.com
- Date
- 2022-05-13 23:14:52 -0700 (Fri, 13 May 2022)
Log Message
ApplePayLogoSystemImage needlessly loads PassKit in WebKit child processes on iOS
https://bugs.webkit.org/show_bug.cgi?id=240404
<rdar://93070349>
Reviewed by Chris Dumez.
Source/WebCore:
* Modules/applepay/ApplePayLogoSystemImage.mm:
(WebCore::passKitBundle):
Adopt systemDirectoryPath instead of unnecessarily loading PassKit just
to find its bundle path (the previous implementation made use of the fact
that `dlopen` internally adjusts the search path to look in the simulator
root, but also resulted in wasted time loading and initializing PassKit
and its dependencies).
Source/WebKit:
* UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
(WebKit::ProcessLauncher::launchProcess): Adopt the WTF implementation of systemDirectoryPath.
(WebKit::systemDirectoryPath): Moved to WTF.
Source/WTF:
* wtf/FileSystem.h:
* wtf/cocoa/FileSystemCocoa.mm:
(WTF::FileSystemImpl::systemDirectoryPath):
Move the implementation of systemDirectoryPath() from WebKit2.
systemDirectoryPath() provides the correct path to /System
in the simulator, for consumption by APIs (like NSURL) that do not
adjust to the simulator-rooted path themselves.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (294187 => 294188)
--- trunk/Source/WTF/ChangeLog 2022-05-14 05:29:41 UTC (rev 294187)
+++ trunk/Source/WTF/ChangeLog 2022-05-14 06:14:52 UTC (rev 294188)
@@ -1,5 +1,22 @@
2022-05-13 Tim Horton <timothy_hor...@apple.com>
+ ApplePayLogoSystemImage needlessly loads PassKit in WebKit child processes on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=240404
+ <rdar://93070349>
+
+ Reviewed by Chris Dumez.
+
+ * wtf/FileSystem.h:
+ * wtf/cocoa/FileSystemCocoa.mm:
+ (WTF::FileSystemImpl::systemDirectoryPath):
+ Move the implementation of systemDirectoryPath() from WebKit2.
+
+ systemDirectoryPath() provides the correct path to /System
+ in the simulator, for consumption by APIs (like NSURL) that do not
+ adjust to the simulator-rooted path themselves.
+
+2022-05-13 Tim Horton <timothy_hor...@apple.com>
+
Add UI-side layers for optionally indicating interaction regions
https://bugs.webkit.org/show_bug.cgi?id=240372
<rdar://problem/87170289>
Modified: trunk/Source/WTF/wtf/FileSystem.h (294187 => 294188)
--- trunk/Source/WTF/wtf/FileSystem.h 2022-05-14 05:29:41 UTC (rev 294187)
+++ trunk/Source/WTF/wtf/FileSystem.h 2022-05-14 06:14:52 UTC (rev 294188)
@@ -204,6 +204,7 @@
#if PLATFORM(COCOA)
WTF_EXPORT_PRIVATE NSString *createTemporaryDirectory(NSString *directoryPrefix);
+WTF_EXPORT_PRIVATE NSString *systemDirectoryPath();
// Allow reading cloud files with no local copy.
enum class PolicyScope : uint8_t { Process, Thread };
Modified: trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm (294187 => 294188)
--- trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm 2022-05-14 05:29:41 UTC (rev 294187)
+++ trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm 2022-05-14 06:14:52 UTC (rev 294188)
@@ -236,5 +236,19 @@
return true;
}
+NSString *systemDirectoryPath()
+{
+ static NeverDestroyed<RetainPtr<NSString>> path = ^{
+#if PLATFORM(IOS_FAMILY_SIMULATOR)
+ char *simulatorRoot = getenv("SIMULATOR_ROOT");
+ return simulatorRoot ? [NSString stringWithFormat:@"%s/System/", simulatorRoot] : @"/System/";
+#else
+ return @"/System/";
+#endif
+ }();
+
+ return path.get().get();
+}
+
} // namespace FileSystemImpl
} // namespace WTF
Modified: trunk/Source/WebCore/ChangeLog (294187 => 294188)
--- trunk/Source/WebCore/ChangeLog 2022-05-14 05:29:41 UTC (rev 294187)
+++ trunk/Source/WebCore/ChangeLog 2022-05-14 06:14:52 UTC (rev 294188)
@@ -1,3 +1,19 @@
+2022-05-13 Tim Horton <timothy_hor...@apple.com>
+
+ ApplePayLogoSystemImage needlessly loads PassKit in WebKit child processes on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=240404
+ <rdar://93070349>
+
+ Reviewed by Chris Dumez.
+
+ * Modules/applepay/ApplePayLogoSystemImage.mm:
+ (WebCore::passKitBundle):
+ Adopt systemDirectoryPath instead of unnecessarily loading PassKit just
+ to find its bundle path (the previous implementation made use of the fact
+ that `dlopen` internally adjusts the search path to look in the simulator
+ root, but also resulted in wasted time loading and initializing PassKit
+ and its dependencies).
+
2022-05-13 Tim Nguyen <n...@apple.com>
[css-ui] Unexpose appearance property values already handled by appearance: auto
Modified: trunk/Source/WebCore/Modules/applepay/ApplePayLogoSystemImage.mm (294187 => 294188)
--- trunk/Source/WebCore/Modules/applepay/ApplePayLogoSystemImage.mm 2022-05-14 05:29:41 UTC (rev 294187)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayLogoSystemImage.mm 2022-05-14 06:14:52 UTC (rev 294188)
@@ -41,12 +41,7 @@
static NSBundle *passKitBundle;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
-#if PLATFORM(MAC)
- passKitBundle = [NSBundle bundleWithURL:[NSURL fileURLWithPath:@"/System/Library/PrivateFrameworks/PassKit.framework" isDirectory:YES]];
-#else
- dlopen("/System/Library/Frameworks/PassKit.framework/PassKit", RTLD_NOW);
- passKitBundle = [NSBundle bundleForClass:NSClassFromString(@"PKPaymentAuthorizationViewController")];
-#endif
+ passKitBundle = [NSBundle bundleWithURL:[NSURL fileURLWithPath:[FileSystem::systemDirectoryPath() stringByAppendingPathComponent:@"Library/Frameworks/PassKit.framework"] isDirectory:YES]];
});
return passKitBundle;
}
Modified: trunk/Source/WebKit/ChangeLog (294187 => 294188)
--- trunk/Source/WebKit/ChangeLog 2022-05-14 05:29:41 UTC (rev 294187)
+++ trunk/Source/WebKit/ChangeLog 2022-05-14 06:14:52 UTC (rev 294188)
@@ -1,3 +1,15 @@
+2022-05-13 Tim Horton <timothy_hor...@apple.com>
+
+ ApplePayLogoSystemImage needlessly loads PassKit in WebKit child processes on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=240404
+ <rdar://93070349>
+
+ Reviewed by Chris Dumez.
+
+ * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
+ (WebKit::ProcessLauncher::launchProcess): Adopt the WTF implementation of systemDirectoryPath.
+ (WebKit::systemDirectoryPath): Moved to WTF.
+
2022-05-13 Wenson Hsieh <wenson_hs...@apple.com>
ImageAnalysisQueue should reanalyze image elements whose image sources have changed
Modified: trunk/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm (294187 => 294188)
--- trunk/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm 2022-05-14 05:29:41 UTC (rev 294187)
+++ trunk/Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm 2022-05-14 06:14:52 UTC (rev 294188)
@@ -38,6 +38,7 @@
#import <spawn.h>
#import <sys/param.h>
#import <sys/stat.h>
+#import <wtf/FileSystem.h>
#import <wtf/MachSendRight.h>
#import <wtf/RunLoop.h>
#import <wtf/SoftLinking.h>
@@ -101,20 +102,6 @@
#endif
}
-static NSString *systemDirectoryPath()
-{
- static NeverDestroyed<RetainPtr<NSString>> path = adoptNS([^{
-#if PLATFORM(IOS_FAMILY_SIMULATOR)
- char *simulatorRoot = getenv("SIMULATOR_ROOT");
- return simulatorRoot ? [NSString stringWithFormat:@"%s/System/", simulatorRoot] : @"/System/";
-#else
- return @"/System/";
-#endif
- }() copy]);
-
- return path.get().get();
-}
-
void ProcessLauncher::launchProcess()
{
ASSERT(!m_xpcConnection);
@@ -220,7 +207,7 @@
xpc_dictionary_set_string(bootstrapMessage.get(), "ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String]);
xpc_dictionary_set_string(bootstrapMessage.get(), "service-name", name);
- bool isWebKitDevelopmentBuild = ![[[[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] bundlePath] stringByDeletingLastPathComponent] hasPrefix:systemDirectoryPath()];
+ bool isWebKitDevelopmentBuild = ![[[[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] bundlePath] stringByDeletingLastPathComponent] hasPrefix:FileSystem::systemDirectoryPath()];
if (isWebKitDevelopmentBuild) {
xpc_dictionary_set_fd(bootstrapMessage.get(), "stdout", STDOUT_FILENO);
xpc_dictionary_set_fd(bootstrapMessage.get(), "stderr", STDERR_FILENO);