⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243173 in webkit


Ignore:
Timestamp:
Mar 19, 2019, 3:11:00 PM (7 years ago)
Author:
Brent Fulgham
Message:

Add default prompt implementation for the Storage Access API
https://bugs.webkit.org/show_bug.cgi?id=195866
<rdar://problem/45150009>

Reviewed by Chris Dumez.

Source/WebCore:

  • en.lproj/Localizable.strings: Update with new strings used by the

Storage Access API dialog.

Source/WebKit:

This patch revises the UIDelegate implementation with a default permission dialog
for the Storage Access API. This allows us to use and test the API in MiniBrowser,
rather than requiring a full-fledged web browser to drive testing.

  • UIProcess/Cocoa/UIDelegate.h:
  • UIProcess/Cocoa/UIDelegate.mm:

(WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
(WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
implementation if the WKWebVIew client doesn't implement the necessary SPI.

  • UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
  • UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.

(WebKit::presentStorageAccessAlert):

  • WebKit.xcodeproj/project.pbxproj:
Location:
trunk/Source
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r243170 r243173  
     12019-03-19  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Add default prompt implementation for the Storage Access API
     4        https://bugs.webkit.org/show_bug.cgi?id=195866
     5        <rdar://problem/45150009>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * en.lproj/Localizable.strings: Update with new strings used by the
     10        Storage Access API dialog.
     11
    1122019-03-19  Thibault Saunier  <tsaunier@igalia.com>
    213
  • trunk/Source/WebCore/en.lproj/Localizable.strings

    r243113 r243173  
    104104"Align Right (Undo action name)" = "Align Right";
    105105
     106/* Allow Storage Access API */
     107"Allow" = "Allow";
     108
     109/* Title for Allow button label in the Storage Access API request dialog */
     110"Allow (cross-site cookie and website data access)" = "Allow";
     111
     112/* Storage Access API request validation (iOS phrasing) */
     113"Allow \"%@\" to use cookies and website data while browsing \"%@\"?" = "Allow \"%@\" to use cookies and website data while browsing \"%@\"?";
     114
    106115/* WKErrorUnknown description */
    107116"An unknown error occurred" = "An unknown error occurred";
     
    248257"Dictation (Undo action name)" = "Dictation";
    249258
     259/* Storage Access API request validation (macOS phrasing) */
     260"Do you want to allow \"%@\" to use cookies and website data while browsing \"%@\"?" = "Do you want to allow \"%@\" to use cookies and website data while browsing \"%@\"?";
     261
     262/* Storage Access API deny access */
     263"Don't Allow" = "Don't Allow";
     264
     265/* Title for Don't Allow button label in the Storage Access API request dialog */
     266"Don't Allow (cross-site cookie and website data access)" = "Don't Allow";
     267
    250268/* Title of the Done button for zoomed form controls. */
    251269"Done" = "Done";
     
    803821"This website may try to trick you into installing software that harms your browsing experience, like changing your settings without your permission or showing you unwanted ads. Once installed, it may be difficult to remove." = "This website may try to trick you into installing software that harms your browsing experience, like changing your settings without your permission or showing you unwanted ads. Once installed, it may be difficult to remove.";
    804822
     823/* Storage Access API tracking warning */
     824"This will allow \"%@\" to track your activity." = "This will allow \"%@\" to track your activity.";
     825
    805826/* Undo action name */
    806827"Tighten Kerning (Undo action name)" = "Tighten Kerning";
  • trunk/Source/WebKit/ChangeLog

    r243168 r243173  
     12019-03-19  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Add default prompt implementation for the Storage Access API
     4        https://bugs.webkit.org/show_bug.cgi?id=195866
     5        <rdar://problem/45150009>
     6
     7        Reviewed by Chris Dumez.
     8
     9        This patch revises the UIDelegate implementation with a default permission dialog
     10        for the Storage Access API. This allows us to use and test the API in MiniBrowser,
     11        rather than requiring a full-fledged web browser to drive testing.
     12 
     13        * UIProcess/Cocoa/UIDelegate.h:
     14        * UIProcess/Cocoa/UIDelegate.mm:
     15        (WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
     16        (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
     17        implementation if the WKWebVIew client doesn't implement the necessary SPI.
     18        * UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
     19        * UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.
     20        (WebKit::presentStorageAccessAlert):
     21        * WebKit.xcodeproj/project.pbxproj:
     22
    1232019-03-19  Conrad Shultz  <conrad_shultz@apple.com>
    224
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h

    r242760 r243173  
    8888        void runJavaScriptConfirm(WebPageProxy*, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final;
    8989        void runJavaScriptPrompt(WebPageProxy*, const WTF::String&, const WTF::String&, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(const WTF::String&)>&&) final;
     90        void presentStorageAccessConfirmDialog(const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler<void(bool)>&&);
    9091        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;
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm

    r242823 r243173  
    4141#import "WKOpenPanelParametersInternal.h"
    4242#import "WKSecurityOriginInternal.h"
     43#import "WKStorageAccessAlert.h"
    4344#import "WKUIDelegatePrivate.h"
    4445#import "WKWebViewConfigurationInternal.h"
     
    339340void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy*, const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler<void(bool)>&& completionHandler)
    340341{
     342    auto delegate = m_uiDelegate.m_delegate.get();
     343    if (!delegate) {
     344        completionHandler(false);
     345        return;
     346    }
     347   
    341348    if (!m_uiDelegate.m_delegateMethods.webViewRequestStorageAccessPanelForTopPrivatelyControlledDomainUnderFirstPartyTopPrivatelyControlledDomainCompletionHandler) {
    342         completionHandler(true);
    343         return;
    344     }
    345 
    346     auto delegate = m_uiDelegate.m_delegate.get();
    347     if (!delegate) {
    348         completionHandler(true);
    349         return;
    350     }
    351    
     349        presentStorageAccessAlert(m_uiDelegate.m_webView, requestingDomain, currentDomain, WTFMove(completionHandler));
     350        return;
     351    }
     352
    352353    auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:));
    353354    [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingDomain underCurrentDomain:currentDomain completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable {
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r243147 r243173  
    11181118                7A41E9FB21F81DAD00B88CDB /* ShouldGrandfatherStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A41E9FA21F81DAC00B88CDB /* ShouldGrandfatherStatistics.h */; };
    11191119                7A772C8D1DDD4A25000F34F1 /* com.apple.WebKit.plugin-common.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7A1506721DD56298001F4B58 /* com.apple.WebKit.plugin-common.sb */; };
     1120                7A78FF32224191960096483E /* WKStorageAccessAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A78FF2E224191750096483E /* WKStorageAccessAlert.h */; };
     1121                7A78FF332241919B0096483E /* WKStorageAccessAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A78FF2F224191760096483E /* WKStorageAccessAlert.mm */; };
    11201122                7A791EFA1C7CFCF100C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A791EF91C7CFB3700C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp */; };
    11211123                7A791EFB1C7CFD0100C4C52B /* WebResourceLoadStatisticsStoreMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A791EF81C7CFB1000C4C52B /* WebResourceLoadStatisticsStoreMessages.h */; };
     
    35653567                7A41E9FA21F81DAC00B88CDB /* ShouldGrandfatherStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ShouldGrandfatherStatistics.h; path = Classifier/ShouldGrandfatherStatistics.h; sourceTree = "<group>"; };
    35663568                7A5E39491D5BD8A700B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "com.macromedia.Flash Player ESR.plugin.sb"; sourceTree = "<group>"; };
     3569                7A78FF2E224191750096483E /* WKStorageAccessAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKStorageAccessAlert.h; sourceTree = "<group>"; };
     3570                7A78FF2F224191760096483E /* WKStorageAccessAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKStorageAccessAlert.mm; sourceTree = "<group>"; };
    35673571                7A791EF81C7CFB1000C4C52B /* WebResourceLoadStatisticsStoreMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebResourceLoadStatisticsStoreMessages.h; path = DerivedSources/WebKit2/WebResourceLoadStatisticsStoreMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
    35683572                7A791EF91C7CFB3700C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebResourceLoadStatisticsStoreMessageReceiver.cpp; path = DerivedSources/WebKit2/WebResourceLoadStatisticsStoreMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
     
    53985402                                1DE0D095211CC21300439B5F /* WKShareSheet.h */,
    53995403                                1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */,
     5404                                7A78FF2E224191750096483E /* WKStorageAccessAlert.h */,
     5405                                7A78FF2F224191760096483E /* WKStorageAccessAlert.mm */,
    54005406                                2D7AAFD218C8640600A7ACD4 /* WKWebViewContentProvider.h */,
    54015407                                2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */,
     
    99789984                                513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */,
    99799985                                93F549B41E3174B7000E7239 /* WKSnapshotConfiguration.h in Headers */,
     9986                                7A78FF32224191960096483E /* WKStorageAccessAlert.h in Headers */,
    99809987                                BC407606124FF0270068F20A /* WKString.h in Headers */,
    99819988                                BC40761A124FF0370068F20A /* WKStringCF.h in Headers */,
     
    1118111188                                5CA26D83217AD1B800F97A35 /* WKSafeBrowsingWarning.mm in Sources */,
    1118211189                                1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */,
     11190                                7A78FF332241919B0096483E /* WKStorageAccessAlert.mm in Sources */,
    1118311191                                26F10BE919187E2E001D0E68 /* WKSyntheticTapGestureRecognizer.m in Sources */,
    1118411192                        );
Note: See TracChangeset for help on using the changeset viewer.