AK+Everywhere: Rename verify_cast to as

Follow-up to fc20e61e72.
This commit is contained in:
Timothy Flynn 2025-01-21 09:12:05 -05:00 committed by Tim Flynn
commit 85b424464a
Notes: github-actions[bot] 2025-01-21 16:49:39 +00:00
191 changed files with 574 additions and 574 deletions

View file

@ -15,7 +15,7 @@ Agent& relevant_agent(JS::Object const& object)
{
// The relevant agent for a platform object platformObject is platformObject's relevant Realm's agent.
// Spec Note: This pointer is not yet defined in the JavaScript specification; see tc39/ecma262#1357.
return verify_cast<Bindings::WebEngineCustomData>(relevant_realm(object).vm().custom_data())->agent;
return as<Bindings::WebEngineCustomData>(relevant_realm(object).vm().custom_data())->agent;
}
}

View file

@ -112,7 +112,7 @@ EventLoop& EnvironmentSettingsObject::responsible_event_loop()
RunScriptDecision can_run_script(JS::Realm const& realm)
{
// 1. If the global object specified by realm is a Window object whose Document object is not fully active, then return "do not run".
if (is<HTML::Window>(realm.global_object()) && !verify_cast<HTML::Window>(realm.global_object()).associated_document().is_fully_active())
if (is<HTML::Window>(realm.global_object()) && !as<HTML::Window>(realm.global_object()).associated_document().is_fully_active())
return RunScriptDecision::DoNotRun;
// 2. If scripting is disabled for realm, then return "do not run".
@ -146,7 +146,7 @@ JS::ExecutionContext const& execution_context_of_realm(JS::Realm const& realm)
// 2. Assert: realm is a synthetic realm.
// 3. Return the execution context of the synthetic realm settings object of realm.
return *verify_cast<Bindings::SyntheticHostDefined>(*realm.host_defined()).synthetic_realm_settings.execution_context;
return *as<Bindings::SyntheticHostDefined>(*realm.host_defined()).synthetic_realm_settings.execution_context;
}
// https://html.spec.whatwg.org/multipage/webappapis.html#clean-up-after-running-script
@ -276,7 +276,7 @@ bool is_scripting_enabled(JS::Realm const& realm)
return true;
// The user has not disabled scripting for realm at this time. (User agents may provide users with the option to disable scripting globally, or in a finer-grained manner, e.g., on a per-origin basis, down to the level of individual realms.)
auto const& document = verify_cast<HTML::Window>(realm.global_object()).associated_document();
auto const& document = as<HTML::Window>(realm.global_object()).associated_document();
if (!document.page().is_scripting_enabled())
return false;
@ -328,7 +328,7 @@ void add_module_to_resolved_module_set(JS::Realm& realm, String const& serialize
};
// 4. Append record to global's resolved module set.
return verify_cast<Window>(global).append_resolved_module(move(resolution));
return as<Window>(global).append_resolved_module(move(resolution));
}
// https://whatpr.org/html/9893/webappapis.html#concept-realm-module-map
@ -342,7 +342,7 @@ ModuleMap& module_map_of_realm(JS::Realm& realm)
// 2. Assert: realm is a synthetic realm.
// 3. Return the module map of the synthetic realm settings object of realm.
return *verify_cast<Bindings::SyntheticHostDefined>(*realm.host_defined()).synthetic_realm_settings.module_map;
return *as<Bindings::SyntheticHostDefined>(*realm.host_defined()).synthetic_realm_settings.module_map;
}
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-incumbent-realm

View file

@ -118,7 +118,7 @@ WebIDL::ExceptionOr<URL::URL> resolve_module_specifier(Optional<Script&> referri
// 5. If realm's global object implements Window, then set importMap to settingsObject's global object's import map.
if (is<Window>(realm->global_object()))
import_map = verify_cast<Window>(realm->global_object()).import_map();
import_map = as<Window>(realm->global_object()).import_map();
// 6. Let serializedBaseURL be baseURL, serialized.
auto serialized_base_url = base_url->serialize();
@ -321,7 +321,7 @@ ScriptFetchOptions get_descendant_script_fetch_options(ScriptFetchOptions const&
String resolve_a_module_integrity_metadata(const URL::URL& url, EnvironmentSettingsObject& settings_object)
{
// 1. Let map be settingsObject's global object's import map.
auto map = verify_cast<Window>(settings_object.global_object()).import_map();
auto map = as<Window>(settings_object.global_object()).import_map();
// 2. If map's integrity[url] does not exist, then return the empty string.
// 3. Return map's integrity[url].
@ -587,7 +587,7 @@ WebIDL::ExceptionOr<void> fetch_worklet_module_worker_script_graph(URL::URL cons
}
// 2. Fetch the descendants of and link result given fetchClient, destination, and onComplete. If performFetch was given, pass it along as well.
fetch_descendants_of_and_link_a_module_script(realm, verify_cast<JavaScriptModuleScript>(*result), fetch_client, destination, move(perform_fetch), on_complete);
fetch_descendants_of_and_link_a_module_script(realm, as<JavaScriptModuleScript>(*result), fetch_client, destination, move(perform_fetch), on_complete);
});
// 2. Fetch a single module script given url, fetchClient, destination, options, settingsObject's realm, "client", true,
@ -621,7 +621,7 @@ void fetch_internal_module_script_graph(JS::Realm& realm, JS::ModuleRequest cons
}
// 2. Fetch the descendants of result given fetch client settings object, destination, visited set, and with onComplete. If performFetch was given, pass it along as well.
auto& module_script = verify_cast<JavaScriptModuleScript>(*result);
auto& module_script = as<JavaScriptModuleScript>(*result);
fetch_descendants_of_a_module_script(realm, module_script, fetch_client_settings_object, destination, visited_set, perform_fetch, on_complete);
});
@ -873,7 +873,7 @@ void fetch_external_module_script_graph(JS::Realm& realm, URL::URL const& url, E
}
// 2. Fetch the descendants of and link result given settingsObject, "script", and onComplete.
auto& module_script = verify_cast<JavaScriptModuleScript>(*result);
auto& module_script = as<JavaScriptModuleScript>(*result);
fetch_descendants_of_and_link_a_module_script(realm, module_script, settings_object, Fetch::Infrastructure::Request::Destination::Script, nullptr, on_complete);
});

View file

@ -36,7 +36,7 @@ void WindowEnvironmentSettingsObject::setup(Page& page, URL::URL const& creation
VERIFY(realm);
// 2. Let window be realm's global object.
auto& window = verify_cast<HTML::Window>(realm->global_object());
auto& window = as<HTML::Window>(realm->global_object());
// 3. Let settings object be a new environment settings object whose algorithms are defined as follows:
// NOTE: See the functions defined for this class.

View file

@ -28,7 +28,7 @@ GC::Ref<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObject::setup(
VERIFY(realm);
// 3. Let worker global scope be realm's global object.
auto& worker = verify_cast<HTML::WorkerGlobalScope>(realm->global_object());
auto& worker = as<HTML::WorkerGlobalScope>(realm->global_object());
// 4. Let settings object be a new environment settings object whose algorithms are defined as follows:
// NOTE: See the functions defined for this class.