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}