Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6420384c096fc03eba04e7002a7e92e2ec88f6c4
https://github.com/WebKit/WebKit/commit/6420384c096fc03eba04e7002a7e92e2ec88f6c4
Author: Youenn Fablet <[email protected]>
Date: 2023-03-14 (Tue, 14 Mar 2023)
Changed paths:
A
LayoutTests/http/wpt/background-fetch/background-fetch-pause-resume.window-expected.txt
A
LayoutTests/http/wpt/background-fetch/background-fetch-pause-resume.window.html
A
LayoutTests/http/wpt/background-fetch/background-fetch-pause-resume.window.js
A LayoutTests/http/wpt/background-fetch/resources/trickle-range.py
M Source/WebCore/workers/service/background-fetch/BackgroundFetch.cpp
M Source/WebCore/workers/service/background-fetch/BackgroundFetch.h
M Source/WebCore/workers/service/background-fetch/BackgroundFetchEngine.cpp
M Source/WebCore/workers/service/background-fetch/BackgroundFetchStore.h
M Source/WebCore/workers/service/server/SWServer.h
M Source/WebCore/workers/service/server/SWServerDelegate.h
M Source/WebKit/NetworkProcess/BackgroundFetchLoad.cpp
M Source/WebKit/NetworkProcess/BackgroundFetchLoad.h
M Source/WebKit/NetworkProcess/NetworkSession.cpp
M Source/WebKit/NetworkProcess/NetworkSession.h
M Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.cpp
M Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.h
M Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.cpp
M Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.h
M Source/WebKit/Shared/BackgroundFetchState.h
M Source/WebKit/Shared/BackgroundFetchState.serialization.in
M Source/WebKit/Shared/Cocoa/BackgroundFetchStateCocoa.mm
M Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
M Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
M Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
M Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
M Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
M Tools/WebKitTestRunner/TestController.cpp
M Tools/WebKitTestRunner/TestController.h
M Tools/WebKitTestRunner/TestInvocation.cpp
M Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
Log Message:
-----------
Add support for pausing and resuming background fetches
https://bugs.webkit.org/show_bug.cgi?id=253308
rdar://problem/106192062
Reviewed by Sihui Liu.
Add support for the pausedFlag as defined in
https://wicg.github.io/background-fetch/#background-fetch-paused-flag.
When pause is called, we stop the loader if active.
When resuming, we restart the loader. If there is already some downloaded data,
we use a range request.
If the response is not a range response, we clear response body and start
writing the data from start.
If the response is a range response, we validate it as per spec and we store
the data.
We store the paused flag in the store and do not restart background fetches if
it is paused.
We expose the paused flag in BackgroundFetchState as well.
Drive-by fix to correctly expose downloaded (it was exposed as uploaded
previously).
Add test runner API to get the currewnt downloaded size.
Covered by newly added test.
*
LayoutTests/http/wpt/background-fetch/background-fetch-pause-resume.window-expected.txt:
Added.
*
LayoutTests/http/wpt/background-fetch/background-fetch-pause-resume.window.html:
Added.
*
LayoutTests/http/wpt/background-fetch/background-fetch-pause-resume.window.js:
Added.
(backgroundFetchDownloaded):
(backgroundFetchIsPaused):
(promise_test.async t):
* LayoutTests/http/wpt/background-fetch/resources/trickle-range.py: Added.
(main):
* Source/WebCore/workers/service/background-fetch/BackgroundFetch.cpp:
(WebCore::BackgroundFetch::BackgroundFetch):
(WebCore::BackgroundFetch::pause):
(WebCore::BackgroundFetch::resume):
(WebCore::BackgroundFetch::storeResponse):
(WebCore::BackgroundFetch::setRecords):
(WebCore::BackgroundFetch::Record::complete):
(WebCore::BackgroundFetch::Record::pause):
(WebCore::extractContentRangeValues):
(WebCore::validatePartialResponse):
(WebCore::BackgroundFetch::Record::didReceiveResponse):
(WebCore::BackgroundFetch::doStore):
(WebCore::BackgroundFetch::createFromStore):
* Source/WebCore/workers/service/background-fetch/BackgroundFetch.h:
(WebCore::BackgroundFetch::pausedFlagIsSet const):
(WebCore::BackgroundFetch::doStore):
(WebCore::BackgroundFetch::setRecords): Deleted.
* Source/WebCore/workers/service/background-fetch/BackgroundFetchEngine.cpp:
(WebCore::BackgroundFetchEngine::startBackgroundFetch):
(WebCore::BackgroundFetchEngine::notifyBackgroundFetchUpdate):
(WebCore::BackgroundFetchEngine::pauseBackgroundFetch):
(WebCore::BackgroundFetchEngine::resumeBackgroundFetch):
* Source/WebCore/workers/service/background-fetch/BackgroundFetchStore.h:
* Source/WebCore/workers/service/server/SWServer.h:
(WebCore::SWServer::createBackgroundFetchRecordLoader):
* Source/WebCore/workers/service/server/SWServerDelegate.h:
* Source/WebKit/NetworkProcess/BackgroundFetchLoad.cpp:
(WebKit::BackgroundFetchLoad::BackgroundFetchLoad):
* Source/WebKit/NetworkProcess/BackgroundFetchLoad.h:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::createBackgroundFetchRecordLoader):
* Source/WebKit/NetworkProcess/NetworkSession.h:
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.cpp:
(WebKit::BackgroundFetchStoreImpl::storeFetch):
(WebKit::BackgroundFetchStoreImpl::getBackgroundFetchState):
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreImpl.h:
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.cpp:
(WebKit::BackgroundFetchStoreManager::storeFetch):
(WebKit::BackgroundFetchStoreManager::storeFetchAfterQuotaCheck):
* Source/WebKit/NetworkProcess/storage/BackgroundFetchStoreManager.h:
* Source/WebKit/Shared/BackgroundFetchState.h:
* Source/WebKit/Shared/BackgroundFetchState.serialization.in:
* Source/WebKit/Shared/Cocoa/BackgroundFetchStateCocoa.mm:
(WebKit::BackgroundFetchState::toDictionary const):
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::backgroundFetchState):
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::backgroundFetchState):
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::backgroundFetchState):
* Tools/WebKitTestRunner/TestController.h:
* Tools/WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::setBackgroundFetchPermission):
(WTR::TestController::lastAddedBackgroundFetchIdentifier const):
(WTR::TestController::lastRemovedBackgroundFetchIdentifier const):
(WTR::TestController::lastUpdatedBackgroundFetchIdentifier const):
(WTR::TestController::backgroundFetchState):
Canonical link: https://commits.webkit.org/261625@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes