1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 04:47:36 +00:00
serenity/Libraries/LibWeb/Bindings
Linus Groh 9ea6ef4ed1 LibJS: Make Interpreter::throw_exception() a void function
The motivation for this change is twofold:

- Returning a JS::Value is misleading as one would expect it to carry
  some meaningful information, like maybe the error object that's being
  created, but in fact it is always empty. Supposedly to serve as a
  shortcut for the common case of "throw and return empty value", but
  that's just leading us to my second point.
- Inconsistent usage / coding style: as of this commit there are 114
  uses of throw_exception() discarding its return value and 55 uses
  directly returning the call result (in LibJS, not counting LibWeb);
  with the first style often having a more explicit empty value (or
  nullptr in some cases) return anyway.
  One more line to always make the return value obvious is should be
  worth it.

So now it's basically always these steps, which is already being used in
the majority of cases (as outlined above):

- Throw an exception. This mutates interpreter state by updating
  m_exception and unwinding, but doesn't return anything.
- Let the caller explicitly return an empty value, nullptr or anything
  else itself.
2020-08-25 18:30:31 +02:00
..
EventListenerWrapper.cpp LibWeb: Move DOM classes into the Web::DOM namespace 2020-07-26 20:05:15 +02:00
EventListenerWrapper.h LibWeb: Move DOM classes into the Web::DOM namespace 2020-07-26 20:05:15 +02:00
EventWrapperFactory.cpp LibWeb: Mark compilation-unit-only functions as static 2020-08-12 20:40:59 +02:00
EventWrapperFactory.h LibWeb: Move DOM classes into the Web::DOM namespace 2020-07-26 20:05:15 +02:00
LocationObject.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
LocationObject.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
NavigatorObject.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
NavigatorObject.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
NodeWrapperFactory.cpp LibWeb: Add Comment and DocumentFragment bindings, move querySelector... 2020-08-17 22:57:05 +02:00
NodeWrapperFactory.h LibWeb: Move DOM classes into the Web::DOM namespace 2020-07-26 20:05:15 +02:00
WindowObject.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
WindowObject.h LibWeb: Move DOM classes into the Web::DOM namespace 2020-07-26 20:05:15 +02:00
Wrappable.cpp LibWeb: Add missing copyright headers 2020-03-15 10:24:05 +01:00
Wrappable.h LibWeb: Use "namespace Web::Foo {" since C++20 allows it :^) 2020-07-21 16:23:08 +02:00
Wrapper.h LibWeb: Use "namespace Web::Foo {" since C++20 allows it :^) 2020-07-21 16:23:08 +02:00
XMLHttpRequestConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
XMLHttpRequestConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
XMLHttpRequestPrototype.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
XMLHttpRequestPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
XMLHttpRequestWrapper.cpp LibWeb: Use "namespace Web::Foo {" since C++20 allows it :^) 2020-07-21 16:23:08 +02:00
XMLHttpRequestWrapper.h LibWeb: Use "namespace Web::Foo {" since C++20 allows it :^) 2020-07-21 16:23:08 +02:00