Changeset 262707 in webkit
- Timestamp:
- Jun 8, 2020 4:33:16 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r262704 r262707 1 2020-06-08 Youenn Fablet <youenn@apple.com> 2 3 File URLs with hostnames are misleading 4 https://bugs.webkit.org/show_bug.cgi?id=212739 5 <rdar://problem/63754917> 6 7 Reviewed by Alex Christensen. 8 9 Showing a file URL like file://example.org/test is misleading to users. 10 To prevent this, we just do a redirection to the same file URL with an empty host. 11 Remove the port at the same time. 12 Covered by added API test. 13 14 * loader/DocumentLoader.cpp: 15 (WebCore::DocumentLoader::willSendRequest): 16 1 17 2020-06-08 Rob Buis <rbuis@igalia.com> 2 18 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r262704 r262707 655 655 } 656 656 657 if (!newRequest.url().host().isEmpty() && SecurityOrigin::shouldIgnoreHost(newRequest.url())) { 658 auto url = newRequest.url(); 659 url.setHostAndPort({ }); 660 newRequest.setURL(WTFMove(url)); 661 } 662 657 663 #if ENABLE(CONTENT_FILTERING) 658 664 if (m_contentFilter && !m_contentFilter->continueAfterWillSendRequest(newRequest, redirectResponse)) -
trunk/Tools/ChangeLog
r262696 r262707 1 2020-06-08 Youenn Fablet <youenn@apple.com> 2 3 File URLs with hostnames are misleading 4 https://bugs.webkit.org/show_bug.cgi?id=212739 5 <rdar://problem/63754917> 6 7 Reviewed by Alex Christensen. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKit/open-window-with-file-url-with-host.html: Added. 11 * TestWebKitAPI/Tests/WebKitCocoa/OpenAndCloseWindow.mm: 12 (TEST): 13 1 14 2020-06-07 Caio Lima <ticaiolima@gmail.com> 2 15 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r262507 r262707 231 231 414AD6862285D1C000777F2D /* StorageQuota.mm in Sources */ = {isa = PBXBuildFile; fileRef = 414AD6852285D1B000777F2D /* StorageQuota.mm */; }; 232 232 41661C662355E85E00D33C27 /* getUserMedia-webaudio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 41661C652355D98B00D33C27 /* getUserMedia-webaudio.html */; }; 233 41848F4424891879000E2588 /* open-window-with-file-url-with-host.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 41848F4324891815000E2588 /* open-window-with-file-url-with-host.html */; }; 233 234 41882F0321010C0D002FF288 /* ProcessPreWarming.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41882F0221010A70002FF288 /* ProcessPreWarming.mm */; }; 234 235 44077BB123144B5000179E2D /* DataDetectorsTestIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 44077BB0231449D200179E2D /* DataDetectorsTestIOS.mm */; }; … … 1492 1493 7CCB99231D3B4A46003922F6 /* open-multiple-external-url.html in Copy Resources */, 1493 1494 468BC45522653A1000A36C96 /* open-window-then-write-to-it.html in Copy Resources */, 1495 41848F4424891879000E2588 /* open-window-with-file-url-with-host.html in Copy Resources */, 1494 1496 931C281E22BC579A001D98C4 /* opendatabase-always-exists.html in Copy Resources */, 1495 1497 290A9BB91735F63800D71BBC /* OpenNewWindow.html in Copy Resources */, … … 1879 1881 414AD6852285D1B000777F2D /* StorageQuota.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = StorageQuota.mm; sourceTree = "<group>"; }; 1880 1882 41661C652355D98B00D33C27 /* getUserMedia-webaudio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "getUserMedia-webaudio.html"; sourceTree = "<group>"; }; 1883 41848F4324891815000E2588 /* open-window-with-file-url-with-host.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "open-window-with-file-url-with-host.html"; sourceTree = "<group>"; }; 1881 1884 41882F0221010A70002FF288 /* ProcessPreWarming.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProcessPreWarming.mm; sourceTree = "<group>"; }; 1882 1885 41973B5C1AF22875006C7B36 /* SharedBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedBuffer.cpp; sourceTree = "<group>"; }; … … 4149 4152 CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */, 4150 4153 468BC454226539C800A36C96 /* open-window-then-write-to-it.html */, 4154 41848F4324891815000E2588 /* open-window-with-file-url-with-host.html */, 4151 4155 83148B08202AC76800BADE99 /* override-builtins-test.html */, 4152 4156 0EBBCC651FFF9DCE00FA42AB /* pop-up-check.html */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/OpenAndCloseWindow.mm
r260366 r262707 320 320 EXPECT_TRUE([[[openedWebView _mainFrameURL] absoluteString] isEqualToString:[[webView URL] absoluteString]]); 321 321 } 322 323 TEST(WebKit, OpenFileURLWithHost) 324 { 325 resetToConsistentState(); 326 327 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 328 329 auto uiDelegate = adoptNS([[OpenWindowThenDocumentOpenUIDelegate alloc] init]); 330 [webView setUIDelegate:uiDelegate.get()]; 331 [webView configuration].preferences.javaScriptCanOpenWindowsAutomatically = YES; 332 333 NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"open-window-with-file-url-with-host" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; 334 [webView loadRequest:request]; 335 336 while (![[[webView URL] absoluteString] hasSuffix:@"#test"]) 337 TestWebKitAPI::Util::spinRunLoop(); 338 339 while (![[[webView URL] absoluteString] hasPrefix:@"file:///"]) 340 TestWebKitAPI::Util::spinRunLoop(); 341 }
Note: See TracChangeset
for help on using the changeset viewer.