| Differences between
and this patch
- a/Source/WebKit/ChangeLog +48 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2019-01-29  Brent Fulgham  <bfulgham@apple.com>
2
3
        StorageAccess API calls should be direct to the Network Process
4
        https://bugs.webkit.org/show_bug.cgi?id=193924
5
        <rdar://problem/47611249>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Now that the ResourceLoadStatistics data lives in the Network Process, calls to Storage Access
10
        API should happen directly between the WebContent and Network processes.
11
12
        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
13
        (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
14
        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
15
        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
16
        (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
17
        (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
18
        (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
19
        (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
20
        (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
21
        (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
22
        (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate):
23
        (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
24
        (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
25
        * NetworkProcess/NetworkConnectionToWebProcess.h:
26
        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
27
        * NetworkProcess/NetworkProcess.cpp:
28
        (WebKit::NetworkProcess::requestStorageAccess):
29
        (WebKit::NetworkProcess::requestStorageAccessGranted):
30
        * NetworkProcess/NetworkProcess.h:
31
        * UIProcess/Network/NetworkProcessProxy.cpp:
32
        (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
33
        * UIProcess/Network/NetworkProcessProxy.h:
34
        * UIProcess/Network/NetworkProcessProxy.messages.in:
35
        * UIProcess/WebPageProxy.cpp:
36
        (WebKit::WebPageProxy::requestStorageAccessConfirm):
37
        (WebKit::WebPageProxy::hasStorageAccess): Deleted.
38
        (WebKit::WebPageProxy::requestStorageAccess): Deleted.
39
        * UIProcess/WebPageProxy.h:
40
        * UIProcess/WebPageProxy.messages.in:
41
        * WebProcess/WebPage/WebPage.cpp:
42
        (WebKit::WebPage::hasStorageAccess):
43
        (WebKit::WebPage::requestStorageAccess):
44
        (WebKit::nextRequestStorageAccessContextId): Deleted.
45
        (WebKit::WebPage::storageAccessResponse): Deleted.
46
        * WebProcess/WebPage/WebPage.h:
47
        * WebProcess/WebPage/WebPage.messages.in:
48
1
2019-01-28  David Kilzer  <ddkilzer@apple.com>
49
2019-01-28  David Kilzer  <ddkilzer@apple.com>
2
50
3
        Move soft-linking of ManagedConfiguration.framework out of ManagedConfigurationSPI.h
51
        Move soft-linking of ManagedConfiguration.framework out of ManagedConfigurationSPI.h
- a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp -5 / +25 lines
Lines 293-306 void WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler(const S a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp_sec1
293
    callback(false);
293
    callback(false);
294
}
294
}
295
295
296
void WebResourceLoadStatisticsStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
296
void WebResourceLoadStatisticsStore::requestStorageAccessGranted(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
297
{
297
{
298
    ASSERT(subFrameHost != topFrameHost);
298
    auto statusHandler = [this, protectedThis = makeRef(*this), subFrameHost = subFrameHost.isolatedCopy(), topFrameHost = topFrameHost.isolatedCopy(), promptEnabled, frameID, pageID, completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable {
299
    ASSERT(RunLoop::isMain());
299
        switch (status) {
300
        case StorageAccessStatus::CannotRequestAccess:
301
            completionHandler(false);
302
            return;
303
        case StorageAccessStatus::RequiresUserPrompt:
304
            {
305
            ASSERT_UNUSED(promptEnabled, promptEnabled);
306
            CompletionHandler<void(bool)> requestConfirmationCompletionHandler = [this, protectedThis = makeRef(*this), subFrameHost = WTFMove(subFrameHost), topFrameHost = WTFMove(topFrameHost), frameID, pageID, completionHandler = WTFMove(completionHandler)] (bool userDidGrantAccess) mutable {
307
                if (userDidGrantAccess)
308
                    grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userDidGrantAccess, WTFMove(completionHandler));
309
                else
310
                    completionHandler(false);
311
            };
312
            m_networkSession->networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::RequestStorageAccessConfirm(pageID, frameID, ResourceLoadStatistics::primaryDomain(subFrameHost), ResourceLoadStatistics::primaryDomain(topFrameHost)), WTFMove(requestConfirmationCompletionHandler));
313
            }
314
            return;
315
        case StorageAccessStatus::HasAccess:
316
            completionHandler(true);
317
            return;
318
        }
319
    };
300
320
301
    requestStorageAccess(subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(completionHandler));
321
    requestStorageAccess(subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(statusHandler));
302
}
322
}
303
    
323
304
void WebResourceLoadStatisticsStore::requestStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
324
void WebResourceLoadStatisticsStore::requestStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
305
{
325
{
306
    auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost);
326
    auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost);
- a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h -2 / +1 lines
Lines 75-83 public: a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h_sec1
75
    void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool, CompletionHandler<void()>&&);
75
    void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool, CompletionHandler<void()>&&);
76
    void setShouldSubmitTelemetry(bool);
76
    void setShouldSubmitTelemetry(bool);
77
77
78
    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
79
    void grantStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);
78
    void grantStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);
80
    void requestStorageAccessCallback(bool wasGranted, uint64_t contextId);
81
79
82
    void applicationWillTerminate();
80
    void applicationWillTerminate();
83
81
Lines 95-100 public: a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h_sec2
95
    void hasStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
93
    void hasStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
96
    bool hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID);
94
    bool hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID);
97
    void requestStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
95
    void requestStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
96
    void requestStorageAccessGranted(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&&);
98
    void requestUpdate();
97
    void requestUpdate();
99
    void setLastSeen(const String& resourceDomain, Seconds, CompletionHandler<void()>&&);
98
    void setLastSeen(const String& resourceDomain, Seconds, CompletionHandler<void()>&&);
100
    void setPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&&);
99
    void setPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&&);
- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp -38 / +13 lines
Lines 56-61 a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp_sec1
56
#include "WebSWServerToContextConnectionMessages.h"
56
#include "WebSWServerToContextConnectionMessages.h"
57
#include "WebsiteDataStoreParameters.h"
57
#include "WebsiteDataStoreParameters.h"
58
#include <WebCore/NetworkStorageSession.h>
58
#include <WebCore/NetworkStorageSession.h>
59
#include <WebCore/ResourceLoadStatistics.h>
59
#include <WebCore/ResourceRequest.h>
60
#include <WebCore/ResourceRequest.h>
60
#include <WebCore/SameSiteInfo.h>
61
#include <WebCore/SameSiteInfo.h>
61
#include <WebCore/SecurityPolicy.h>
62
#include <WebCore/SecurityPolicy.h>
Lines 559-647 void NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession() a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp_sec2
559
    m_networkProcess->addWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters());
560
    m_networkProcess->addWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters());
560
}
561
}
561
562
563
#if ENABLE(RESOURCE_LOAD_STATISTICS)
562
void NetworkConnectionToWebProcess::removeStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID)
564
void NetworkConnectionToWebProcess::removeStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID)
563
{
565
{
564
#if ENABLE(RESOURCE_LOAD_STATISTICS)
565
    if (auto* storageSession = networkProcess().storageSession(sessionID))
566
    if (auto* storageSession = networkProcess().storageSession(sessionID))
566
        storageSession->removeStorageAccessForFrame(frameID, pageID);
567
        storageSession->removeStorageAccessForFrame(frameID, pageID);
567
#else
568
    UNUSED_PARAM(sessionID);
569
    UNUSED_PARAM(frameID);
570
    UNUSED_PARAM(pageID);
571
#endif
572
}
568
}
573
569
574
void NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID)
570
void NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID)
575
{
571
{
576
#if ENABLE(RESOURCE_LOAD_STATISTICS)
577
    if (auto* storageSession = networkProcess().storageSession(sessionID))
572
    if (auto* storageSession = networkProcess().storageSession(sessionID))
578
        storageSession->removeStorageAccessForAllFramesOnPage(pageID);
573
        storageSession->removeStorageAccessForAllFramesOnPage(pageID);
579
#else
580
    UNUSED_PARAM(sessionID);
581
    UNUSED_PARAM(pageID);
582
#endif
583
}
574
}
584
575
585
void NetworkConnectionToWebProcess::logUserInteraction(PAL::SessionID sessionID, const String& topLevelOrigin)
576
void NetworkConnectionToWebProcess::logUserInteraction(PAL::SessionID sessionID, const String& topLevelOrigin)
586
{
577
{
587
#if ENABLE(RESOURCE_LOAD_STATISTICS)
588
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
578
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
589
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
579
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
590
            resourceLoadStatistics->logUserInteraction(topLevelOrigin, [] { });
580
            resourceLoadStatistics->logUserInteraction(topLevelOrigin, [] { });
591
    }
581
    }
