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

Issue 2973903002: [Extensions Bindings] Introduce a supportsLazyListeners property (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] Introduce a supportsLazyListeners property Right now, we determine whether to store the record of a lazy listener in the extension prefs based only on the type of context - if the context registering the listener is a lazy context (like an event page), then we store a lazy listener in extension prefs. This is incorrect for webview events. Webview events are exposed on a <webview> DOM object, but are implemented behind-the-scenes as extension events (including the listener bookkeeping). However, having a lazy listener for a webview event doesn't make sense: - the only time a listener would be considered lazy is when the listener was added in a lazy context - a lazy listener will only be used to wake up an inactive context - webview events are tied to a specific webview Thus, a lazy listener would only be used for a webview which has since been torn down. With this in mind, we can avoid registering any lazy listeners for webview-related events. Introduce the key supportsLazyListeners into the JSON schema and add it for webview events. When this key is present, events don't register lazy listeners. Wire this up for both native and JS-based bindings, and add unit tests for the bindings and an end-to-end test to ensure that webview event listeners will never be registered as lazy listeners. A followup will add logic to clean up current prefs to remove traces of the listeners. BUG=736381 Review-Url: https://codereview.chromium.org/2973903002 Cr-Commit-Position: refs/heads/master@{#487991} Committed: https://chromium.googlesource.com/chromium/src/+/91f0c8a3cc9d78c32e914b74c920c26ccd748968

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : . #

Patch Set 4 : . #

Total comments: 19

Patch Set 5 : lazyboy's #

Patch Set 6 : rebase #

Patch Set 7 : compile #

Patch Set 8 : rebase #

Patch Set 9 : onMessage event fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+428 lines, -152 lines) Patch
M chrome/browser/extensions/events_apitest.cc View 1 2 3 4 5 6 7 8 1 chunk +33 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/webview_tag.json View 14 chunks +17 lines, -17 lines 0 comments Download
M chrome/renderer/resources/extensions/web_view/chrome_web_view.js View 1 2 3 chunks +4 lines, -3 lines 0 comments Download
A chrome/test/data/extensions/api_test/events/webview_events/manifest.json View 1 chunk +10 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/events/webview_events/test.js View 1 2 3 4 5 6 7 8 1 chunk +16 lines, -0 lines 0 comments Download
M extensions/browser/event_router.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M extensions/browser/event_router.cc View 1 2 3 4 5 2 chunks +11 lines, -0 lines 0 comments Download
M extensions/renderer/bindings/api_binding.cc View 1 2 3 4 5 6 chunks +16 lines, -3 lines 0 comments Download
M extensions/renderer/bindings/api_binding_js_util.h View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M extensions/renderer/bindings/api_binding_js_util.cc View 1 2 3 4 5 2 chunks +7 lines, -4 lines 0 comments Download
M extensions/renderer/bindings/api_event_handler.h View 1 2 3 4 5 2 chunks +9 lines, -4 lines 0 comments Download
M extensions/renderer/bindings/api_event_handler.cc View 1 2 3 4 5 4 chunks +8 lines, -5 lines 0 comments Download
M extensions/renderer/bindings/api_event_handler_unittest.cc View 1 2 3 4 5 6 25 chunks +95 lines, -44 lines 0 comments Download
M extensions/renderer/bindings/api_event_listeners.h View 1 2 5 chunks +15 lines, -6 lines 0 comments Download
M extensions/renderer/bindings/api_event_listeners.cc View 7 chunks +16 lines, -7 lines 0 comments Download
M extensions/renderer/bindings/api_event_listeners_unittest.cc View 12 chunks +62 lines, -14 lines 0 comments Download
M extensions/renderer/bindings/event_emitter_unittest.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M extensions/renderer/chrome_setting.cc View 1 chunk +3 lines, -1 line 0 comments Download
M extensions/renderer/event_bindings.h View 1 2 3 4 5 6 7 3 chunks +3 lines, -3 lines 0 comments Download
M extensions/renderer/event_bindings.cc View 1 2 3 4 5 6 7 9 chunks +31 lines, -15 lines 0 comments Download
M extensions/renderer/native_extension_bindings_system.cc View 1 2 3 4 5 6 7 3 chunks +6 lines, -6 lines 0 comments Download
M extensions/renderer/resources/app_window_custom_bindings.js View 1 chunk +4 lines, -1 line 0 comments Download
M extensions/renderer/resources/context_menus_handlers.js View 1 2 3 4 2 chunks +12 lines, -4 lines 0 comments Download
M extensions/renderer/resources/event.js View 2 5 chunks +13 lines, -5 lines 0 comments Download
M extensions/renderer/resources/guest_view/guest_view_events.js View 1 2 1 chunk +9 lines, -2 lines 0 comments Download
M extensions/renderer/resources/guest_view/web_view/web_view_events.js View 1 2 3 4 5 6 7 8 2 chunks +10 lines, -2 lines 0 comments Download
M extensions/renderer/resources/messaging.js View 1 2 3 4 5 1 chunk +4 lines, -2 lines 0 comments Download
M extensions/renderer/resources/web_request_event.js View 1 chunk +7 lines, -2 lines 0 comments Download

Messages

Total messages: 55 (42 generated)
Devlin
A significantly less-fun one. :(
3 years, 5 months ago (2017-07-08 02:29:47 UTC) #15
jbroman
This lgtm, but I don't understand <webview> well enough to review that aspect of it. ...
3 years, 5 months ago (2017-07-10 15:33:02 UTC) #16
lazyboy
https://codereview.chromium.org/2973903002/diff/60001/extensions/renderer/bindings/api_binding.cc File extensions/renderer/bindings/api_binding.cc (right): https://codereview.chromium.org/2973903002/diff/60001/extensions/renderer/bindings/api_binding.cc#newcode323 extensions/renderer/bindings/api_binding.cc:323: bool temp_supports_lazy_listeners = false; On 2017/07/10 15:33:02, jbroman wrote: ...
3 years, 5 months ago (2017-07-14 00:04:43 UTC) #17
lazyboy
Also /cc James: Can you or someone from current webview team check the CL description? ...
3 years, 5 months ago (2017-07-14 00:08:40 UTC) #18
wjmaclean
On 2017/07/14 00:08:40, lazyboy wrote: > Also /cc James: Can you or someone from current ...
3 years, 5 months ago (2017-07-14 13:34:20 UTC) #19
wjmaclean
On 2017/07/14 00:08:40, lazyboy wrote: > Also /cc James: Can you or someone from current ...
3 years, 5 months ago (2017-07-14 13:34:21 UTC) #20
wjmaclean
On 2017/07/14 00:08:40, lazyboy wrote: > Also /cc James: Can you or someone from current ...
3 years, 5 months ago (2017-07-14 13:34:23 UTC) #21
wjmaclean
On 2017/07/14 00:08:40, lazyboy wrote: > Also /cc James: Can you or someone from current ...
3 years, 5 months ago (2017-07-14 13:34:24 UTC) #22
wjmaclean
On 2017/07/14 13:34:24, wjmaclean wrote: > On 2017/07/14 00:08:40, lazyboy wrote: > > Also /cc ...
3 years, 5 months ago (2017-07-14 13:35:09 UTC) #23
Devlin
https://codereview.chromium.org/2973903002/diff/60001/extensions/renderer/bindings/api_binding.cc File extensions/renderer/bindings/api_binding.cc (right): https://codereview.chromium.org/2973903002/diff/60001/extensions/renderer/bindings/api_binding.cc#newcode323 extensions/renderer/bindings/api_binding.cc:323: bool temp_supports_lazy_listeners = false; On 2017/07/14 00:04:42, lazyboy wrote: ...
3 years, 5 months ago (2017-07-14 15:37:55 UTC) #26
lazyboy
lgtm https://codereview.chromium.org/2973903002/diff/60001/extensions/renderer/bindings/api_binding.cc File extensions/renderer/bindings/api_binding.cc (right): https://codereview.chromium.org/2973903002/diff/60001/extensions/renderer/bindings/api_binding.cc#newcode323 extensions/renderer/bindings/api_binding.cc:323: bool temp_supports_lazy_listeners = false; On 2017/07/14 15:37:54, Devlin ...
3 years, 5 months ago (2017-07-17 23:38:50 UTC) #29
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/2973903002/150001
3 years, 5 months ago (2017-07-19 17:46:46 UTC) #52
commit-bot: I haz the power
3 years, 5 months ago (2017-07-19 21:27:02 UTC) #55
Message was sent while issue was closed.
Committed patchset #9 (id:150001) as
https://chromium.googlesource.com/chromium/src/+/91f0c8a3cc9d78c32e914b74c920...

Powered by Google App Engine
This is Rietveld 408576698