mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-07 09:31:53 +00:00
LibWeb: Stub CacheStorage interface
With this change we can again open login form https://discord.com/login instead of failing in js because `caches.open()` is not defined.
This commit is contained in:
parent
28bfe701b7
commit
7efdd1c1ec
Notes:
github-actions[bot]
2025-06-05 21:03:31 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 7efdd1c1ec
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5012
10 changed files with 102 additions and 0 deletions
|
@ -40,6 +40,7 @@
|
|||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
#include <LibWeb/Platform/ImageCodecPlugin.h>
|
||||
#include <LibWeb/ResourceTiming/PerformanceResourceTiming.h>
|
||||
#include <LibWeb/ServiceWorker/CacheStorage.h>
|
||||
#include <LibWeb/UserTiming/PerformanceMark.h>
|
||||
#include <LibWeb/UserTiming/PerformanceMeasure.h>
|
||||
#include <LibWeb/WebIDL/AbstractOperations.h>
|
||||
|
@ -77,6 +78,7 @@ void WindowOrWorkerGlobalScopeMixin::visit_edges(JS::Cell::Visitor& visitor)
|
|||
entry.value.visit_edges(visitor);
|
||||
visitor.visit(m_registered_event_sources);
|
||||
visitor.visit(m_crypto);
|
||||
visitor.visit(m_cache_storage);
|
||||
visitor.visit(m_resource_timing_secondary_buffer);
|
||||
}
|
||||
|
||||
|
@ -1020,4 +1022,15 @@ GC::Ref<Crypto::Crypto> WindowOrWorkerGlobalScopeMixin::crypto()
|
|||
return GC::Ref { *m_crypto };
|
||||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#cache-storage-interface
|
||||
GC::Ref<ServiceWorker::CacheStorage> WindowOrWorkerGlobalScopeMixin::caches()
|
||||
{
|
||||
auto& platform_object = this_impl();
|
||||
auto& realm = platform_object.realm();
|
||||
|
||||
if (!m_cache_storage)
|
||||
m_cache_storage = realm.create<ServiceWorker::CacheStorage>(realm);
|
||||
return GC::Ref { *m_cache_storage };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue