| Differences between
and this patch
- a/Source/WebKit/ChangeLog +33 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2020-10-10  Jiewen Tan  <jiewen_tan@apple.com>
2
3
        [WebAuthn] Implement a dummy WebAuthenticationAgent Part 2
4
        https://bugs.webkit.org/show_bug.cgi?id=217559
5
        <rdar://problem/70168749>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        This is a WIP patch. Just uploaded to showcase some problems I have encountered during this investigation.
10
11
        Two major road blockers are identified to make this daemon really happen.
12
        1) The major one is on macOS. New daemons cannot be installed without a system update. It means relocatable Safari (e.g. STP)
13
        and staged Safari on downlevel OSes will not get this feature. And relocatable STP can only utilize the system daemon. This
14
        seems a bimmer especailly for the STP case given it is heavily used to test latest web features. On the other hand, This patch
15
        showcases things we can do for non-staged Safari and staged Safari on +1 OSes (not completed). For non-staged Safari, the installation
16
        process can place a symlink of the launchd plist on /System/... to point to a location that is owned by WebKit/Safari which is outside
17
        of the system partition, and then staged/none-staged Safari can update this plist to point to the right binary. This location is well
18
        established for Safari daemons, but it is unknown whether WebKit can directly reuse that.
19
        2) Additional plumbing is needed for testing and engineering builds. This problem is specific to WebKit and is on both macOS and iOS.
20
        WebKit doesn't build roots to test engineering builds, which is required to update the plist on the above location. Hence, a separate
21
        configuration is needed to generate a different plist that points to the right engineering binary and additional scripts will be needed
22
        to ask launchd to load the plist before running any tests. Some extra exercises are probably needed to not confuse launchd about the
23
        engineering binary and system binary.
24
25
        Given the about two road blockers, making this process as a daemon is probably not the best approach for WebKit.
26
27
        Covered by manual tests.
28
29
        * Configurations/WebAuthenticationAgent.xcconfig:
30
        * Daemons/WebAuthenticationAgent/com.apple.webkit.WebAuthenticationAgent.plist:
31
        * Scripts/copy-launchd-plist-and-create-symlinks.sh: Added.
32
        * WebKit.xcodeproj/project.pbxproj:
33
1
2020-10-08  Jiewen Tan  <jiewen_tan@apple.com>
34
2020-10-08  Jiewen Tan  <jiewen_tan@apple.com>
2
35
3
        [WebAuthn] Implement a dummy WebAuthenticationAgent
36
        [WebAuthn] Implement a dummy WebAuthenticationAgent
- a/Source/WebKit/Configurations/WebAuthenticationAgent.xcconfig +11 lines
Lines 35-37 ENTITLEMENTS_REQUIRED_USE_INTERNAL_SDK_NO = NO; a/Source/WebKit/Configurations/WebAuthenticationAgent.xcconfig_sec1
35
ENTITLEMENTS_REQUIRED_USE_INTERNAL_SDK_YES = $(ENTITLEMENTS_REQUIRED);
35
ENTITLEMENTS_REQUIRED_USE_INTERNAL_SDK_YES = $(ENTITLEMENTS_REQUIRED);
36
36
37
CODE_SIGN_ENTITLEMENTS = Daemons/WebAuthenticationAgent/WebAuthenticationAgent.entitlements;
37
CODE_SIGN_ENTITLEMENTS = Daemons/WebAuthenticationAgent/WebAuthenticationAgent.entitlements;
38
39
LAUNCHD_PLIST_INSTALL_PATH[sdk=macosx*] = $(WEBKIT_FRAMEWORKS_DIR)/WebKit.framework/Versions/A/Resources;
40
LAUNCHD_PLIST_INSTALL_PATH[sdk=iphone*] = /System/Library/LaunchDaemons;
41
42
LAUNCHD_PLIST_FILE_NAME[sdk=macosx*] = com.apple.WebKit.WebAuthenticationAgent.plist
43
LAUNCHD_PLIST_FILE_NAME[sdk=iphone*] = com.apple.WebKit.WebAuthenticationAgent-iOS.plist
44
45
LAUNCHD_PLIST_INPUT_FILE = Daemons/WebAuthenticationAgent/$(LAUNCHD_PLIST_FILE_NAME)
46
47
LAUNCHD_PLIST_OUTPUT_FILE = $(LAUNCHD_PLIST_INSTALL_PATH)/$(LAUNCHD_PLIST_FILE_NAME)
48
LAUNCHD_PLIST_SYMLINK_PATH[sdk=macosx*] = /System/Library/LaunchAgents
- a/Source/WebKit/Daemons/WebAuthenticationAgent/com.apple.webkit.WebAuthenticationAgent.plist -1 / +1 lines
Lines 14-19 a/Source/WebKit/Daemons/WebAuthenticationAgent/com.apple.webkit.WebAuthenticationAgent.plist_sec1
14
		<true/>
14
		<true/>
15
	</dict>
15
	</dict>
16
	<key>Program</key>
16
	<key>Program</key>
17
	<string>/Users/jwtan/Documents/Build/Products/Debug/com.apple.WebKit.WebAuthenticationAgent.Development</string>
17
	<string>${INSTALL_PATH}/${PRODUCT_NAME}</string>
18
</dict>
18
</dict>
19
</plist>
19
</plist>
- a/Source/WebKit/Scripts/copy-launchd-plist-and-create-symlinks.sh +66 lines
Line 0 a/Source/WebKit/Scripts/copy-launchd-plist-and-create-symlinks.sh_sec1
1
#!/bin/sh
2
#
3
# Copyright (C) 2020 Apple Inc. All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
7
# are met:
8
# 1. Redistributions of source code must retain the above copyright
9
#    notice, this list of conditions and the following disclaimer.
10
# 2. Redistributions in binary form must reproduce the above copyright
11
#    notice, this list of conditions and the following disclaimer in the
12
#    documentation and/or other materials provided with the distribution.
13
#
14
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
# THE POSSIBILITY OF SUCH DAMAGE.
25
26
if [ -z "${LAUNCHD_PLIST_INSTALL_PATH}" ]; then
27
    exit 0;
28
fi
29
30
if [[ "${SKIP_INSTALL}" == "YES" ]]; then
31
    exit 0;
32
fi
33
34
# On macOS, we install the launchd plist into $(WEBKIT_FRAMEWORKS_DIR)/WebKit.framework/Versions/A/Resources
35
# and then add a symlink from the standard place the launchd plists live to the above
36
# copy. This allows us to update the plist when shipping downlevels, since we otherwise
37
# can't change the contents of /System. The macOS plist needs to point to the binary
38
# inside $(WEBKIT_FRAMEWORKS_DIR)/WebKit.framework/Versions/A/XPCServices.
39
40
# Generate launchd plist and replace placeholder values with their real paths.
41
GENERATED_LAUNCHD_PLIST_DIR="${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2"
42
mkdir -p "${GENERATED_LAUNCHD_PLIST_DIR}"
43
GENERATED_LAUNCHD_PLIST_PATH="${GENERATED_LAUNCHD_PLIST_DIR}/${LAUNCHD_PLIST_FILE_NAME}"
44
45
echo "Replacing placeholders in ${LAUNCHD_PLIST_INPUT_FILE} and saving to ${GENERATED_LAUNCHD_PLIST_PATH}"
46
sed -e "s|\${INSTALL_PATH}|${INSTALL_PATH}|" -e "s|\${PRODUCT_NAME}|${PRODUCT_NAME}|" "${LAUNCHD_PLIST_INPUT_FILE}" > "${GENERATED_LAUNCHD_PLIST_PATH}"
47
48
# Install the plist.
49
DSTROOT_LAUNCHD_PLIST_OUTPUT_FILE="${DSTROOT}${LAUNCHD_PLIST_OUTPUT_FILE}"
50
51
mkdir -p "${DSTROOT}${LAUNCHD_PLIST_INSTALL_PATH}"
52
53
echo "Copying ${GENERATED_LAUNCHD_PLIST_PATH} to ${DSTROOT_LAUNCHD_PLIST_OUTPUT_FILE}"
54
ditto "${GENERATED_LAUNCHD_PLIST_PATH}" "${DSTROOT_LAUNCHD_PLIST_OUTPUT_FILE}"
55
56
if [[ ${WK_PLATFORM_NAME} != "macosx" || "${USE_STAGING_INSTALL_PATH}" == "YES" || "${WK_IS_TECH_PREVIEW_BUILD}" == "YES" ]]; then
57
    exit 0;
58
fi
59
60
# On non-staged and non-STP macOS builds, create the symlink.
61
DSTROOT_LAUNCHD_PLIST_SYMLINK_DIR="${DSTROOT}/${LAUNCHD_PLIST_SYMLINK_PATH}"
62
63
echo "Creating a symlink at ${DSTROOT_LAUNCHD_PLIST_SYMLINK_DIR} pointing to ${LAUNCHD_PLIST_OUTPUT_FILE}"
64
mkdir -p "${DSTROOT_LAUNCHD_PLIST_SYMLINK_DIR}"
65
66
ln -sf "${LAUNCHD_PLIST_OUTPUT_FILE}" "${DSTROOT_LAUNCHD_PLIST_SYMLINK_DIR}"
- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj +24 lines
Lines 3903-3908 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec1
3903
		570DAAC9230385FD00E8FC04 /* CtapNfcDriver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CtapNfcDriver.cpp; sourceTree = "<group>"; };
3903
		570DAAC9230385FD00E8FC04 /* CtapNfcDriver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CtapNfcDriver.cpp; sourceTree = "<group>"; };
3904
		572FD44122265CE200A1ECC3 /* WebViewDidMoveToWindowObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebViewDidMoveToWindowObserver.h; sourceTree = "<group>"; };
3904
		572FD44122265CE200A1ECC3 /* WebViewDidMoveToWindowObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebViewDidMoveToWindowObserver.h; sourceTree = "<group>"; };
3905
		574217912400E098002B303D /* LocalAuthenticationSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticationSPI.h; sourceTree = "<group>"; };
3905
		574217912400E098002B303D /* LocalAuthenticationSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticationSPI.h; sourceTree = "<group>"; };
3906
		5742A2E2253196A800B7BA14 /* copy-launchd-plist-and-create-symlinks.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "copy-launchd-plist-and-create-symlinks.sh"; sourceTree = "<group>"; };
3906
		574728CF23456E98001700AF /* _WKWebAuthenticationPanel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKWebAuthenticationPanel.h; sourceTree = "<group>"; };
3907
		574728CF23456E98001700AF /* _WKWebAuthenticationPanel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKWebAuthenticationPanel.h; sourceTree = "<group>"; };
3907
		574728D023456E98001700AF /* _WKWebAuthenticationPanel.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebAuthenticationPanel.mm; sourceTree = "<group>"; };
3908
		574728D023456E98001700AF /* _WKWebAuthenticationPanel.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebAuthenticationPanel.mm; sourceTree = "<group>"; };
3908
		574728D3234570AE001700AF /* _WKWebAuthenticationPanelInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKWebAuthenticationPanelInternal.h; sourceTree = "<group>"; };
3909
		574728D3234570AE001700AF /* _WKWebAuthenticationPanelInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKWebAuthenticationPanelInternal.h; sourceTree = "<group>"; };
Lines 10294-10299 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec2
10294
				535E08CA225460FC00DF00CA /* postprocess-header-rule */,
10295
				535E08CA225460FC00DF00CA /* postprocess-header-rule */,
10295
				7CDE73A21F9DA59700390312 /* PreferencesTemplates */,
10296
				7CDE73A21F9DA59700390312 /* PreferencesTemplates */,
10296
				0FC0856E187CE0A900780D86 /* __init__.py */,
10297
				0FC0856E187CE0A900780D86 /* __init__.py */,
10298
				5742A2E2253196A800B7BA14 /* copy-launchd-plist-and-create-symlinks.sh */,
10297
				4157853021276B6F00DD3800 /* copy-webcontent-resources-to-private-headers.sh */,
10299
				4157853021276B6F00DD3800 /* copy-webcontent-resources-to-private-headers.sh */,
10298
				C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */,
10300
				C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */,
10299
				0FC0856F187CE0A900780D86 /* messages.py */,
10301
				0FC0856F187CE0A900780D86 /* messages.py */,
Lines 11995-12000 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec3
11995
			buildPhases = (
11997
			buildPhases = (
11996
				57A9FEF8252BD8AA006A2040 /* Sources */,
11998
				57A9FEF8252BD8AA006A2040 /* Sources */,
11997
				57A9FEF9252BD8AA006A2040 /* Frameworks */,
11999
				57A9FEF9252BD8AA006A2040 /* Frameworks */,
12000
				5742A2E32531A8C700B7BA14 /* Copy launchd plist and create symlinks */,
11998
				57A9FEFA252BD8AA006A2040 /* CopyFiles */,
12001
				57A9FEFA252BD8AA006A2040 /* CopyFiles */,
11999
			);
12002
			);
12000
			buildRules = (
12003
			buildRules = (
Lines 12528-12533 a/Source/WebKit/WebKit.xcodeproj/project.pbxproj_sec4
12528
			shellPath = /bin/sh;
12531
			shellPath = /bin/sh;
12529
			shellScript = "Scripts/check-xcfilelists.sh\n";
12532
			shellScript = "Scripts/check-xcfilelists.sh\n";
12530
		};
12533
		};
12534
		5742A2E32531A8C700B7BA14 /* Copy launchd plist and create symlinks */ = {
12535
			isa = PBXShellScriptBuildPhase;
12536
			buildActionMask = 8;
12537
			files = (
12538
			);
12539
			inputFileListPaths = (
12540
			);
12541
			inputPaths = (
12542
				"$(SRCROOT)/$(LAUNCHD_PLIST_INPUT_FILE)",
12543
				"$(SRCROOT)/Scripts/copy-launchd-plist-and-create-symlinks.sh",
12544
			);
12545
			name = "Copy launchd plist and create symlinks";
12546
			outputFileListPaths = (
12547
			);
12548
			outputPaths = (
12549
				"$(DSTROOT)/$(LAUNCHD_PLIST_PATH)/$(LAUNCHD_PLIST_FILE_NAME)",
12550
			);
12551
			runOnlyForDeploymentPostprocessing = 1;
12552
			shellPath = /bin/sh;
12553
			shellScript = "Scripts/copy-launchd-plist-and-create-symlinks.sh\n";
12554
		};
12531
		5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */ = {
12555
		5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */ = {
12532
			isa = PBXShellScriptBuildPhase;
12556
			isa = PBXShellScriptBuildPhase;
12533
			buildActionMask = 2147483647;
12557
			buildActionMask = 2147483647;

Return to Bug 217559