Diff
Modified: trunk/LayoutTests/ChangeLog (276325 => 276326)
--- trunk/LayoutTests/ChangeLog 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/LayoutTests/ChangeLog 2021-04-20 23:11:40 UTC (rev 276326)
@@ -1,3 +1,25 @@
+2021-04-20 Kate Cheney <[email protected]>
+
+ Preconnect tasks and preflight checks do not correctly mark app-bound context string
+ https://bugs.webkit.org/show_bug.cgi?id=224779
+ <rdar://problem/76738879>
+
+ Reviewed by Brent Fulgham.
+
+ Layout test coverage.
+
+ * http/tests/in-app-browser-privacy/context-string-for-subframe.html:
+ Drive by fix to create the subframe with JS so we can add a dummy
+ parameter to avoid caching and causing flakiness. Found this while
+ testing for flakiness in new tests.
+
+ * http/tests/in-app-browser-privacy/context-string-preconnect-expected.txt: Added.
+ * http/tests/in-app-browser-privacy/context-string-preconnect.html: Added.
+ * http/tests/in-app-browser-privacy/context-string-preflight-expected.txt: Added.
+ * http/tests/in-app-browser-privacy/context-string-preflight.html: Added.
+ Test an unsuccessful preflight request so a real request doesn't
+ override the stored context data for testing purposes.
+
2021-04-20 Cameron McCormack <[email protected]>
Add test for line breaking around inline-blocks.
Modified: trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-for-subframe.html (276325 => 276326)
--- trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-for-subframe.html 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-for-subframe.html 2021-04-20 23:11:40 UTC (rev 276326)
@@ -2,32 +2,41 @@
<html>
<head>
<script src=""
- <script src=""
- <script>
- description("Tests that the app-bound-request context string gets properly set for an iframe");
- jsTestIsAsync = true;
+ <script src=""
+</head>
+<body>
+<script>
+ description("Tests that the app-bound-request context string gets properly set for an iframe");
+ jsTestIsAsync = true;
- var subFrameHost = "localhost";
- var contextHost = "127.0.0.1";
- function askForContextStringForSubFrame() {
- testRunner.appBoundRequestContextDataForDomain(subFrameHost, function (contextData) {
- if (contextData == null) {
- askForContextStringForSubFrame();
- return;
- }
+ const subFrameHost = "localhost";
+ const contextHost = "127.0.0.1";
+ function askForContextStringForSubFrame() {
+ testRunner.appBoundRequestContextDataForDomain(subFrameHost, function (contextData) {
+ if (contextData == null) {
+ askForContextStringForSubFrame();
+ return;
+ }
- if (contextData == contextHost)
- testPassed("Context string for sub frame correctly captured.");
- else
- testFailed("Context string for sub frame NOT correctly captured.");
+ if (contextData == contextHost)
+ testPassed("Context string for sub frame correctly captured.");
+ else
+ testFailed("Context string for sub frame NOT correctly captured.");
- finishJSTest();
- });
+ finishJSTest();
+ });
+ }
+
+ function openIframe(url, onLoadHandler) {
+ const element = document.createElement("iframe");
+ element.src = ""
+ if (onLoadHandler) {
+ element._onload_ = onLoadHandler;
}
- </script>
-</head>
-<body>
-<iframe _onload_="setTimeout('askForContextStringForSubFrame()', 0)" src=""
-</iframe>
+ document.body.appendChild(element);
+ }
+
+ openIframe("http://localhost:8000/in-app-browser-privacy/resources/basic-iframe.html&dummy=" + Math.random(), askForContextStringForSubFrame);
+</script>
</body>
</html>
Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preconnect-expected.txt (0 => 276326)
--- trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preconnect-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preconnect-expected.txt 2021-04-20 23:11:40 UTC (rev 276326)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: Successfuly preconnected to http://localhost:8000/
+Tests that preconnect tasks get marked with the proper context string.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Context string for preconnect correctly captured.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preconnect.html (0 => 276326)
--- trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preconnect.html (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preconnect.html 2021-04-20 23:11:40 UTC (rev 276326)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Tests that preconnect tasks get marked with the proper context string.");
+jsTestIsAsync = true;
+
+var preconnectLinkDomain = "localhost";
+var contextHost = "127.0.0.1";
+
+function askForContextStringForPreconnect() {
+ testRunner.appBoundRequestContextDataForDomain(preconnectLinkDomain, function (contextData) {
+ if (contextData == null) {
+ askForContextStringForPreconnect();
+ return;
+ }
+
+ if (contextData == contextHost)
+ testPassed("Context string for preconnect correctly captured.");
+ else
+ testFailed("Context string for preconnect NOT correctly captured.");
+
+ finishJSTest();
+ });
+}
+
+internals.setConsoleMessageListener(function() {
+ askForContextStringForPreconnect();
+});
+
+const testLink = document.createElement("link");
+testLink.rel = "preconnect";
+testLink.href = ""
+document.head.appendChild(testLink);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preflight-expected.txt (0 => 276326)
--- trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preflight-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preflight-expected.txt 2021-04-20 23:11:40 UTC (rev 276326)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: Preflight response is not successful
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/status-404-without-body.py due to access control checks.
+CONSOLE MESSAGE: Preflight response is not successful
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/status-404-without-body.py due to access control checks.
+Tests that not successful preflight responses make preflight failing
+
+PASS: NetworkError: A network error occurred.
+PASS Context string for CORS preflight correctly captured.
+
Added: trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preflight.html (0 => 276326)
--- trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preflight.html (rev 0)
+++ trunk/LayoutTests/http/tests/in-app-browser-privacy/context-string-preflight.html 2021-04-20 23:11:40 UTC (rev 276326)
@@ -0,0 +1,62 @@
+<p>Tests that not successful preflight responses make preflight failing</p>
+
+<pre id="console"></pre>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById('console').appendChild(document.createTextNode(message + '\n'));
+}
+
+var preflightLinkDomain = "localhost";
+var contextHost = "127.0.0.1";
+var url = ""
+
+function askForContextStringForPreflight() {
+ testRunner.appBoundRequestContextDataForDomain(preflightLinkDomain, function (contextData) {
+ if (contextData == null) {
+ askForContextStringForPreflight();
+ return;
+ }
+
+ if (contextData == contextHost)
+ log("PASS Context string for CORS preflight correctly captured.");
+ else
+ log("FAIL Context string for CORS preflight NOT correctly captured.");
+
+ testRunner.notifyDone();
+ });
+}
+
+function runTest()
+{
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.setRequestHeader("x-webkit", "foo");
+
+ try {
+ req.send(null);
+ log("PASS: " + req.responseText);
+ } catch (ex) {
+ log("PASS: " + ex);
+ }
+
+ req = new XMLHttpRequest();
+ req.open("GET", url, true);
+ req.setRequestHeader("x-webkit", "foo");
+
+ req._onload_ = function() {
+ askForContextStringForPreflight();
+ }
+ req._onerror_ = function() {
+ askForContextStringForPreflight();
+ }
+ req.send(null);
+}
+
+runTest();
+</script>
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (276325 => 276326)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2021-04-20 23:11:40 UTC (rev 276326)
@@ -1787,6 +1787,8 @@
# Some In-App Browser Privacy tests rely on functions in WebKitAdditions.
http/tests/in-app-browser-privacy/context-string-for-subframe.html [ Skip ]
+http/tests/in-app-browser-privacy/context-string-preconnect.html [ Skip ]
+http/tests/in-app-browser-privacy/context-string-preflight.html [ Skip ]
webkit.org/b/175193 fast/images/async-image-body-background-image.html [ Pass Timeout ]
Modified: trunk/Source/WebCore/ChangeLog (276325 => 276326)
--- trunk/Source/WebCore/ChangeLog 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Source/WebCore/ChangeLog 2021-04-20 23:11:40 UTC (rev 276326)
@@ -1,3 +1,18 @@
+2021-04-20 Kate Cheney <[email protected]>
+
+ Preconnect tasks and preflight checks do not correctly mark app-bound context string
+ https://bugs.webkit.org/show_bug.cgi?id=224779
+ <rdar://problem/76738879>
+
+ Reviewed by Brent Fulgham.
+
+ Tests: http/tests/in-app-browser-privacy/context-string-preconnect.html
+ http/tests/in-app-browser-privacy/context-string-preflight.html
+
+ * loader/CrossOriginAccessControl.cpp:
+ (WebCore::createAccessControlPreflightRequest):
+ CORS preflight case.
+
2021-04-20 Aditya Keerthi <[email protected]>
[iOS][FCR] Update date/time picker appearance
Modified: trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp (276325 => 276326)
--- trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp 2021-04-20 23:11:40 UTC (rev 276326)
@@ -88,6 +88,7 @@
preflightRequest.setHTTPMethod("OPTIONS");
preflightRequest.setHTTPHeaderField(HTTPHeaderName::AccessControlRequestMethod, request.httpMethod());
preflightRequest.setPriority(request.priority());
+ preflightRequest.setFirstPartyForCookies(request.firstPartyForCookies());
if (!referrer.isNull())
preflightRequest.setHTTPReferrer(referrer);
Modified: trunk/Source/WebKit/ChangeLog (276325 => 276326)
--- trunk/Source/WebKit/ChangeLog 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Source/WebKit/ChangeLog 2021-04-20 23:11:40 UTC (rev 276326)
@@ -1,3 +1,29 @@
+2021-04-20 Kate Cheney <[email protected]>
+
+ Preconnect tasks and preflight checks do not correctly mark app-bound context string
+ https://bugs.webkit.org/show_bug.cgi?id=224779
+ <rdar://problem/76738879>
+
+ Reviewed by Brent Fulgham.
+
+ We are using request.firstPartyForCookies() to set the app-bound request
+ context as of https://bugs.webkit.org/show_bug.cgi?id=224311. Some
+ cases like preconnect tasks and CORS preflight requests don't set this
+ value because it is not needed for cookie purposes. Since we are now
+ using it for app-bound requests, and the context is needed for all
+ network connections, even those that don't send bytes, we should set
+ the firstPartyForCookies for these cases.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::preconnectTo):
+ This is the code path for preconnecting to the main resource load, so
+ we can use the given URL as the first party.
+
+ * WebProcess/Network/WebLoaderStrategy.cpp:
+ (WebKit::WebLoaderStrategy::preconnectTo):
+ This is the code path for sub resources. We should use the document
+ firstPartyForCookies value.
+
2021-04-20 Aditya Keerthi <[email protected]>
[iOS][FCR] Update date/time picker appearance
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (276325 => 276326)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2021-04-20 23:11:40 UTC (rev 276326)
@@ -1378,6 +1378,7 @@
NetworkLoadParameters parameters;
parameters.request = ResourceRequest { url };
parameters.request.setIsAppBound(lastNavigationWasAppBound == LastNavigationWasAppBound::Yes);
+ parameters.request.setFirstPartyForCookies(url);
parameters.webPageProxyID = webPageProxyID;
parameters.webPageID = webPageID;
parameters.isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain;
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (276325 => 276326)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2021-04-20 23:11:40 UTC (rev 276326)
@@ -768,8 +768,12 @@
void WebLoaderStrategy::preconnectTo(WebCore::ResourceRequest&& request, WebPage& webPage, WebFrame& webFrame, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, PreconnectCompletionHandler&& completionHandler)
{
if (auto* document = webPage.mainFrame()->document()) {
- if (document && document->loader())
- request.setIsAppBound(document->loader()->lastNavigationWasAppBound());
+ if (!document)
+ return;
+
+ request.setFirstPartyForCookies(document->firstPartyForCookies());
+ if (auto* loader = document->loader())
+ request.setIsAppBound(loader->lastNavigationWasAppBound());
}
Optional<uint64_t> preconnectionIdentifier;
Modified: trunk/Tools/ChangeLog (276325 => 276326)
--- trunk/Tools/ChangeLog 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Tools/ChangeLog 2021-04-20 23:11:40 UTC (rev 276326)
@@ -1,3 +1,20 @@
+2021-04-20 Kate Cheney <[email protected]>
+
+ Preconnect tasks and preflight checks do not correctly mark app-bound context string
+ https://bugs.webkit.org/show_bug.cgi?id=224779
+ <rdar://problem/76738879>
+
+ Reviewed by Brent Fulgham.
+
+ We should clear data between tests to avoid flakiness or failures.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::resetStateToConsistentValues):
+ (WTR::TestController::clearAppBoundNavigationData):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::TestController::clearAppBoundNavigationData):
+
2021-04-20 Basuke Suzuki <[email protected]>
[PlayStation] Remove warnings for unused parameter.
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (276325 => 276326)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2021-04-20 23:11:40 UTC (rev 276326)
@@ -1075,6 +1075,7 @@
updateLiveDocumentsAfterTest();
#if PLATFORM(COCOA)
clearApplicationBundleIdentifierTestingOverride();
+ clearAppBoundNavigationData();
#endif
clearBundleIdentifierInNetworkProcess();
}
@@ -2674,6 +2675,10 @@
{
}
+void TestController::clearAppBoundNavigationData()
+{
+}
+
struct GetAllStorageAccessEntriesCallbackContext {
GetAllStorageAccessEntriesCallbackContext(TestController& controller, CompletionHandler<void(Vector<String>&&)>&& handler)
: testController(controller)
Modified: trunk/Tools/WebKitTestRunner/TestController.h (276325 => 276326)
--- trunk/Tools/WebKitTestRunner/TestController.h 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2021-04-20 23:11:40 UTC (rev 276326)
@@ -263,6 +263,7 @@
void clearAppBoundSession();
void reinitializeAppBoundDomains();
void appBoundRequestContextDataForDomain(WKStringRef);
+ void clearAppBoundNavigationData();
void updateBundleIdentifierInNetworkProcess(const std::string& bundleIdentifier);
void clearBundleIdentifierInNetworkProcess();
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (276325 => 276326)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2021-04-20 22:45:13 UTC (rev 276325)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2021-04-20 23:11:40 UTC (rev 276326)
@@ -399,6 +399,19 @@
}];
}
+void TestController::clearAppBoundNavigationData()
+{
+ auto* parentView = mainWebView();
+ if (!parentView)
+ return;
+
+ __block bool doneClearing = false;
+ [m_mainWebView->platformView() _clearAppBoundNavigationData:^{
+ doneClearing = true;
+ }];
+ platformRunUntil(doneClearing, noTimeout);
+}
+
void TestController::injectUserScript(WKStringRef script)
{
auto userScript = adoptNS([[WKUserScript alloc] initWithSource: toWTFString(script) injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO]);