Changeset 285208 in webkit
- Timestamp:
- Nov 3, 2021, 9:17:21 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/file-with-iframe.html (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r285195 r285208 1 2021-11-03 Kate Cheney <katherine_cheney@apple.com> 2 3 [iOS] Need API for marking file requests as non-app-initiated 4 https://bugs.webkit.org/show_bug.cgi?id=232506 5 <rdar://problem/84824703> 6 7 Reviewed by Brent Fulgham. 8 9 Pass app initiated value through to the WebPage so file loads 10 can be attributed correctly. 11 12 * UIProcess/API/Cocoa/WKWebView.mm: 13 (-[WKWebView loadFileRequest:allowingReadAccessToURL:]): 14 * UIProcess/WebPageProxy.cpp: 15 (WebKit::WebPageProxy::loadFile): 16 * UIProcess/WebPageProxy.h: 17 1 18 2021-11-02 Don Olmstead <don.olmstead@sony.com> 2 19 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r285163 r285208 1764 1764 [NSException raise:NSInvalidArgumentException format:@"%@ is not a file URL", readAccessURL]; 1765 1765 1766 return wrapper(_page->loadFile(URL.absoluteString, readAccessURL.absoluteString)); 1766 bool isAppInitiated = true; 1767 #if ENABLE(APP_PRIVACY_REPORT) 1768 isAppInitiated = request.attribution == NSURLRequestAttributionDeveloper; 1769 #endif 1770 1771 return wrapper(_page->loadFile(URL.absoluteString, readAccessURL.absoluteString, isAppInitiated)); 1767 1772 } 1768 1773 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r285165 r285208 1436 1436 } 1437 1437 1438 RefPtr<API::Navigation> WebPageProxy::loadFile(const String& fileURLString, const String& resourceDirectoryURLString, API::Object* userData)1438 RefPtr<API::Navigation> WebPageProxy::loadFile(const String& fileURLString, const String& resourceDirectoryURLString, bool isAppInitiated, API::Object* userData) 1439 1439 { 1440 1440 WEBPAGEPROXY_RELEASE_LOG(Loading, "loadFile:"); … … 1481 1481 m_pageLoadState.setPendingAPIRequest(transaction, { navigation->navigationID(), fileURLString }, resourceDirectoryURL); 1482 1482 1483 auto request = ResourceRequest(fileURL); 1484 request.setIsAppInitiated(isAppInitiated); 1485 m_lastNavigationWasAppInitiated = isAppInitiated; 1486 1483 1487 LoadParameters loadParameters; 1484 1488 loadParameters.navigationID = navigation->navigationID(); 1485 loadParameters.request = fileURL;1489 loadParameters.request = WTFMove(request); 1486 1490 loadParameters.shouldOpenExternalURLsPolicy = ShouldOpenExternalURLsPolicy::ShouldNotAllow; 1487 1491 loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get()); -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r285165 r285208 648 648 void addPlatformLoadParameters(WebProcessProxy&, LoadParameters&); 649 649 RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemesButNotAppLinks, API::Object* userData = nullptr); 650 RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);650 RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, bool isAppInitiated = true, API::Object* userData = nullptr); 651 651 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); 652 652 RefPtr<API::Navigation> loadSimulatedRequest(WebCore::ResourceRequest&&, WebCore::ResourceResponse&&, const IPC::DataReference&); -
trunk/Tools/ChangeLog
r285207 r285208 1 2021-11-03 Kate Cheney <katherine_cheney@apple.com> 2 3 [iOS] Need API for marking file requests as non-app-initiated 4 https://bugs.webkit.org/show_bug.cgi?id=232506 5 <rdar://problem/84824703> 6 7 Reviewed by Brent Fulgham. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm: 11 * TestWebKitAPI/Tests/WebKitCocoa/file-with-iframe.html: Added. 12 1 13 2021-11-03 Brady Eidson <beidson@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r284890 r285208 323 323 4995A6F025E8772000E5F0A9 /* csp-document-uri-report.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4995A6EF25E876A300E5F0A9 /* csp-document-uri-report.html */; }; 324 324 49AEEF6D2407359D00C87E4C /* InAppBrowserPrivacy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49AEEF6B2407358600C87E4C /* InAppBrowserPrivacy.mm */; }; 325 49D2E5C22731E3BC00BCCAED /* file-with-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 49D2E5C12731E37400BCCAED /* file-with-iframe.html */; }; 325 326 49EF6AD52677C0BE007967DC /* AppPrivacyReport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49EF6AD42677C0BE007967DC /* AppPrivacyReport.mm */; }; 326 327 4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; }; … … 1390 1391 dstSubfolderSpec = 7; 1391 1392 files = ( 1393 49D2E5C22731E3BC00BCCAED /* file-with-iframe.html in Copy Resources */, 1392 1394 55A817FF2181021A0004A39A /* 100x100-red.tga in Copy Resources */, 1393 1395 1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */, … … 2179 2181 49AEEF682407276F00C87E4C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 2180 2182 49AEEF6B2407358600C87E4C /* InAppBrowserPrivacy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InAppBrowserPrivacy.mm; sourceTree = "<group>"; }; 2183 49D2E5C12731E37400BCCAED /* file-with-iframe.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "file-with-iframe.html"; sourceTree = "<group>"; }; 2181 2184 49D7FBA7241FDDDA00AB67FA /* in-app-browser-privacy-local-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "in-app-browser-privacy-local-file.html"; sourceTree = "<group>"; }; 2182 2185 49EF6AD42677C0BE007967DC /* AppPrivacyReport.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppPrivacyReport.mm; sourceTree = "<group>"; }; … … 4290 4293 5120C83B1E674E350025B250 /* WebsiteDataStoreCustomPaths.html */, 4291 4294 2E131C171D83A97E001BA36C /* wide-autoplaying-video-with-audio.html */, 4295 49D2E5C12731E37400BCCAED /* file-with-iframe.html */, 4292 4296 ); 4293 4297 name = Resources; -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm
r285163 r285208 826 826 } 827 827 828 static void loadFileTest(IsAppInitiated isAppInitiated) 829 { 830 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 831 832 NSURL *file = [[NSBundle mainBundle] URLForResource:@"file-with-iframe" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 833 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:file]; 834 request.attribution = isAppInitiated == IsAppInitiated::Yes ? NSURLRequestAttributionDeveloper : NSURLRequestAttributionUser; 835 836 [webView loadFileRequest:request allowingReadAccessToURL:file.URLByDeletingLastPathComponent]; 837 [webView _test_waitForDidFinishNavigation]; 838 839 static bool isDone = false; 840 bool expectingAppInitiatedRequests = isAppInitiated == IsAppInitiated::Yes ? true : false; 841 [webView _appPrivacyReportTestingData:^(struct WKAppPrivacyReportTestingData data) { 842 EXPECT_EQ(data.hasLoadedAppInitiatedRequestTesting, expectingAppInitiatedRequests); 843 EXPECT_EQ(data.hasLoadedNonAppInitiatedRequestTesting, !expectingAppInitiatedRequests); 844 isDone = true; 845 }]; 846 TestWebKitAPI::Util::run(&isDone); 847 } 848 849 TEST(AppPrivacyReport, LoadFileRequestIsAppInitiated) 850 { 851 loadFileTest(IsAppInitiated::Yes); 852 } 853 854 TEST(AppPrivacyReport, LoadFileRequestIsNonAppInitiated) 855 { 856 loadFileTest(IsAppInitiated::No); 857 } 858 828 859 #endif // APP_PRIVACY_REPORT
Note:
See TracChangeset
for help on using the changeset viewer.