1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-13 01:31:00 +00:00
serenity/Libraries
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
..
LibAudio Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibC LibC: Don't let ctype isfoo() helpers access array out of bounds 2020-05-17 22:35:25 +02:00
LibCore LibCore: Allow ArgsParser::parse() to not exit on failure 2020-05-17 11:58:08 +02:00
LibCrypto Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibDebug Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibDesktop Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibELF Kernel: Absorb LibBareMetal back into the kernel 2020-05-16 12:00:04 +02:00
LibGemini LibGemini: Implement rendering text/gemini documents to HTML 2020-05-17 16:35:42 +02:00
LibGfx LibGfx: Add UTF-32 version of the text painting code paths 2020-05-17 22:35:25 +02:00
LibGUI LibGUI: Fix crash in TextDocument::remove(TextRange) 2020-05-17 22:35:25 +02:00
LibHTTP LibGemini+LibHTTP: Defer did_progress call to match other callbacks 2020-05-17 12:41:38 +02:00
LibIPC Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibJS LibJS: Pass Interpreter& to Value::to_number() et al. 2020-05-18 09:39:55 +02:00
LibLine Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibM LibM: Fix floor() and floorf() for negative numbers 2020-05-15 22:05:59 +02:00
LibMarkdown Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibPCIDB Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibProtocol Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibPthread Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibTextCodec Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibThread Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibTLS Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
LibUnwind LibUnwind: Create UnwindBase.h to capture the EH ABI in code 2020-05-14 08:50:10 +02:00
LibVT LibVT: TerminalWidget now opts into emoji input by default :^) 2020-05-17 22:35:25 +02:00
LibWeb LibJS: Pass Interpreter& to Value::to_number() et al. 2020-05-18 09:39:55 +02:00
LibX86 Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
CMakeLists.txt LibGemini: Implement basic Gemini protocol support 2020-05-17 12:41:38 +02:00