[Extensions Bindings] Add JS hooks for the exception handler

Desktop / Chromium - Devlin Cronin [chromium.org] - 14 July 2017 00:02 EDT

There are two JS hooks we used in handling exceptions in extensions bindings:- There is an exposed "handleException" method, which handles exceptions encountered in running untrusted code.- The test API allows us to set custom handlers for uncaught exceptions (so we can fail a test or verify expected errors).

Implement each of these in the utilities exposed to the JS bindings, and add unittests for the same.

Bug: 653596 Change-Id: I246308c78b0760f5176949c2b1d88da07dca337a Reviewed-on: https://chromium-review.googlesource.com/568692

b9a8c32 [Extensions Bindings] Add JS hooks for the exception handler
.../renderer/bindings/api_binding_js_util.cc | 39 ++++++++-
extensions/renderer/bindings/api_binding_js_util.h | 21 ++++-
.../bindings/api_binding_js_util_unittest.cc | 97 ++++++++++++++++++++++
.../bindings/api_bindings_system_unittest.cc | 6 +-
.../bindings/api_bindings_system_unittest.h | 4 +
extensions/renderer/bindings/exception_handler.cc | 16 +++-
extensions/renderer/bindings/exception_handler.h | 5 ++
.../renderer/native_extension_bindings_system.cc | 3 +-
.../renderer/resources/test_custom_bindings.js | 25 ++++--
9 files changed, 201 insertions(+), 15 deletions(-)

Upstream: git.chromium.org


  • Share