Title: [245427] trunk
Revision
245427
Author
[email protected]
Date
2019-05-16 16:33:39 -0700 (Thu, 16 May 2019)

Log Message

Storage Access API: Call completion handlers in NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess() when feature is off
https://bugs.webkit.org/show_bug.cgi?id=197967
<rdar://problem/50753129>

Reviewed by Brent Fulgham.

Source/WebKit:

NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess()
should call their completion handlers when there is no Resource Load Statistics object, i.e. when Resource
Load Statistics is off. This happens for ephemeral sessions which made code for federated login providers
hang, waiting for the result to document.hasStorageAccess().

The existing layout test case was augmented to use an ephemeral session.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
(WebKit::NetworkConnectionToWebProcess::requestStorageAccess):

LayoutTests:

* http/tests/storageAccess/has-storage-access-true-if-feature-off.html:
* platform/mac-wk2/TestExpectations:
    Test case marked as [ Pass ].

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245426 => 245427)


--- trunk/LayoutTests/ChangeLog	2019-05-16 23:27:57 UTC (rev 245426)
+++ trunk/LayoutTests/ChangeLog	2019-05-16 23:33:39 UTC (rev 245427)
@@ -1,3 +1,15 @@
+2019-05-16  John Wilander  <[email protected]>
+
+        Storage Access API: Call completion handlers in NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess() when feature is off
+        https://bugs.webkit.org/show_bug.cgi?id=197967
+        <rdar://problem/50753129>
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/storageAccess/has-storage-access-true-if-feature-off.html:
+        * platform/mac-wk2/TestExpectations:
+            Test case marked as [ Pass ].
+
 2019-05-16  Ross Kirsling  <[email protected]>
 
         [JSC] Invalid AssignmentTargetType should be an early error.

Modified: trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html (245426 => 245427)


--- trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html	2019-05-16 23:27:57 UTC (rev 245426)
+++ trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html	2019-05-16 23:33:39 UTC (rev 245427)
@@ -8,6 +8,9 @@
         description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if there is no way to request access (feature off).");
         jsTestIsAsync = true;
 
+        if (window.testRunner)
+            testRunner.setPrivateBrowsingEnabled(true);
+
         window.addEventListener("message", receiveMessage, false);
 
         function receiveMessage(event) {

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (245426 => 245427)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2019-05-16 23:27:57 UTC (rev 245426)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2019-05-16 23:33:39 UTC (rev 245427)
@@ -731,6 +731,7 @@
 [ HighSierra+ ] http/tests/storageAccess/grant-with-prompt-preserves-gesture.html [ Pass ]
 [ HighSierra+ ] http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html [ Skip ]
 [ HighSierra+ ] http/tests/storageAccess/deny-without-prompt-preserves-gesture.html [ Pass ]
+[ HighSierra+ ] http/tests/storageAccess/has-storage-access-true-if-feature-off.html [ Pass ]
 
 # As of https://trac.webkit.org/changeset/227762 the timestampResolution is just 5 seconds which makes this test flaky
 http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Skip ]

Modified: trunk/Source/WebKit/ChangeLog (245426 => 245427)


--- trunk/Source/WebKit/ChangeLog	2019-05-16 23:27:57 UTC (rev 245426)
+++ trunk/Source/WebKit/ChangeLog	2019-05-16 23:33:39 UTC (rev 245427)
@@ -1,3 +1,22 @@
+2019-05-16  John Wilander  <[email protected]>
+
+        Storage Access API: Call completion handlers in NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess() when feature is off
+        https://bugs.webkit.org/show_bug.cgi?id=197967
+        <rdar://problem/50753129>
+
+        Reviewed by Brent Fulgham.
+
+        NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess()
+        should call their completion handlers when there is no Resource Load Statistics object, i.e. when Resource
+        Load Statistics is off. This happens for ephemeral sessions which made code for federated login providers
+        hang, waiting for the result to document.hasStorageAccess().
+
+        The existing layout test case was augmented to use an ephemeral session.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
+        (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
+
 2019-05-16  Alex Christensen  <[email protected]>
 
         Add a unit test for client certificate authentication

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (245426 => 245427)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-05-16 23:27:57 UTC (rev 245426)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-05-16 23:33:39 UTC (rev 245427)
@@ -682,17 +682,25 @@
 void NetworkConnectionToWebProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
 {
     if (auto networkSession = networkProcess().networkSession(sessionID)) {
-        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
+        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) {
             resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));
+            return;
+        }
     }
+
+    completionHandler(true);
 }
 
 void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(WebCore::StorageAccessWasGranted wasGranted, WebCore::StorageAccessPromptWasShown promptWasShown)>&& completionHandler)
 {
     if (auto networkSession = networkProcess().networkSession(sessionID)) {
-        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
+        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) {
             resourceLoadStatistics->requestStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));
+            return;
+        }
     }
+
+    completionHandler(WebCore::StorageAccessWasGranted::Yes, WebCore::StorageAccessPromptWasShown::No);
 }
 
 void NetworkConnectionToWebProcess::requestStorageAccessUnderOpener(PAL::SessionID sessionID, WebCore::RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain&& openerDomain)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to