mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
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
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:
parent
73b981e339
commit
ad62af3d82
Notes:
github-actions[bot]
2025-04-21 21:27:46 +00:00
Author: https://github.com/shannonbooth
Commit: ad62af3d82
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4279
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 30 additions and 2 deletions
|
@ -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 newestWorker’s classic scripts imported flag is set, then:
|
||||
// 21. If hasUpdatedResources is false and newestWorker’s 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 newestWorker’s 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 job’s client, destination is "script", parser metadata
|
||||
// is "not parser-inserted", and whose use-URL-credentials flag is set.
|
||||
// FIXME: 3. Set importRequest’s cache mode to "no-cache" if any of the following are true:
|
||||
// * registration’s update via cache mode is "none".
|
||||
// * job’s force bypass cache flag is set.
|
||||
// * registration is stale.
|
||||
// FIXME: 4. Let fetchedResponse be the result of fetching importRequest.
|
||||
// FIXME: 5. Set updatedResourceMap[importRequest’s url] to fetchedResponse.
|
||||
// FIXME: 6. Set fetchedResponse to fetchedResponse’s unsafe response.
|
||||
// FIXME: 7. If fetchedResponse’s cache state is not "local", set registration’s 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 fetchedResponse’s body is not byte-for-byte identical with storedResponse’s unsafe response’s 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> {};
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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...
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue