Changeset 286640 in webkit
- Timestamp:
- Dec 7, 2021, 8:24:38 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 33 edited
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (modified) (1 diff)
-
Source/WebCore/CMakeLists.txt (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/DerivedSources-input.xcfilelist (modified) (1 diff)
-
Source/WebCore/DerivedSources-output.xcfilelist (modified) (2 diffs)
-
Source/WebCore/DerivedSources.make (modified) (1 diff)
-
Source/WebCore/Headers.cmake (modified) (1 diff)
-
Source/WebCore/Modules/cookie-consent (added)
-
Source/WebCore/Modules/cookie-consent/CookieConsentDecisionResult.h (added)
-
Source/WebCore/Modules/cookie-consent/Navigator+CookieConsent.idl (added)
-
Source/WebCore/Modules/cookie-consent/NavigatorCookieConsent.cpp (added)
-
Source/WebCore/Modules/cookie-consent/NavigatorCookieConsent.h (added)
-
Source/WebCore/Modules/cookie-consent/RequestCookieConsentOptions.h (added)
-
Source/WebCore/Modules/cookie-consent/RequestCookieConsentOptions.idl (added)
-
Source/WebCore/Modules/filesystemaccess/WorkerFileSystemStorageConnection.cpp (modified) (1 diff)
-
Source/WebCore/Modules/filesystemaccess/WorkerFileSystemStorageConnection.h (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (2 diffs)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (8 diffs)
-
Source/WebCore/loader/EmptyClients.cpp (modified) (2 diffs)
-
Source/WebCore/loader/EmptyClients.h (modified) (1 diff)
-
Source/WebCore/page/ChromeClient.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/APIUIClient.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/UIDelegate.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (2 diffs)
-
Source/WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (modified) (2 diffs)
-
Source/WebKitLegacy/win/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp (modified) (2 diffs)
-
Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (6 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit/CookieConsent.mm (added)
-
Tools/TestWebKitAPI/Tests/WebKit/cookie-consent-basic.html (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r286601 r286640 1 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for `navigator.requestCookieConsent()` behind a disabled feature flag 4 https://bugs.webkit.org/show_bug.cgi?id=233890 5 rdar://86117718 6 7 Reviewed by Darin Adler. 8 9 Add the new feature flag (off by default). Note that this is also only an internal feature flag for the time 10 being (rather than an experimental feature flag), such that it cannot (yet) be turned on by non-Apple internal 11 users. 12 13 * Scripts/Preferences/WebPreferencesInternal.yaml: 14 1 15 2021-12-07 Sihui Liu <sihui_liu@apple.com> 2 16 -
trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml
r286554 r286640 177 177 default: false 178 178 179 CookieConsentAPIEnabled: 180 type: bool 181 humanReadableName: "Cookie Consent API" 182 humanReadableDescription: "Enable cookie consent API" 183 exposed: [ WebKit ] 184 defaultValue: 185 WebCore: 186 default: false 187 WebKitLegacy: 188 default: false 189 WebKit: 190 default: false 191 179 192 DOMPasteAccessRequestsEnabled: 180 193 type: bool -
trunk/Source/WebCore/CMakeLists.txt
r286555 r286640 28 28 "${WEBCORE_DIR}/Modules/cache" 29 29 "${WEBCORE_DIR}/Modules/contact-picker" 30 "${WEBCORE_DIR}/Modules/cookie-consent" 30 31 "${WEBCORE_DIR}/Modules/credentialmanagement" 31 32 "${WEBCORE_DIR}/Modules/encryptedmedia" … … 257 258 Modules/contact-picker/Navigator+Contacts.idl 258 259 260 Modules/cookie-consent/Navigator+CookieConsent.idl 261 Modules/cookie-consent/RequestCookieConsentOptions.idl 262 259 263 Modules/credentialmanagement/BasicCredential.idl 260 264 Modules/credentialmanagement/CredentialCreationOptions.idl -
trunk/Source/WebCore/ChangeLog
r286637 r286640 1 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for `navigator.requestCookieConsent()` behind a disabled feature flag 4 https://bugs.webkit.org/show_bug.cgi?id=233890 5 rdar://86117718 6 7 Reviewed by Darin Adler. 8 9 Add plumbing to support a new (internal-for-the-time-being) navigator API, `requestCookieConsent()`. This 10 returns a promise indicating whether or not the user (or the UA, on behalf of the user) consents to usage of 11 cookies that are not strictly necessary for page performance. 12 13 Paired with this web-facing API, we also introduce corresponding private WKUIDelegate methods that are invoked 14 as a result of calling `navigator.requestCookieConsent();`, which a WebKit embedder may implement in order to 15 present UI or otherwise respond appropriately to the request. See WebKit ChangeLog for more details. 16 17 Tests: CookieConsent.BasicDecisionHandler 18 CookieConsent.NotEnabled 19 CookieConsent.ThrowsExceptionWithoutDelegate 20 21 * CMakeLists.txt: 22 * DerivedSources-input.xcfilelist: 23 * DerivedSources-output.xcfilelist: 24 * DerivedSources.make: 25 * Headers.cmake: 26 * Modules/cookie-consent/CookieConsentDecisionResult.h: Added. 27 * Modules/cookie-consent/Navigator+CookieConsent.idl: Added. 28 * Modules/cookie-consent/NavigatorCookieConsent.cpp: Added. 29 30 Add a new partial interface on Navigator that implements the new API by calling into the chrome client hook (see 31 WebKit changes for more details). Note that in the case where the consent delegate method is not implemented by 32 the client, we will reject the promise with a `NotSupportedError`. 33 34 (WebCore::NavigatorCookieConsent::requestCookieConsent): 35 (WebCore::NavigatorCookieConsent::from): 36 * Modules/cookie-consent/NavigatorCookieConsent.h: Added. 37 (WebCore::RequestCookieConsentOptions::RequestCookieConsentOptions): 38 * Modules/cookie-consent/RequestCookieConsentOptions.h: Added. 39 * Modules/cookie-consent/RequestCookieConsentOptions.idl: Added. 40 * Modules/filesystemaccess/WorkerFileSystemStorageConnection.cpp: 41 * Modules/filesystemaccess/WorkerFileSystemStorageConnection.h: 42 43 Add some missing includes to fix the unified source build on Windows. 44 45 * Sources.txt: 46 * WebCore.xcodeproj/project.pbxproj: 47 * loader/EmptyClients.cpp: 48 (WebCore::EmptyChromeClient::requestCookieConsent): 49 * loader/EmptyClients.h: 50 * page/ChromeClient.h: 51 1 52 2021-12-07 Cameron McCormack <heycam@apple.com> 2 53 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r286555 r286640 233 233 $(PROJECT_DIR)/Modules/contact-picker/ContactsSelectOptions.idl 234 234 $(PROJECT_DIR)/Modules/contact-picker/Navigator+Contacts.idl 235 $(PROJECT_DIR)/Modules/cookie-consent/Navigator+CookieConsent.idl 236 $(PROJECT_DIR)/Modules/cookie-consent/RequestCookieConsentOptions.idl 235 237 $(PROJECT_DIR)/Modules/credentialmanagement/BasicCredential.idl 236 238 $(PROJECT_DIR)/Modules/credentialmanagement/CredentialCreationOptions.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r286555 r286640 1648 1648 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigator+Contacts.cpp 1649 1649 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigator+Contacts.h 1650 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigator+CookieConsent.cpp 1651 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigator+CookieConsent.h 1650 1652 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigator+Credentials.cpp 1651 1653 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNavigator+Credentials.h … … 2090 2092 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRequestAnimationFrameCallback.cpp 2091 2093 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRequestAnimationFrameCallback.h 2094 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRequestCookieConsentOptions.cpp 2095 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSRequestCookieConsentOptions.h 2092 2096 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserver.cpp 2093 2097 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSResizeObserver.h -
trunk/Source/WebCore/DerivedSources.make
r286555 r286640 255 255 $(WebCore)/Modules/contact-picker/ContactsSelectOptions.idl \ 256 256 $(WebCore)/Modules/contact-picker/Navigator+Contacts.idl \ 257 $(WebCore)/Modules/cookie-consent/Navigator+CookieConsent.idl \ 258 $(WebCore)/Modules/cookie-consent/RequestCookieConsentOptions.idl \ 257 259 $(WebCore)/Modules/credentialmanagement/BasicCredential.idl \ 258 260 $(WebCore)/Modules/credentialmanagement/CredentialCreationOptions.idl \ -
trunk/Source/WebCore/Headers.cmake
r286596 r286640 153 153 Modules/contact-picker/ContactProperty.h 154 154 Modules/contact-picker/ContactsRequestData.h 155 156 Modules/cookie-consent/CookieConsentDecisionResult.h 155 157 156 158 Modules/encryptedmedia/CDMClient.h -
trunk/Source/WebCore/Modules/filesystemaccess/WorkerFileSystemStorageConnection.cpp
r286414 r286640 27 27 #include "WorkerFileSystemStorageConnection.h" 28 28 29 #include "FileSystemSyncAccessHandle.h" 29 30 #include "WorkerGlobalScope.h" 30 31 #include "WorkerLoaderProxy.h" -
trunk/Source/WebCore/Modules/filesystemaccess/WorkerFileSystemStorageConnection.h
r286414 r286640 33 33 namespace WebCore { 34 34 35 class FileSystemSyncAccessHandle; 35 36 class WorkerGlobalScope; 36 37 class WorkerThread; -
trunk/Source/WebCore/Sources.txt
r286630 r286640 69 69 Modules/contact-picker/ContactsManager.cpp 70 70 Modules/contact-picker/NavigatorContacts.cpp 71 Modules/cookie-consent/NavigatorCookieConsent.cpp 71 72 Modules/credentialmanagement/BasicCredential.cpp 72 73 Modules/credentialmanagement/CredentialsContainer.cpp … … 3674 3675 JSRemotePlaybackAvailabilityCallback.cpp 3675 3676 JSRequestAnimationFrameCallback.cpp 3677 JSRequestCookieConsentOptions.cpp 3676 3678 JSResizeObserver.cpp 3677 3679 JSResizeObserverBoxOptions.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r286630 r286640 5451 5451 F3ABFE0C130E9DA000E7F7D1 /* InstrumentingAgents.h in Headers */ = {isa = PBXBuildFile; fileRef = F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */; }; 5452 5452 F3D461491161D53200CA0D09 /* JSErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D461471161D53200CA0D09 /* JSErrorHandler.h */; }; 5453 F4034F9D275C4789003A81F8 /* CookieConsentDecisionResult.h in Headers */ = {isa = PBXBuildFile; fileRef = F4034F9C275C4783003A81F8 /* CookieConsentDecisionResult.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5454 F4034FAC275EAD6E003A81F8 /* RequestCookieConsentOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = F4034F8F275C1686003A81F8 /* RequestCookieConsentOptions.h */; }; 5455 F4034FAE275EAD76003A81F8 /* NavigatorCookieConsent.h in Headers */ = {isa = PBXBuildFile; fileRef = F4034F8D275C087B003A81F8 /* NavigatorCookieConsent.h */; }; 5453 5456 F403E7872363B58C00044550 /* EnterKeyHint.h in Headers */ = {isa = PBXBuildFile; fileRef = F403E7852363B58C00044550 /* EnterKeyHint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5454 5457 F40DAAEC25D9F25E0011B4FA /* PasteboardContext.h in Headers */ = {isa = PBXBuildFile; fileRef = F40DAAEB25D9F25E0011B4FA /* PasteboardContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 17596 17599 F3D461461161D53200CA0D09 /* JSErrorHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorHandler.cpp; sourceTree = "<group>"; }; 17597 17600 F3D461471161D53200CA0D09 /* JSErrorHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorHandler.h; sourceTree = "<group>"; }; 17601 F4034F8C275C087B003A81F8 /* NavigatorCookieConsent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NavigatorCookieConsent.cpp; path = "cookie-consent/NavigatorCookieConsent.cpp"; sourceTree = "<group>"; }; 17602 F4034F8D275C087B003A81F8 /* NavigatorCookieConsent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NavigatorCookieConsent.h; path = "cookie-consent/NavigatorCookieConsent.h"; sourceTree = "<group>"; }; 17603 F4034F8E275C087C003A81F8 /* Navigator+CookieConsent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "Navigator+CookieConsent.idl"; path = "cookie-consent/Navigator+CookieConsent.idl"; sourceTree = "<group>"; }; 17604 F4034F8F275C1686003A81F8 /* RequestCookieConsentOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RequestCookieConsentOptions.h; path = "cookie-consent/RequestCookieConsentOptions.h"; sourceTree = "<group>"; }; 17605 F4034F91275C1686003A81F8 /* RequestCookieConsentOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = RequestCookieConsentOptions.idl; path = "cookie-consent/RequestCookieConsentOptions.idl"; sourceTree = "<group>"; }; 17606 F4034F9C275C4783003A81F8 /* CookieConsentDecisionResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CookieConsentDecisionResult.h; path = "cookie-consent/CookieConsentDecisionResult.h"; sourceTree = "<group>"; }; 17598 17607 F403E7852363B58C00044550 /* EnterKeyHint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EnterKeyHint.h; sourceTree = "<group>"; }; 17599 17608 F403E7862363B58C00044550 /* EnterKeyHint.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = EnterKeyHint.cpp; sourceTree = "<group>"; }; … … 25811 25820 41380C1E1F34366000155FDA /* cache */, 25812 25821 E596DD23251902D600C275A7 /* contact-picker */, 25822 F4034F8B275C0867003A81F8 /* cookie-consent */, 25813 25823 57C7A6881E56946D00C67D71 /* credentialmanagement */, 25814 25824 CDA98DBD16014E0800FEA3B1 /* encryptedmedia */, … … 31216 31226 ); 31217 31227 path = mac; 31228 sourceTree = "<group>"; 31229 }; 31230 F4034F8B275C0867003A81F8 /* cookie-consent */ = { 31231 isa = PBXGroup; 31232 children = ( 31233 F4034F9C275C4783003A81F8 /* CookieConsentDecisionResult.h */, 31234 F4034F8E275C087C003A81F8 /* Navigator+CookieConsent.idl */, 31235 F4034F8C275C087B003A81F8 /* NavigatorCookieConsent.cpp */, 31236 F4034F8D275C087B003A81F8 /* NavigatorCookieConsent.h */, 31237 F4034F8F275C1686003A81F8 /* RequestCookieConsentOptions.h */, 31238 F4034F91275C1686003A81F8 /* RequestCookieConsentOptions.idl */, 31239 ); 31240 name = "cookie-consent"; 31218 31241 sourceTree = "<group>"; 31219 31242 }; … … 33054 33077 buildActionMask = 2147483647; 33055 33078 files = ( 33056 7B582DD82716F55B004B92D0 /* (null) in Headers */,33057 33079 7CD0E2B81F80A4820016A4CE /* AbortController.h in Headers */, 33058 33080 7CD0E2BF1F80A56E0016A4CE /* AbortSignal.h in Headers */, … … 33605 33627 83F28C0024DB1DE1005BA6F6 /* ConvolverOptions.h in Headers */, 33606 33628 D8B6152F1032495100C8554A /* Cookie.h in Headers */, 33629 F4034F9D275C4789003A81F8 /* CookieConsentDecisionResult.h in Headers */, 33607 33630 E1424C94164B52C800F32D40 /* CookieJar.h in Headers */, 33608 33631 7A5699702086C619000E0433 /* CookieRequestHeaderFieldProxy.h in Headers */, … … 36039 36062 F440E77A233D94D70063F9AB /* NavigatorClipboard.h in Headers */, 36040 36063 E596DD29251903D200C275A7 /* NavigatorContacts.h in Headers */, 36064 F4034FAE275EAD76003A81F8 /* NavigatorCookieConsent.h in Headers */, 36041 36065 372D3E57216578AE00C5E021 /* NavigatorCredentials.h in Headers */, 36042 36066 9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */, … … 36613 36637 46DD6E1F26E7DBE7008C1F4C /* ReportingEndpointsCache.h in Headers */, 36614 36638 4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */, 36639 F4034FAC275EAD6E003A81F8 /* RequestCookieConsentOptions.h in Headers */, 36615 36640 F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */, 36616 36641 58B2F9F42232D45300938D63 /* ResizeObservation.h in Headers */, -
trunk/Source/WebCore/loader/EmptyClients.cpp
r286632 r286640 36 36 #include "ColorChooser.h" 37 37 #include "ContextMenuClient.h" 38 #include "CookieConsentDecisionResult.h" 38 39 #include "CookieJar.h" 39 40 #include "DOMPasteAccess.h" … … 585 586 } 586 587 588 void EmptyChromeClient::requestCookieConsent(CompletionHandler<void(CookieConsentDecisionResult)>&& completion) 589 { 590 completion(CookieConsentDecisionResult::NotSupported); 591 } 592 587 593 void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, PolicyCheckIdentifier, FramePolicyFunction&&) 588 594 { -
trunk/Source/WebCore/loader/EmptyClients.h
r286019 r286640 219 219 220 220 RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; } 221 222 void requestCookieConsent(CompletionHandler<void(CookieConsentDecisionResult)>&&) final; 221 223 }; 222 224 -
trunk/Source/WebCore/page/ChromeClient.h
r286459 r286640 143 143 struct WindowFeatures; 144 144 145 enum class CookieConsentDecisionResult : uint8_t; 145 146 enum class RouteSharingPolicy : uint8_t; 146 147 … … 620 621 #endif 621 622 623 virtual void requestCookieConsent(CompletionHandler<void(CookieConsentDecisionResult)>&&) = 0; 624 622 625 protected: 623 626 virtual ~ChromeClient() = default; -
trunk/Source/WebKit/ChangeLog
r286632 r286640 1 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for `navigator.requestCookieConsent()` behind a disabled feature flag 4 https://bugs.webkit.org/show_bug.cgi?id=233890 5 rdar://86117718 6 7 Reviewed by Darin Adler. 8 9 Add plumbing for an async `requestCookieConsent()` method on ChromeClient that plumbs through the WebKit2 client 10 layer, into a new private (for the time being) UI delegate method. If the new delegate method is not implemented 11 (or there is no UI delegate at all), we immediately invoke the decision handler with a result of `NotSupported`, 12 allowing us to reject the promise with a `NotSupportedError`. 13 14 See WebCore ChangeLog for more details. 15 16 * UIProcess/API/APIUIClient.h: 17 (API::UIClient::requestCookieConsent): 18 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: 19 * UIProcess/Cocoa/UIDelegate.h: 20 * UIProcess/Cocoa/UIDelegate.mm: 21 (WebKit::UIDelegate::setDelegate): 22 (WebKit::UIDelegate::UIClient::requestCookieConsent): 23 * UIProcess/WebPageProxy.cpp: 24 (WebKit::WebPageProxy::requestCookieConsent): 25 * UIProcess/WebPageProxy.h: 26 * UIProcess/WebPageProxy.messages.in: 27 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 28 (WebKit::WebChromeClient::requestCookieConsent): 29 * WebProcess/WebCoreSupport/WebChromeClient.h: 30 1 31 2021-12-07 Devin Rousso <drousso@apple.com> 2 32 -
trunk/Source/WebKit/UIProcess/API/APIUIClient.h
r286318 r286640 31 31 #include "WebHitTestResultData.h" 32 32 #include "WebPageProxy.h" 33 #include <WebCore/CookieConsentDecisionResult.h> 33 34 #include <WebCore/FloatRect.h> 34 35 #include <wtf/CompletionHandler.h> … … 145 146 virtual void decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, SecurityOrigin&, CompletionHandler<void(bool allowed)>&& completionHandler) { completionHandler(false); } 146 147 virtual void requestStorageAccessConfirm(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(true); } 148 virtual void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&& completionHandler) { completionHandler(WebCore::CookieConsentDecisionResult::NotSupported); } 147 149 148 150 // Printing. -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r286318 r286640 177 177 - (void)_webView:(WKWebView *)webView startXRSessionWithCompletionHandler:(void (^)(id))completionHandler WK_API_AVAILABLE(macos(12.0), ios(15.0)); 178 178 - (void)_webView:(WKWebView *)webView requestNotificationPermissionForSecurityOrigin:(WKSecurityOrigin *)securityOrigin decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA)); 179 180 - (void)_webView:(WKWebView *)webView requestCookieConsentWithMoreInfoHandler:(void (^)(void))moreInfoHandler decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 179 181 180 182 #if TARGET_OS_IPHONE -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r286318 r286640 107 107 void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final; 108 108 void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, CompletionHandler<void(bool allowed)>&&) final; 109 void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&&) final; 109 110 110 111 #if PLATFORM(MAC) … … 271 272 #endif 272 273 bool webViewRequestNotificationPermissionForSecurityOriginDecisionHandler : 1; 274 bool webViewRequestCookieConsentWithMoreInfoHandlerDecisionHandler : 1; 273 275 } m_delegateMethods; 274 276 }; -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r286318 r286640 198 198 #endif 199 199 m_delegateMethods.webViewRequestNotificationPermissionForSecurityOriginDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:)]; 200 m_delegateMethods.webViewRequestCookieConsentWithMoreInfoHandlerDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestCookieConsentWithMoreInfoHandler:decisionHandler:)]; 200 201 } 201 202 … … 642 643 } 643 644 645 void UIDelegate::UIClient::requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&& completion) 646 { 647 if (!m_uiDelegate) 648 return completion(WebCore::CookieConsentDecisionResult::NotSupported); 649 650 if (!m_uiDelegate->m_delegateMethods.webViewRequestCookieConsentWithMoreInfoHandlerDecisionHandler) 651 return completion(WebCore::CookieConsentDecisionResult::NotSupported); 652 653 auto delegate = m_uiDelegate->m_delegate.get(); 654 if (!delegate) 655 return completion(WebCore::CookieConsentDecisionResult::NotSupported); 656 657 // FIXME: Add support for the 'more info' handler. 658 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate->m_webView.get().get() requestCookieConsentWithMoreInfoHandler:nil decisionHandler:makeBlockPtr([completion = WTFMove(completion)] (BOOL decision) mutable { 659 completion(decision ? WebCore::CookieConsentDecisionResult::Consent : WebCore::CookieConsentDecisionResult::Dissent); 660 }).get()]; 661 } 662 644 663 #if PLATFORM(MAC) 645 664 bool UIDelegate::UIClient::canRunModal() const -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286632 r286640 11025 11025 #endif 11026 11026 11027 void WebPageProxy::requestCookieConsent(CompletionHandler<void(CookieConsentDecisionResult)>&& completion) 11028 { 11029 m_uiClient->requestCookieConsent(WTFMove(completion)); 11030 } 11031 11027 11032 } // namespace WebKit 11028 11033 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r286632 r286640 266 266 267 267 enum class AutoplayEvent : uint8_t; 268 enum class CookieConsentDecisionResult : uint8_t; 268 269 enum class CreateNewGroupForHighlight : bool; 269 270 enum class DOMPasteAccessCategory : uint8_t; … … 2033 2034 void didDestroyNotification(uint64_t notificationID); 2034 2035 2036 void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&&); 2037 2035 2038 private: 2036 2039 WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r286632 r286640 617 617 AbortApplePayAMSUISession() 618 618 #endif 619 620 RequestCookieConsent() -> (enum:uint8_t WebCore::CookieConsentDecisionResult result) Async 619 621 } -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r286459 r286640 1560 1560 #endif // ENABLE(APPLE_PAY_AMS_UI) 1561 1561 1562 void WebChromeClient::requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&& completion) 1563 { 1564 m_page.sendWithAsyncReply(Messages::WebPageProxy::RequestCookieConsent(), WTFMove(completion)); 1565 } 1566 1562 1567 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r286459 r286640 32 32 class HTMLImageElement; 33 33 class RegistrableDomain; 34 enum class CookieConsentDecisionResult : uint8_t; 34 35 enum class StorageAccessPromptWasShown : bool; 35 36 enum class StorageAccessWasGranted : bool; … … 463 464 #endif 464 465 466 void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&&) final; 467 465 468 mutable bool m_cachedMainFrameHasHorizontalScrollbar { false }; 466 469 mutable bool m_cachedMainFrameHasVerticalScrollbar { false }; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r286632 r286640 1 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for `navigator.requestCookieConsent()` behind a disabled feature flag 4 https://bugs.webkit.org/show_bug.cgi?id=233890 5 rdar://86117718 6 7 Reviewed by Darin Adler. 8 9 Add an implementation stub for the new chrome client hook, `requestCookieConsent()`. 10 11 * WebCoreSupport/WebChromeClient.h: 12 * WebCoreSupport/WebChromeClient.mm: 13 (WebChromeClient::requestCookieConsent): 14 1 15 2021-12-07 Devin Rousso <drousso@apple.com> 2 16 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h
r286459 r286640 258 258 RefPtr<PAL::WebGPU::GPU> createGPUForWebGPU() const final; 259 259 260 void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&&) final; 261 260 262 #if ENABLE(VIDEO_PRESENTATION_MODE) 261 263 bool m_mockVideoPresentationModeEnabled { false }; -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm
r286459 r286640 59 59 #import <WebCore/ContextMenu.h> 60 60 #import <WebCore/ContextMenuController.h> 61 #import <WebCore/CookieConsentDecisionResult.h> 61 62 #import <WebCore/Cursor.h> 62 63 #import <WebCore/DataListSuggestionPicker.h> … … 1167 1168 #endif 1168 1169 } 1170 1171 void WebChromeClient::requestCookieConsent(CompletionHandler<void(CookieConsentDecisionResult)>&& completion) 1172 { 1173 completion(CookieConsentDecisionResult::NotSupported); 1174 } -
trunk/Source/WebKitLegacy/win/ChangeLog
r286632 r286640 1 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for `navigator.requestCookieConsent()` behind a disabled feature flag 4 https://bugs.webkit.org/show_bug.cgi?id=233890 5 rdar://86117718 6 7 Reviewed by Darin Adler. 8 9 Add an implementation stub for the new chrome client hook, `requestCookieConsent()`. 10 11 * WebCoreSupport/WebChromeClient.cpp: 12 (WebChromeClient::requestCookieConsent): 13 * WebCoreSupport/WebChromeClient.h: 14 1 15 2021-12-07 Devin Rousso <drousso@apple.com> 2 16 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp
r282606 r286640 39 39 #include <WebCore/BString.h> 40 40 #include <WebCore/ContextMenu.h> 41 #include <WebCore/CookieConsentDecisionResult.h> 41 42 #include <WebCore/Cursor.h> 42 43 #include <WebCore/FileChooser.h> … … 876 877 #endif 877 878 } 879 880 void WebChromeClient::requestCookieConsent(CompletionHandler<void(CookieConsentDecisionResult)>&& completion) 881 { 882 completion(CookieConsentDecisionResult::NotSupported); 883 } -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h
r282606 r286640 184 184 void didFinishLoadingImageForElement(WebCore::HTMLImageElement&) final; 185 185 186 void requestCookieConsent(CompletionHandler<void(WebCore::CookieConsentDecisionResult)>&&); 187 186 188 private: 187 189 COMPtr<IWebUIDelegate> uiDelegate(); -
trunk/Tools/ChangeLog
r286633 r286640 1 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add support for `navigator.requestCookieConsent()` behind a disabled feature flag 4 https://bugs.webkit.org/show_bug.cgi?id=233890 5 rdar://86117718 6 7 Reviewed by Darin Adler. 8 9 Add several new API tests that enable the feature flag and exercise the API. 10 11 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 12 * TestWebKitAPI/Tests/WebKit/CookieConsent.mm: Added. 13 (-[CookieConsentDelegate _webView:requestCookieConsentWithMoreInfoHandler:decisionHandler:]): 14 (TestWebKitAPI::createWebViewForTestingCookieConsent): 15 (TestWebKitAPI::checkForString): 16 (TestWebKitAPI::TEST): 17 * TestWebKitAPI/Tests/WebKit/cookie-consent-basic.html: Added. 18 1 19 2021-12-07 Yousuke Kimoto <Yousuke.Kimoto@sony.com> 2 20 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r286630 r286640 998 998 F4010B8324DA267F00A876E2 /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4010B8124DA267F00A876E2 /* PoseAsClass.mm */; }; 999 999 F402F56C23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = F402F56B23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm */; }; 1000 F4034FA1275D5402003A81F8 /* CookieConsent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4034FA0275D5402003A81F8 /* CookieConsent.mm */; }; 1001 F4034FA3275D5AC6003A81F8 /* cookie-consent-basic.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4034FA2275D5449003A81F8 /* cookie-consent-basic.html */; }; 1000 1002 F407FE391F1D0DFC0017CF25 /* enormous.svg in Copy Resources */ = {isa = PBXBuildFile; fileRef = F407FE381F1D0DE60017CF25 /* enormous.svg */; }; 1001 1003 F4094CC725545BD5003D73E3 /* DisplayListTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4094CC625545BD5003D73E3 /* DisplayListTests.cpp */; }; … … 1266 1268 5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */, 1267 1269 CD0BD0A81F79982D001AB2CF /* ContextMenuImgWithVideo.html in Copy Resources */, 1270 F4034FA3275D5AC6003A81F8 /* cookie-consent-basic.html in Copy Resources */, 1268 1271 5C2936961D5C00ED00DEAB1E /* CookieMessage.html in Copy Resources */, 1269 1272 9B1F6F791F90559E00B55744 /* copy-html.html in Copy Resources */, … … 2926 2929 F4010B8224DA267F00A876E2 /* PoseAsClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PoseAsClass.h; path = ../TestRunnerShared/cocoa/PoseAsClass.h; sourceTree = "<group>"; }; 2927 2930 F402F56B23ECC2FB00865549 /* UIWKInteractionViewProtocol.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIWKInteractionViewProtocol.mm; sourceTree = "<group>"; }; 2931 F4034FA0275D5402003A81F8 /* CookieConsent.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CookieConsent.mm; sourceTree = "<group>"; }; 2932 F4034FA2275D5449003A81F8 /* cookie-consent-basic.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "cookie-consent-basic.html"; sourceTree = "<group>"; }; 2928 2933 F407FE381F1D0DE60017CF25 /* enormous.svg */ = {isa = PBXFileReference; lastKnownFileType = text; path = enormous.svg; sourceTree = "<group>"; }; 2929 2934 F4094CC625545BD5003D73E3 /* DisplayListTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayListTests.cpp; sourceTree = "<group>"; }; … … 3273 3278 C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */, 3274 3279 C1692DC923D10DAE006E88F7 /* Battery.mm */, 3280 F4034FA0275D5402003A81F8 /* CookieConsent.mm */, 3275 3281 C13D82D82416F13200A62793 /* EnableAccessibility.mm */, 3276 3282 1C81802625FB09E200608B3E /* FontRegistrySandboxCheck.mm */, … … 4595 4601 9B270FED1DDC25FD002D53F3 /* closed-shadow-tree-test.html */, 4596 4602 5C9E56861DF9148E00C9EE33 /* contentBlockerCheck.html */, 4603 F4034FA2275D5449003A81F8 /* cookie-consent-basic.html */, 4597 4604 2DDD4DA3270B8B3300659A61 /* cube.usdz */, 4598 4605 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */, … … 5409 5416 CD0BD0A61F79924D001AB2CF /* ContextMenuImgWithVideo.mm in Sources */, 5410 5417 A1C142C224AA7B2E00444207 /* ContextMenuMouseEvents.mm in Sources */, 5418 F4034FA1275D5402003A81F8 /* CookieConsent.mm in Sources */, 5411 5419 7CCE7EAC1A411A3400447C4C /* Counters.cpp in Sources */, 5412 5420 7AEAD47F1E20116C00416EFE /* CrossPartitionFileSchemeAccess.mm in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.