Move the event attach/detach logic on unload from event.js to
commitd99095034d2e88897ae82c8353f3327a3a1d03a5
authorkalman <kalman@chromium.org>
Mon, 13 Apr 2015 23:02:17 +0000 (13 16:02 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Apr 2015 23:02:52 +0000 (13 23:02 +0000)
tree2e95876dfa630023c3ad100f86c95947164110df
parent8c8162e4c9d3cc2310cc290b10b8d509f876b607
Move the event attach/detach logic on unload from event.js to
event_bindings.cc.

This removes one of the reasons to call into JavaScript on context unload,
which can crash. It's also more robust; it's confusing trying to maintain a
data structure in JavaScript which reflects C++ state, which contributes to
bugs like crbug.com/474718.

Also clean up and formalise the script context invalidation system: CHECK
rather than guarding against multiple invalidations, only invalidate script
context related member variables, add an invalidation observer interface.

BUG=474718, 475536
R=rdevlin.cronin@chromium.org

Review URL: https://codereview.chromium.org/1074273002

Cr-Commit-Position: refs/heads/master@{#324933}
22 files changed:
chrome/browser/extensions/events_apitest.cc
chrome/test/data/extensions/api_test/events_are_unregistered/manifest.json [new file with mode: 0644]
chrome/test/data/extensions/api_test/events_are_unregistered/page1.html [new file with mode: 0644]
chrome/test/data/extensions/api_test/events_are_unregistered/page1.js [new file with mode: 0644]
chrome/test/data/extensions/api_test/events_are_unregistered/page2.html [new file with mode: 0644]
chrome/test/data/extensions/api_test/events_are_unregistered/page2.js [new file with mode: 0644]
extensions/renderer/dispatcher.cc
extensions/renderer/event_bindings.cc
extensions/renderer/event_bindings.h
extensions/renderer/event_unittest.cc
extensions/renderer/module_system.cc
extensions/renderer/module_system.h
extensions/renderer/module_system_test.cc
extensions/renderer/native_handler.cc
extensions/renderer/native_handler.h
extensions/renderer/object_backed_native_handler.cc
extensions/renderer/object_backed_native_handler.h
extensions/renderer/resources/event.js
extensions/renderer/script_context.cc
extensions/renderer/script_context.h
extensions/renderer/script_context_set_unittest.cc
extensions/renderer/v8_schema_registry.cc