ladybird/Userland/Libraries/LibWeb/IndexedDB/IDBFactory.cpp
Shannon Booth f7beea1397 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 :^)
2024-05-19 16:24:11 +02:00

38 lines
917 B
C++

/*
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/IDBFactoryPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/IndexedDB/IDBFactory.h>
#include <LibWeb/IndexedDB/IDBOpenDBRequest.h>
namespace Web::IndexedDB {
JS_DEFINE_ALLOCATOR(IDBFactory);
IDBFactory::IDBFactory(JS::Realm& realm)
: Bindings::PlatformObject(realm)
{
}
IDBFactory::~IDBFactory() = default;
void IDBFactory::initialize(JS::Realm& realm)
{
Base::initialize(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);
}
}