|
[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
Total comments: 19
|
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
|
Total messages: 55 (42 generated)
|