WebKit Bugzilla
Attachment 339693 Details for
Bug 185335
: Add experimental feature to prompt for Storage Access API use
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185335-20180506154731.patch (text/plain), 47.52 KB, created by
Brent Fulgham
on 2018-05-06 15:47:32 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2018-05-06 15:47:32 PDT
Size:
47.52 KB
patch
obsolete
>Subversion Revision: 231396 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 643899057e03d25ecbc3c3fdd48bce9166e16eaa..fa7f60b695990236f1d6f9b010d1687b17e0560b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-05-05 Brent Fulgham <bfulgham@apple.com> >+ >+ Add experimental feature to prompt for Storage Access API use >+ https://bugs.webkit.org/show_bug.cgi?id=185335 >+ <rdar://problem/39994649> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Create a new experimental feature that gates the ability of WebKit clients to prompt the user when >+ Storage Access API is invoked. >+ >+ Currently this feature doesn't have any user-visible impact. >+ >+ * page/RuntimeEnabledFeatures.h: >+ (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled): >+ (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const): >+ * testing/InternalSettings.cpp: >+ (WebCore::InternalSettings::Backup::Backup): >+ (WebCore::InternalSettings::Backup::restoreTo): >+ (WebCore::InternalSettings::setStorageAccessPromptsEnabled): >+ * testing/InternalSettings.h: >+ * testing/InternalSettings.idl: >+ > 2018-05-04 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 6bc61b61b4fa0246738dc1fa2eae9f8e23d6f533..1a531ac0642c02b944221dc016fdb091327676da 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,48 @@ >+2018-05-05 Brent Fulgham <bfulgham@apple.com> >+ >+ Add experimental feature to prompt for Storage Access API use >+ https://bugs.webkit.org/show_bug.cgi?id=185335 >+ <rdar://problem/39994649> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Create a new experimental feature that gates the ability of WebKit clients to prompt the user when >+ Storage Access API is invoked. >+ >+ Currently this feature doesn't have any user-visible impact. >+ >+ * Shared/API/APIObject.h: >+ * Shared/API/c/WKBase.h: >+ * Shared/WebPreferences.yaml: >+ * UIProcess/API/APIUIClient.h: >+ (API::UIClient::requestStorageAccessConfirm): >+ * UIProcess/API/C/WKPage.cpp: >+ (WebKit::RequestStorageAccessConfirmResultListener::create): >+ (WebKit::RequestStorageAccessConfirmResultListener::~RequestStorageAccessConfirmResultListener): >+ (WebKit::RequestStorageAccessConfirmResultListener::call): >+ (WebKit::RequestStorageAccessConfirmResultListener::RequestStorageAccessConfirmResultListener): >+ (WKPageRequestStorageAccessConfirmResultListenerGetTypeID): >+ (WKPageRequestStorageAccessConfirmResultListenerCall): >+ (WKPageSetPageUIClient): >+ * UIProcess/API/C/WKPageUIClient.h: >+ * UIProcess/API/Cocoa/WKPreferences.mm: >+ (-[WKPreferences _storageAccessPromptsEnabled]): >+ (-[WKPreferences _setStorageAccessPromptsEnabled:]): >+ * UIProcess/API/Cocoa/WKPreferencesPrivate.h: >+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: >+ * UIProcess/Cocoa/UIDelegate.h: >+ * UIProcess/Cocoa/UIDelegate.mm: >+ (WebKit::UIDelegate::setDelegate): >+ (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::requestStorageAccessConfirm): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ * UIProcess/WebPreferences.cpp: >+ (WebKit::WebPreferences::update): >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::requestStorageAccess): >+ > 2018-05-04 Tim Horton <timothy_horton@apple.com> > > Shift to a lower-level framework for simplifying URLs >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index f19927dc21b219b39c942eb950b331f72dae7254..20cb924cfb4cb0e8aa23f0a306edc420c0c92700 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -469,6 +469,7 @@ public: > > virtual void hasStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void (bool)>&& callback) { callback(false); } > virtual void requestStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void (bool)>&& callback) { callback(false); } >+ virtual void didRequestStorageAccessConfirm(uint64_t /*frameID*/, uint64_t /*pageID*/, uint64_t /*callbackIdentifier*/, bool /*hasActivity*/) { } > > virtual void didInsertMenuElement(HTMLMenuElement&) { } > virtual void didRemoveMenuElement(HTMLMenuElement&) { } >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.h b/Source/WebCore/page/RuntimeEnabledFeatures.h >index 7df0ac0689c46a10586a6af68215c450562c62b1..f692e57fd027a245b847bce70569aea020a87691 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.h >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.h >@@ -256,6 +256,9 @@ public: > void setWebGLCompressedTextureASTCSupportEnabled(bool isEnabled) { m_isWebGLCompressedTextureASTCSupportEnabled = isEnabled; } > bool webGLCompressedTextureASTCSupportEnabled() const { return m_isWebGLCompressedTextureASTCSupportEnabled; } > >+ void setStorageAccessPromptsEnabled(bool isEnabled) { m_promptForStorageAccessAPIEnabled = isEnabled; } >+ bool storageAccessPromptsEnabled() const { return m_promptForStorageAccessAPIEnabled; } >+ > WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures(); > > private: >@@ -394,6 +397,8 @@ private: > > bool m_isWebGLCompressedTextureASTCSupportEnabled { false }; > >+ bool m_promptForStorageAccessAPIEnabled { false }; >+ > friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>; > }; > >diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp >index 6b17e873bc2dcc9c8de61c53906b919a64928eff..47aa6376ac1e1e096756321131c42bf44e7074c5 100644 >--- a/Source/WebCore/testing/InternalSettings.cpp >+++ b/Source/WebCore/testing/InternalSettings.cpp >@@ -122,6 +122,7 @@ InternalSettings::Backup::Backup(Settings& settings) > , m_shouldManageAudioSessionCategory(DeprecatedGlobalSettings::shouldManageAudioSessionCategory()) > #endif > , m_customPasteboardDataEnabled(RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) >+ , m_promptForStorageAccessAPIEnabled(RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled()) > { > } > >@@ -225,6 +226,8 @@ void InternalSettings::Backup::restoreTo(Settings& settings) > #if USE(AUDIO_SESSION) > DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(m_shouldManageAudioSessionCategory); > #endif >+ >+ RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(m_promptForStorageAccessAPIEnabled); > } > > class InternalSettingsWrapper : public Supplement<Page> { >@@ -776,6 +779,11 @@ void InternalSettings::setScreenCaptureEnabled(bool enabled) > #endif > } > >+void InternalSettings::setStorageAccessPromptsEnabled(bool enabled) >+{ >+ RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(enabled); >+} >+ > ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy() > { > if (!m_page) >diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h >index 38e0719a0fe85ae058216c6056b6908eb4df570a..ce3b37204539dece0119e750644bae0002b5e265 100644 >--- a/Source/WebCore/testing/InternalSettings.h >+++ b/Source/WebCore/testing/InternalSettings.h >@@ -127,6 +127,8 @@ public: > > static bool cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled(); > >+ static void setStorageAccessPromptsEnabled(bool); >+ > private: > explicit InternalSettings(Page*); > >@@ -214,6 +216,7 @@ private: > bool m_shouldManageAudioSessionCategory; > #endif > bool m_customPasteboardDataEnabled; >+ bool m_promptForStorageAccessAPIEnabled { false }; > }; > > Page* m_page; >diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl >index c9856a7533cc2c1215d531b96eb2ed34e55631ce..bf8854067996922309a40f7a0728329ad3b1ddf3 100644 >--- a/Source/WebCore/testing/InternalSettings.idl >+++ b/Source/WebCore/testing/InternalSettings.idl >@@ -92,6 +92,7 @@ enum FontLoadTimingOverride { "Block", "Swap", "Failure" }; > void setWebGPUEnabled(boolean enabled); > void setWebVREnabled(boolean enabled); > void setScreenCaptureEnabled(boolean enabled); >+ void setStorageAccessPromptsEnabled(boolean enabled); > > [MayThrowException] DOMString userInterfaceDirectionPolicy(); > [MayThrowException] void setUserInterfaceDirectionPolicy(DOMString policy); >diff --git a/Source/WebKit/Shared/API/APIObject.h b/Source/WebKit/Shared/API/APIObject.h >index 75572a6dbb046243b675b150e074ee8e52a65d60..1f6003ff5f4d9de4f186e7b1a3ba4ed2a12d2c70 100644 >--- a/Source/WebKit/Shared/API/APIObject.h >+++ b/Source/WebKit/Shared/API/APIObject.h >@@ -144,6 +144,7 @@ public: > ProcessPoolConfiguration, > PluginSiteDataManager, > Preferences, >+ RequestStorageAccessConfirmResultListener, > ResourceLoadStatisticsStore, > RunBeforeUnloadConfirmPanelResultListener, > RunJavaScriptAlertResultListener, >diff --git a/Source/WebKit/Shared/API/c/WKBase.h b/Source/WebKit/Shared/API/c/WKBase.h >index c995cbc5818836316dfcd9248dd079425065f8ed..1164c1582c412a7b550a5b1c56bb1df54ffe7aa9 100644 >--- a/Source/WebKit/Shared/API/c/WKBase.h >+++ b/Source/WebKit/Shared/API/c/WKBase.h >@@ -125,6 +125,7 @@ typedef const struct OpaqueWKPageRunBeforeUnloadConfirmPanelResultListener* WKPa > typedef const struct OpaqueWKPageRunJavaScriptAlertResultListener* WKPageRunJavaScriptAlertResultListenerRef; > typedef const struct OpaqueWKPageRunJavaScriptConfirmResultListener* WKPageRunJavaScriptConfirmResultListenerRef; > typedef const struct OpaqueWKPageRunJavaScriptPromptResultListener* WKPageRunJavaScriptPromptResultListenerRef; >+typedef const struct OpaqueWKPageRequestStorageAccessConfirmResultListener* WKPageRequestStorageAccessConfirmResultListenerRef; > typedef const struct OpaqueWKResourceLoadStatisticsManager* WKResourceLoadStatisticsManagerRef; > typedef const struct OpaqueWKTextChecker* WKTextCheckerRef; > typedef const struct OpaqueWKSession* WKSessionRef; >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index 0e04ccd9dce6a0b16aa08b215e3d85028ba92ab1..3189575a8d78d04e6c86d4414a63c5b6d2b376bb 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1259,3 +1259,11 @@ WebGLCompressedTextureASTCSupportEnabled: > humanReadableDescription: "Support for ASTC compressed texture formats in WebGL" > category: experimental > webcoreBinding: RuntimeEnabledFeatures >+ >+StorageAccessPromptsEnabled: >+ type: bool >+ defaultValue: false >+ humanReadableName: "Prompt for Storage Access API Requests" >+ humanReadableDescription: "Prompt the user when Storage Access API calls are made" >+ category: experimental >+ webcoreBinding: RuntimeEnabledFeatures >diff --git a/Source/WebKit/UIProcess/API/APIUIClient.h b/Source/WebKit/UIProcess/API/APIUIClient.h >index d0bca76a0214111fe1fad8925fbc7af3191c7b24..410ecb4a676c5007e5f693277c1bcd57f80270af 100644 >--- a/Source/WebKit/UIProcess/API/APIUIClient.h >+++ b/Source/WebKit/UIProcess/API/APIUIClient.h >@@ -128,6 +128,7 @@ public: > virtual bool decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy&) { return false; } > virtual bool checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy&) { return false; } > virtual void decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, SecurityOrigin&, Function<void(bool)>&& completionHandler) { completionHandler(false); } >+ virtual void requestStorageAccessConfirm(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WTF::String& requestingDomain, const WTF::String& currentDomain, Function<void (bool)>&& completionHandler) { completionHandler(true); } > > // Printing. > virtual float headerHeight(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { return 0; } >diff --git a/Source/WebKit/UIProcess/API/C/WKPage.cpp b/Source/WebKit/UIProcess/API/C/WKPage.cpp >index 67cfbf3ea003d0a0f7b87fa753b96f577bda19cf..0fb5e19c02c7a8f4ace47fcf013247f94ee67a67 100644 >--- a/Source/WebKit/UIProcess/API/C/WKPage.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKPage.cpp >@@ -111,7 +111,7 @@ template<> struct ClientTraits<WKPagePolicyClientBase> { > }; > > template<> struct ClientTraits<WKPageUIClientBase> { >- typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10, WKPageUIClientV11> Versions; >+ typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10, WKPageUIClientV11, WKPageUIClientV12> Versions; > }; > > #if ENABLE(CONTEXT_MENUS) >@@ -1510,10 +1510,36 @@ private: > Function<void (const String&)> m_completionHandler; > }; > >+class RequestStorageAccessConfirmResultListener : public API::ObjectImpl<API::Object::Type::RequestStorageAccessConfirmResultListener> { >+public: >+ static Ref<RequestStorageAccessConfirmResultListener> create(CompletionHandler<void(bool)>&& completionHandler) >+ { >+ return adoptRef(*new RequestStorageAccessConfirmResultListener(WTFMove(completionHandler))); >+ } >+ >+ virtual ~RequestStorageAccessConfirmResultListener() >+ { >+ } >+ >+ void call(bool result) >+ { >+ m_completionHandler(result); >+ } >+ >+private: >+ explicit RequestStorageAccessConfirmResultListener(CompletionHandler<void(bool)>&& completionHandler) >+ : m_completionHandler(WTFMove(completionHandler)) >+ { >+ } >+ >+ CompletionHandler<void(bool)> m_completionHandler; >+}; >+ > WK_ADD_API_MAPPING(WKPageRunBeforeUnloadConfirmPanelResultListenerRef, RunBeforeUnloadConfirmPanelResultListener) > WK_ADD_API_MAPPING(WKPageRunJavaScriptAlertResultListenerRef, RunJavaScriptAlertResultListener) > WK_ADD_API_MAPPING(WKPageRunJavaScriptConfirmResultListenerRef, RunJavaScriptConfirmResultListener) > WK_ADD_API_MAPPING(WKPageRunJavaScriptPromptResultListenerRef, RunJavaScriptPromptResultListener) >+WK_ADD_API_MAPPING(WKPageRequestStorageAccessConfirmResultListenerRef, RequestStorageAccessConfirmResultListener) > > } > >@@ -1557,6 +1583,16 @@ void WKPageRunJavaScriptPromptResultListenerCall(WKPageRunJavaScriptPromptResult > toImpl(listener)->call(toWTFString(result)); > } > >+WKTypeID WKPageRequestStorageAccessConfirmResultListenerGetTypeID() >+{ >+ return toAPI(RequestStorageAccessConfirmResultListener::APIType); >+} >+ >+void WKPageRequestStorageAccessConfirmResultListenerCall(WKPageRequestStorageAccessConfirmResultListenerRef listener, bool result) >+{ >+ toImpl(listener)->call(result); >+} >+ > void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient) > { > class UIClient : public API::Client<WKPageUIClientBase>, public API::UIClient { >@@ -1982,6 +2018,17 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient > m_client.decidePolicyForNotificationPermissionRequest(toAPI(&page), toAPI(&origin), toAPI(NotificationPermissionRequest::create(WTFMove(completionHandler)).ptr()), m_client.base.clientInfo); > } > >+ void requestStorageAccessConfirm(WebPageProxy& page, WebFrameProxy& frame, const WTF::String& requestingDomain, const WTF::String& currentDomain, Function<void(bool)>&& completionHandler) final >+ { >+ if (!m_client.requestStorageAccessConfirm) { >+ completionHandler(true); >+ return; >+ } >+ >+ RefPtr<RequestStorageAccessConfirmResultListener> listener = RequestStorageAccessConfirmResultListener::create(WTFMove(completionHandler)); >+ m_client.requestStorageAccessConfirm(toAPI(&page), toAPI(&frame), toAPI(requestingDomain.impl()), toAPI(currentDomain.impl()), toAPI(listener.get()), m_client.base.clientInfo); >+ } >+ > // Printing. > float headerHeight(WebPageProxy& page, WebFrameProxy& frame) final > { >diff --git a/Source/WebKit/UIProcess/API/C/WKPageUIClient.h b/Source/WebKit/UIProcess/API/C/WKPageUIClient.h >index a649b1d7dccb129fd366dd9b45f731b3b68aaa73..4d62bb3d6b1c9fbd95fd6177a1d17cb18a26afa6 100644 >--- a/Source/WebKit/UIProcess/API/C/WKPageUIClient.h >+++ b/Source/WebKit/UIProcess/API/C/WKPageUIClient.h >@@ -79,12 +79,16 @@ WK_EXPORT void WKPageRunJavaScriptConfirmResultListenerCall(WKPageRunJavaScriptC > WK_EXPORT WKTypeID WKPageRunJavaScriptPromptResultListenerGetTypeID(); > WK_EXPORT void WKPageRunJavaScriptPromptResultListenerCall(WKPageRunJavaScriptPromptResultListenerRef listener, WKStringRef result); > >+WK_EXPORT WKTypeID WKPageRequestStorageAccessConfirmResultListenerGetTypeID(); >+WK_EXPORT void WKPageRequestStorageAccessConfirmResultListenerCall(WKPageRequestStorageAccessConfirmResultListenerRef listener, bool result); >+ > typedef void (*WKPageUIClientCallback)(WKPageRef page, const void* clientInfo); > typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo); > typedef void (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo); > typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptAlertResultListenerRef listener, const void *clientInfo); > typedef void (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptConfirmResultListenerRef listener, const void *clientInfo); > typedef void (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo); >+typedef void (*WKPageRequestStorageAccessConfirmCallback)(WKPageRef page, WKFrameRef frame, WKStringRef requestingDomain, WKStringRef currentDomain, WKPageRequestStorageAccessConfirmResultListenerRef listener, const void *clientInfo); > typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo); > typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo); > typedef void (*WKPageUnfocusCallback)(WKPageRef page, const void *clientInfo); >@@ -1033,6 +1037,107 @@ typedef struct WKPageUIClientV11 { > WKPageDidResignInputElementStrongPasswordAppearanceCallback didResignInputElementStrongPasswordAppearance; > } WKPageUIClientV11; > >+typedef struct WKPageUIClientV12 { >+ WKPageUIClientBase base; >+ >+ // Version 0. >+ WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; >+ WKPageUIClientCallback showPage; >+ WKPageUIClientCallback close; >+ WKPageTakeFocusCallback takeFocus; >+ WKPageFocusCallback focus; >+ WKPageUnfocusCallback unfocus; >+ WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; >+ WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; >+ WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; >+ WKPageSetStatusTextCallback setStatusText; >+ WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; >+ WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; >+ WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; >+ WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; >+ WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; >+ WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; >+ WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; >+ WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; >+ WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; >+ WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; >+ WKPageGetIsResizableCallback isResizable; >+ WKPageSetIsResizableCallback setIsResizable; >+ WKPageGetWindowFrameCallback getWindowFrame; >+ WKPageSetWindowFrameCallback setWindowFrame; >+ WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel_deprecatedForUseWithV6; >+ WKPageUIClientCallback didDraw; >+ WKPageUIClientCallback pageDidScroll; >+ WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; >+ WKPageRunOpenPanelCallback runOpenPanel; >+ WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; >+ WKPageHeaderHeightCallback headerHeight; >+ WKPageFooterHeightCallback footerHeight; >+ WKPageDrawHeaderCallback drawHeader; >+ WKPageDrawFooterCallback drawFooter; >+ WKPagePrintFrameCallback printFrame; >+ WKPageUIClientCallback runModal; >+ void* unused1; // Used to be didCompleteRubberBandForMainFrame >+ WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; >+ void* shouldInterruptJavaScript_unavailable; >+ >+ // Version 1. >+ WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage_deprecatedForUseWithV1; >+ WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; >+ WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; >+ WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; >+ >+ // Version 2. >+ WKPageShowColorPickerCallback showColorPicker; >+ WKPageHideColorPickerCallback hideColorPicker; >+ WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; >+ >+ // Version 3. >+ WKPagePinnedStateDidChangeCallback pinnedStateDidChange; >+ >+ // Version 4. >+ void* unused2; // Used to be didBeginTrackingPotentialLongMousePress. >+ void* unused3; // Used to be didRecognizeLongMousePress. >+ void* unused4; // Used to be didCancelTrackingPotentialLongMousePress. >+ WKPageIsPlayingAudioDidChangeCallback isPlayingAudioDidChange; >+ >+ // Version 5. >+ WKPageDecidePolicyForUserMediaPermissionRequestCallback decidePolicyForUserMediaPermissionRequest; >+ WKPageDidClickAutoFillButtonCallback didClickAutoFillButton; >+ WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5 runJavaScriptAlert_deprecatedForUseWithV5; >+ WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5 runJavaScriptConfirm_deprecatedForUseWithV5; >+ WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5 runJavaScriptPrompt_deprecatedForUseWithV5; >+ WKPageMediaSessionMetadataDidChangeCallback mediaSessionMetadataDidChange; >+ >+ // Version 6. >+ WKPageCreateNewPageCallback createNewPage; >+ WKPageRunJavaScriptAlertCallback runJavaScriptAlert; >+ WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; >+ WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; >+ WKCheckUserMediaPermissionCallback checkUserMediaPermissionForOrigin; >+ >+ // Version 7. >+ WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; >+ WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline; >+ >+ // Version 8. >+ WKRequestPointerLockCallback requestPointerLock; >+ WKDidLosePointerLockCallback didLosePointerLock; >+ >+ // Version 9. >+ WKHandleAutoplayEventCallback handleAutoplayEvent; >+ >+ // Version 10. >+ WKHasVideoInPictureInPictureDidChangeCallback hasVideoInPictureInPictureDidChange; >+ WKDidExceedBackgroundResourceLimitWhileInForegroundCallback didExceedBackgroundResourceLimitWhileInForeground; >+ >+ // Version 11. >+ WKPageDidResignInputElementStrongPasswordAppearanceCallback didResignInputElementStrongPasswordAppearance; >+ >+ // Version 12. >+ WKPageRequestStorageAccessConfirmCallback requestStorageAccessConfirm; >+} WKPageUIClientV12; >+ > #ifdef __cplusplus > } > #endif >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >index 9ba349599219a038b49420fd4bb68db498dfeae8..944e082d2b2e82ebb8d067569e5521635da81e47 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >@@ -129,6 +129,16 @@ - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)javaScriptCanOpenWindowsA > _preferences->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically); > } > >+- (BOOL)_storageAccessPromptsEnabled >+{ >+ return _preferences->storageAccessPromptsEnabled(); >+} >+ >+- (void)_setStorageAccessPromptsEnabled:(BOOL)enabled >+{ >+ _preferences->setStorageAccessPromptsEnabled(enabled); >+} >+ > #pragma mark OS X-specific methods > > #if PLATFORM(MAC) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >index 977d4e8544de3c28d43526b26f679012d16c7c41..f9baf8ad689fabb6ca659372f464e7bfaf55e730 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >@@ -136,6 +136,8 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) { > > @property (nonatomic, setter=_setShouldEnableTextAutosizingBoost:) BOOL _shouldEnableTextAutosizingBoost WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > >+@property (nonatomic, setter=_setStorageAccessPromptsEnabled:) BOOL _storageAccessPromptsEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >+ > #if !TARGET_OS_IPHONE > @property (nonatomic, setter=_setWebGLEnabled:) BOOL _webGLEnabled WK_API_AVAILABLE(macosx(10.13.4)); > @property (nonatomic, setter=_setJavaEnabledForLocalFiles:) BOOL _javaEnabledForLocalFiles WK_API_AVAILABLE(macosx(10.13.4)); >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h >index 470d5557fb41e89d05ba23144e6207756b222867..8825b1ea6090ce249bf2e53b892852f47eb6ac42 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h >@@ -116,6 +116,8 @@ struct UIEdgeInsets; > > - (void)_webView:(WKWebView *)webView didResignInputElementStrongPasswordAppearanceWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > >+- (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)); >+ > #if TARGET_OS_IPHONE > - (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(9.0)); > - (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray<_WKElementAction *> *)defaultActions; >diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.h b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h >index 4251b7a58e787678ff8f4dca3695e477d4465348..c4ec284e0355a918ef77414e62bdc70b717da91e 100644 >--- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.h >+++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h >@@ -88,6 +88,7 @@ private: > void runJavaScriptAlert(WebPageProxy*, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void()>&& completionHandler) final; > void runJavaScriptConfirm(WebPageProxy*, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final; > void runJavaScriptPrompt(WebPageProxy*, const WTF::String&, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(const WTF::String&)>&&) final; >+ void requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy&, const WTF::String& requestingDomain, const WTF::String& currentDomain, Function<void(bool)>&& completionHandler) final; > void decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, Function<void(bool)>&) final; > bool canRunBeforeUnloadConfirmPanel() const final; > void runBeforeUnloadConfirmPanel(WebPageProxy*, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final; >@@ -156,6 +157,7 @@ private: > bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1; > bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; > bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1; >+ bool webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler : 1; > bool webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; > bool webViewRequestGeolocationPermissionForFrameDecisionHandler : 1; > bool webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo : 1; >diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >index b605233ef666a26ce503e8f9894e4c55b9092ed1..8be3ef2d0970d4d6486a0ce8c26d430b6b566569 100644 >--- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >+++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >@@ -102,6 +102,7 @@ void UIDelegate::setDelegate(id <WKUIDelegate> delegate) > m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)]; > m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; > m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)]; >+ m_delegateMethods.webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler = [delegate respondsToSelector:@selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)]; > m_delegateMethods.webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(_webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; > m_delegateMethods.webViewRequestGeolocationPermissionForFrameDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestGeolocationPermissionForFrame:decisionHandler:)]; > m_delegateMethods.webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo = [delegate respondsToSelector:@selector(_webView:didResignInputElementStrongPasswordAppearanceWithUserInfo:)]; >@@ -328,6 +329,28 @@ void UIDelegate::UIClient::runJavaScriptPrompt(WebPageProxy*, const WTF::String& > }).get()]; > } > >+void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy&, const WTF::String& requestingDomain, const WTF::String& currentDomain, Function<void(bool)>&& completionHandler) >+{ >+ if (!m_uiDelegate.m_delegateMethods.webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler) { >+ completionHandler(false); >+ return; >+ } >+ >+ auto delegate = m_uiDelegate.m_delegate.get(); >+ if (!delegate) { >+ completionHandler(false); >+ return; >+ } >+ >+ auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)); >+ [(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) { >+ if (checker->completionHandlerHasBeenCalled()) >+ return; >+ completionHandler(result); >+ checker->didCallCompletionHandler(); >+ }).get()]; >+} >+ > void UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy& frame, API::SecurityOrigin& securityOrigin, Function<void(bool)>& completionHandler) > { > if (!m_uiDelegate.m_delegateMethods.webViewRequestGeolocationPermissionForFrameDecisionHandler) >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index efe7620e0fdadc4d673e33992fe152f99a0a138a..af021b8011c517e81cd7bf3dc35a667db6f301a0 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -138,6 +138,7 @@ > #include <WebCore/PerformanceLoggingClient.h> > #include <WebCore/PublicSuffix.h> > #include <WebCore/RenderEmbeddedObject.h> >+#include <WebCore/RuntimeEnabledFeatures.h> > #include <WebCore/SSLKeyGenerator.h> > #include <WebCore/SerializedCryptoKeyWrap.h> > #include <WebCore/SharedBuffer.h> >@@ -4270,6 +4271,26 @@ void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const SecurityOriginDat > }); > } > >+void WebPageProxy::requestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, const String& requestingDomain, const String& currentDomain, uint64_t callbackIdentifier) >+{ >+ if (!RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled()) { >+ send(Messages::WebProcess::DidRequestStorageAccessConfirm(frameID, pageID, callbackIdentifier, true), 0); >+ return; >+ } >+ >+ WebFrameProxy* frame = m_process->webFrame(frameID); >+ MESSAGE_CHECK(frame); >+ >+ if (m_controlledByAutomation) { >+ if (auto* automationSession = process().processPool().automationSession()) >+ automationSession->willShowJavaScriptDialog(*this); >+ } >+ >+ m_uiClient->requestStorageAccessConfirm(*this, *frame, requestingDomain, currentDomain, [protectedThis = makeRef(*this), frameID, pageID, callbackIdentifier](bool result) { >+ protectedThis->send(Messages::WebProcess::DidRequestStorageAccessConfirm(frameID, pageID, callbackIdentifier, result), 0); >+ }); >+} >+ > void WebPageProxy::setStatusText(const String& text) > { > m_uiClient->setStatusText(this, text); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 9d1355d0cd7c9daebbb837176d747f3df57ebaed..a66019208631c15e4a30224c5e104ec58d41d106 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1402,6 +1402,7 @@ private: > void runJavaScriptAlert(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply>&&); > void runJavaScriptConfirm(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply>&&); > void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>&&); >+ void requestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, const String& requestingDomain, const String& currentDomain, uint64_t callbackIdentifier); > void setStatusText(const String&); > void mouseDidMoveOverElement(WebHitTestResultData&&, uint32_t modifiers, UserData&&); > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index ac7aa760557497d4b6ff298ce8d4d49d4ee8c995..ef68816e6af5d05dbe25c130f53744eb6921da18 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -28,6 +28,7 @@ messages -> WebPageProxy { > RunJavaScriptAlert(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, String message) -> () Delayed > RunJavaScriptConfirm(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, String message) -> (bool result) Delayed > RunJavaScriptPrompt(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, String message, String defaultValue) -> (String result) Delayed >+ RequestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, String requestingDomain, String currentDomain, uint64_t callbackIdentifier) > MouseDidMoveOverElement(struct WebKit::WebHitTestResultData hitTestResultData, uint32_t modifiers, WebKit::UserData userData) > > #if ENABLE(NETSCAPE_PLUGIN_API) >diff --git a/Source/WebKit/UIProcess/WebPreferences.cpp b/Source/WebKit/UIProcess/WebPreferences.cpp >index 830e0d7bde8f1fce0e90cbf5c1d0fee7cf2e2c84..1ba52a158803c3a3ce36ec9dbe6c2b20216bb8d3 100644 >--- a/Source/WebKit/UIProcess/WebPreferences.cpp >+++ b/Source/WebKit/UIProcess/WebPreferences.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. >+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -30,6 +30,7 @@ > #include "WebPreferencesKeys.h" > #include "WebProcessPool.h" > #include <WebCore/LibWebRTCProvider.h> >+#include <WebCore/RuntimeEnabledFeatures.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/ThreadingPrimitives.h> > >@@ -133,6 +134,9 @@ void WebPreferences::updateBoolValueForKey(const String& key, bool value) > > void WebPreferences::updateBoolValueForExperimentalFeatureKey(const String& key, bool value) > { >+ if (key == WebPreferencesKey::storageAccessPromptsEnabledKey()) >+ WebCore::RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(storageAccessPromptsEnabled()); >+ > update(); // FIXME: Only send over the changed key and value. > } > >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index 0a3ea5f8dd9879109eae6165a726437586d5ffce..b1c01e819388e8bced96e3aa2f00b19de1bf4b08 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2010-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved. > * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). > * > * Redistribution and use in source and binary forms, with or without >@@ -1289,9 +1289,36 @@ void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameH > m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); > } > >-void WebChromeClient::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) >+void WebChromeClient::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void (bool)>&& completionHandler) > { >- m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); >+ static std::atomic<uint64_t> currentHandlerIdentifier; >+ uint64_t identifier = ++currentHandlerIdentifier; >+ >+ { >+ Locker<Lock> locker(m_requestStorageAccessCallbackLock); >+ auto result = m_requestStorageAccessCallbacks.ensure(identifier, [subFrameHost, topFrameHost, completionHandler = WTFMove(completionHandler)]() mutable { >+ return std::make_tuple(subFrameHost, topFrameHost, WTFMove(completionHandler)); >+ }); >+ ASSERT_UNUSED(result, result.isNewEntry); >+ } >+ >+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::RequestStorageAccessConfirm(frameID, pageID, subFrameHost, topFrameHost, identifier), m_page.pageID()); >+} >+ >+void WebChromeClient::didRequestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, uint64_t callbackIdentifier, bool confirmedAccess) >+{ >+ ASSERT(isMainThread()); >+ >+ Locker<Lock> locker(m_requestStorageAccessCallbackLock); >+ auto callbackTuple = m_requestStorageAccessCallbacks.take(callbackIdentifier); >+ locker.unlockEarly(); >+ >+ if (!confirmedAccess) { >+ std::get<2>(callbackTuple)(false); >+ return; >+ } >+ >+ m_page.requestStorageAccess(WTFMove(std::get<0>(callbackTuple)), WTFMove(std::get<1>(callbackTuple)), frameID, pageID, WTFMove(std::get<2>(callbackTuple)), confirmedAccess); > } > #endif > >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 1f69e6fb7e04e2e7094249234a0fc9fb8a2ad505..18fefdb82f11d848aeb18dbe8a4bcea34185fa66 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -354,6 +354,7 @@ private: > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final; > void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final; >+ void didRequestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, uint64_t callbackIdentifier, bool hasActivity) final; > #endif > > String m_cachedToolTip; >@@ -361,6 +362,11 @@ private: > mutable bool m_cachedMainFrameHasHorizontalScrollbar { false }; > mutable bool m_cachedMainFrameHasVerticalScrollbar { false }; > >+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) >+ Lock m_requestStorageAccessCallbackLock; >+ HashMap<uint64_t, std::tuple<String, String, CompletionHandler<void(bool)>>> m_requestStorageAccessCallbacks; >+#endif >+ > WebPage& m_page; > }; > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 9780cfc6c5af840cbdafb1d093eca8e4e2eef2f1..02507b89e3300b7bd6c0e2b4cc20e0d0f5d17f8a 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1052,8 +1052,8 @@ public: > void flushPendingEditorStateUpdate(); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >- void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >+ void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback); >+ void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback); > void storageAccessResponse(bool wasGranted, uint64_t contextId); > #endif > >diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp >index 982ddfd2d3211490509a472eb39a4a415b1f3275..df4f2e221a599e705f614a2b4428a27c8fd58452 100644 >--- a/Source/WebKit/WebProcess/WebProcess.cpp >+++ b/Source/WebKit/WebProcess/WebProcess.cpp >@@ -80,6 +80,8 @@ > #include <WebCore/AXObjectCache.h> > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/AuthenticationChallenge.h> >+#include <WebCore/Chrome.h> >+#include <WebCore/ChromeClient.h> > #include <WebCore/CPUMonitor.h> > #include <WebCore/CommonVM.h> > #include <WebCore/CrossOriginPreflightResultCache.h> >@@ -1688,4 +1690,12 @@ void WebProcess::setScreenProperties(uint32_t primaryScreenID, const HashMap<uin > } > #endif > >+void WebProcess::didRequestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, uint64_t callbackIdentifier, bool confirmed) >+{ >+ if (auto* page = webPage(pageID)) { >+ if (auto* corePage = page->corePage()) >+ corePage->chrome().client().didRequestStorageAccessConfirm(frameID, pageID, callbackIdentifier, confirmed); >+ } >+} >+ > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/WebProcess.h b/Source/WebKit/WebProcess/WebProcess.h >index 9928225fb2d6d898037cf76e97fe611faee86fdc..1e11faaef123be36b9630fcb93bbcca4d6323211 100644 >--- a/Source/WebKit/WebProcess/WebProcess.h >+++ b/Source/WebKit/WebProcess/WebProcess.h >@@ -319,6 +319,8 @@ private: > void registerServiceWorkerClients(); > #endif > >+ void didRequestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, uint64_t callbackIdentifier, bool hasActivity); >+ > void releasePageCache(); > > void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WebsiteData&); >diff --git a/Source/WebKit/WebProcess/WebProcess.messages.in b/Source/WebKit/WebProcess/WebProcess.messages.in >index efb07e3fa3b503c794385fec3ade7e36a2bdedc6..21217857aad19509c351b13558ce1383b111717e 100644 >--- a/Source/WebKit/WebProcess/WebProcess.messages.in >+++ b/Source/WebKit/WebProcess/WebProcess.messages.in >@@ -136,4 +136,5 @@ messages -> WebProcess LegacyReceiver { > ScrollerStylePreferenceChanged(bool useOvelayScrollbars) > #endif > #endif >+ DidRequestStorageAccessConfirm(uint64_t frameID, uint64_t pageID, uint64_t callbackIdentifier, bool didConfirm) > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185335
:
339616
|
339651
|
339652
|
339655
|
339659
|
339693
|
339697
|
339700
|
339735
|
339742
|
339745
|
339755
|
339766