Changeset 267227 in webkit
- Timestamp:
- Sep 18, 2020 1:15:32 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r267220 r267227 1 2020-09-18 Youenn Fablet <youenn@apple.com> 2 3 XHR.timeout is affected by long tasks 4 https://bugs.webkit.org/show_bug.cgi?id=216266 5 <rdar://problem/68908150> 6 7 Reviewed by Alex Christensen. 8 9 platform/mac-wk1/TestExpectations: Skip WK1 test. 10 1 11 2020-09-16 Darin Adler <darin@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/ChangeLog
r267218 r267227 1 2020-09-18 Youenn Fablet <youenn@apple.com> 2 3 XHR.timeout is affected by long tasks 4 https://bugs.webkit.org/show_bug.cgi?id=216266 5 <rdar://problem/68908150> 6 7 Reviewed by Alex Christensen. 8 9 * web-platform-tests/xhr/xhr-timeout-longtask.any-expected.txt: Added. 10 * web-platform-tests/xhr/xhr-timeout-longtask.any.html: Added. 11 * web-platform-tests/xhr/xhr-timeout-longtask.any.js: Added. 12 * web-platform-tests/xhr/xhr-timeout-longtask.any.worker-expected.txt: Added. 13 * web-platform-tests/xhr/xhr-timeout-longtask.any.worker.html: Added. 14 1 15 2020-09-17 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r267168 r267227 270 270 # WK1 does not support sync XHR redirections as does WK2 271 271 http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-sync-xhr-in-main-frame.html [ Skip ] 272 # WK1 networking is blocked by JS 273 imported/w3c/web-platform-tests/xhr/xhr-timeout-longtask.any.html 272 274 273 275 webkit.org/b/187230 editing/mac/pasteboard/can-copy-url-without-title.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r267222 r267227 1 2020-09-18 Youenn Fablet <youenn@apple.com> 2 3 XHR.timeout is affected by long tasks 4 https://bugs.webkit.org/show_bug.cgi?id=216266 5 <rdar://problem/68908150> 6 7 Reviewed by Alex Christensen. 8 9 Long tasks may block the main thread, which may block IPC processing of load messages. 10 In that case, even though the load is finished, WebProcess did not know that yet and will cancel the load. 11 To prevent that, in case of XHR timeout, do an explicit check to compute the done flag. 12 https://fetch.spec.whatwg.org/#done-flag 13 14 Tests: imported/w3c/web-platform-tests/xhr/xhr-timeout-longtask.any.html 15 imported/w3c/web-platform-tests/xhr/xhr-timeout-longtask.any.worker.html 16 17 * loader/DocumentThreadableLoader.cpp: 18 (WebCore::DocumentThreadableLoader::computeIsDone): 19 * loader/DocumentThreadableLoader.h: 20 * loader/LoaderStrategy.h: 21 * loader/ThreadableLoader.h: 22 * loader/ThreadableLoaderClient.h: 23 (WebCore::ThreadableLoaderClient::notifyIsDone): 24 * loader/ThreadableLoaderClientWrapper.h: 25 (WebCore::ThreadableLoaderClientWrapper::notifyIsDone): 26 * loader/WorkerThreadableLoader.cpp: 27 (WebCore::WorkerThreadableLoader::computeIsDone): 28 (WebCore::WorkerThreadableLoader::MainThreadBridge::computeIsDone): 29 (WebCore::WorkerThreadableLoader::MainThreadBridge::notifyIsDone): 30 * loader/WorkerThreadableLoader.h: 31 (WebCore::WorkerThreadableLoader::MainThreadBridge::loaderProxy): 32 * xml/XMLHttpRequest.cpp: 33 (WebCore::XMLHttpRequest::didReachTimeout): 34 (WebCore::XMLHttpRequest::notifyIsDone): 35 * xml/XMLHttpRequest.h: 36 1 37 2020-09-17 Sam Weinig <weinig@apple.com> 2 38 -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r267222 r267227 269 269 } 270 270 271 void DocumentThreadableLoader::computeIsDone() 272 { 273 if (!m_async || m_preflightChecker || !m_resource) { 274 if (m_client) 275 m_client->notifyIsDone(m_async && !m_preflightChecker && !m_resource); 276 return; 277 } 278 platformStrategies()->loaderStrategy()->isResourceLoadFinished(*m_resource, [this, protectedThis = makeRef(*this)](bool isDone) { 279 if (m_client) 280 m_client->notifyIsDone(isDone); 281 }); 282 } 283 271 284 void DocumentThreadableLoader::setDefersLoading(bool value) 272 285 { -
trunk/Source/WebCore/loader/DocumentThreadableLoader.h
r261597 r267227 58 58 void cancel() override; 59 59 virtual void setDefersLoading(bool); 60 void computeIsDone() final; 60 61 61 62 friend CrossOriginPreflightChecker; -
trunk/Source/WebCore/loader/LoaderStrategy.h
r257206 r267227 89 89 virtual NetworkLoadMetrics networkMetricsFromResourceLoadIdentifier(uint64_t resourceLoadIdentifier); 90 90 91 virtual void isResourceLoadFinished(CachedResource&, CompletionHandler<void(bool)>&& callback) = 0; 92 91 93 // Used for testing only. 92 94 virtual Vector<uint64_t> ongoingLoads() const { return { }; } -
trunk/Source/WebCore/loader/ThreadableLoader.h
r246490 r267227 77 77 static RefPtr<ThreadableLoader> create(ScriptExecutionContext&, ThreadableLoaderClient&, ResourceRequest&&, const ThreadableLoaderOptions&, String&& referrer = String()); 78 78 79 virtual void computeIsDone() = 0; 79 80 virtual void cancel() = 0; 80 81 void ref() { refThreadableLoader(); } -
trunk/Source/WebCore/loader/ThreadableLoaderClient.h
r223728 r267227 47 47 virtual void didFail(const ResourceError&) { } 48 48 virtual void didFinishTiming(const ResourceTiming&) { } 49 virtual void notifyIsDone(bool) { ASSERT_NOT_REACHED(); } 49 50 50 51 protected: -
trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h
r228545 r267227 80 80 } 81 81 82 void notifyIsDone(bool isDone) 83 { 84 if (m_client) 85 m_client->notifyIsDone(isDone); 86 } 87 82 88 void didFail(const ResourceError& error) 83 89 { -
trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp
r248846 r267227 86 86 } 87 87 88 void WorkerThreadableLoader::computeIsDone() 89 { 90 m_bridge.computeIsDone(); 91 } 92 88 93 struct LoaderTaskOptions { 89 94 WTF_MAKE_STRUCT_FAST_ALLOCATED; … … 183 188 } 184 189 190 void WorkerThreadableLoader::MainThreadBridge::computeIsDone() 191 { 192 m_loaderProxy.postTaskToLoader([this](auto&) { 193 if (!m_mainThreadLoader) { 194 notifyIsDone(true); 195 return; 196 } 197 m_mainThreadLoader->computeIsDone(); 198 }); 199 } 200 201 void WorkerThreadableLoader::MainThreadBridge::notifyIsDone(bool isDone) 202 { 203 m_loaderProxy.postTaskForModeToWorkerGlobalScope([protectedWorkerClientWrapper = makeRef(*m_workerClientWrapper), isDone](auto&) { 204 protectedWorkerClientWrapper->notifyIsDone(isDone); 205 }, m_taskMode); 206 } 207 185 208 void WorkerThreadableLoader::MainThreadBridge::clearClientWrapper() 186 209 { -
trunk/Source/WebCore/loader/WorkerThreadableLoader.h
r231813 r267227 61 61 bool done() const { return m_workerClientWrapper->done(); } 62 62 63 void notifyIsDone(bool isDone); 64 63 65 using RefCounted<WorkerThreadableLoader>::ref; 64 66 using RefCounted<WorkerThreadableLoader>::deref; … … 93 95 void cancel(); 94 96 void destroy(); 97 void computeIsDone(); 95 98 96 99 private: … … 105 108 void didFail(const ResourceError&) override; 106 109 void didFinishTiming(const ResourceTiming&) override; 110 void notifyIsDone(bool isDone) final; 107 111 108 112 // Only to be used on the main thread. … … 125 129 WorkerThreadableLoader(WorkerGlobalScope&, ThreadableLoaderClient&, const String& taskMode, ResourceRequest&&, const ThreadableLoaderOptions&, const String& referrer); 126 130 131 void computeIsDone() final; 132 127 133 Ref<WorkerGlobalScope> m_workerGlobalScope; 128 134 Ref<ThreadableLoaderClientWrapper> m_workerClientWrapper; -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r266168 r267227 119 119 , m_responseType(static_cast<unsigned>(ResponseType::EmptyString)) 120 120 , m_progressEventThrottle(*this) 121 , m_timeoutTimer(*this, &XMLHttpRequest:: didReachTimeout)121 , m_timeoutTimer(*this, &XMLHttpRequest::timeoutTimerFired) 122 122 { 123 123 #ifndef NDEBUG … … 1104 1104 } 1105 1105 1106 void XMLHttpRequest::timeoutTimerFired() 1107 { 1108 if (!m_loadingActivity) 1109 return; 1110 m_loadingActivity->loader->computeIsDone(); 1111 } 1112 1113 void XMLHttpRequest::notifyIsDone(bool isDone) 1114 { 1115 if (isDone) 1116 return; 1117 didReachTimeout(); 1118 } 1119 1106 1120 void XMLHttpRequest::didReachTimeout() 1107 1121 { -
trunk/Source/WebCore/xml/XMLHttpRequest.h
r264853 r267227 160 160 void didFinishLoading(unsigned long identifier) override; 161 161 void didFail(const ResourceError&) override; 162 void notifyIsDone(bool) final; 162 163 163 164 bool responseIsXML() const; … … 184 185 185 186 ExceptionOr<void> createRequest(); 187 188 void timeoutTimerFired(); 186 189 187 190 void genericError(); -
trunk/Source/WebKit/ChangeLog
r267226 r267227 1 2020-09-18 Youenn Fablet <youenn@apple.com> 2 3 XHR.timeout is affected by long tasks 4 https://bugs.webkit.org/show_bug.cgi?id=216266 5 <rdar://problem/68908150> 6 7 Reviewed by Alex Christensen. 8 9 Go to network process to know whether a load is finished or not. 10 11 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 12 (WebKit::NetworkConnectionToWebProcess::isResourceLoadFinished): 13 * NetworkProcess/NetworkConnectionToWebProcess.h: 14 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 15 * WebProcess/Network/WebLoaderStrategy.cpp: 16 (WebKit::WebLoaderStrategy::isResourceLoadFinished): 17 * WebProcess/Network/WebLoaderStrategy.h: 18 1 19 2020-09-18 Carlos Garcia Campos <cgarcia@igalia.com> 2 20 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r266467 r267227 594 594 } 595 595 596 void NetworkConnectionToWebProcess::isResourceLoadFinished(uint64_t loadIdentifier, CompletionHandler<void(bool)>&& callback) 597 { 598 callback(!m_networkResourceLoaders.contains(loadIdentifier)); 599 } 600 596 601 void NetworkConnectionToWebProcess::didFinishPreconnection(uint64_t preconnectionIdentifier, const ResourceError& error) 597 602 { -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
r266467 r267227 200 200 void sendH2Ping(NetworkResourceLoadParameters&&, CompletionHandler<void(Expected<WTF::Seconds, WebCore::ResourceError>&&)>&&); 201 201 void preconnectTo(Optional<uint64_t> preconnectionIdentifier, NetworkResourceLoadParameters&&); 202 void isResourceLoadFinished(uint64_t loadIdentifier, CompletionHandler<void(bool)>&&); 202 203 203 204 void removeLoadIdentifier(ResourceLoadIdentifier); -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r266467 r267227 33 33 SendH2Ping(WebKit::NetworkResourceLoadParameters parameters) -> (Expected<Seconds, WebCore::ResourceError> result) Async 34 34 PreconnectTo(Optional<uint64_t> preconnectionIdentifier, WebKit::NetworkResourceLoadParameters loadParameters); 35 IsResourceLoadFinished(uint64_t resourceLoadIdentifier) -> (bool isFinished) Async 35 36 36 37 StartDownload(WebKit::DownloadID downloadID, WebCore::ResourceRequest request, enum:bool Optional<WebKit::NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain, String suggestedName) -
trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
r266990 r267227 782 782 } 783 783 784 void WebLoaderStrategy::isResourceLoadFinished(CachedResource& resource, CompletionHandler<void(bool)>&& callback) 785 { 786 if (!resource.loader()) { 787 callback(true); 788 return; 789 } 790 WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::IsResourceLoadFinished(resource.loader()->identifier()), WTFMove(callback), 0); 791 } 792 784 793 void WebLoaderStrategy::setOnLineState(bool isOnLine) 785 794 { -
trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
r264021 r267227 113 113 bool havePerformedSecurityChecks(const WebCore::ResourceResponse&) const final; 114 114 115 void isResourceLoadFinished(WebCore::CachedResource&, CompletionHandler<void(bool)>&&) final; 116 115 117 Vector<uint64_t> ongoingLoads() const final 116 118 { -
trunk/Source/WebKitLegacy/ChangeLog
r267034 r267227 1 2020-09-18 Youenn Fablet <youenn@apple.com> 2 3 XHR.timeout is affected by long tasks 4 https://bugs.webkit.org/show_bug.cgi?id=216266 5 <rdar://problem/68908150> 6 7 Reviewed by Alex Christensen. 8 9 * WebCoreSupport/WebResourceLoadScheduler.cpp: 10 (WebResourceLoadScheduler::isResourceLoadFinished): 11 * WebCoreSupport/WebResourceLoadScheduler.h: 12 1 13 2020-09-14 Fujii Hironori <Hironori.Fujii@sony.com> 2 14 -
trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp
r257206 r267227 26 26 27 27 #include "PingHandle.h" 28 #include <WebCore/CachedResource.h> 28 29 #include <WebCore/Document.h> 29 30 #include <WebCore/DocumentLoader.h> … … 204 205 } 205 206 207 void WebResourceLoadScheduler::isResourceLoadFinished(CachedResource& resource, CompletionHandler<void(bool)>&& callback) 208 { 209 if (!resource.loader()) { 210 callback(true); 211 return; 212 } 213 callback(!hostForURL(resource.loader()->url())); 214 } 215 206 216 void WebResourceLoadScheduler::setDefersLoading(ResourceLoader& loader, bool defers) 207 217 { -
trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h
r260415 r267227 80 80 81 81 bool isSuspendingPendingRequests() const { return !!m_suspendPendingRequestsCount; } 82 void isResourceLoadFinished(WebCore::CachedResource&, CompletionHandler<void(bool)>&&) final; 82 83 83 84 class HostInformation {
Note: See TracChangeset
for help on using the changeset viewer.