mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:17:44 +00:00
LibJS+LibWeb: Wrap raw JS::Cell*/& fields in GCPtr/NonnullGCPtr
This commit is contained in:
parent
1df3652e27
commit
7c0c1c8f49
214 changed files with 825 additions and 827 deletions
|
@ -58,7 +58,7 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, Deprec
|
|||
auto& object = callback.callback;
|
||||
|
||||
// 4. Let realm be O’s associated Realm.
|
||||
auto& realm = object.shape().realm();
|
||||
auto& realm = object->shape().realm();
|
||||
|
||||
// 5. Let relevant settings be realm’s settings object.
|
||||
auto& relevant_settings = Bindings::host_defined_environment_settings_object(realm);
|
||||
|
@ -70,15 +70,15 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, Deprec
|
|||
relevant_settings.prepare_to_run_script();
|
||||
|
||||
// 8. Prepare to run a callback with stored settings.
|
||||
stored_settings.prepare_to_run_callback();
|
||||
stored_settings->prepare_to_run_callback();
|
||||
|
||||
// 9. Let X be O.
|
||||
auto* actual_function_object = &object;
|
||||
auto actual_function_object = object;
|
||||
|
||||
// 10. If ! IsCallable(O) is false, then:
|
||||
if (!object.is_function()) {
|
||||
if (!object->is_function()) {
|
||||
// 1. Let getResult be Get(O, opName).
|
||||
auto get_result = object.get(operation_name);
|
||||
auto get_result = object->get(operation_name);
|
||||
|
||||
// 2. If getResult is an abrupt completion, set completion to getResult and jump to the step labeled return.
|
||||
if (get_result.is_throw_completion()) {
|
||||
|
@ -94,10 +94,10 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, Deprec
|
|||
|
||||
// 3. Set X to getResult.[[Value]].
|
||||
// NOTE: This is done out of order because `actual_function_object` is of type JS::Object and we cannot assign to it until we know for sure getResult.[[Value]] is a JS::Object.
|
||||
actual_function_object = &get_result.release_value().as_object();
|
||||
actual_function_object = get_result.release_value().as_object();
|
||||
|
||||
// 5. Set thisArg to O (overriding the provided value).
|
||||
this_argument = &object;
|
||||
this_argument = object;
|
||||
}
|
||||
|
||||
// FIXME: 11. Let esArgs be the result of converting args to an ECMAScript arguments list. If this throws an exception, set completion to the completion value representing the thrown exception and jump to the step labeled return.
|
||||
|
@ -105,7 +105,7 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, Deprec
|
|||
|
||||
// 12. Let callResult be Call(X, thisArg, esArgs).
|
||||
VERIFY(actual_function_object);
|
||||
auto& vm = object.vm();
|
||||
auto& vm = object->vm();
|
||||
auto call_result = JS::call(vm, verify_cast<JS::FunctionObject>(*actual_function_object), this_argument.value(), forward<Args>(args)...);
|
||||
|
||||
// 13. If callResult is an abrupt completion, set completion to callResult and jump to the step labeled return.
|
||||
|
@ -129,7 +129,7 @@ JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Valu
|
|||
{
|
||||
auto& function_object = callback.callback;
|
||||
|
||||
JS::MarkedVector<JS::Value> arguments_list { function_object.vm().heap() };
|
||||
JS::MarkedVector<JS::Value> arguments_list { function_object->vm().heap() };
|
||||
(arguments_list.append(forward<Args>(args)), ...);
|
||||
|
||||
return invoke_callback(callback, move(this_argument), move(arguments_list));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue