diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-14 17:31:07 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-14 17:31:07 +0200 |
commit | bbe2d4a2d97ce7968b0985e4f99cdfc01fe5823e (patch) | |
tree | ee26f6da1865c600da92c961982f3f06794e45ee /Libraries/LibWeb/DOM/Node.cpp | |
parent | c5127389caeab57f1f90d722350f691b0365a5fc (diff) | |
download | serenity-bbe2d4a2d97ce7968b0985e4f99cdfc01fe5823e.zip |
LibJS+LibWeb: Clear exceptions after call'ing JavaScript functions
Decorated Interpreter::call() with [[nodiscard]] to provoke thinking
about the returned value at each call site. This is definitely not
perfect and we should really start thinking about slimming down the
public-facing LibJS interpreter API.
Fixes #3136.
Diffstat (limited to 'Libraries/LibWeb/DOM/Node.cpp')
-rw-r--r-- | Libraries/LibWeb/DOM/Node.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index b6a51ddfe2..0b8cc49b4d 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -127,7 +127,10 @@ void Node::dispatch_event(NonnullRefPtr<Event> event) auto* event_wrapper = wrap(global_object, *event); JS::MarkedValueList arguments(global_object.heap()); arguments.append(event_wrapper); - document().interpreter().call(function, this_value, move(arguments)); + auto& interpreter = document().interpreter(); + (void)interpreter.call(function, this_value, move(arguments)); + if (interpreter.exception()) + interpreter.clear_exception(); } } |