1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:07:34 +00:00

LibJS: Convert to_i32() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-17 23:33:35 +03:00
parent 20d990563c
commit f6a5ff7b00
11 changed files with 47 additions and 61 deletions

View file

@ -143,9 +143,7 @@ JS_DEFINE_NATIVE_FUNCTION(TestRunnerGlobalObject::fuzzilli)
auto operation = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
if (operation == "FUZZILLI_CRASH") {
auto type = vm.argument(1).to_i32(global_object);
if (vm.exception())
return {};
auto type = TRY_OR_DISCARD(vm.argument(1).to_i32(global_object));
switch (type) {
case 0:
*((int*)0x41414141) = 0x1337;

View file

@ -1129,9 +1129,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
)~~~");
} else if (parameter.type->name == "long") {
scoped_generator.append(R"~~~(
auto @cpp_name@ = @js_name@@js_suffix@.to_i32(global_object);
if (vm.exception())
@return_statement@
auto @cpp_name@ = TRY_OR_DISCARD(@js_name@@js_suffix@.to_i32(global_object));
)~~~");
} else if (parameter.type->name == "EventHandler") {
// x.onfoo = function() { ... }