• Anna Henningsen's avatar
    [api] Make running scripts in AddMessageListener callback work in debug mode · 09b53eef
    Anna Henningsen authored
    The existance of an `AllowJavascriptExecutionDebugOnly` scope in
    `Isolate::ReportPendingMessages()` indicates that the API supports
    running arbitrary JS code in a `AddMessageListener` callback.
    
    Currently, this can fail in debug mode: The
    `!isolate->external_caught_exception()` condition is checked when
    entering API methods inside such a handler. However, if there is
    a verbose `TryCatch` active when the exception occurs, this
    check fails, and when calling `ToString()` on the exception object
    leaves a pending exception itself, the flag is re-set to `true`.
    
    Fix this problem by clearing the flag and the pending exception if
    there was one during `ToString()`. This matches the code a few lines
    up in `messages.cc`, so the exception state is now consistent
    during the callback.
    
    This currently makes a Node.js test fail in debug mode
    (`parallel/test-error-reporting`).
    
    Bug: node:7144
    Bug: node:17016
    Change-Id: I060d00fea3e9a497f4df34c6ff8d6e29ebe96321
    Reviewed-on: https://chromium-review.googlesource.com/718096
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#49466}
    09b53eef
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gni Loading commit data...
gypfiles Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.editorconfig Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...