Diff
Modified: trunk/Source/WebKit/ChangeLog (285207 => 285208)
--- trunk/Source/WebKit/ChangeLog 2021-11-03 16:14:05 UTC (rev 285207)
+++ trunk/Source/WebKit/ChangeLog 2021-11-03 16:17:21 UTC (rev 285208)
@@ -1,3 +1,20 @@
+2021-11-03 Kate Cheney <[email protected]>
+
+ [iOS] Need API for marking file requests as non-app-initiated
+ https://bugs.webkit.org/show_bug.cgi?id=232506
+ <rdar://problem/84824703>
+
+ Reviewed by Brent Fulgham.
+
+ Pass app initiated value through to the WebPage so file loads
+ can be attributed correctly.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView loadFileRequest:allowingReadAccessToURL:]):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::loadFile):
+ * UIProcess/WebPageProxy.h:
+
2021-11-02 Don Olmstead <[email protected]>
Non-unified build fixes early November 2021 edition
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (285207 => 285208)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-11-03 16:14:05 UTC (rev 285207)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2021-11-03 16:17:21 UTC (rev 285208)
@@ -1763,7 +1763,12 @@
if (![readAccessURL isFileURL])
[NSException raise:NSInvalidArgumentException format:@"%@ is not a file URL", readAccessURL];
- return wrapper(_page->loadFile(URL.absoluteString, readAccessURL.absoluteString));
+ bool isAppInitiated = true;
+#if ENABLE(APP_PRIVACY_REPORT)
+ isAppInitiated = request.attribution == NSURLRequestAttributionDeveloper;
+#endif
+
+ return wrapper(_page->loadFile(URL.absoluteString, readAccessURL.absoluteString, isAppInitiated));
}
- (CocoaColor *)themeColor
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (285207 => 285208)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-11-03 16:14:05 UTC (rev 285207)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-11-03 16:17:21 UTC (rev 285208)
@@ -1435,7 +1435,7 @@
process->startResponsivenessTimer();
}
-RefPtr<API::Navigation> WebPageProxy::loadFile(const String& fileURLString, const String& resourceDirectoryURLString, API::Object* userData)
+RefPtr<API::Navigation> WebPageProxy::loadFile(const String& fileURLString, const String& resourceDirectoryURLString, bool isAppInitiated, API::Object* userData)
{
WEBPAGEPROXY_RELEASE_LOG(Loading, "loadFile:");
@@ -1480,9 +1480,13 @@
m_pageLoadState.setPendingAPIRequest(transaction, { navigation->navigationID(), fileURLString }, resourceDirectoryURL);
+ auto request = ResourceRequest(fileURL);
+ request.setIsAppInitiated(isAppInitiated);
+ m_lastNavigationWasAppInitiated = isAppInitiated;
+
LoadParameters loadParameters;
loadParameters.navigationID = navigation->navigationID();
- loadParameters.request = fileURL;
+ loadParameters.request = WTFMove(request);
loadParameters.shouldOpenExternalURLsPolicy = ShouldOpenExternalURLsPolicy::ShouldNotAllow;
loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
const bool checkAssumedReadAccessToResourceURL = false;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (285207 => 285208)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-11-03 16:14:05 UTC (rev 285207)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-11-03 16:17:21 UTC (rev 285208)
@@ -647,7 +647,7 @@
void addPlatformLoadParameters(WebProcessProxy&, LoadParameters&);
RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemesButNotAppLinks, API::Object* userData = nullptr);
- RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
+ RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, bool isAppInitiated = true, API::Object* userData = nullptr);
RefPtr<API::Navigation> loadData(const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);
RefPtr<API::Navigation> loadSimulatedRequest(WebCore::ResourceRequest&&, WebCore::ResourceResponse&&, const IPC::DataReference&);
void loadAlternateHTML(const IPC::DataReference&, const String& encoding, const URL& baseURL, const URL& unreachableURL, API::Object* userData = nullptr);
Modified: trunk/Tools/ChangeLog (285207 => 285208)
--- trunk/Tools/ChangeLog 2021-11-03 16:14:05 UTC (rev 285207)
+++ trunk/Tools/ChangeLog 2021-11-03 16:17:21 UTC (rev 285208)
@@ -1,3 +1,15 @@
+2021-11-03 Kate Cheney <[email protected]>
+
+ [iOS] Need API for marking file requests as non-app-initiated
+ https://bugs.webkit.org/show_bug.cgi?id=232506
+ <rdar://problem/84824703>
+
+ Reviewed by Brent Fulgham.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm:
+ * TestWebKitAPI/Tests/WebKitCocoa/file-with-iframe.html: Added.
+
2021-11-03 Brady Eidson <[email protected]>
Fix iOS API tests after r285199
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (285207 => 285208)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-11-03 16:14:05 UTC (rev 285207)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-11-03 16:17:21 UTC (rev 285208)
@@ -322,6 +322,7 @@
498D030A26376B34009CBFAD /* resourceLoadStatisticsMissingUniqueIndex.db in Copy Resources */ = {isa = PBXBuildFile; fileRef = 498D030926376B2C009CBFAD /* resourceLoadStatisticsMissingUniqueIndex.db */; };
4995A6F025E8772000E5F0A9 /* csp-document-uri-report.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4995A6EF25E876A300E5F0A9 /* csp-document-uri-report.html */; };
49AEEF6D2407359D00C87E4C /* InAppBrowserPrivacy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49AEEF6B2407358600C87E4C /* InAppBrowserPrivacy.mm */; };
+ 49D2E5C22731E3BC00BCCAED /* file-with-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 49D2E5C12731E37400BCCAED /* file-with-iframe.html */; };
49EF6AD52677C0BE007967DC /* AppPrivacyReport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49EF6AD42677C0BE007967DC /* AppPrivacyReport.mm */; };
4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
510477721D298DDD009747EB /* IDBDeleteRecovery.sqlite3 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5104776F1D298D85009747EB /* IDBDeleteRecovery.sqlite3 */; };
@@ -1389,6 +1390,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ 49D2E5C22731E3BC00BCCAED /* file-with-iframe.html in Copy Resources */,
55A817FF2181021A0004A39A /* 100x100-red.tga in Copy Resources */,
1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
55A81800218102210004A39A /* 400x400-green.png in Copy Resources */,
@@ -2178,6 +2180,7 @@
4995A6EF25E876A300E5F0A9 /* csp-document-uri-report.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "csp-document-uri-report.html"; sourceTree = "<group>"; };
49AEEF682407276F00C87E4C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
49AEEF6B2407358600C87E4C /* InAppBrowserPrivacy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InAppBrowserPrivacy.mm; sourceTree = "<group>"; };
+ 49D2E5C12731E37400BCCAED /* file-with-iframe.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "file-with-iframe.html"; sourceTree = "<group>"; };
49D7FBA7241FDDDA00AB67FA /* in-app-browser-privacy-local-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "in-app-browser-privacy-local-file.html"; sourceTree = "<group>"; };
49EF6AD42677C0BE007967DC /* AppPrivacyReport.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppPrivacyReport.mm; sourceTree = "<group>"; };
4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMedia.cpp; sourceTree = "<group>"; };
@@ -4289,6 +4292,7 @@
51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */,
5120C83B1E674E350025B250 /* WebsiteDataStoreCustomPaths.html */,
2E131C171D83A97E001BA36C /* wide-autoplaying-video-with-audio.html */,
+ 49D2E5C12731E37400BCCAED /* file-with-iframe.html */,
);
name = Resources;
sourceTree = "<group>";
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm (285207 => 285208)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm 2021-11-03 16:14:05 UTC (rev 285207)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm 2021-11-03 16:17:21 UTC (rev 285208)
@@ -825,4 +825,35 @@
restoreFromInteractionStateTest(IsAppInitiated::No);
}
+static void loadFileTest(IsAppInitiated isAppInitiated)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+
+ NSURL *file = [[NSBundle mainBundle] URLForResource:@"file-with-iframe" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:file];
+ request.attribution = isAppInitiated == IsAppInitiated::Yes ? NSURLRequestAttributionDeveloper : NSURLRequestAttributionUser;
+
+ [webView loadFileRequest:request allowingReadAccessToURL:file.URLByDeletingLastPathComponent];
+ [webView _test_waitForDidFinishNavigation];
+
+ static bool isDone = false;
+ bool expectingAppInitiatedRequests = isAppInitiated == IsAppInitiated::Yes ? true : false;
+ [webView _appPrivacyReportTestingData:^(struct WKAppPrivacyReportTestingData data) {
+ EXPECT_EQ(data.hasLoadedAppInitiatedRequestTesting, expectingAppInitiatedRequests);
+ EXPECT_EQ(data.hasLoadedNonAppInitiatedRequestTesting, !expectingAppInitiatedRequests);
+ isDone = true;
+ }];
+ TestWebKitAPI::Util::run(&isDone);
+}
+
+TEST(AppPrivacyReport, LoadFileRequestIsAppInitiated)
+{
+ loadFileTest(IsAppInitiated::Yes);
+}
+
+TEST(AppPrivacyReport, LoadFileRequestIsNonAppInitiated)
+{
+ loadFileTest(IsAppInitiated::No);
+}
+
#endif // APP_PRIVACY_REPORT
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/file-with-iframe.html (0 => 285208)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/file-with-iframe.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/file-with-iframe.html 2021-11-03 16:17:21 UTC (rev 285208)
@@ -0,0 +1,5 @@
+<html>
+<body>
+ <iframe src=""
+</body>
+</html>