Changeset 231457 in webkit
- Timestamp:
- May 7, 2018 2:56:53 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r231456 r231457 1 2018-05-07 Brent Fulgham <bfulgham@apple.com> 2 3 Add experimental feature to prompt for Storage Access API use 4 https://bugs.webkit.org/show_bug.cgi?id=185335 5 <rdar://problem/39994649> 6 7 Reviewed by Alex Christensen and Youenn Fablet. 8 9 Create a new experimental feature that gates the ability of WebKit clients to prompt the user when 10 Storage Access API is invoked. 11 12 Currently this feature doesn't have any user-visible impact. 13 14 * page/RuntimeEnabledFeatures.h: 15 (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled): 16 (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const): 17 * testing/InternalSettings.cpp: 18 (WebCore::InternalSettings::Backup::Backup): 19 (WebCore::InternalSettings::Backup::restoreTo): 20 (WebCore::InternalSettings::setStorageAccessPromptsEnabled): 21 * testing/InternalSettings.h: 22 * testing/InternalSettings.idl: 23 1 24 2018-05-07 Chris Dumez <cdumez@apple.com> 2 25 -
trunk/Source/WebCore/page/RuntimeEnabledFeatures.h
r231327 r231457 257 257 bool webGLCompressedTextureASTCSupportEnabled() const { return m_isWebGLCompressedTextureASTCSupportEnabled; } 258 258 259 void setStorageAccessPromptsEnabled(bool isEnabled) { m_promptForStorageAccessAPIEnabled = isEnabled; } 260 bool storageAccessPromptsEnabled() const { return m_promptForStorageAccessAPIEnabled; } 261 259 262 WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures(); 260 263 … … 395 398 bool m_isWebGLCompressedTextureASTCSupportEnabled { false }; 396 399 400 bool m_promptForStorageAccessAPIEnabled { false }; 401 397 402 friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>; 398 403 }; -
trunk/Source/WebCore/testing/InternalSettings.cpp
r230808 r231457 123 123 #endif 124 124 , m_customPasteboardDataEnabled(RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) 125 , m_promptForStorageAccessAPIEnabled(RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled()) 125 126 { 126 127 } … … 226 227 DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(m_shouldManageAudioSessionCategory); 227 228 #endif 229 230 RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(m_promptForStorageAccessAPIEnabled); 228 231 } 229 232 … … 777 780 } 778 781 782 void InternalSettings::setStorageAccessPromptsEnabled(bool enabled) 783 { 784 RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(enabled); 785 } 786 779 787 ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy() 780 788 { -
trunk/Source/WebCore/testing/InternalSettings.h
r230808 r231457 128 128 static bool cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled(); 129 129 130 static void setStorageAccessPromptsEnabled(bool); 131 130 132 private: 131 133 explicit InternalSettings(Page*); … … 215 217 #endif 216 218 bool m_customPasteboardDataEnabled; 219 bool m_promptForStorageAccessAPIEnabled { false }; 217 220 }; 218 221 -
trunk/Source/WebCore/testing/InternalSettings.idl
r230808 r231457 93 93 void setWebVREnabled(boolean enabled); 94 94 void setScreenCaptureEnabled(boolean enabled); 95 void setStorageAccessPromptsEnabled(boolean enabled); 95 96 96 97 [MayThrowException] DOMString userInterfaceDirectionPolicy(); -
trunk/Source/WebKit/ChangeLog
r231454 r231457 1 2018-05-07 Brent Fulgham <bfulgham@apple.com> 2 3 Add experimental feature to prompt for Storage Access API use 4 https://bugs.webkit.org/show_bug.cgi?id=185335 5 <rdar://problem/39994649> 6 7 Reviewed by Alex Christensen and Youenn Fablet. 8 9 Create a new experimental feature that gates the ability of WebKit clients to prompt the user when 10 Storage Access API is invoked. 11 12 Currently this feature doesn't have any user-visible impact. 13 14 * Shared/API/APIObject.h: 15 * Shared/API/c/WKBase.h: 16 * Shared/WebPreferences.yaml: 17 * UIProcess/API/APIUIClient.h: 18 (API::UIClient::requestStorageAccessConfirm): 19 * UIProcess/API/C/WKPage.cpp: 20 (WebKit::RequestStorageAccessConfirmResultListener::create): 21 (WebKit::RequestStorageAccessConfirmResultListener::~RequestStorageAccessConfirmResultListener): 22 (WebKit::RequestStorageAccessConfirmResultListener::call): 23 (WebKit::RequestStorageAccessConfirmResultListener::RequestStorageAccessConfirmResultListener): 24 (WKPageRequestStorageAccessConfirmResultListenerGetTypeID): 25 (WKPageRequestStorageAccessConfirmResultListenerCall): 26 (WKPageSetPageUIClient): 27 * UIProcess/API/C/WKPageUIClient.h: 28 * UIProcess/API/Cocoa/WKPreferences.mm: 29 (-[WKPreferences _storageAccessPromptsEnabled]): 30 (-[WKPreferences _setStorageAccessPromptsEnabled:]): 31 * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 32 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: 33 * UIProcess/Cocoa/UIDelegate.h: 34 * UIProcess/Cocoa/UIDelegate.mm: 35 (WebKit::UIDelegate::setDelegate): 36 (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): 37 * UIProcess/WebPageProxy.cpp: 38 (WebKit::WebPageProxy::requestStorageAccessConfirm): 39 * UIProcess/WebPageProxy.h: 40 * UIProcess/WebPageProxy.messages.in: 41 * UIProcess/WebPreferences.cpp: 42 (WebKit::WebPreferences::update): 43 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 44 (WebKit::WebChromeClient::requestStorageAccess): 45 1 46 2018-05-07 Dean Jackson <dino@apple.com> 2 47 -
trunk/Source/WebKit/Shared/API/APIObject.h
r225598 r231457 145 145 PluginSiteDataManager, 146 146 Preferences, 147 RequestStorageAccessConfirmResultListener, 147 148 ResourceLoadStatisticsStore, 148 149 RunBeforeUnloadConfirmPanelResultListener, -
trunk/Source/WebKit/Shared/API/c/WKBase.h
r228455 r231457 126 126 typedef const struct OpaqueWKPageRunJavaScriptConfirmResultListener* WKPageRunJavaScriptConfirmResultListenerRef; 127 127 typedef const struct OpaqueWKPageRunJavaScriptPromptResultListener* WKPageRunJavaScriptPromptResultListenerRef; 128 typedef const struct OpaqueWKPageRequestStorageAccessConfirmResultListener* WKPageRequestStorageAccessConfirmResultListenerRef; 128 129 typedef const struct OpaqueWKResourceLoadStatisticsManager* WKResourceLoadStatisticsManagerRef; 129 130 typedef const struct OpaqueWKTextChecker* WKTextCheckerRef; -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r231327 r231457 1260 1260 category: experimental 1261 1261 webcoreBinding: RuntimeEnabledFeatures 1262 1263 StorageAccessPromptsEnabled: 1264 type: bool 1265 defaultValue: false 1266 humanReadableName: "Prompt for Storage Access API Requests" 1267 humanReadableDescription: "Prompt the user when Storage Access API calls are made" 1268 category: experimental 1269 webcoreBinding: RuntimeEnabledFeatures -
trunk/Source/WebKit/UIProcess/API/APIUIClient.h
r230851 r231457 129 129 virtual bool checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy&) { return false; } 130 130 virtual void decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, SecurityOrigin&, Function<void(bool)>&& completionHandler) { completionHandler(false); } 131 virtual void requestStorageAccessConfirm(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(true); } 131 132 132 133 // Printing. -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r231024 r231457 112 112 113 113 template<> struct ClientTraits<WKPageUIClientBase> { 114 typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10, WKPageUIClientV11 > Versions;114 typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10, WKPageUIClientV11, WKPageUIClientV12> Versions; 115 115 }; 116 116 … … 1511 1511 }; 1512 1512 1513 class RequestStorageAccessConfirmResultListener : public API::ObjectImpl<API::Object::Type::RequestStorageAccessConfirmResultListener> { 1514 public: 1515 static Ref<RequestStorageAccessConfirmResultListener> create(CompletionHandler<void(bool)>&& completionHandler) 1516 { 1517 return adoptRef(*new RequestStorageAccessConfirmResultListener(WTFMove(completionHandler))); 1518 } 1519 1520 virtual ~RequestStorageAccessConfirmResultListener() 1521 { 1522 } 1523 1524 void call(bool result) 1525 { 1526 m_completionHandler(result); 1527 } 1528 1529 private: 1530 explicit RequestStorageAccessConfirmResultListener(CompletionHandler<void(bool)>&& completionHandler) 1531 : m_completionHandler(WTFMove(completionHandler)) 1532 { 1533 } 1534 1535 CompletionHandler<void(bool)> m_completionHandler; 1536 }; 1537 1513 1538 WK_ADD_API_MAPPING(WKPageRunBeforeUnloadConfirmPanelResultListenerRef, RunBeforeUnloadConfirmPanelResultListener) 1514 1539 WK_ADD_API_MAPPING(WKPageRunJavaScriptAlertResultListenerRef, RunJavaScriptAlertResultListener) 1515 1540 WK_ADD_API_MAPPING(WKPageRunJavaScriptConfirmResultListenerRef, RunJavaScriptConfirmResultListener) 1516 1541 WK_ADD_API_MAPPING(WKPageRunJavaScriptPromptResultListenerRef, RunJavaScriptPromptResultListener) 1542 WK_ADD_API_MAPPING(WKPageRequestStorageAccessConfirmResultListenerRef, RequestStorageAccessConfirmResultListener) 1517 1543 1518 1544 } … … 1556 1582 { 1557 1583 toImpl(listener)->call(toWTFString(result)); 1584 } 1585 1586 WKTypeID WKPageRequestStorageAccessConfirmResultListenerGetTypeID() 1587 { 1588 return toAPI(RequestStorageAccessConfirmResultListener::APIType); 1589 } 1590 1591 void WKPageRequestStorageAccessConfirmResultListenerCall(WKPageRequestStorageAccessConfirmResultListenerRef listener, bool result) 1592 { 1593 toImpl(listener)->call(result); 1558 1594 } 1559 1595 … … 1983 2019 } 1984 2020 2021 void requestStorageAccessConfirm(WebPageProxy& page, WebFrameProxy* frame, const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler<void(bool)>&& completionHandler) final 2022 { 2023 if (!m_client.requestStorageAccessConfirm) { 2024 completionHandler(true); 2025 return; 2026 } 2027 2028 auto listener = RequestStorageAccessConfirmResultListener::create(WTFMove(completionHandler)); 2029 m_client.requestStorageAccessConfirm(toAPI(&page), toAPI(frame), toAPI(requestingDomain.impl()), toAPI(currentDomain.impl()), toAPI(listener.ptr()), m_client.base.clientInfo); 2030 } 2031 1985 2032 // Printing. 1986 2033 float headerHeight(WebPageProxy& page, WebFrameProxy& frame) final -
trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h
r230851 r231457 80 80 WK_EXPORT void WKPageRunJavaScriptPromptResultListenerCall(WKPageRunJavaScriptPromptResultListenerRef listener, WKStringRef result); 81 81 82 WK_EXPORT WKTypeID WKPageRequestStorageAccessConfirmResultListenerGetTypeID(); 83 WK_EXPORT void WKPageRequestStorageAccessConfirmResultListenerCall(WKPageRequestStorageAccessConfirmResultListenerRef listener, bool result); 84 82 85 typedef void (*WKPageUIClientCallback)(WKPageRef page, const void* clientInfo); 83 86 typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo); … … 86 89 typedef void (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptConfirmResultListenerRef listener, const void *clientInfo); 87 90 typedef void (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo); 91 typedef void (*WKPageRequestStorageAccessConfirmCallback)(WKPageRef page, WKFrameRef frame, WKStringRef requestingDomain, WKStringRef currentDomain, WKPageRequestStorageAccessConfirmResultListenerRef listener, const void *clientInfo); 88 92 typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo); 89 93 typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo); … … 1034 1038 } WKPageUIClientV11; 1035 1039 1040 typedef struct WKPageUIClientV12 { 1041 WKPageUIClientBase base; 1042 1043 // Version 0. 1044 WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; 1045 WKPageUIClientCallback showPage; 1046 WKPageUIClientCallback close; 1047 WKPageTakeFocusCallback takeFocus; 1048 WKPageFocusCallback focus; 1049 WKPageUnfocusCallback unfocus; 1050 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 1051 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 1052 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 1053 WKPageSetStatusTextCallback setStatusText; 1054 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; 1055 WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; 1056 WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; 1057 WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; 1058 WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; 1059 WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; 1060 WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; 1061 WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; 1062 WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; 1063 WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; 1064 WKPageGetIsResizableCallback isResizable; 1065 WKPageSetIsResizableCallback setIsResizable; 1066 WKPageGetWindowFrameCallback getWindowFrame; 1067 WKPageSetWindowFrameCallback setWindowFrame; 1068 WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel_deprecatedForUseWithV6; 1069 WKPageUIClientCallback didDraw; 1070 WKPageUIClientCallback pageDidScroll; 1071 WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; 1072 WKPageRunOpenPanelCallback runOpenPanel; 1073 WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; 1074 WKPageHeaderHeightCallback headerHeight; 1075 WKPageFooterHeightCallback footerHeight; 1076 WKPageDrawHeaderCallback drawHeader; 1077 WKPageDrawFooterCallback drawFooter; 1078 WKPagePrintFrameCallback printFrame; 1079 WKPageUIClientCallback runModal; 1080 void* unused1; // Used to be didCompleteRubberBandForMainFrame 1081 WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; 1082 void* shouldInterruptJavaScript_unavailable; 1083 1084 // Version 1. 1085 WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage_deprecatedForUseWithV1; 1086 WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; 1087 WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; 1088 WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; 1089 1090 // Version 2. 1091 WKPageShowColorPickerCallback showColorPicker; 1092 WKPageHideColorPickerCallback hideColorPicker; 1093 WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; 1094 1095 // Version 3. 1096 WKPagePinnedStateDidChangeCallback pinnedStateDidChange; 1097 1098 // Version 4. 1099 void* unused2; // Used to be didBeginTrackingPotentialLongMousePress. 1100 void* unused3; // Used to be didRecognizeLongMousePress. 1101 void* unused4; // Used to be didCancelTrackingPotentialLongMousePress. 1102 WKPageIsPlayingAudioDidChangeCallback isPlayingAudioDidChange; 1103 1104 // Version 5. 1105 WKPageDecidePolicyForUserMediaPermissionRequestCallback decidePolicyForUserMediaPermissionRequest; 1106 WKPageDidClickAutoFillButtonCallback didClickAutoFillButton; 1107 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5 runJavaScriptAlert_deprecatedForUseWithV5; 1108 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5 runJavaScriptConfirm_deprecatedForUseWithV5; 1109 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5 runJavaScriptPrompt_deprecatedForUseWithV5; 1110 WKPageMediaSessionMetadataDidChangeCallback mediaSessionMetadataDidChange; 1111 1112 // Version 6. 1113 WKPageCreateNewPageCallback createNewPage; 1114 WKPageRunJavaScriptAlertCallback runJavaScriptAlert; 1115 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; 1116 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; 1117 WKCheckUserMediaPermissionCallback checkUserMediaPermissionForOrigin; 1118 1119 // Version 7. 1120 WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; 1121 WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline; 1122 1123 // Version 8. 1124 WKRequestPointerLockCallback requestPointerLock; 1125 WKDidLosePointerLockCallback didLosePointerLock; 1126 1127 // Version 9. 1128 WKHandleAutoplayEventCallback handleAutoplayEvent; 1129 1130 // Version 10. 1131 WKHasVideoInPictureInPictureDidChangeCallback hasVideoInPictureInPictureDidChange; 1132 WKDidExceedBackgroundResourceLimitWhileInForegroundCallback didExceedBackgroundResourceLimitWhileInForeground; 1133 1134 // Version 11. 1135 WKPageDidResignInputElementStrongPasswordAppearanceCallback didResignInputElementStrongPasswordAppearance; 1136 1137 // Version 12. 1138 WKPageRequestStorageAccessConfirmCallback requestStorageAccessConfirm; 1139 } WKPageUIClientV12; 1140 1036 1141 #ifdef __cplusplus 1037 1142 } -
trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp
r230968 r231457 195 195 } 196 196 197 void WKPreferencesSetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef, bool enabled) 198 { 199 toImpl(preferencesRef)->setStorageAccessPromptsEnabled(enabled); 200 } 201 202 bool WKPreferencesGetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef) 203 { 204 return toImpl(preferencesRef)->storageAccessPromptsEnabled(); 205 } 206 197 207 void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef, bool hyperlinkAuditingEnabled) 198 208 { -
trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h
r230968 r231457 109 109 WK_EXPORT bool WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferences); 110 110 111 // Defaults to false. 112 WK_EXPORT void WKPreferencesSetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef, bool enabled); 113 WK_EXPORT bool WKPreferencesGetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef); 114 111 115 // Defaults to true. 112 116 WK_EXPORT void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferences, bool hyperlinkAuditingEnabled); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
r230039 r231457 130 130 } 131 131 132 - (BOOL)_storageAccessPromptsEnabled 133 { 134 return _preferences->storageAccessPromptsEnabled(); 135 } 136 137 - (void)_setStorageAccessPromptsEnabled:(BOOL)enabled 138 { 139 _preferences->setStorageAccessPromptsEnabled(enabled); 140 } 141 132 142 #pragma mark OS X-specific methods 133 143 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
r230121 r231457 137 137 @property (nonatomic, setter=_setShouldEnableTextAutosizingBoost:) BOOL _shouldEnableTextAutosizingBoost WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 138 138 139 @property (nonatomic, setter=_setStorageAccessPromptsEnabled:) BOOL _storageAccessPromptsEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 140 139 141 #if !TARGET_OS_IPHONE 140 142 @property (nonatomic, setter=_setWebGLEnabled:) BOOL _webGLEnabled WK_API_AVAILABLE(macosx(10.13.4)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r231174 r231457 117 117 - (void)_webView:(WKWebView *)webView didResignInputElementStrongPasswordAppearanceWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 118 118 119 - (void)_webView:(WKWebView *)webView requestStorageAccessPanelForDomain:(NSString *)requestingDomain underCurrentDomain:(NSString *)currentDomain completionHandler:(void (^)(BOOL result))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 120 119 121 #if TARGET_OS_IPHONE 120 122 - (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(9.0)); -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r231174 r231457 89 89 void runJavaScriptConfirm(WebPageProxy*, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final; 90 90 void runJavaScriptPrompt(WebPageProxy*, const WTF::String&, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(const WTF::String&)>&&) final; 91 void requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy*, const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler<void(bool)>&&) final; 91 92 void decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, Function<void(bool)>&) final; 92 93 bool canRunBeforeUnloadConfirmPanel() const final; … … 157 158 bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; 158 159 bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1; 160 bool webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler : 1; 159 161 bool webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; 160 162 bool webViewRequestGeolocationPermissionForFrameDecisionHandler : 1; -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r231174 r231457 103 103 m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; 104 104 m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)]; 105 m_delegateMethods.webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler = [delegate respondsToSelector:@selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)]; 105 106 m_delegateMethods.webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(_webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; 106 107 m_delegateMethods.webViewRequestGeolocationPermissionForFrameDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestGeolocationPermissionForFrame:decisionHandler:)]; … … 329 330 } 330 331 332 void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy*, const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler<void(bool)>&& completionHandler) 333 { 334 if (!m_uiDelegate.m_delegateMethods.webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler) { 335 completionHandler(true); 336 return; 337 } 338 339 auto delegate = m_uiDelegate.m_delegate.get(); 340 if (!delegate) { 341 completionHandler(true); 342 return; 343 } 344 345 auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)); 346 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingDomain underCurrentDomain:currentDomain completionHandler:BlockPtr<void(BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](BOOL result) { 347 if (checker->completionHandlerHasBeenCalled()) 348 return; 349 completionHandler(result); 350 checker->didCallCompletionHandler(); 351 }).get()]; 352 } 353 331 354 void UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy& frame, API::SecurityOrigin& securityOrigin, Function<void(bool)>& completionHandler) 332 355 { -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r231447 r231457 7473 7473 7474 7474 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 7475 void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_twebProcessContextId)7476 { 7477 m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [this, webProcessContextId] (bool hasAccess) {7475 void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId) 7476 { 7477 m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID, [this, webProcessContextId] (bool hasAccess) { 7478 7478 m_process->send(Messages::WebPage::StorageAccessResponse(hasAccess, webProcessContextId), m_pageID); 7479 7479 }); 7480 7480 } 7481 7481 7482 void WebPageProxy::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId) 7483 { 7484 ASSERT(pageID == m_pageID); 7485 m_websiteDataStore->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [this, webProcessContextId] (bool wasGranted) { 7486 m_process->send(Messages::WebPage::StorageAccessResponse(wasGranted, webProcessContextId), m_pageID); 7482 void WebPageProxy::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId, bool promptEnabled) 7483 { 7484 auto completionHandler = [this, protectedThis = makeRef(*this), webProcessContextId] (bool access) { 7485 m_process->send(Messages::WebPage::StorageAccessResponse(access, webProcessContextId), m_pageID); 7486 }; 7487 String requestingDomain = subFrameHost; 7488 String currentDomain = topFrameHost; 7489 m_websiteDataStore->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID, [this, protectedThis = makeRef(*this), requestingDomain = WTFMove(requestingDomain), currentDomain = WTFMove(currentDomain), promptEnabled, frameID, completionHandler = WTFMove(completionHandler)] (bool wasGranted) mutable { 7490 if (!wasGranted) 7491 return completionHandler(false); 7492 7493 if (!promptEnabled) 7494 return completionHandler(true); 7495 7496 m_uiClient->requestStorageAccessConfirm(*this, m_process->webFrame(frameID), requestingDomain, currentDomain, WTFMove(completionHandler)); 7487 7497 }); 7488 7498 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r231439 r231457 1281 1281 1282 1282 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 1283 void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_twebProcessContextId);1284 void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId);1283 void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId); 1284 void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId, bool prompt); 1285 1285 #endif 1286 1286 -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r231439 r231457 513 513 514 514 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 515 HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_tcontextID)516 RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID)515 HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t contextID) 516 RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t contextID, bool prompt) 517 517 #endif 518 518 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r231043 r231457 1285 1285 1286 1286 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 1287 void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback)1288 { 1289 m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID,WTFMove(callback));1290 } 1291 1292 void WebChromeClient::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback)1293 { 1294 m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID,WTFMove(callback));1287 void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& callback) 1288 { 1289 m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, WTFMove(callback)); 1290 } 1291 1292 void WebChromeClient::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& callback) 1293 { 1294 m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, WTFMove(callback)); 1295 1295 } 1296 1296 #endif -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r231439 r231457 5913 5913 } 5914 5914 5915 void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback)5915 void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback) 5916 5916 { 5917 5917 auto contextId = nextRequestStorageAccessContextId(); … … 5919 5919 ASSERT(addResult.isNewEntry); 5920 5920 if (addResult.iterator->value) 5921 send(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID,contextId));5921 send(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, contextId)); 5922 5922 else 5923 5923 callback(false); 5924 5924 } 5925 5925 5926 void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback)5926 void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback) 5927 5927 { 5928 5928 auto contextId = nextRequestStorageAccessContextId(); 5929 5929 auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); 5930 5930 ASSERT(addResult.isNewEntry); 5931 if (addResult.iterator->value) 5932 send(Messages::WebPageProxy::RequestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, contextId)); 5933 else 5931 if (addResult.iterator->value) { 5932 bool promptEnabled = RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled(); 5933 send(Messages::WebPageProxy::RequestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, contextId, promptEnabled)); 5934 } else 5934 5935 callback(false); 5935 5936 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r231439 r231457 1055 1055 1056 1056 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 1057 void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback);1058 void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback);1057 void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback); 1058 void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback); 1059 1059 void storageAccessResponse(bool wasGranted, uint64_t contextId); 1060 1060 #endif
Note: See TracChangeset
for help on using the changeset viewer.