1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 08:47:35 +00:00
serenity/Libraries/LibWeb
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
..
Bindings LibJS: Pass Interpreter& to Value::to_number() et al. 2020-05-18 09:39:55 +02:00
CodeGenerators Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
CSS LibWeb: Support the :root pseudo class 2020-05-14 08:49:51 +02:00
DOM LibWeb: Log URL when loading <script> with src attribute 2020-05-16 21:47:16 +02:00
Layout LibWeb: Fixed non-spec processing of margin and padding 2020-05-12 08:53:58 +02:00
Parser LibWeb: Support the :root pseudo class 2020-05-14 08:49:51 +02:00
Scripts LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
CMakeLists.txt LibGemini: Implement rendering text/gemini documents to HTML 2020-05-17 16:35:42 +02:00
DOMTreeModel.cpp LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
DOMTreeModel.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
Dump.cpp LibWeb: Support more advanced selectors in document.querySelectorAll() 2020-03-30 11:35:39 +02:00
Dump.h LibWeb: Add naive support for document.querySelectorAll() 2020-03-30 11:35:39 +02:00
FontCache.cpp LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
FontCache.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
Forward.h LibWeb: Add Text to the forwarding header 2020-05-10 22:32:12 +02:00
Frame.cpp LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
Frame.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
HtmlView.cpp LibGemini: Implement rendering text/gemini documents to HTML 2020-05-17 16:35:42 +02:00
HtmlView.h LibWeb: Add a hook for when an URL is dropped on an HtmlView 2020-05-10 22:32:12 +02:00
Origin.h LibWeb: Add Origin concept (protocol, host, port tuple) 2020-04-07 23:01:45 +02:00
RenderingContext.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
ResourceLoader.cpp LibWeb: Recognise and pass gemini URLs to ProtocolServer 2020-05-17 12:41:38 +02:00
ResourceLoader.h LibProtocol: Pass response headers in a case insensitive HashMap 2020-05-10 22:32:12 +02:00
StylePropertiesModel.cpp LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
StylePropertiesModel.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
TreeNode.h LibWeb: Implement <script src> support for synchronous scripts 2020-04-03 23:06:09 +02:00
URLEncoder.cpp LibWeb: Make the URL encoding function a little less copy-happy 2020-05-05 15:50:28 +02:00
URLEncoder.h LibWeb: Make the URL encoding function a little less copy-happy 2020-05-05 15:50:28 +02:00