LibWeb/ServiceWorker: Add some FIXME comments for updatedResources logic
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This commit is contained in:
Shannon Booth 2025-04-08 17:41:14 +12:00 committed by Andrew Kaster
parent 73b981e339
commit ad62af3d82
Notes: github-actions[bot] 2025-04-21 21:27:46 +00:00
3 changed files with 30 additions and 2 deletions

View file

@ -349,7 +349,31 @@ static void update(JS::VM& vm, GC::Ref<Job> job)
state->set_has_updated_resources(true);
}
// FIXME: 21. If hasUpdatedResources is false and newestWorkers classic scripts imported flag is set, then:
// 21. If hasUpdatedResources is false and newestWorkers classic scripts imported flag is set, then:
if (!state->has_updated_resources()) {
VERIFY(newest_worker);
if (newest_worker->classic_scripts_imported) {
// 1. For each importUrl → storedResponse of newestWorkers script resource map:
if (false) {
// FIXME: 1. If importUrl is url, then continue.
// FIXME 2. Let importRequest be a new request whose url is importUrl, client is jobs client, destination is "script", parser metadata
// is "not parser-inserted", and whose use-URL-credentials flag is set.
// FIXME: 3. Set importRequests cache mode to "no-cache" if any of the following are true:
// * registrations update via cache mode is "none".
// * jobs force bypass cache flag is set.
// * registration is stale.
// FIXME: 4. Let fetchedResponse be the result of fetching importRequest.
// FIXME: 5. Set updatedResourceMap[importRequests url] to fetchedResponse.
// FIXME: 6. Set fetchedResponse to fetchedResponses unsafe response.
// FIXME: 7. If fetchedResponses cache state is not "local", set registrations last update check time to the current time.
// FIXME: 8. If fetchedResponse is a bad import script response, continue.
// NOTE: Bad responses for importScripts() are ignored for the purpose of the byte-to-byte check. Only good responses for the incumbent worker
// and good responses for the potential update worker are considered. See issue #1374 for some rationale
// FIXME: 9. If fetchedResponses body is not byte-for-byte identical with storedResponses unsafe responses body, set hasUpdatedResources to true.
// NOTE: The control does not break the loop in this step to continue with all the imported scripts to populate the cache.
}
}
}
// 22. Asynchronously complete these steps with response.
process_response_completion_result = WebIDL::ExceptionOr<void> {};

View file

@ -41,7 +41,7 @@ public:
StorageAPI::StorageKey const& storage_key() const { return m_storage_key; }
URL::URL const& scope_url() const { return m_scope_url; }
Bindings::ServiceWorkerUpdateViaCache update_via_cache() const { return m_update_via_cache_mode; }
void set_update_via_cache(Bindings::ServiceWorkerUpdateViaCache update_visa_cache_mode) { m_update_via_cache_mode = update_visa_cache_mode; }
void set_update_via_cache(Bindings::ServiceWorkerUpdateViaCache update_via_cache_mode) { m_update_via_cache_mode = update_via_cache_mode; }
void set_last_update_check_time(MonotonicTime time) { m_last_update_check_time = time; }

View file

@ -29,6 +29,10 @@ struct ServiceWorkerRecord {
// A service worker has an associated type which is either "classic" or "module". Unless stated otherwise, it is "classic".
Bindings::WorkerType worker_type = Bindings::WorkerType::Classic;
// https://w3c.github.io/ServiceWorker/#dfn-classic-scripts-imported-flag
// A service worker has an associated classic scripts imported flag. It is initially unset.
bool classic_scripts_imported { false };
// FIXME: A lot more fields after this...
};