LibWeb: Add stub for IDBFactory.open

I saw that this not being implemented was causing a javascript exception
to be thrown when loading https://profiler.firefox.com/.

I was hoping that like the last time that partially implementing this
interface would allow the page to load further, but it seems that this
is unfortunately not the case this time!

However, this may help other pages load slightly further, and puts some
of the scaffolding in place for a proper implementation :^)
This commit is contained in:
Shannon Booth 2024-05-19 18:08:04 +12:00 committed by Andreas Kling
parent 3aa36caa52
commit f7beea1397
Notes: sideshowbarker 2024-07-16 19:57:55 +09:00
3 changed files with 16 additions and 2 deletions

View File

@ -7,6 +7,7 @@
#include <LibWeb/Bindings/IDBFactoryPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/IndexedDB/IDBFactory.h>
#include <LibWeb/IndexedDB/IDBOpenDBRequest.h>
namespace Web::IndexedDB {
@ -25,4 +26,12 @@ void IDBFactory::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBFactory);
}
// https://w3c.github.io/IndexedDB/#dom-idbfactory-open
JS::NonnullGCPtr<IDBOpenDBRequest> IDBFactory::open(String const&, Optional<WebIDL::UnsignedLongLong>)
{
dbgln("FIXME: Implement IDBFactory::open");
auto& realm = this->realm();
return vm().heap().allocate<IDBOpenDBRequest>(realm, realm);
}
}

View File

@ -7,6 +7,7 @@
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/WebIDL/Types.h>
namespace Web::IndexedDB {
@ -18,6 +19,8 @@ class IDBFactory : public Bindings::PlatformObject {
public:
virtual ~IDBFactory() override;
JS::NonnullGCPtr<IDBOpenDBRequest> open(String const& name, Optional<WebIDL::UnsignedLongLong> version = {});
protected:
explicit IDBFactory(JS::Realm&);

View File

@ -1,8 +1,10 @@
#import <IndexedDB/IDBOpenDBRequest.idl>
// https://w3c.github.io/IndexedDB/#idbfactory
[Exposed=(Window,Worker)]
interface IDBFactory {
// FIXME: [NewObject] IDBOpenDBRequest open(DOMString name,
// optional [EnforceRange] unsigned long long version);
[NewObject] IDBOpenDBRequest open(DOMString name,
optional [EnforceRange] unsigned long long version);
// FIXME: [NewObject] IDBOpenDBRequest deleteDatabase(DOMString name);
// FIXME: Promise<sequence<IDBDatabaseInfo>> databases();