Changeset 231457 in webkit


Ignore:
Timestamp:
May 7, 2018 2:56:53 PM (6 years ago)
Author:
achristensen@apple.com
Message:

Add experimental feature to prompt for Storage Access API use
https://bugs.webkit.org/show_bug.cgi?id=185335
<rdar://problem/39994649>

Patch by Brent Fulgham <Brent Fulgham> on 2018-05-07
Reviewed by Alex Christensen and Youenn Fablet.

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.

Source/WebCore:

  • 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:

Source/WebKit:

  • 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):

Location:
trunk/Source
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r231456 r231457  
     12018-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
    1242018-05-07  Chris Dumez  <cdumez@apple.com>
    225
  • trunk/Source/WebCore/page/RuntimeEnabledFeatures.h

    r231327 r231457  
    257257    bool webGLCompressedTextureASTCSupportEnabled() const { return m_isWebGLCompressedTextureASTCSupportEnabled; }
    258258
     259    void setStorageAccessPromptsEnabled(bool isEnabled)  { m_promptForStorageAccessAPIEnabled = isEnabled; }
     260    bool storageAccessPromptsEnabled() const { return m_promptForStorageAccessAPIEnabled; }
     261
    259262    WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
    260263
     
    395398    bool m_isWebGLCompressedTextureASTCSupportEnabled { false };
    396399
     400    bool m_promptForStorageAccessAPIEnabled { false };
     401
    397402    friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
    398403};
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r230808 r231457  
    123123#endif
    124124    , m_customPasteboardDataEnabled(RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled())
     125    , m_promptForStorageAccessAPIEnabled(RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled())
    125126{
    126127}
     
    226227    DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(m_shouldManageAudioSessionCategory);
    227228#endif
     229
     230    RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(m_promptForStorageAccessAPIEnabled);
    228231}
    229232
     
    777780}
    778781
     782void InternalSettings::setStorageAccessPromptsEnabled(bool enabled)
     783{
     784    RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(enabled);
     785}
     786   
    779787ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy()
    780788{
  • trunk/Source/WebCore/testing/InternalSettings.h

    r230808 r231457  
    128128    static bool cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled();
    129129
     130    static void setStorageAccessPromptsEnabled(bool);
     131
    130132private:
    131133    explicit InternalSettings(Page*);
     
    215217#endif
    216218        bool m_customPasteboardDataEnabled;
     219        bool m_promptForStorageAccessAPIEnabled { false };
    217220    };
    218221
  • trunk/Source/WebCore/testing/InternalSettings.idl

    r230808 r231457  
    9393    void setWebVREnabled(boolean enabled);
    9494    void setScreenCaptureEnabled(boolean enabled);
     95    void setStorageAccessPromptsEnabled(boolean enabled);
    9596
    9697    [MayThrowException] DOMString userInterfaceDirectionPolicy();
  • trunk/Source/WebKit/ChangeLog

    r231454 r231457  
     12018-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
    1462018-05-07  Dean Jackson  <dino@apple.com>
    247
  • trunk/Source/WebKit/Shared/API/APIObject.h

    r225598 r231457  
    145145        PluginSiteDataManager,
    146146        Preferences,
     147        RequestStorageAccessConfirmResultListener,
    147148        ResourceLoadStatisticsStore,
    148149        RunBeforeUnloadConfirmPanelResultListener,
  • trunk/Source/WebKit/Shared/API/c/WKBase.h

    r228455 r231457  
    126126typedef const struct OpaqueWKPageRunJavaScriptConfirmResultListener* WKPageRunJavaScriptConfirmResultListenerRef;
    127127typedef const struct OpaqueWKPageRunJavaScriptPromptResultListener* WKPageRunJavaScriptPromptResultListenerRef;
     128typedef const struct OpaqueWKPageRequestStorageAccessConfirmResultListener* WKPageRequestStorageAccessConfirmResultListenerRef;
    128129typedef const struct OpaqueWKResourceLoadStatisticsManager* WKResourceLoadStatisticsManagerRef;
    129130typedef const struct OpaqueWKTextChecker* WKTextCheckerRef;
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r231327 r231457  
    12601260  category: experimental
    12611261  webcoreBinding: RuntimeEnabledFeatures
     1262
     1263StorageAccessPromptsEnabled:
     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  
    129129    virtual bool checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy&) { return false; }
    130130    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); }
    131132
    132133    // Printing.
  • trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp

    r231024 r231457  
    112112
    113113template<> 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;
    115115};
    116116
     
    15111511};
    15121512
     1513class RequestStorageAccessConfirmResultListener : public API::ObjectImpl<API::Object::Type::RequestStorageAccessConfirmResultListener> {
     1514public:
     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   
     1529private:
     1530    explicit RequestStorageAccessConfirmResultListener(CompletionHandler<void(bool)>&& completionHandler)
     1531        : m_completionHandler(WTFMove(completionHandler))
     1532    {
     1533    }
     1534   
     1535    CompletionHandler<void(bool)> m_completionHandler;
     1536};
     1537
    15131538WK_ADD_API_MAPPING(WKPageRunBeforeUnloadConfirmPanelResultListenerRef, RunBeforeUnloadConfirmPanelResultListener)
    15141539WK_ADD_API_MAPPING(WKPageRunJavaScriptAlertResultListenerRef, RunJavaScriptAlertResultListener)
    15151540WK_ADD_API_MAPPING(WKPageRunJavaScriptConfirmResultListenerRef, RunJavaScriptConfirmResultListener)
    15161541WK_ADD_API_MAPPING(WKPageRunJavaScriptPromptResultListenerRef, RunJavaScriptPromptResultListener)
     1542WK_ADD_API_MAPPING(WKPageRequestStorageAccessConfirmResultListenerRef, RequestStorageAccessConfirmResultListener)
    15171543
    15181544}
     
    15561582{
    15571583    toImpl(listener)->call(toWTFString(result));
     1584}
     1585
     1586WKTypeID WKPageRequestStorageAccessConfirmResultListenerGetTypeID()
     1587{
     1588    return toAPI(RequestStorageAccessConfirmResultListener::APIType);
     1589}
     1590
     1591void WKPageRequestStorageAccessConfirmResultListenerCall(WKPageRequestStorageAccessConfirmResultListenerRef listener, bool result)
     1592{
     1593    toImpl(listener)->call(result);
    15581594}
    15591595
     
    19832019        }
    19842020
     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
    19852032        // Printing.
    19862033        float headerHeight(WebPageProxy& page, WebFrameProxy& frame) final
  • trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h

    r230851 r231457  
    8080WK_EXPORT void WKPageRunJavaScriptPromptResultListenerCall(WKPageRunJavaScriptPromptResultListenerRef listener, WKStringRef result);
    8181
     82WK_EXPORT WKTypeID WKPageRequestStorageAccessConfirmResultListenerGetTypeID();
     83WK_EXPORT void WKPageRequestStorageAccessConfirmResultListenerCall(WKPageRequestStorageAccessConfirmResultListenerRef listener, bool result);
     84   
    8285typedef void (*WKPageUIClientCallback)(WKPageRef page, const void* clientInfo);
    8386typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo);
     
    8689typedef void (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptConfirmResultListenerRef listener, const void *clientInfo);
    8790typedef void (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo);
     91typedef void (*WKPageRequestStorageAccessConfirmCallback)(WKPageRef page, WKFrameRef frame, WKStringRef requestingDomain, WKStringRef currentDomain, WKPageRequestStorageAccessConfirmResultListenerRef listener, const void *clientInfo);
    8892typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo);
    8993typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo);
     
    10341038} WKPageUIClientV11;
    10351039
     1040typedef 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
    10361141#ifdef __cplusplus
    10371142}
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp

    r230968 r231457  
    195195}
    196196
     197void WKPreferencesSetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef, bool enabled)
     198{
     199    toImpl(preferencesRef)->setStorageAccessPromptsEnabled(enabled);
     200}
     201
     202bool WKPreferencesGetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef)
     203{
     204    return toImpl(preferencesRef)->storageAccessPromptsEnabled();
     205}
     206
    197207void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef, bool hyperlinkAuditingEnabled)
    198208{
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h

    r230968 r231457  
    109109WK_EXPORT bool WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferences);
    110110
     111// Defaults to false.
     112WK_EXPORT void WKPreferencesSetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef, bool enabled);
     113WK_EXPORT bool WKPreferencesGetStorageAccessPromptsEnabled(WKPreferencesRef preferencesRef);
     114
    111115// Defaults to true.
    112116WK_EXPORT void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferences, bool hyperlinkAuditingEnabled);
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

    r230039 r231457  
    130130}
    131131
     132- (BOOL)_storageAccessPromptsEnabled
     133{
     134    return _preferences->storageAccessPromptsEnabled();
     135}
     136
     137- (void)_setStorageAccessPromptsEnabled:(BOOL)enabled
     138{
     139    _preferences->setStorageAccessPromptsEnabled(enabled);
     140}
     141
    132142#pragma mark OS X-specific methods
    133143
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r230121 r231457  
    137137@property (nonatomic, setter=_setShouldEnableTextAutosizingBoost:) BOOL _shouldEnableTextAutosizingBoost WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    138138
     139@property (nonatomic, setter=_setStorageAccessPromptsEnabled:) BOOL _storageAccessPromptsEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     140
    139141#if !TARGET_OS_IPHONE
    140142@property (nonatomic, setter=_setWebGLEnabled:) BOOL _webGLEnabled WK_API_AVAILABLE(macosx(10.13.4));
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h

    r231174 r231457  
    117117- (void)_webView:(WKWebView *)webView didResignInputElementStrongPasswordAppearanceWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    118118
     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
    119121#if TARGET_OS_IPHONE
    120122- (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(9.0));
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h

    r231174 r231457  
    8989        void runJavaScriptConfirm(WebPageProxy*, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final;
    9090        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;
    9192        void decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, Function<void(bool)>&) final;
    9293        bool canRunBeforeUnloadConfirmPanel() const final;
     
    157158        bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
    158159        bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
     160        bool webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler : 1;
    159161        bool webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
    160162        bool webViewRequestGeolocationPermissionForFrameDecisionHandler : 1;
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm

    r231174 r231457  
    103103    m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
    104104    m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)];
     105    m_delegateMethods.webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler = [delegate respondsToSelector:@selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)];
    105106    m_delegateMethods.webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(_webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
    106107    m_delegateMethods.webViewRequestGeolocationPermissionForFrameDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestGeolocationPermissionForFrame:decisionHandler:)];
     
    329330}
    330331
     332void 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
    331354void UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy& frame, API::SecurityOrigin& securityOrigin, Function<void(bool)>& completionHandler)
    332355{
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r231447 r231457  
    74737473
    74747474#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    7475 void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId)
    7476 {
    7477     m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [this, webProcessContextId] (bool hasAccess) {
     7475void 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) {
    74787478        m_process->send(Messages::WebPage::StorageAccessResponse(hasAccess, webProcessContextId), m_pageID);
    74797479    });
    74807480}
    74817481
    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);
     7482void 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));
    74877497    });
    74887498}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r231439 r231457  
    12811281
    12821282#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    1283     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId);
    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);
    12851285#endif
    12861286
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r231439 r231457  
    513513
    514514#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    515     HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID)
    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)
    517517#endif
    518518
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r231043 r231457  
    12851285
    12861286#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));
     1287void 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
     1292void 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));
    12951295}
    12961296#endif
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r231439 r231457  
    59135913}
    59145914
    5915 void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
     5915void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback)
    59165916{
    59175917    auto contextId = nextRequestStorageAccessContextId();
     
    59195919    ASSERT(addResult.isNewEntry);
    59205920    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));
    59225922    else
    59235923        callback(false);
    59245924}
    59255925   
    5926 void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
     5926void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback)
    59275927{
    59285928    auto contextId = nextRequestStorageAccessContextId();
    59295929    auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback));
    59305930    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
    59345935        callback(false);
    59355936}
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r231439 r231457  
    10551055
    10561056#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);
    10591059    void storageAccessResponse(bool wasGranted, uint64_t contextId);
    10601060#endif
Note: See TracChangeset for help on using the changeset viewer.