592
#else
593
    UNUSED_PARAM(sessionID);
594
    UNUSED_PARAM(topLevelOrigin);
595
#endif
596
}
582
}
597
583
598
void NetworkConnectionToWebProcess::logWebSocketLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen)
584
void NetworkConnectionToWebProcess::logWebSocketLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen)
599
{
585
{
600
#if ENABLE(RESOURCE_LOAD_STATISTICS)
601
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
586
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
602
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
587
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
603
            resourceLoadStatistics->logWebSocketLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { });
588
            resourceLoadStatistics->logWebSocketLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { });
604
    }
589
    }
605
#else
606
    UNUSED_PARAM(sessionID);
607
    UNUSED_PARAM(targetPrimaryDomain);
608
    UNUSED_PARAM(mainFramePrimaryDomain);
609
    UNUSED_PARAM(lastSeen);
610
#endif
611
}
590
}
612
591
613
void NetworkConnectionToWebProcess::logSubresourceLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen)
592
void NetworkConnectionToWebProcess::logSubresourceLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen)
614
{
593
{
615
#if ENABLE(RESOURCE_LOAD_STATISTICS)
616
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
594
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
617
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
595
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
618
            resourceLoadStatistics->logSubresourceLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { });
596
            resourceLoadStatistics->logSubresourceLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { });
619
    }
597
    }
620
#else
621
    UNUSED_PARAM(sessionID);
622
    UNUSED_PARAM(targetPrimaryDomain);
623
    UNUSED_PARAM(mainFramePrimaryDomain);
624
    UNUSED_PARAM(lastSeen);
625
#endif
626
}
598
}
627
599
628
void NetworkConnectionToWebProcess::logSubresourceRedirect(PAL::SessionID sessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain)
600
void NetworkConnectionToWebProcess::logSubresourceRedirect(PAL::SessionID sessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain)
629
{
601
{
630
#if ENABLE(RESOURCE_LOAD_STATISTICS)
631
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
602
    if (auto networkSession = networkProcess().networkSession(sessionID)) {
632
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
603
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
633
            resourceLoadStatistics->logSubresourceRedirect(sourcePrimaryDomain, targetPrimaryDomain, [] { });
604
            resourceLoadStatistics->logSubresourceRedirect(sourcePrimaryDomain, targetPrimaryDomain, [] { });
634
    }
605
    }
635
#else
636
    UNUSED_PARAM(sessionID);
637
    UNUSED_PARAM(sourcePrimaryDomain);
638
    UNUSED_PARAM(targetPrimaryDomain);
639
#endif
640
}
606
}
641
607
642
void NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate()
608
void NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate()
643
{
609
{
644
#if ENABLE(RESOURCE_LOAD_STATISTICS)
645
    for (auto& networkSession : networkProcess().networkSessions().values()) {
610
    for (auto& networkSession : networkProcess().networkSessions().values()) {
646
        if (networkSession->sessionID().isEphemeral())
611
        if (networkSession->sessionID().isEphemeral())
647
            continue;
612
            continue;
Lines 649-657 void NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate() a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp_sec3
649
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
614
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
650
            resourceLoadStatistics->requestUpdate();
615
            resourceLoadStatistics->requestUpdate();
651
    }
616
    }
652
#endif
653
}
617
}
654
618
619
void NetworkConnectionToWebProcess::hasStorageAccess(PAL::SessionID sessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
620
{
621
    networkProcess().hasStorageAccess(sessionID, subFrameHost, topFrameHost, frameID, pageID, WTFMove(completionHandler));
622
}
623
624
void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
625
{
626
    networkProcess().requestStorageAccessGranted(sessionID, subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(completionHandler));
627
}
628
#endif
629
655
void NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains)
630
void NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains)
656
{
631
{
657
    SecurityPolicy::addOriginAccessWhitelistEntry(SecurityOrigin::createFromString(sourceOrigin).get(), destinationProtocol, destinationHost, allowDestinationSubdomains);
632
    SecurityPolicy::addOriginAccessWhitelistEntry(SecurityOrigin::createFromString(sourceOrigin).get(), destinationProtocol, destinationHost, allowDestinationSubdomains);
- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h +5 lines
Lines 192-204 private: a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h_sec1
192
192
193
    CacheStorageEngineConnection& cacheStorageConnection();
193
    CacheStorageEngineConnection& cacheStorageConnection();
194
194
195
#if ENABLE(RESOURCE_LOAD_STATISTICS)
195
    void removeStorageAccessForFrame(PAL::SessionID, uint64_t frameID, uint64_t pageID);
196
    void removeStorageAccessForFrame(PAL::SessionID, uint64_t frameID, uint64_t pageID);
196
    void removeStorageAccessForAllFramesOnPage(PAL::SessionID, uint64_t pageID);
197
    void removeStorageAccessForAllFramesOnPage(PAL::SessionID, uint64_t pageID);
198
197
    void logUserInteraction(PAL::SessionID, const String& topLevelOrigin);
199
    void logUserInteraction(PAL::SessionID, const String& topLevelOrigin);
198
    void logWebSocketLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen);
200
    void logWebSocketLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen);
