Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Issue 2961103002: [Extensions Bindings] Add an ExceptionHandler class (Closed)

Created:
3 years, 5 months ago by Devlin
Modified:
3 years, 5 months ago
Reviewers:
lazyboy, jbroman
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, extensions-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Extensions Bindings] Add an ExceptionHandler class There are a number of times we need to handle exceptions from untrusted code running in the bindings system; two of the main ones include when running a callback to an asynchronous extension function and when dispatching events to listeners. In both of these cases, we want to log the exception (so the developer knows something went wrong), but we don't want to allow the exception to interrupt the flow of running JS. Introduce an ExceptionHandler class to handle these cases and log the caught exceptions to either the console (default) or a custom-set handler (used in testing). Wire it up to the APIRequestHandler (with more uses coming in later patch sets). Add unit tests for both the ExceptionHandler and the APIRequestHandler's use of it. BUG=653596 Review-Url: https://codereview.chromium.org/2961103002 Cr-Commit-Position: refs/heads/master@{#485807} Committed: https://chromium.googlesource.com/chromium/src/+/e5e2cb9ce72dd22be2685f08cf881d6141cb21b0

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : rebase #

Total comments: 9

Patch Set 4 : jbroman's #

Total comments: 14

Patch Set 5 : rebase + nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+448 lines, -81 lines) Patch
M extensions/renderer/BUILD.gn View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M extensions/renderer/bindings/api_binding_types.h View 1 chunk +4 lines, -0 lines 0 comments Download
M extensions/renderer/bindings/api_binding_unittest.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M extensions/renderer/bindings/api_bindings_system.h View 1 2 3 4 4 chunks +6 lines, -0 lines 0 comments Download
M extensions/renderer/bindings/api_bindings_system.cc View 1 2 3 4 1 chunk +6 lines, -1 line 0 comments Download
M extensions/renderer/bindings/api_bindings_system_unittest.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M extensions/renderer/bindings/api_last_error.h View 1 2 3 chunks +3 lines, -5 lines 0 comments Download
M extensions/renderer/bindings/api_last_error.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M extensions/renderer/bindings/api_request_handler.h View 1 2 3 4 3 chunks +7 lines, -1 line 0 comments Download
M extensions/renderer/bindings/api_request_handler.cc View 1 2 3 4 3 chunks +14 lines, -2 lines 0 comments Download
M extensions/renderer/bindings/api_request_handler_unittest.cc View 1 2 3 4 21 chunks +105 lines, -65 lines 0 comments Download
M extensions/renderer/bindings/declarative_event_unittest.cc View 1 chunk +2 lines, -2 lines 0 comments Download
A extensions/renderer/bindings/exception_handler.h View 1 2 3 4 1 chunk +53 lines, -0 lines 0 comments Download
A extensions/renderer/bindings/exception_handler.cc View 1 2 3 4 1 chunk +95 lines, -0 lines 0 comments Download
A extensions/renderer/bindings/exception_handler_unittest.cc View 1 2 3 1 chunk +144 lines, -0 lines 0 comments Download
M extensions/renderer/native_extension_bindings_system.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 37 (25 generated)
Devlin
Hey folks, mind taking a look? https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.h File extensions/renderer/bindings/exception_handler.h (right): https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.h#newcode37 extensions/renderer/bindings/exception_handler.h:37: void SetHandlerForContext(v8::Local<v8::Context> context, ...
3 years, 5 months ago (2017-06-29 01:36:01 UTC) #11
jbroman
High-level question: v8::TryCatch::SetVerbose seems to handle the "we want to log caught exceptions" case, so ...
3 years, 5 months ago (2017-06-29 17:45:48 UTC) #12
Devlin
On 2017/06/29 17:45:48, jbroman wrote: > High-level question: v8::TryCatch::SetVerbose seems to handle the "we want ...
3 years, 5 months ago (2017-06-29 18:26:13 UTC) #13
jbroman
https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.cc File extensions/renderer/bindings/exception_handler.cc (right): https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.cc#newcode21 extensions/renderer/bindings/exception_handler.cc:21: const v8::TryCatch& try_catch) { Hmm. Minor question here: do ...
3 years, 5 months ago (2017-06-30 18:35:31 UTC) #14
Devlin
https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.cc File extensions/renderer/bindings/exception_handler.cc (right): https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.cc#newcode21 extensions/renderer/bindings/exception_handler.cc:21: const v8::TryCatch& try_catch) { On 2017/06/30 18:35:31, jbroman wrote: ...
3 years, 5 months ago (2017-07-06 16:49:23 UTC) #16
jbroman
lgtm https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.cc File extensions/renderer/bindings/exception_handler.cc (right): https://codereview.chromium.org/2961103002/diff/40001/extensions/renderer/bindings/exception_handler.cc#newcode39 extensions/renderer/bindings/exception_handler.cc:39: v8::TryCatch try_catch(isolate); On 2017/07/06 at 16:49:22, Devlin wrote: ...
3 years, 5 months ago (2017-07-06 21:09:19 UTC) #20
lazyboy
lgtm https://codereview.chromium.org/2961103002/diff/60001/extensions/renderer/bindings/api_request_handler.h File extensions/renderer/bindings/api_request_handler.h (right): https://codereview.chromium.org/2961103002/diff/60001/extensions/renderer/bindings/api_request_handler.h#newcode126 extensions/renderer/bindings/api_request_handler.h:126: ExceptionHandler* const exception_handler_; Comment about ownership https://codereview.chromium.org/2961103002/diff/60001/extensions/renderer/bindings/api_request_handler_unittest.cc File ...
3 years, 5 months ago (2017-07-10 23:12:08 UTC) #21
Devlin
https://codereview.chromium.org/2961103002/diff/60001/extensions/renderer/bindings/api_request_handler.h File extensions/renderer/bindings/api_request_handler.h (right): https://codereview.chromium.org/2961103002/diff/60001/extensions/renderer/bindings/api_request_handler.h#newcode126 extensions/renderer/bindings/api_request_handler.h:126: ExceptionHandler* const exception_handler_; On 2017/07/10 23:12:08, lazyboy wrote: > ...
3 years, 5 months ago (2017-07-11 17:33:36 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2961103002/80001
3 years, 5 months ago (2017-07-11 17:40:15 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/498222)
3 years, 5 months ago (2017-07-11 19:41:11 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2961103002/80001
3 years, 5 months ago (2017-07-12 00:18:30 UTC) #33
commit-bot: I haz the power
3 years, 5 months ago (2017-07-12 02:31:22 UTC) #37
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/e5e2cb9ce72dd22be2685f08cf88...

Powered by Google App Engine
This is Rietveld 408576698