Title: [279247] trunk
- Revision
- 279247
- Author
- katherine_che...@apple.com
- Date
- 2021-06-24 15:12:52 -0700 (Thu, 24 Jun 2021)
Log Message
WKWebView loadSimulatedRequest does not set attribution value for url requests within html content
https://bugs.webkit.org/show_bug.cgi?id=227266
<rdar://problem/79316911>
Reviewed by Brent Fulgham.
Source/WebKit:
We currently pass the attribution value from the main NSURLRequest
passed into WebPageProxy::loadRequest by setting a value on the WebPage
document loader that gets passed to all requests initiated by that main
navigation. This patch adds the same functionality for
WebPageProxy::loadSimulatedRequest, which could initiate URL requests
from HTML content.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadSimulatedRequest):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadSimulatedRequestAndResponse):
Tools:
API test coverage.
* TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (279246 => 279247)
--- trunk/Source/WebKit/ChangeLog 2021-06-24 22:10:40 UTC (rev 279246)
+++ trunk/Source/WebKit/ChangeLog 2021-06-24 22:12:52 UTC (rev 279247)
@@ -1,3 +1,23 @@
+2021-06-24 Kate Cheney <katherine_che...@apple.com>
+
+ WKWebView loadSimulatedRequest does not set attribution value for url requests within html content
+ https://bugs.webkit.org/show_bug.cgi?id=227266
+ <rdar://problem/79316911>
+
+ Reviewed by Brent Fulgham.
+
+ We currently pass the attribution value from the main NSURLRequest
+ passed into WebPageProxy::loadRequest by setting a value on the WebPage
+ document loader that gets passed to all requests initiated by that main
+ navigation. This patch adds the same functionality for
+ WebPageProxy::loadSimulatedRequest, which could initiate URL requests
+ from HTML content.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::loadSimulatedRequest):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::loadSimulatedRequestAndResponse):
+
2021-06-24 Wenson Hsieh <wenson_hs...@apple.com>
[watchOS] Automatically apply system minimum layout margins as scroll view content insets
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (279246 => 279247)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-06-24 22:10:40 UTC (rev 279246)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-06-24 22:12:52 UTC (rev 279247)
@@ -1491,6 +1491,10 @@
{
WEBPAGEPROXY_RELEASE_LOG(Loading, "loadSimulatedRequest:");
+#if PLATFORM(COCOA)
+ setLastNavigationWasAppBound(simulatedRequest);
+#endif
+
#if ENABLE(APP_BOUND_DOMAINS)
if (simulatedResponse.mimeType() == "text/html"_s && !isFullWebBrowser())
m_limitsNavigationsToAppBoundDomains = true;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (279246 => 279247)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-06-24 22:10:40 UTC (rev 279246)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-06-24 22:12:52 UTC (rev 279247)
@@ -1771,6 +1771,8 @@
ASSERT(simulatedResponse.textEncodingName() == loadParameters.encodingName);
ASSERT(static_cast<size_t>(simulatedResponse.expectedContentLength()) == loadParameters.data.size());
+ setLastNavigationWasAppBound(loadParameters.request.isAppBound());
+
platformDidReceiveLoadParameters(loadParameters);
auto sharedBuffer = SharedBuffer::create(loadParameters.data.data(), loadParameters.data.size());
Modified: trunk/Tools/ChangeLog (279246 => 279247)
--- trunk/Tools/ChangeLog 2021-06-24 22:10:40 UTC (rev 279246)
+++ trunk/Tools/ChangeLog 2021-06-24 22:12:52 UTC (rev 279247)
@@ -1,3 +1,15 @@
+2021-06-24 Kate Cheney <katherine_che...@apple.com>
+
+ WKWebView loadSimulatedRequest does not set attribution value for url requests within html content
+ https://bugs.webkit.org/show_bug.cgi?id=227266
+ <rdar://problem/79316911>
+
+ Reviewed by Brent Fulgham.
+
+ API test coverage.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
+
2021-06-24 Sihui Liu <sihui_...@apple.com>
IndexedDB prints error log about blob files when there is no error
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm (279246 => 279247)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm 2021-06-24 22:10:40 UTC (rev 279246)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm 2021-06-24 22:12:52 UTC (rev 279247)
@@ -2039,4 +2039,37 @@
#endif
+static void loadSimulatedRequestTest(bool isAppInitiated)
+{
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+
+ auto delegate = adoptNS([[TestNavigationDelegate alloc] init]);
+ [webView setNavigationDelegate:delegate.get()];
+
+ NSMutableURLRequest *loadRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://webkit.org"]];
+ loadRequest.attribution = isAppInitiated ? NSURLRequestAttributionDeveloper : NSURLRequestAttributionUser;
+
+ NSString *HTML = @"<html><head></head><body><img src=''></img></body></html>";
+ [webView loadSimulatedRequest:loadRequest responseHTMLString:HTML];
+ [delegate waitForDidFinishNavigation];
+
+ static bool isDone = false;
+ [webView _appBoundNavigationData:^(struct WKAppBoundNavigationTestingData data) {
+ EXPECT_EQ(data.hasLoadedAppBoundRequestTesting, isAppInitiated);
+ EXPECT_EQ(data.hasLoadedNonAppBoundRequestTesting, !isAppInitiated);
+ isDone = true;
+ }];
+ TestWebKitAPI::Util::run(&isDone);
+}
+
+TEST(InAppBrowserPrivacy, LoadSimulatedRequestIsAppInitiated)
+{
+ loadSimulatedRequestTest(true);
+}
+
+TEST(InAppBrowserPrivacy, LoadSimulatedRequestIsNonAppInitiated)
+{
+ loadSimulatedRequestTest(false);
+}
+
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes