Files
ladybird/Libraries/LibJS/Runtime
Linus Groh 476094922b LibJS: Pass Interpreter& to Value::to_number() et al.
This patch is unfortunately rather large and might make some things feel
bloated, but it is necessary to fix a few flaws in LibJS, primarily
blindly coercing values to numbers without exception checks - i.e.

interpreter.argument(0).to_i32();  // can fail!!!

Some examples where the interpreter would actually crash:

var o = { toString: () => { throw Error() } };
+o;
o - 1;
"foo".charAt(o);
"bar".repeat(o);

To fix this, we now have the following...

to_double(Interpreter&)
to_i32()
to_i32(Interpreter&)
to_size_t()
to_size_t(Interpreter&)

...and a whole lot of exception checking.

There's intentionally no to_double(), use as_double() directly instead.

This way we still can use these convenient utility functions but don't
need to check for exceptions if we are sure the value already is a
number.

Fixes #2267.
2020-05-18 09:39:55 +02:00
..
2020-04-23 09:47:23 +02:00
2020-05-08 20:06:49 +02:00
2020-05-08 20:06:49 +02:00
2020-03-24 22:21:58 +01:00
2020-03-24 22:21:58 +01:00
2020-05-17 16:21:33 +02:00
2020-04-23 19:38:13 +02:00
2020-05-17 18:05:15 +02:00
2020-04-28 15:07:08 +02:00
2020-05-07 23:05:55 +02:00
2020-05-17 18:05:15 +02:00
2020-05-17 18:05:15 +02:00
2020-05-17 18:05:15 +02:00
2020-05-17 18:05:15 +02:00
2020-05-17 18:05:15 +02:00