1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:07:45 +00:00

LibJS+LibWeb: Wrap raw JS::Cell*/& fields in GCPtr/NonnullGCPtr

This commit is contained in:
Matthew Olsson 2023-02-26 16:09:02 -07:00 committed by Andreas Kling
parent 1df3652e27
commit 7c0c1c8f49
214 changed files with 825 additions and 827 deletions

View file

@ -259,7 +259,7 @@ void EnvironmentSettingsObject::notify_about_rejected_promises(Badge<EventLoop>)
// 4. If p's [[PromiseIsHandled]] internal slot is false, add p to settings object's outstanding rejected promises weak set.
if (!promise->is_handled())
m_outstanding_rejected_promises_weak_set.append(promise);
m_outstanding_rejected_promises_weak_set.append(*promise);
// This algorithm results in promise rejections being marked as handled or not handled. These concepts parallel handled and not handled script errors.
// If a rejection is still not handled after this, then the rejection may be reported to a developer console.

View file

@ -130,7 +130,7 @@ private:
// https://html.spec.whatwg.org/multipage/webappapis.html#outstanding-rejected-promises-weak-set
// The outstanding rejected promises weak set must not create strong references to any of its members, and implementations are free to limit its size, e.g. by removing old entries from it when new ones are added.
Vector<JS::Promise*> m_outstanding_rejected_promises_weak_set;
Vector<JS::GCPtr<JS::Promise>> m_outstanding_rejected_promises_weak_set;
// https://html.spec.whatwg.org/multipage/webappapis.html#about-to-be-notified-rejected-promises-list
Vector<JS::Handle<JS::Promise>> m_about_to_be_notified_rejected_promises_list;

View file

@ -48,7 +48,7 @@ public:
struct Entry {
EntryType type;
JavaScriptModuleScript* module_script;
JS::GCPtr<JavaScriptModuleScript> module_script;
};
bool is_fetching(AK::URL const& url, DeprecatedString const& type) const;

View file

@ -35,7 +35,7 @@ private:
AK::URL m_base_url;
DeprecatedString m_filename;
EnvironmentSettingsObject& m_settings_object;
JS::NonnullGCPtr<EnvironmentSettingsObject> m_settings_object;
};
}

View file

@ -30,7 +30,7 @@ void WindowEnvironmentSettingsObject::visit_edges(JS::Cell::Visitor& visitor)
WebIDL::ExceptionOr<void> WindowEnvironmentSettingsObject::setup(AK::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext> execution_context, Optional<Environment> reserved_environment, AK::URL top_level_creation_url, Origin top_level_origin)
{
// 1. Let realm be the value of execution context's Realm component.
auto* realm = execution_context->realm;
auto realm = execution_context->realm;
VERIFY(realm);
// 2. Let window be realm's global object.

View file

@ -25,7 +25,7 @@ public:
static JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> setup(NonnullOwnPtr<JS::ExecutionContext> execution_context /* FIXME: null or an environment reservedEnvironment, a URL topLevelCreationURL, and an origin topLevelOrigin */)
{
auto* realm = execution_context->realm;
auto realm = execution_context->realm;
VERIFY(realm);
auto settings_object = realm->heap().allocate<WorkerEnvironmentSettingsObject>(*realm, move(execution_context)).release_allocated_value_but_fixme_should_propagate_errors();
settings_object->target_browsing_context = nullptr;