mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 22:42:08 +00:00
LibWeb: Convert usages of Value::TDSWOSE to Value::TSWOSE
This commit is contained in:
parent
24e9cea524
commit
527edb55ad
6 changed files with 13 additions and 13 deletions
|
@ -325,7 +325,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
@cpp_type@* @cpp_name@ = nullptr;
|
@cpp_type@* @cpp_name@ = nullptr;
|
||||||
if (!@js_name@@js_suffix@.is_nullish()) {
|
if (!@js_name@@js_suffix@.is_nullish()) {
|
||||||
if (!@js_name@@js_suffix@.is_object())
|
if (!@js_name@@js_suffix@.is_object())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects()));
|
||||||
|
|
||||||
auto callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
|
auto callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
|
||||||
@cpp_name@ = @cpp_type@::create(realm, *callback_type).ptr();
|
@cpp_name@ = @cpp_type@::create(realm, *callback_type).ptr();
|
||||||
|
@ -334,7 +334,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
} else {
|
} else {
|
||||||
scoped_generator.append(R"~~~(
|
scoped_generator.append(R"~~~(
|
||||||
if (!@js_name@@js_suffix@.is_object())
|
if (!@js_name@@js_suffix@.is_object())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects()));
|
||||||
|
|
||||||
auto callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
|
auto callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
|
||||||
auto @cpp_name@ = adopt_ref(*new @cpp_type@(callback_type));
|
auto @cpp_name@ = adopt_ref(*new @cpp_type@(callback_type));
|
||||||
|
@ -692,7 +692,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
if (!callback_function.is_legacy_treat_non_object_as_null) {
|
if (!callback_function.is_legacy_treat_non_object_as_null) {
|
||||||
callback_function_generator.append(R"~~~(
|
callback_function_generator.append(R"~~~(
|
||||||
if (!@js_name@@js_suffix@.is_function())
|
if (!@js_name@@js_suffix@.is_function())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, @js_name@@js_suffix@.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects()));
|
||||||
)~~~");
|
)~~~");
|
||||||
}
|
}
|
||||||
// 2. Return the IDL callback function type value that represents a reference to the same object that V represents, with the incumbent settings object as the callback context.
|
// 2. Return the IDL callback function type value that represents a reference to the same object that V represents, with the incumbent settings object as the callback context.
|
||||||
|
@ -757,11 +757,11 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
|
|
||||||
sequence_generator.append(R"~~~(
|
sequence_generator.append(R"~~~(
|
||||||
if (!@js_name@@js_suffix@.is_object())
|
if (!@js_name@@js_suffix@.is_object())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects()));
|
||||||
|
|
||||||
auto* iterator_method@recursion_depth@ = TRY(@js_name@@js_suffix@.get_method(vm, *vm.well_known_symbol_iterator()));
|
auto* iterator_method@recursion_depth@ = TRY(@js_name@@js_suffix@.get_method(vm, *vm.well_known_symbol_iterator()));
|
||||||
if (!iterator_method@recursion_depth@)
|
if (!iterator_method@recursion_depth@)
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotIterable, @js_name@@js_suffix@.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects()));
|
||||||
)~~~");
|
)~~~");
|
||||||
|
|
||||||
parameterized_type.generate_sequence_from_iterable(sequence_generator, DeprecatedString::formatted("{}{}", acceptable_cpp_name, optional ? "_non_optional" : ""), DeprecatedString::formatted("{}{}", js_name, js_suffix), DeprecatedString::formatted("iterator_method{}", recursion_depth), interface, recursion_depth + 1);
|
parameterized_type.generate_sequence_from_iterable(sequence_generator, DeprecatedString::formatted("{}{}", acceptable_cpp_name, optional ? "_non_optional" : ""), DeprecatedString::formatted("{}{}", js_name, js_suffix), DeprecatedString::formatted("iterator_method{}", recursion_depth), interface, recursion_depth + 1);
|
||||||
|
@ -806,7 +806,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
if (recursion_depth == 0) {
|
if (recursion_depth == 0) {
|
||||||
record_generator.append(R"~~~(
|
record_generator.append(R"~~~(
|
||||||
if (!@js_name@@js_suffix@.is_object())
|
if (!@js_name@@js_suffix@.is_object())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects()));
|
||||||
|
|
||||||
auto& @js_name@@js_suffix@_object = @js_name@@js_suffix@.as_object();
|
auto& @js_name@@js_suffix@_object = @js_name@@js_suffix@.as_object();
|
||||||
)~~~");
|
)~~~");
|
||||||
|
@ -2764,7 +2764,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::for_each)
|
||||||
|
|
||||||
auto callback = vm.argument(0);
|
auto callback = vm.argument(0);
|
||||||
if (!callback.is_function())
|
if (!callback.is_function())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, callback.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback.to_string_without_side_effects()));
|
||||||
|
|
||||||
auto this_value = vm.this_value();
|
auto this_value = vm.this_value();
|
||||||
TRY(impl->for_each([&](auto key, auto value) -> JS::ThrowCompletionOr<void> {
|
TRY(impl->for_each([&](auto key, auto value) -> JS::ThrowCompletionOr<void> {
|
||||||
|
|
|
@ -172,10 +172,10 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
||||||
break;
|
break;
|
||||||
auto next_item1 = TRY(JS::iterator_value(vm, *next1));
|
auto next_item1 = TRY(JS::iterator_value(vm, *next1));
|
||||||
if (!next_item1.is_object())
|
if (!next_item1.is_object())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, next_item1.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, next_item1.to_string_without_side_effects()));
|
||||||
auto* iterator_method1 = TRY(next_item1.get_method(vm, *vm.well_known_symbol_iterator()));
|
auto* iterator_method1 = TRY(next_item1.get_method(vm, *vm.well_known_symbol_iterator()));
|
||||||
if (!iterator_method1)
|
if (!iterator_method1)
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotIterable, next_item1.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, next_item1.to_string_without_side_effects()));
|
||||||
auto iterator2 = TRY(JS::get_iterator(vm, next_item1, JS::IteratorHint::Sync, iterator_method1));
|
auto iterator2 = TRY(JS::get_iterator(vm, next_item1, JS::IteratorHint::Sync, iterator_method1));
|
||||||
Vector<DeprecatedString> sequence_item1;
|
Vector<DeprecatedString> sequence_item1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ void report_exception_to_console(JS::Value value, JS::Realm& realm, ErrorInPromi
|
||||||
dbgln("\033[31;1mUnhandled JavaScript exception{}:\033[0m {}", error_in_promise == ErrorInPromise::Yes ? " (in promise)" : "", value);
|
dbgln("\033[31;1mUnhandled JavaScript exception{}:\033[0m {}", error_in_promise == ErrorInPromise::Yes ? " (in promise)" : "", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.report_exception(*JS::Error::create(realm, value.to_deprecated_string_without_side_effects()), error_in_promise == ErrorInPromise::Yes);
|
console.report_exception(*JS::Error::create(realm, value.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string()), error_in_promise == ErrorInPromise::Yes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#report-the-exception
|
// https://html.spec.whatwg.org/#report-the-exception
|
||||||
|
|
|
@ -326,7 +326,7 @@ WebIDL::ExceptionOr<void> Worker::terminate()
|
||||||
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker-postmessage
|
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker-postmessage
|
||||||
void Worker::post_message(JS::Value message, JS::Value)
|
void Worker::post_message(JS::Value message, JS::Value)
|
||||||
{
|
{
|
||||||
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Post Message: {}", message.to_deprecated_string_without_side_effects());
|
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Post Message: {}", MUST(message.to_string_without_side_effects()));
|
||||||
|
|
||||||
// 1. Let targetPort be the port with which this is entangled, if any; otherwise let it be null.
|
// 1. Let targetPort be the port with which this is entangled, if any; otherwise let it be null.
|
||||||
auto& target_port = m_outside_port;
|
auto& target_port = m_outside_port;
|
||||||
|
|
|
@ -34,7 +34,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> WebAssemblyTableConstructor:
|
||||||
auto descriptor = TRY(vm.argument(0).to_object(vm));
|
auto descriptor = TRY(vm.argument(0).to_object(vm));
|
||||||
auto element_value = TRY(descriptor->get("element"));
|
auto element_value = TRY(descriptor->get("element"));
|
||||||
if (!element_value.is_string())
|
if (!element_value.is_string())
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidHint, element_value.to_deprecated_string_without_side_effects());
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::InvalidHint, TRY_OR_THROW_OOM(vm, element_value.to_string_without_side_effects()));
|
||||||
auto element = TRY(element_value.as_string().deprecated_string());
|
auto element = TRY(element_value.as_string().deprecated_string());
|
||||||
|
|
||||||
Optional<Wasm::ValueType> reference_type;
|
Optional<Wasm::ValueType> reference_type;
|
||||||
|
|
|
@ -88,7 +88,7 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, Deprec
|
||||||
|
|
||||||
// 4. If ! IsCallable(X) is false, then set completion to a new Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}, and jump to the step labeled return.
|
// 4. If ! IsCallable(X) is false, then set completion to a new Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}, and jump to the step labeled return.
|
||||||
if (!get_result.value().is_function()) {
|
if (!get_result.value().is_function()) {
|
||||||
completion = realm.vm().template throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, get_result.value().to_deprecated_string_without_side_effects());
|
completion = realm.vm().template throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(realm.vm(), get_result.value().to_string_without_side_effects()));
|
||||||
return clean_up_on_return(stored_settings, relevant_settings, completion);
|
return clean_up_on_return(stored_settings, relevant_settings, completion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue