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

Issue 2921013002: [Extensions Bindings] Return result from event dispatch (Closed)

Created:
3 years, 6 months ago by Devlin
Modified:
3 years, 6 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] Return result from event dispatch The JS bindings return an array of results from a call to dispatch(), containing the results returned by each listener. This is primarily used, it seems, to detect whether or not a message port will be used asynchronously through the onMessage event. Because of this, it is (for now) necessary to also support in native bindings. Add functionality to return the results from a JS dispatch() call on an event. Since this is called directly from JS, we should know that running JS synchronously from that point is safe. Add tests for returning the result of dispatch() as well as end-to-end tests for asynchronously responding to a message. BUG=653596 Review-Url: https://codereview.chromium.org/2921013002 Cr-Commit-Position: refs/heads/master@{#478838} Committed: https://chromium.googlesource.com/chromium/src/+/a3c4e75c6feb70b9af379067bf2daa7c9ef92b62

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : . #

Total comments: 16

Patch Set 4 : jbroman's #

Total comments: 2

Patch Set 5 : add listener count todo #

Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -31 lines) Patch
M chrome/test/data/extensions/api_test/native_bindings/extension/background.js View 2 chunks +9 lines, -2 lines 0 comments Download
M chrome/test/data/extensions/api_test/native_bindings/extension/content_script.js View 1 1 chunk +13 lines, -1 line 0 comments Download
M extensions/renderer/BUILD.gn View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M extensions/renderer/api_binding_unittest.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M extensions/renderer/api_bindings_system.cc View 1 chunk +1 line, -1 line 0 comments Download
M extensions/renderer/api_event_handler.h View 1 2 2 chunks +2 lines, -0 lines 0 comments Download
M extensions/renderer/api_event_handler.cc View 1 2 3 chunks +12 lines, -7 lines 0 comments Download
M extensions/renderer/api_event_handler_unittest.cc View 1 2 6 chunks +7 lines, -1 line 0 comments Download
M extensions/renderer/event_emitter.h View 3 chunks +12 lines, -1 line 0 comments Download
M extensions/renderer/event_emitter.cc View 1 2 3 4 4 chunks +79 lines, -18 lines 0 comments Download
A extensions/renderer/event_emitter_unittest.cc View 1 2 3 1 chunk +119 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (22 generated)
Devlin
3 years, 6 months ago (2017-06-03 01:14:22 UTC) #11
jbroman
https://codereview.chromium.org/2921013002/diff/40001/extensions/renderer/event_emitter.cc File extensions/renderer/event_emitter.cc (right): https://codereview.chromium.org/2921013002/diff/40001/extensions/renderer/event_emitter.cc#newcode145 extensions/renderer/event_emitter.cc:145: v8::Local<v8::Array> v8_responses = v8::Array::New(isolate); super-nit: length is already known; ...
3 years, 6 months ago (2017-06-06 18:29:10 UTC) #12
Devlin
https://codereview.chromium.org/2921013002/diff/40001/extensions/renderer/event_emitter.cc File extensions/renderer/event_emitter.cc (right): https://codereview.chromium.org/2921013002/diff/40001/extensions/renderer/event_emitter.cc#newcode145 extensions/renderer/event_emitter.cc:145: v8::Local<v8::Array> v8_responses = v8::Array::New(isolate); On 2017/06/06 18:29:10, jbroman wrote: ...
3 years, 6 months ago (2017-06-09 18:20:14 UTC) #14
jbroman
lgtm https://codereview.chromium.org/2921013002/diff/40001/extensions/renderer/event_emitter.cc File extensions/renderer/event_emitter.cc (right): https://codereview.chromium.org/2921013002/diff/40001/extensions/renderer/event_emitter.cc#newcode149 extensions/renderer/event_emitter.cc:149: if (!v8_responses->Set(context, i, listener_responses[i].Get(isolate)) On 2017/06/09 at 18:20:14, ...
3 years, 6 months ago (2017-06-09 19:56:36 UTC) #18
Devlin
https://codereview.chromium.org/2921013002/diff/60001/extensions/renderer/event_emitter.cc File extensions/renderer/event_emitter.cc (right): https://codereview.chromium.org/2921013002/diff/60001/extensions/renderer/event_emitter.cc#newcode155 extensions/renderer/event_emitter.cc:155: ->CreateDataProperty(context, i, On 2017/06/09 19:56:36, jbroman wrote: > Can ...
3 years, 6 months ago (2017-06-09 20:26:21 UTC) #20
jbroman
lgtm stands
3 years, 6 months ago (2017-06-12 15:17:03 UTC) #24
lazyboy
lgtm (the returned results array not having 1:1 correspondence with the # of listeners seems ...
3 years, 6 months ago (2017-06-12 22:19:19 UTC) #25
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/2921013002/80001
3 years, 6 months ago (2017-06-12 22:41:10 UTC) #27
commit-bot: I haz the power
3 years, 6 months ago (2017-06-13 00:19:50 UTC) #31
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/a3c4e75c6feb70b9af379067bf2d...

Powered by Google App Engine
This is Rietveld 408576698