199
    void logSubresourceLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen);
201
    void logSubresourceLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen);
200
    void logSubresourceRedirect(PAL::SessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain);
202
    void logSubresourceRedirect(PAL::SessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain);
201
    void requestResourceLoadStatisticsUpdate();
203
    void requestResourceLoadStatisticsUpdate();
204
    void hasStorageAccess(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
205
    void requestStorageAccess(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool prompt, CompletionHandler<void(bool)>&&);
206
#endif
202
207
203
    void addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains);
208
    void addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains);
204
    void removeOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains);
209
    void removeOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains);
- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in -2 / +4 lines
Lines 1-4 a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in_sec1
1
# Copyright (C) 2012-2017 Apple Inc. All rights reserved.
1
# Copyright (C) 2012-2019 Apple Inc. All rights reserved.
2
#
2
#
3
# Redistribution and use in source and binary forms, with or without
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions
4
# modification, are permitted provided that the following conditions
Lines 56-69 messages -> NetworkConnectionToWebProcess LegacyReceiver { a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in_sec2
56
56
57
    EnsureLegacyPrivateBrowsingSession()
57
    EnsureLegacyPrivateBrowsingSession()
58
58
59
#if ENABLE(RESOURCE_LOAD_STATISTICS)
59
    RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
60
    RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
60
    RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID);
61
    RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID);
61
#if ENABLE(RESOURCE_LOAD_STATISTICS)
62
    LogUserInteraction(PAL::SessionID sessionID, String topLevelOrigin)
62
    LogUserInteraction(PAL::SessionID sessionID, String topLevelOrigin)
63
    LogWebSocketLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen)
63
    LogWebSocketLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen)
64
    LogSubresourceLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen)
64
    LogSubresourceLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen)
65
    LogSubresourceRedirect(PAL::SessionID sessionID, String sourcePrimaryDomain, String targetPrimaryDomain)
65
    LogSubresourceRedirect(PAL::SessionID sessionID, String sourcePrimaryDomain, String targetPrimaryDomain)
66
    RequestResourceLoadStatisticsUpdate();
66
    RequestResourceLoadStatisticsUpdate();
67
    HasStorageAccess(PAL::SessionID sessionID, String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async
68
    RequestStorageAccess(PAL::SessionID sessionID, String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, bool prompt) -> (bool accessGranted) Async
67
#endif
69
#endif
68
70
69
    AddOriginAccessWhitelistEntry(String sourceOrigin, String destinationProtocol, String destinationHost, bool allowDestinationSubdomains);
71
    AddOriginAccessWhitelistEntry(String sourceOrigin, String destinationProtocol, String destinationHost, bool allowDestinationSubdomains);
- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp -1 / +14 lines
Lines 969-975 void NetworkProcess::requestStorageAccess(PAL::SessionID sessionID, const String a/Source/WebKit/NetworkProcess/NetworkProcess.cpp_sec1
969
{
969
{
970
    if (auto* networkSession = this->networkSession(sessionID)) {
970
    if (auto* networkSession = this->networkSession(sessionID)) {
971
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
971
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
972
            resourceLoadStatistics->requestStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID, promptEnabled, WTFMove(completionHandler));
972
            resourceLoadStatistics->requestStorageAccess(resourceDomain, firstPartyDomain, frameID.value(), pageID, promptEnabled, WTFMove(completionHandler));
973
        else
973
        else
974
            completionHandler(StorageAccessStatus::CannotRequestAccess);
974
            completionHandler(StorageAccessStatus::CannotRequestAccess);
975
    } else {
975
    } else {
Lines 978-983 void NetworkProcess::requestStorageAccess(PAL::SessionID sessionID, const String a/Source/WebKit/NetworkProcess/NetworkProcess.cpp_sec2
978
    }
978
    }
979
}
979
}
980
980
981
void NetworkProcess::requestStorageAccessGranted(PAL::SessionID sessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler)
982
{
983
    if (auto* networkSession = this->networkSession(sessionID)) {
984
        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
985
            resourceLoadStatistics->requestStorageAccessGranted(subFrameHost, topFrameHost, frameID, pageID, promptEnabled, WTFMove(completionHandler));
986
        else
987
            completionHandler(false);
988
    } else {
989
        ASSERT_NOT_REACHED();
990
        completionHandler(false);
991
    }
992
}
993
981
void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)
994
void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)
982
{
995
{
983
    if (auto* networkSession = this->networkSession(sessionID)) {
996
    if (auto* networkSession = this->networkSession(sessionID)) {
- a/Source/WebKit/NetworkProcess/NetworkProcess.h +1 lines
Lines 206-211 public: a/Source/WebKit/NetworkProcess/NetworkProcess.h_sec1
206
    void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);
206
    void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);
207
    void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains);
207
    void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains);
208
    void requestStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
208
    void requestStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
209
    void requestStorageAccessGranted(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(bool)>&&);
209
    void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&);
210
    void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&);
210
    void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&);
211
    void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&);
211
    void scheduleClearInMemoryAndPersistent(PAL::SessionID, Optional<WallTime> modifiedSince, ShouldGrandfatherStatistics, CompletionHandler<void()>&&);
212
    void scheduleClearInMemoryAndPersistent(PAL::SessionID, Optional<WallTime> modifiedSince, ShouldGrandfatherStatistics, CompletionHandler<void()>&&);
- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp +5 lines
Lines 727-732 void NetworkProcessProxy::requestStorageAccess(PAL::SessionID sessionID, const S a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp_sec1
727
    sendWithAsyncReply(Messages::NetworkProcess::RequestStorageAccess(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, promptEnabled), WTFMove(completionHandler));
727
    sendWithAsyncReply(Messages::NetworkProcess::RequestStorageAccess(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, promptEnabled), WTFMove(completionHandler));
728
}
728
}
729
729
730
void NetworkProcessProxy::requestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, const String& subFrameHost, const String& topFrameHost, CompletionHandler<void(bool)>&& completionHandler)
731
{
732
    WebPageProxy::requestStorageAccessConfirm(pageID, frameID, subFrameHost, topFrameHost, WTFMove(completionHandler));
733
}
734
730
void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)
735
void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)
731
{
736
{
732
    if (!canSendMessage()) {
737
    if (!canSendMessage()) {
- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h +1 lines
Lines 113-118 public: a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h_sec1
113
    void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);
113
    void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);
114
    void hasStorageAccess(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
114
    void hasStorageAccess(PAL::SessionID, const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
115
    void requestStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
115
    void requestStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
116
    void requestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, const String& subFrameHost, const String& topFrameHost, CompletionHandler<void(bool)>&&);
116
    void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&);
117
    void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&);
117
    void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);
