1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibJS: Update outdated PROMISE_DEBUG logging

This commit is contained in:
Linus Groh 2022-10-02 10:28:18 +01:00
parent ed2aa6459d
commit 4986fa262c

View file

@ -146,7 +146,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
auto then_job_callback = vm.host_make_job_callback(then_action.as_function());
// 14. Let job be NewPromiseResolveThenableJob(promise, resolution, thenJobCallback).
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / PromiseResolvingFunction]: Creating PromiseResolveThenableJob for thenable {}", &promise, resolution);
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / PromiseResolvingFunction]: Creating PromiseJob for thenable {}", &promise, resolution);
auto job = create_promise_resolve_thenable_job(vm, promise, resolution, move(then_job_callback));
// 15. Perform HostEnqueuePromiseJob(job.[[Job]], job.[[Realm]]).
@ -270,7 +270,7 @@ void Promise::trigger_reactions() const
// 1. For each element reaction of reactions, do
for (auto& reaction : reactions) {
// a. Let job be NewPromiseReactionJob(reaction, argument).
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / trigger_reactions()]: Creating PromiseReactionJob for PromiseReaction @ {} with argument {}", this, &reaction, m_result);
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / trigger_reactions()]: Creating PromiseJob for PromiseReaction @ {} with argument {}", this, &reaction, m_result);
auto [job, realm] = create_promise_reaction_job(vm, *reaction, m_result);
// b. Perform HostEnqueuePromiseJob(job.[[Job]], job.[[Realm]]).
@ -340,7 +340,7 @@ Value Promise::perform_then(Value on_fulfilled, Value on_rejected, Optional<Prom
auto value = m_result;
// b. Let fulfillJob be NewPromiseReactionJob(fulfillReaction, value).
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: State is State::Fulfilled, creating PromiseReactionJob for PromiseReaction @ {} with argument {}", this, fulfill_reaction, value);
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: State is State::Fulfilled, creating PromiseJob for PromiseReaction @ {} with argument {}", this, fulfill_reaction, value);
auto [fulfill_job, realm] = create_promise_reaction_job(vm, *fulfill_reaction, value);
// c. Perform HostEnqueuePromiseJob(fulfillJob.[[Job]], fulfillJob.[[Realm]]).
@ -360,7 +360,7 @@ Value Promise::perform_then(Value on_fulfilled, Value on_rejected, Optional<Prom
vm.host_promise_rejection_tracker(*this, RejectionOperation::Handle);
// d. Let rejectJob be NewPromiseReactionJob(rejectReaction, reason).
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: State is State::Rejected, creating PromiseReactionJob for PromiseReaction @ {} with argument {}", this, reject_reaction, reason);
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: State is State::Rejected, creating PromiseJob for PromiseReaction @ {} with argument {}", this, reject_reaction, reason);
auto [reject_job, realm] = create_promise_reaction_job(vm, *reject_reaction, reason);
// e. Perform HostEnqueuePromiseJob(rejectJob.[[Job]], rejectJob.[[Realm]]).
@ -378,14 +378,14 @@ Value Promise::perform_then(Value on_fulfilled, Value on_rejected, Optional<Prom
// 13. If resultCapability is undefined, then
if (!result_capability.has_value()) {
// a. Return undefined.
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: No ResultCapability, returning undefined", this);
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: No result PromiseCapability, returning undefined", this);
return js_undefined();
}
// 14. Else,
// a. Return resultCapability.[[Promise]].
auto* promise = result_capability.value().promise;
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: Returning Promise @ {} from ResultCapability @ {}", this, promise, &result_capability.value());
dbgln_if(PROMISE_DEBUG, "[Promise @ {} / perform_then()]: Returning Promise @ {} from result PromiseCapability @ {}", this, promise, &result_capability.value());
return promise;
}