Changeset 290146 in webkit
- Timestamp:
- Feb 18, 2022, 11:01:21 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 16 edited
- 1 copied
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/PlatformEnableCocoa.h (modified) (1 diff)
-
Source/WebCore/PAL/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/pal/crypto/CryptoDigest.h (modified) (2 diffs)
-
Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Configurations/WebKit.xcconfig (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (modified) (1 diff)
-
Source/WebKit/WebKit.xcodeproj/project.pbxproj (modified) (7 diffs)
-
Source/WebKit/webpushd/AppBundleRequest.mm (modified) (2 diffs)
-
Source/WebKit/webpushd/ICAppBundle.h (added)
-
Source/WebKit/webpushd/ICAppBundle.mm (added)
-
Source/WebKit/webpushd/InstallCoordinationSPI.h (added)
-
Source/WebKit/webpushd/LaunchServicesSPI.h (copied) (copied from trunk/Source/WebKit/webpushd/PushAppBundle.h ) (2 diffs)
-
Source/WebKit/webpushd/PushAppBundle.h (modified) (2 diffs)
-
Source/WebKit/webpushd/WebPushDaemon.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (modified) (1 diff)
-
WebKitLibraries/ChangeLog (modified) (1 diff)
-
WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/15/InstallCoordination.framework (added)
-
WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/15/InstallCoordination.framework/InstallCoordination.tbd (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r290111 r290146 1 2022-02-18 Brady Eidson <beidson@apple.com> 2 3 Add an InstallCoordination webpushd backend 4 https://bugs.webkit.org/show_bug.cgi?id=233714 5 6 Reviewed by Alex Christensen. 7 8 * wtf/PlatformEnableCocoa.h: 9 1 10 2022-02-17 Matt Woodrow <mattwoodrow@apple.com> 2 11 -
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
r289894 r290146 144 144 #endif 145 145 146 #if !defined(ENABLE_INSTALL_COORDINATION_BUNDLES) && PLATFORM(IOS) 147 #define ENABLE_INSTALL_COORDINATION_BUNDLES 1 148 #endif 149 146 150 #if !defined(ENABLE_CACHE_PARTITIONING) 147 151 #define ENABLE_CACHE_PARTITIONING 1 -
trunk/Source/WebCore/PAL/ChangeLog
r290117 r290146 1 2022-02-18 Brady Eidson <beidson@apple.com> 2 3 Add an InstallCoordination webpushd backend 4 https://bugs.webkit.org/show_bug.cgi?id=233714 5 6 Reviewed by Alex Christensen. 7 8 Expose "toHexString" so we can SHA256 an arbitrary string to a hex representation. 9 10 * pal/crypto/CryptoDigest.h: 11 * pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp: 12 (PAL::CryptoDigest::toHexString): 13 1 14 2022-02-18 Saam Barati <sbarati@apple.com> 2 15 -
trunk/Source/WebCore/PAL/pal/crypto/CryptoDigest.h
r218843 r290146 28 28 #include <wtf/Noncopyable.h> 29 29 #include <wtf/Vector.h> 30 #include <wtf/text/WTFString.h> 30 31 31 32 namespace PAL { … … 48 49 PAL_EXPORT void addBytes(const void* input, size_t length); 49 50 PAL_EXPORT Vector<uint8_t> computeHash(); 51 PAL_EXPORT String toHexString(); 50 52 51 53 private: -
trunk/Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
r235935 r290146 183 183 } 184 184 185 String CryptoDigest::toHexString() 186 { 187 auto hash = computeHash(); 188 189 char* start = 0; 190 unsigned hashLength = hash.size(); 191 CString result = CString::newUninitialized(hashLength * 2, start); 192 char* buffer = start; 193 for (size_t i = 0; i < hashLength; ++i) { 194 snprintf(buffer, 3, "%02X", hash.at(i)); 195 buffer += 2; 196 } 197 return String::fromUTF8(result); 198 } 199 185 200 } // namespace PAL -
trunk/Source/WebKit/ChangeLog
r290144 r290146 1 2022-02-18 Brady Eidson <beidson@apple.com> 2 3 Add an InstallCoordination webpushd backend 4 https://bugs.webkit.org/show_bug.cgi?id=233714 5 6 Reviewed by Alex Christensen. 7 8 Covered by API tests. 9 10 This patch lets the iOS build create a placeholder app bundle to represent a registration using InstallCoordination. 11 12 * Configurations/webpushd.xcconfig: 13 * WebKit.xcodeproj/project.pbxproj: 14 15 * webpushd/AppBundleRequest.mm: 16 (WebPushD::AppBundleRequest::start): Use the ICAppBundle implementation when appropriate. 17 18 * webpushd/ICAppBundle.h: Copied from Source/WebKit/webpushd/PushAppBundle.h. 19 (WebPushD::ICAppBundle::create): 20 21 * webpushd/ICAppBundle.mm: Added. 22 (-[WebAppInstallCoordinatorObserver initWithICAppBundle:]): 23 (-[WebAppInstallCoordinatorObserver coordinatorDidCompleteSuccessfully:forApplicationRecord:]): 24 (-[WebAppInstallCoordinatorObserver coordinator:canceledWithReason:client:]): 25 (WebPushD::broadcastDebugMessage): 26 (WebPushD::ICAppBundle::ICAppBundle): 27 (WebPushD::encodeOriginStringForBundleIdentifier): 28 (WebPushD::originStringFromEncodedBundleIdentifier): 29 (WebPushD::bundlePrefixForHostAppIdentifier): 30 (WebPushD::bundleNameForOriginStringAndHostAppIdentifier): 31 (WebPushD::ICAppBundle::getOriginsWithRegistrations): 32 (WebPushD::ICAppBundle::getBundleIdentifier): 33 (WebPushD::ICAppBundle::checkForExistingBundle): 34 (WebPushD::ICAppBundle::deleteExistingBundle): 35 (WebPushD::ICAppBundle::didDeleteExistingBundleWithError): 36 (WebPushD::ICAppBundle::stop): 37 (WebPushD::ICAppBundle::createBundle): 38 (WebPushD::ICAppBundle::bundleCreationSucceeded): 39 (WebPushD::ICAppBundle::bundleCreationFailed): 40 41 * webpushd/InstallCoordinationSPI.h: Added. 42 * webpushd/LaunchServicesSPI.h: Copied from Source/WebKit/webpushd/PushAppBundle.h. 43 * webpushd/PushAppBundle.h: 44 45 * webpushd/WebPushDaemon.mm: 46 (WebPushD::Daemon::getOriginsWithPushAndNotificationPermissions): Use the ICAppBundle implementation when appropriate. 47 1 48 2022-02-18 Gavin Phillips <gavin.p@apple.com> 2 49 -
trunk/Source/WebKit/Configurations/WebKit.xcconfig
r290117 r290146 153 153 WK_LIBNETWORKEXTENSION_LDFLAGS_tvos = ; 154 154 155 FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -lnetwork -framework Metal $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_BACKBOARD_SERVICES_LDFLAGS) $(WK_RUNNINGBOARD_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CONTACTS_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBNETWORKEXTENSION_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROTOTYPE_TOOLS_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS) $(WK_COORDINATOR_LDFLAGS); 155 WK_INSTALL_COORDINATION_LDFLAGS = $(WK_INSTALL_COORDINATION_LDFLAGS_$(WK_PLATFORM_NAME)); 156 WK_INSTALL_COORDINATION_LDFLAGS_iphoneos = -framework InstallCoordination; 157 WK_INSTALL_COORDINATION_LDFLAGS_iphonesimulator = $(WK_INSTALL_COORDINATION_LDFLAGS_iphoneos) 158 159 FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -lnetwork -framework Metal $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_BACKBOARD_SERVICES_LDFLAGS) $(WK_RUNNINGBOARD_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CONTACTS_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBNETWORKEXTENSION_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROTOTYPE_TOOLS_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS) $(WK_COORDINATOR_LDFLAGS) $(WK_INSTALL_COORDINATION_LDFLAGS); 156 160 157 161 // Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols. -
trunk/Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp
r289721 r290146 71 71 void NetworkNotificationManager::requestSystemNotificationPermission(const String& originString, CompletionHandler<void(bool)>&& completionHandler) 72 72 { 73 LOG(Push, "Network process passing permission request to webpushd"); 73 74 sendMessageWithReply<WebPushD::MessageType::RequestSystemNotificationPermission>(WTFMove(completionHandler), originString); 74 75 } -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r289694 r290146 668 668 return; 669 669 checker->didCallCompletionHandler(); 670 670 671 completionHandler(result); 671 672 }).get()]; -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r290030 r290146 1060 1060 51DD9F2916367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51DD9F2716367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h */; }; 1061 1061 51E351CB180F2CCC00E53BE9 /* IDBUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E351C9180F2CCC00E53BE9 /* IDBUtilities.h */; }; 1062 51E9049527BCB3C900929E7E /* ICAppBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E9049327BCB3C600929E7E /* ICAppBundle.h */; }; 1063 51E9049727BCB3D900929E7E /* ICAppBundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E9049427BCB3C800929E7E /* ICAppBundle.mm */; }; 1064 51E9049A27BCB9D400929E7E /* LaunchServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E9049827BCB9D100929E7E /* LaunchServicesSPI.h */; }; 1065 51E9049B27BCB9D400929E7E /* LaunchServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E9049827BCB9D100929E7E /* LaunchServicesSPI.h */; }; 1066 51E9049C27BCB9D400929E7E /* InstallCoordinationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E9049927BCB9D300929E7E /* InstallCoordinationSPI.h */; }; 1067 51E9049D27BCB9D400929E7E /* InstallCoordinationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E9049927BCB9D300929E7E /* InstallCoordinationSPI.h */; }; 1062 1068 51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1063 1069 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */; }; … … 4599 4605 51E399051D6F54C5009C8831 /* UIGamepadProviderCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIGamepadProviderCocoa.mm; sourceTree = "<group>"; }; 4600 4606 51E8B68D1E712873001B7132 /* WebURLSchemeTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebURLSchemeTask.cpp; sourceTree = "<group>"; }; 4607 51E9049327BCB3C600929E7E /* ICAppBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICAppBundle.h; sourceTree = "<group>"; }; 4608 51E9049427BCB3C800929E7E /* ICAppBundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ICAppBundle.mm; sourceTree = "<group>"; }; 4609 51E9049827BCB9D100929E7E /* LaunchServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchServicesSPI.h; sourceTree = "<group>"; }; 4610 51E9049927BCB9D300929E7E /* InstallCoordinationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstallCoordinationSPI.h; sourceTree = "<group>"; }; 4601 4611 51E949961D761CC700EC9EB9 /* UIGamepadProviderIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIGamepadProviderIOS.mm; sourceTree = "<group>"; }; 4602 4612 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebResourceLoaderMessageReceiver.cpp; path = DerivedSources/WebKit/WebResourceLoaderMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; … … 10219 10229 EB0D312E275AE13300863D8F /* com.apple.webkit.webpushd.ios.plist */, 10220 10230 EB0D312D275AE13300863D8F /* com.apple.webkit.webpushd.mac.plist */, 10231 51E9049327BCB3C600929E7E /* ICAppBundle.h */, 10232 51E9049427BCB3C800929E7E /* ICAppBundle.mm */, 10233 51E9049927BCB9D300929E7E /* InstallCoordinationSPI.h */, 10234 51E9049827BCB9D100929E7E /* LaunchServicesSPI.h */, 10221 10235 51F7BB75274498BB00C45A72 /* MockAppBundleForTesting.h */, 10222 10236 51F7BB74274498BA00C45A72 /* MockAppBundleForTesting.mm */, … … 12823 12837 buildActionMask = 2147483647; 12824 12838 files = ( 12839 51E9049B27BCB9D400929E7E /* LaunchServicesSPI.h in Headers */, 12840 51E9049527BCB3C900929E7E /* ICAppBundle.h in Headers */, 12841 51E9049D27BCB9D400929E7E /* InstallCoordinationSPI.h in Headers */, 12825 12842 ); 12826 12843 runOnlyForDeploymentPostprocessing = 0; … … 13357 13374 41DD72AB2682167300A90C71 /* NWSPI.h in Headers */, 13358 13375 BC8ACA1316670D89004C1941 /* ObjCObjectGraph.h in Headers */, 13376 51E9049A27BCB9D400929E7E /* LaunchServicesSPI.h in Headers */, 13359 13377 93085DCA26E29775000EC6A7 /* OriginStorageManager.h in Headers */, 13360 13378 F4EB4AFD269CD7F300D297AE /* OSStateSPI.h in Headers */, … … 13570 13588 F48570A32644BEC500C05F71 /* Timeout.h in Headers */, 13571 13589 2F8336861FA139DF00C6E080 /* TouchBarMenuData.h in Headers */, 13590 51E9049C27BCB9D400929E7E /* InstallCoordinationSPI.h in Headers */, 13572 13591 46BEB6E322FBB21A00269867 /* TransientLocalStorageNamespace.h in Headers */, 13573 13592 57EB2E3A21E1983E00B89CDF /* U2fAuthenticator.h in Headers */, … … 15655 15674 1DF29E64257F37A3003C28AF /* MediaSourcePrivateRemoteMessageReceiver.cpp in Sources */, 15656 15675 9B4790912531563200EC11AB /* MessageArgumentDescriptions.cpp in Sources */, 15676 51E9049727BCB3D900929E7E /* ICAppBundle.mm in Sources */, 15657 15677 517B5F84275E97B6002DC22D /* MockAppBundleForTesting.mm in Sources */, 15658 15678 517B5F86275E97B6002DC22D /* MockAppBundleRegistry.mm in Sources */, -
trunk/Source/WebKit/webpushd/AppBundleRequest.mm
r287009 r290146 27 27 #import "AppBundleRequest.h" 28 28 29 #import "ICAppBundle.h" 29 30 #import "MockAppBundleForTesting.h" 30 31 #import "WebPushDaemon.h" … … 55 56 m_appBundle = MockAppBundleForTesting::create(m_originString, m_connection->hostAppCodeSigningIdentifier(), *this); 56 57 else { 58 #if ENABLE(INSTALL_COORDINATION_BUNDLES) 59 m_appBundle = ICAppBundle::create(*m_connection, m_originString, *this); 60 #else 57 61 m_connection->broadcastDebugMessage("Client is trying to initiate app bundle request without having configured mock app bundles for testing. About to crash..."); 58 62 RELEASE_ASSERT_NOT_REACHED(); 63 #endif 59 64 } 60 65 -
trunk/Source/WebKit/webpushd/LaunchServicesSPI.h
r290145 r290146 1 1 /* 2 * Copyright (C) 202 1Apple Inc. All rights reserved.2 * Copyright (C) 2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #if PLATFORM(IOS) 27 #if USE(APPLE_INTERNAL_SDK) 27 28 28 #include <wtf/RefCounted.h> 29 // This space intentionally left blank 29 30 30 @class NSError; 31 #else 31 32 32 namespace WebPushD { 33 NS_ASSUME_NONNULL_BEGIN 33 34 34 enum class PushAppBundleExists : bool { 35 No, 36 Yes, 35 typedef NS_ENUM(NSUInteger, LSInstallType) { 36 LSInstallTypeIntentionalDowngrade = 8 37 37 }; 38 38 39 enum class PushAppBundleCreationResult : bool { 40 Failure, 41 Success, 39 @interface LSRecord : NSObject 40 @end 41 42 @interface LSBundleRecord : LSRecord 43 @property (readonly, nullable) NSString *bundleIdentifier; 44 @end 45 46 @interface LSApplicationRecord : LSBundleRecord 47 @property (readonly) BOOL placeholder; 48 @property (readonly) NSString *managementDomain; 49 50 - (instancetype)initWithBundleIdentifier:(NSString *)bundleIdentifier allowPlaceholder:(BOOL)allowPlaceholder error:(NSError **)outError; 51 @end 52 53 @interface LSEnumerator<__covariant ObjectType> : NSEnumerator<ObjectType> 54 @end 55 56 typedef NS_OPTIONS(uint64_t, LSApplicationEnumerationOptions) { 57 LSApplicationEnumerationOptionsEnumeratePlaceholders = (1 << 6) 42 58 }; 43 59 44 class PushAppBundle; 60 @interface LSApplicationRecord (Enumeration) 61 + (LSEnumerator<LSApplicationRecord *> *)enumeratorWithOptions:(LSApplicationEnumerationOptions)options; 62 @end 45 63 46 class PushAppBundleClient { 47 public: 48 virtual ~PushAppBundleClient(); 64 NS_ASSUME_NONNULL_END 49 65 50 virtual void didCheckForExistingBundle(PushAppBundle&, PushAppBundleExists) = 0; 51 virtual void didDeleteExistingBundleWithError(PushAppBundle&, NSError *) = 0; 52 virtual void didCreateAppBundle(PushAppBundle&, PushAppBundleCreationResult) = 0; 53 }; 54 55 class PushAppBundle : public RefCounted<PushAppBundle> { 56 public: 57 virtual ~PushAppBundle(); 58 void detachFromClient(); 59 60 virtual void checkForExistingBundle() = 0; 61 virtual void deleteExistingBundle() = 0; 62 virtual void createBundle() = 0; 63 virtual void stop() = 0; 64 65 protected: 66 PushAppBundle(PushAppBundleClient&); 67 68 PushAppBundleClient* m_client; 69 }; 70 71 72 } // namespace WebPushD 66 #endif // USE(APPLE_INTERNAL_SDK) 67 #endif // PLATFORM(IOS) -
trunk/Source/WebKit/webpushd/PushAppBundle.h
r286273 r290146 26 26 #pragma once 27 27 28 #include <wtf/ RefCounted.h>28 #include <wtf/ThreadSafeRefCounted.h> 29 29 30 30 @class NSError; … … 53 53 }; 54 54 55 class PushAppBundle : public RefCounted<PushAppBundle> {55 class PushAppBundle : public ThreadSafeRefCounted<PushAppBundle> { 56 56 public: 57 57 virtual ~PushAppBundle(); -
trunk/Source/WebKit/webpushd/WebPushDaemon.mm
r289353 r290146 32 32 #import "DaemonUtilities.h" 33 33 #import "HandleMessage.h" 34 #import "ICAppBundle.h" 34 35 #import "MockAppBundleRegistry.h" 35 36 … … 442 443 } 443 444 444 // FIXME: This will need platform-specific implementations for real world bundles once implemented. 445 replySender({ }); 445 #if ENABLE(INSTALL_COORDINATION_BUNDLES) 446 ICAppBundle::getOriginsWithRegistrations(*connection, WTFMove(replySender)); 447 #else 448 RELEASE_ASSERT_NOT_REACHED(); 449 #endif 446 450 } 447 451 -
trunk/Tools/ChangeLog
r290126 r290146 1 2022-02-18 Brady Eidson <beidson@apple.com> 2 3 Add an InstallCoordination webpushd backend 4 https://bugs.webkit.org/show_bug.cgi?id=233714 5 6 Reviewed by Alex Christensen. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm: 9 1 10 2022-02-07 Jonathan Bedard <jbedard@apple.com> 2 11 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm
r289353 r290146 708 708 } 709 709 710 #if ENABLE(INSTALL_COORDINATION_BUNDLES) 711 #if USE(APPLE_INTERNAL_SDK) 712 static void deleteAllRegistrationsForDataStore(WKWebsiteDataStore *dataStore) 713 { 714 __block bool originOperationDone = false; 715 __block RetainPtr<NSSet<WKSecurityOrigin *>> originSet; 716 [dataStore _getOriginsWithPushAndNotificationPermissions:^(NSSet<WKSecurityOrigin *> *origins) { 717 originSet = origins; 718 originOperationDone = true; 719 }]; 720 TestWebKitAPI::Util::run(&originOperationDone); 721 722 if (![originSet count]) 723 return; 724 725 __block size_t deletedOrigins = 0; 726 originOperationDone = false; 727 for (WKSecurityOrigin *origin in originSet.get()) { 728 [dataStore _deletePushAndNotificationRegistration:origin completionHandler:^(NSError *error) { 729 EXPECT_FALSE(!!error); 730 if (++deletedOrigins == [originSet count]) 731 originOperationDone = true; 732 }]; 733 } 734 TestWebKitAPI::Util::run(&originOperationDone); 735 736 originOperationDone = false; 737 [dataStore _getOriginsWithPushAndNotificationPermissions:^(NSSet<WKSecurityOrigin *> *origins) { 738 EXPECT_EQ([origins count], 0u); 739 originOperationDone = true; 740 }]; 741 TestWebKitAPI::Util::run(&originOperationDone); 742 743 } 744 745 TEST(WebPushD, InstallCoordinationBundles) 746 { 747 NSURL *tempDirectory = setUpTestWebPushD(); 748 749 auto dataStoreConfiguration = adoptNS([_WKWebsiteDataStoreConfiguration new]); 750 dataStoreConfiguration.get().webPushMachServiceName = @"org.webkit.webpushtestdaemon.service"; 751 auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration.get()]); 752 753 deleteAllRegistrationsForDataStore(dataStore.get()); 754 755 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 756 configuration.get().websiteDataStore = dataStore.get(); 757 [configuration.get().preferences _setNotificationsEnabled:YES]; 758 for (_WKExperimentalFeature *feature in [WKPreferences _experimentalFeatures]) { 759 if ([feature.key isEqualToString:@"BuiltInNotificationsEnabled"]) 760 [[configuration preferences] _setEnabled:YES forFeature:feature]; 761 } 762 763 auto handler = adoptNS([[TestURLSchemeHandler alloc] init]); 764 [configuration setURLSchemeHandler:handler.get() forURLScheme:@"testing"]; 765 766 [handler setStartURLSchemeTaskHandler:^(WKWebView *, id<WKURLSchemeTask> task) { 767 auto response = adoptNS([[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:@"text/html" expectedContentLength:0 textEncodingName:nil]); 768 [task didReceiveResponse:response.get()]; 769 [task didReceiveData:[NSData dataWithBytes:mainBytes length:strlen(mainBytes)]]; 770 [task didFinish]; 771 }]; 772 773 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]); 774 auto uiDelegate = adoptNS([[NotificationPermissionDelegate alloc] init]); 775 [webView setUIDelegate:uiDelegate.get()]; 776 777 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"testing://main/index.html"]]]; 778 TestWebKitAPI::Util::run(&alertReceived); 779 780 alertReceived = false; 781 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"testing://secondary/index.html"]]]; 782 TestWebKitAPI::Util::run(&alertReceived); 783 784 static bool originOperationDone = false; 785 static RetainPtr<NSSet<WKSecurityOrigin *>> origins; 786 [dataStore _getOriginsWithPushAndNotificationPermissions:^(NSSet<WKSecurityOrigin *> *rawOrigins) { 787 EXPECT_EQ([rawOrigins count], 2u); 788 origins = rawOrigins; 789 originOperationDone = true; 790 }]; 791 TestWebKitAPI::Util::run(&originOperationDone); 792 793 for (WKSecurityOrigin *origin in origins.get()) { 794 EXPECT_TRUE([origin.protocol isEqualToString:@"testing"]); 795 EXPECT_TRUE([origin.host isEqualToString:@"main"] || [origin.host isEqualToString:@"secondary"]); 796 } 797 798 deleteAllRegistrationsForDataStore(dataStore.get()); 799 cleanUpTestWebPushD(tempDirectory); 800 } 801 #endif // #if USE(APPLE_INTERNAL_SDK) 802 #endif // ENABLE(INSTALL_COORDINATION_BUNDLES) 803 710 804 } // namespace TestWebKitAPI 711 805 -
trunk/WebKitLibraries/ChangeLog
r289073 r290146 1 2022-02-18 Brady Eidson <beidson@apple.com> 2 3 Add an InstallCoordination webpushd backend 4 https://bugs.webkit.org/show_bug.cgi?id=233714 5 6 Reviewed by Alex Christensen. 7 8 * WebKitPrivateFrameworkStubs/iOS/15/InstallCoordination.framework/InstallCoordination.tbd: Added. 9 1 10 2022-02-03 Robert Jenner <Jenner@apple.com> 2 11
Note:
See TracChangeset
for help on using the changeset viewer.