Changeset 251991 in webkit
- Timestamp:
- Nov 4, 2019 8:32:36 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251989 r251991 1 2019-11-04 Andy Estes <aestes@apple.com> 2 3 REGRESSION (r251623): When downloading a QuickLook file, the web view navigates to a "The URL can't be shown" error page instead of staying on the current page 4 https://bugs.webkit.org/show_bug.cgi?id=203790 5 <rdar://problem/56795440> 6 7 Reviewed by Alex Christensen. 8 9 When a PreviewConverter fails updating due to a call to PreviewConverter::failedUpdating(), 10 we should not dispatch previewConverterDidFailUpdating. LegacyPreviewLoader handles that 11 callback by calling ResourceLoader::didFail() with a WebKitErrorCannotShowURL error code, 12 but when downloading or cancelling we must fail with a 13 WebKitErrorFrameLoadInterruptedByPolicyChange error code instead. 14 15 This patch teaches PreviewConverter to distinguish between internal updating errors and 16 external calls to failedUpdating(), only dispatching previewConverterDidFailUpdating in the 17 former case. 18 19 Updated QuickLook API tests. 20 21 * platform/PreviewConverter.cpp: 22 (WebCore::PreviewConverter::updateMainResource): 23 (WebCore::PreviewConverter::failedUpdating): 24 (WebCore::PreviewConverter::didFailUpdating): 25 * platform/PreviewConverter.h: 26 1 27 2019-11-04 youenn fablet <youenn@apple.com> 2 28 -
trunk/Source/WebCore/platform/PreviewConverter.cpp
r251623 r251991 79 79 auto provider = m_provider.get(); 80 80 if (!provider) { 81 failedUpdating();81 didFailUpdating(); 82 82 return; 83 83 } … … 87 87 appendFromBuffer(*buffer); 88 88 else 89 failedUpdating();89 didFailUpdating(); 90 90 }); 91 91 } … … 125 125 m_state = State::FailedUpdating; 126 126 platformFailedAppending(); 127 128 iterateClients([&](auto& client) {129 client.previewConverterDidFailUpdating(*this);130 });131 127 } 132 128 … … 193 189 iterateClients([&](auto& client) { 194 190 client.previewConverterDidFailConverting(*this); 191 }); 192 } 193 194 void PreviewConverter::didFailUpdating() 195 { 196 failedUpdating(); 197 198 iterateClients([&](auto& client) { 199 client.previewConverterDidFailUpdating(*this); 195 200 }); 196 201 } -
trunk/Source/WebCore/platform/PreviewConverter.h
r251623 r251991 98 98 void didAddClient(PreviewConverterClient&); 99 99 void didFailConvertingWithError(const ResourceError&); 100 void didFailUpdating(); 100 101 void replayToClient(PreviewConverterClient&); 101 102 -
trunk/Tools/ChangeLog
r251990 r251991 1 2019-11-04 Andy Estes <aestes@apple.com> 2 3 REGRESSION (r251623): When downloading a QuickLook file, the web view navigates to a "The URL can't be shown" error page instead of staying on the current page 4 https://bugs.webkit.org/show_bug.cgi?id=203790 5 <rdar://problem/56795440> 6 7 Reviewed by Alex Christensen. 8 9 Tested that "download" and "cancel" policy decisions for QuickLook files result in a 10 provisional navigation failure with error code WebKitErrorFrameLoadInterruptedByPolicyChange. 11 12 * TestWebKitAPI/Tests/WebKitCocoa/QuickLook.mm: 13 (-[QuickLookDelegate navigationError]): 14 (-[QuickLookDelegate _webView:didFailNavigation:withError:userInfo:]): 15 (-[QuickLookDelegate webView:didFailProvisionalNavigation:withError:]): 16 (TEST): 17 1 18 2019-11-04 Peng Liu <peng.liu6@apple.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/QuickLook.mm
r251765 r251991 64 64 @property (nonatomic, readonly) BOOL didFinishQuickLookLoad; 65 65 @property (nonatomic, readonly) BOOL didStartQuickLookLoad; 66 @property (nonatomic, readonly, nullable) NSError *navigationError; 66 67 67 68 @end … … 72 73 NSUInteger _expectedFileSize; 73 74 RetainPtr<NSData> _expectedFileData; 75 RetainPtr<NSError> _navigationError; 74 76 RetainPtr<NSString> _expectedFileName; 75 77 RetainPtr<NSString> _expectedFileType; … … 114 116 } 115 117 118 - (nullable NSError *)navigationError 119 { 120 return _navigationError.get(); 121 } 122 116 123 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation 117 124 { … … 160 167 EXPECT_FALSE(_didFailNavigation); 161 168 EXPECT_FALSE(_didFinishNavigation); 169 EXPECT_NULL(_navigationError); 162 170 _didFailNavigation = YES; 171 _navigationError = error; 163 172 isDone = true; 164 173 } … … 168 177 EXPECT_FALSE(_didFailNavigation); 169 178 EXPECT_FALSE(_didFinishNavigation); 179 EXPECT_NULL(_navigationError); 170 180 _didFailNavigation = YES; 181 _navigationError = error; 171 182 isDone = true; 172 183 } … … 328 339 auto delegate = adoptNS([[QuickLookDelegate alloc] initWithExpectedFileURL:pagesDocumentURL responsePolicy:WKNavigationResponsePolicyCancel]); 329 340 runTestDecideBeforeLoading(delegate.get(), [NSURLRequest requestWithURL:pagesDocumentURL]); 341 EXPECT_EQ(WebKitErrorFrameLoadInterruptedByPolicyChange, [delegate navigationError].code); 330 342 EXPECT_FALSE([delegate didFinishNavigation]); 331 343 EXPECT_FALSE([delegate didFinishQuickLookLoad]); … … 338 350 auto delegate = adoptNS([[QuickLookDelegate alloc] initWithExpectedFileURL:pagesDocumentURL previewMIMEType:pagesDocumentPreviewMIMEType responsePolicy:WKNavigationResponsePolicyCancel]); 339 351 runTestDecideAfterLoading(delegate.get(), [NSURLRequest requestWithURL:pagesDocumentURL]); 352 EXPECT_EQ(WebKitErrorFrameLoadInterruptedByPolicyChange, [delegate navigationError].code); 340 353 EXPECT_FALSE([delegate didFinishNavigation]); 341 354 EXPECT_TRUE([delegate didFailNavigation]); … … 348 361 auto delegate = adoptNS([[QuickLookDelegate alloc] initWithExpectedFileURL:pagesDocumentURL responsePolicy:_WKNavigationResponsePolicyBecomeDownload]); 349 362 runTestDecideBeforeLoading(delegate.get(), [NSURLRequest requestWithURL:pagesDocumentURL]); 363 EXPECT_EQ(WebKitErrorFrameLoadInterruptedByPolicyChange, [delegate navigationError].code); 350 364 EXPECT_FALSE([delegate didFinishNavigation]); 351 365 EXPECT_FALSE([delegate didFinishQuickLookLoad]); … … 361 375 auto delegate = adoptNS([[QuickLookDelegate alloc] initWithExpectedFileURL:pagesDocumentURL previewMIMEType:pagesDocumentPreviewMIMEType responsePolicy:_WKNavigationResponsePolicyBecomeDownload]); 362 376 runTestDecideAfterLoading(delegate.get(), [NSURLRequest requestWithURL:pagesDocumentURL]); 377 EXPECT_EQ(WebKitErrorFrameLoadInterruptedByPolicyChange, [delegate navigationError].code); 363 378 EXPECT_FALSE([delegate didFinishNavigation]); 364 379 EXPECT_TRUE([delegate didFailNavigation]);
Note: See TracChangeset
for help on using the changeset viewer.