118
    void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);
118
    void scheduleClearInMemoryAndPersistent(PAL::SessionID, ShouldGrandfatherStatistics, CompletionHandler<void()>&&);
119
    void scheduleClearInMemoryAndPersistent(PAL::SessionID, ShouldGrandfatherStatistics, CompletionHandler<void()>&&);
- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in -1 / +2 lines
Lines 1-4 a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in_sec1
1
# Copyright (C) 2012 Apple Inc. All rights reserved.
1
# Copyright (C) 2012-2019 Apple Inc. All rights reserved.
2
#
2
#
3
# Redistribution and use in source and binary forms, with or without
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions
4
# modification, are permitted provided that the following conditions
Lines 46-51 messages -> NetworkProcessProxy LegacyReceiver { a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in_sec2
46
    NotifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished()
46
    NotifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished()
47
    NotifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished()
47
    NotifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished()
48
    NotifyResourceLoadStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins)
48
    NotifyResourceLoadStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins)
49
    RequestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, String subFrameHost, String topFrameHost) -> (bool userDidGrantAccess) Async
49
#endif
50
#endif
50
#if ENABLE(CONTENT_EXTENSIONS)
51
#if ENABLE(CONTENT_EXTENSIONS)
51
    ContentExtensionRules(WebKit::UserContentControllerIdentifier identifier)
52
    ContentExtensionRules(WebKit::UserContentControllerIdentifier identifier)
- a/Source/WebKit/UIProcess/WebPageProxy.cpp -31 / +8 lines
Lines 8239-8276 void WebPageProxy::loadSynchronousURLSchemeTask(URLSchemeTaskParameters&& parame a/Source/WebKit/UIProcess/WebPageProxy.cpp_sec1
8239
}
8239
}
8240
8240
8241
#if ENABLE(RESOURCE_LOAD_STATISTICS)
8241
#if ENABLE(RESOURCE_LOAD_STATISTICS)
8242
void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId)
8242
void WebPageProxy::requestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, const String& subFrameHost, const String& topFrameHost, CompletionHandler<void(bool)>&& completionHandler)
8243
{
8243
{
8244
    m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID, [this, webProcessContextId] (bool hasAccess) {
8244
    WebPageProxy* page = WebProcessProxy::webPage(pageID);
8245
        m_process->send(Messages::WebPage::StorageAccessResponse(hasAccess, webProcessContextId), m_pageID);
8245
    if (!page) {
8246
    });
8246
        completionHandler(false);
8247
}
8247
        return;
8248
8248
    }
8249
void WebPageProxy::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId, bool promptEnabled)
8249
    
8250
{
8250
    page->m_uiClient->requestStorageAccessConfirm(*page, page->m_process->webFrame(frameID), ResourceLoadStatistics::primaryDomain(subFrameHost), ResourceLoadStatistics::primaryDomain(topFrameHost), WTFMove(completionHandler));
8251
    CompletionHandler<void(bool)> completionHandler = [this, protectedThis = makeRef(*this), webProcessContextId] (bool access) {
8252
        m_process->send(Messages::WebPage::StorageAccessResponse(access, webProcessContextId), m_pageID);
8253
    };
8254
8255
    m_websiteDataStore->requestStorageAccess(String(subFrameHost), String(topFrameHost), frameID, m_pageID, promptEnabled, [this, protectedThis = makeRef(*this), subFrameHost, topFrameHost, promptEnabled, frameID, completionHandler = WTFMove(completionHandler)] (StorageAccessStatus status) mutable {
8256
        switch (status) {
8257
        case StorageAccessStatus::CannotRequestAccess:
8258
            completionHandler(false);
8259
            return;
8260
        case StorageAccessStatus::RequiresUserPrompt:
8261
            ASSERT_UNUSED(promptEnabled, promptEnabled);
8262
            m_uiClient->requestStorageAccessConfirm(*this, m_process->webFrame(frameID), ResourceLoadStatistics::primaryDomain(subFrameHost), ResourceLoadStatistics::primaryDomain(topFrameHost), [this, protectedThis = makeRef(*this), subFrameHost, topFrameHost, frameID, completionHandler = WTFMove(completionHandler)] (bool userDidGrantAccess) mutable {
8263
                if (userDidGrantAccess)
8264
                    m_websiteDataStore->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID, userDidGrantAccess, WTFMove(completionHandler));
8265
                else
8266
                    completionHandler(false);
8267
            });
8268
            return;
8269
        case StorageAccessStatus::HasAccess:
8270
            completionHandler(true);
8271
            return;
8272
        }
8273
    });
8274
}
8251
}
8275
#endif
8252
#endif
8276
8253
- a/Source/WebKit/UIProcess/WebPageProxy.h -2 / +1 lines
Lines 1380-1387 public: a/Source/WebKit/UIProcess/WebPageProxy.h_sec1
1380
#endif
1380
#endif
1381
1381
1382
#if ENABLE(RESOURCE_LOAD_STATISTICS)
1382
#if ENABLE(RESOURCE_LOAD_STATISTICS)
1383
    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId);
1383
    static void requestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, const String& subFrameHost, const String& topFrameHost, CompletionHandler<void(bool)>&&);
1384
    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId, bool prompt);
1385
#endif
1384
#endif
1386
1385
1387
    static WebPageProxy* nonEphemeralWebPageProxy();
1386
    static WebPageProxy* nonEphemeralWebPageProxy();
- a/Source/WebKit/UIProcess/WebPageProxy.messages.in -6 / +1 lines
Lines 1-4 a/Source/WebKit/UIProcess/WebPageProxy.messages.in_sec1
1
# Copyright (C) 2010-2018 Apple Inc. All rights reserved.
1
# Copyright (C) 2010-2019 Apple Inc. All rights reserved.
2
#
2
#
3
# Redistribution and use in source and binary forms, with or without
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions
4
# modification, are permitted provided that the following conditions
Lines 534-544 messages -> WebPageProxy { a/Source/WebKit/UIProcess/WebPageProxy.messages.in_sec2
534
    StopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier)
534
    StopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier)
535
    LoadSynchronousURLSchemeTask(struct WebKit::URLSchemeTaskParameters parameters) -> (WebCore::ResourceResponse response, WebCore::ResourceError error, IPC::DataReference data) Delayed
535
    LoadSynchronousURLSchemeTask(struct WebKit::URLSchemeTaskParameters parameters) -> (WebCore::ResourceResponse response, WebCore::ResourceError error, IPC::DataReference data) Delayed
536
536
537
#if ENABLE(RESOURCE_LOAD_STATISTICS)
538
    HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t contextID)
539
    RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t contextID, bool prompt)
540
#endif
541
542
#if ENABLE(ATTACHMENT_ELEMENT)
537
#if ENABLE(ATTACHMENT_ELEMENT)
543
    RegisterAttachmentIdentifierFromData(String identifier, String contentType, String preferredFileName, IPC::SharedBufferDataReference data)
538
    RegisterAttachmentIdentifierFromData(String identifier, String contentType, String preferredFileName, IPC::SharedBufferDataReference data)
544
    RegisterAttachmentIdentifierFromFilePath(String identifier, String contentType, String filePath)
539
    RegisterAttachmentIdentifierFromFilePath(String identifier, String contentType, String filePath)
- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp -31 / +8 lines
Lines 1227-1234 void WebPage::close() a/Source/WebKit/WebProcess/WebPage/WebPage.cpp_sec1
1227
    if (m_isClosed)
1227
    if (m_isClosed)
1228
        return;
1228
        return;
1229
1229
1230
#if ENABLE(RESOURCE_LOAD_STATISTICS)
1230
    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForAllFramesOnPage(sessionID(), m_pageID), 0);
1231
    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForAllFramesOnPage(sessionID(), m_pageID), 0);
1231
    
1232
#endif
1233
1232
    m_isClosed = true;
1234
    m_isClosed = true;
1233
1235
1234
    // If there is still no URL, then we never loaded anything in this page, so nothing to report.
1236
    // If there is still no URL, then we never loaded anything in this page, so nothing to report.
Lines 6367-6406 void WebPage::frameBecameRemote(uint64_t frameID, GlobalFrameIdentifier&& remote a/Source/WebKit/WebProcess/WebPage/WebPage.cpp_sec2
6367
}
6369
}
6368
6370
6369
#if ENABLE(RESOURCE_LOAD_STATISTICS)
6371
#if ENABLE(RESOURCE_LOAD_STATISTICS)
6370
static uint64_t nextRequestStorageAccessContextId()
6372
void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler)
6371
{
6373
{
6372
    static uint64_t nextContextId = 0;
6374
    WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::HasStorageAccess(sessionID(), WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID), WTFMove(completionHandler));
6373
    return ++nextContextId;
6374
}
6375
6376
void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback)
6377
{
6378
    auto contextId = nextRequestStorageAccessContextId();
6379
    auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback));
6380
    ASSERT(addResult.isNewEntry);
6381
    if (addResult.iterator->value)
6382
        send(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, contextId));
6383
    else
6384
        callback(false);
6385
}
6375
}
6386
    
6376
    
6387
void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback)
6377
void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler)
6388
{
6378
{
6389
    auto contextId = nextRequestStorageAccessContextId();
6379
    bool promptEnabled = RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled();
6390
    auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback));
6380
    WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID, promptEnabled), WTFMove(completionHandler));
6391
    ASSERT(addResult.isNewEntry);
6392
    if (addResult.iterator->value) {
6393
        bool promptEnabled = RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled();
6394
        send(Messages::WebPageProxy::RequestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, contextId, promptEnabled));
6395
    } else
6396
        callback(false);
6397
}
6398
6399
void WebPage::storageAccessResponse(bool wasGranted, uint64_t contextId)
6400
{
6401
    auto callback = m_storageAccessResponseCallbackMap.take(contextId);
6402
    ASSERT(callback);
6403
    callback(wasGranted);
6404
}
6381
}
6405
#endif
6382
#endif
6406
    
6383
    
- a/Source/WebKit/WebProcess/WebPage/WebPage.h -2 / +1 lines
Lines 1-5 a/Source/WebKit/WebProcess/WebPage/WebPage.h_sec1
1
/*
1
/*
2
 * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
2
 * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
3
 *
3
 *
4
 * Redistribution and use in source and binary forms, with or without
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
5
 * modification, are permitted provided that the following conditions
Lines 1111-1117 public: a/Source/WebKit/WebProcess/WebPage/WebPage.h_sec2
1111
#if ENABLE(RESOURCE_LOAD_STATISTICS)
1111
#if ENABLE(RESOURCE_LOAD_STATISTICS)
1112
    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1112
    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1113
    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1113
    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1114
    void storageAccessResponse(bool wasGranted, uint64_t contextId);
1115
#endif
1114
#endif
1116
1115
1117
    void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1116
    void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in -5 / +1 lines
Lines 1-4 a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in_sec1
1
# Copyright (C) 2010-2016 Apple Inc. All rights reserved.
1
# Copyright (C) 2010-2019 Apple Inc. All rights reserved.
2
#
2
#
3
# Redistribution and use in source and binary forms, with or without
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions
4
# modification, are permitted provided that the following conditions
Lines 531-540 messages -> WebPage LegacyReceiver { a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in_sec2
531
531
532
    SetIsSuspended(bool suspended)
532
    SetIsSuspended(bool suspended)
533
533
534
#if ENABLE(RESOURCE_LOAD_STATISTICS)
535
    StorageAccessResponse(bool wasGranted, uint64_t contextId)
536
#endif
537
538
#if ENABLE(ATTACHMENT_ELEMENT)
534
#if ENABLE(ATTACHMENT_ELEMENT)
539
    InsertAttachment(String identifier, Optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID)
535
    InsertAttachment(String identifier, Optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID)
540
    UpdateAttachmentAttributes(String identifier, Optional<uint64_t> fileSize, String contentType, String fileName, IPC::SharedBufferDataReference enclosingImageData, WebKit::CallbackID callbackID)
536
    UpdateAttachmentAttributes(String identifier, Optional<uint64_t> fileSize, String contentType, String fileName, IPC::SharedBufferDataReference enclosingImageData, WebKit::CallbackID callbackID)

Return to Bug 193924