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

Issue 1074273002: Move the event attach/detach logic on unload from event.js to (Closed)

Created:
5 years, 8 months ago by not at google - send to devlin
Modified:
5 years, 8 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://crrev.com/d99095034d2e88897ae82c8353f3327a3a1d03a5 Cr-Commit-Position: refs/heads/master@{#324933}

Patch Set 1 #

Total comments: 27

Patch Set 2 : comments #

Patch Set 3 : fix memory leak #

Total comments: 5

Patch Set 4 : better friend #

Patch Set 5 : other comment #

Total comments: 19

Patch Set 6 : better invalidation logic, small fixes #

Patch Set 7 : fix lifetime #

Patch Set 8 : being process of relanding - more test assertions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+247 lines, -112 lines) Patch
M chrome/browser/extensions/events_apitest.cc View 1 2 3 4 5 6 7 1 chunk +43 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/events_are_unregistered/manifest.json View 1 chunk +7 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/events_are_unregistered/page1.html View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
A chrome/test/data/extensions/api_test/events_are_unregistered/page1.js View 1 chunk +24 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/events_are_unregistered/page2.html View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
A + chrome/test/data/extensions/api_test/events_are_unregistered/page2.js View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M extensions/renderer/dispatcher.cc View 1 chunk +2 lines, -1 line 0 comments Download
M extensions/renderer/event_bindings.h View 1 2 3 4 5 4 chunks +27 lines, -6 lines 0 comments Download
M extensions/renderer/event_bindings.cc View 1 2 3 4 5 6 chunks +41 lines, -18 lines 0 comments Download
M extensions/renderer/event_unittest.cc View 2 chunks +0 lines, -36 lines 0 comments Download
M extensions/renderer/module_system.h View 1 2 3 4 5 6 3 chunks +13 lines, -0 lines 0 comments Download
M extensions/renderer/module_system.cc View 1 2 3 4 5 6 5 chunks +18 lines, -10 lines 0 comments Download
M extensions/renderer/module_system_test.cc View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download
M extensions/renderer/native_handler.h View 1 chunk +3 lines, -0 lines 0 comments Download
M extensions/renderer/native_handler.cc View 1 6 1 chunk +9 lines, -2 lines 0 comments Download
M extensions/renderer/object_backed_native_handler.h View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M extensions/renderer/object_backed_native_handler.cc View 1 2 3 4 5 3 chunks +5 lines, -5 lines 0 comments Download
M extensions/renderer/resources/event.js View 5 chunks +0 lines, -16 lines 0 comments Download
M extensions/renderer/script_context.h View 1 2 3 4 5 4 chunks +17 lines, -5 lines 0 comments Download
M extensions/renderer/script_context.cc View 1 3 chunks +25 lines, -7 lines 0 comments Download
M extensions/renderer/script_context_set_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M extensions/renderer/v8_schema_registry.cc View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (3 generated)
not at google - send to devlin
5 years, 8 months ago (2015-04-10 17:33:20 UTC) #1
Devlin
Mostly nits, but I wanna take another look to make sure I've fully processed all ...
5 years, 8 months ago (2015-04-10 18:10:40 UTC) #2
Devlin
https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/native_handler.cc File extensions/renderer/native_handler.cc (right): https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/native_handler.cc#newcode15 extensions/renderer/native_handler.cc:15: Invalidate(); In retrospect, this won't work. When a class ...
5 years, 8 months ago (2015-04-10 18:25:50 UTC) #3
not at google - send to devlin
https://codereview.chromium.org/1074273002/diff/1/chrome/browser/extensions/events_apitest.cc File chrome/browser/extensions/events_apitest.cc (right): https://codereview.chromium.org/1074273002/diff/1/chrome/browser/extensions/events_apitest.cc#newcode10 chrome/browser/extensions/events_apitest.cc:10: using extensions::EventRouter; On 2015/04/10 18:10:39, Devlin wrote: > Can't ...
5 years, 8 months ago (2015-04-10 18:39:02 UTC) #4
not at google - send to devlin
https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/native_handler.cc File extensions/renderer/native_handler.cc (right): https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/native_handler.cc#newcode15 extensions/renderer/native_handler.cc:15: Invalidate(); On 2015/04/10 18:25:50, Devlin wrote: > In retrospect, ...
5 years, 8 months ago (2015-04-10 19:21:54 UTC) #5
Devlin
https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/event_bindings.h File extensions/renderer/event_bindings.h (right): https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/event_bindings.h#newcode19 extensions/renderer/event_bindings.h:19: class EventFilter; On 2015/04/10 18:39:01, kalman wrote: > On ...
5 years, 8 months ago (2015-04-10 22:00:24 UTC) #6
not at google - send to devlin
https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/event_bindings.h File extensions/renderer/event_bindings.h (right): https://codereview.chromium.org/1074273002/diff/1/extensions/renderer/event_bindings.h#newcode19 extensions/renderer/event_bindings.h:19: class EventFilter; On 2015/04/10 22:00:24, Devlin wrote: > On ...
5 years, 8 months ago (2015-04-10 22:31:45 UTC) #8
not at google - send to devlin
ping
5 years, 8 months ago (2015-04-11 00:09:36 UTC) #9
Devlin
Just nits this round, but you seem to have a good number of tests failing ...
5 years, 8 months ago (2015-04-13 16:07:08 UTC) #10
not at google - send to devlin
I've given up on the CHECK(!is_valid()) in the destructor of NativeHandler. I fixed up as ...
5 years, 8 months ago (2015-04-13 17:08:30 UTC) #11
Devlin
lgtm as long as bots are happy. https://codereview.chromium.org/1074273002/diff/90001/extensions/renderer/script_context.h File extensions/renderer/script_context.h (right): https://codereview.chromium.org/1074273002/diff/90001/extensions/renderer/script_context.h#newcode16 extensions/renderer/script_context.h:16: #include "extensions/renderer/module_system.h" ...
5 years, 8 months ago (2015-04-13 17:24:36 UTC) #12
not at google - send to devlin
I ended up needing to fix the last remaining failed CHECKs in order to fix ...
5 years, 8 months ago (2015-04-13 20:01:12 UTC) #13
Devlin
On 2015/04/13 20:01:12, kalman wrote: > I ended up needing to fix the last remaining ...
5 years, 8 months ago (2015-04-13 20:12:19 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1074273002/130001
5 years, 8 months ago (2015-04-13 20:39:08 UTC) #17
commit-bot: I haz the power
Committed patchset #7 (id:130001)
5 years, 8 months ago (2015-04-13 23:02:26 UTC) #18
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/d99095034d2e88897ae82c8353f3327a3a1d03a5 Cr-Commit-Position: refs/heads/master@{#324933}
5 years, 8 months ago (2015-04-13 23:03:33 UTC) #19
mlamouri (slow - plz ping)
A revert of this CL (patchset #7 id:130001) has been created in https://codereview.chromium.org/1083663004/ by mlamouri@chromium.org. ...
5 years, 8 months ago (2015-04-14 10:21:30 UTC) #20
mlamouri (slow - plz ping)
On 2015/04/14 at 10:21:30, Mounir Lamouri wrote: > A revert of this CL (patchset #7 ...
5 years, 8 months ago (2015-04-14 10:59:23 UTC) #21
mlamouri (slow - plz ping)
On 2015/04/14 at 10:59:23, Mounir Lamouri wrote: > On 2015/04/14 at 10:21:30, Mounir Lamouri wrote: ...
5 years, 8 months ago (2015-04-14 15:27:36 UTC) #22
huangs
kalman@: As a Sheriff I insisted that this patch be reverted owing to consistent failure ...
5 years, 8 months ago (2015-04-14 15:55:17 UTC) #23
not at google - send to devlin
5 years, 8 months ago (2015-04-14 16:06:28 UTC) #24
Message was sent while issue was closed.
On 2015/04/14 15:55:17, huangs wrote:
> kalman@: As a Sheriff I insisted that this patch be reverted owing to
consistent
> failure of ExtensionApiTest.EventsAreUnregistered on Win7 Dbg:
> 
>
https://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%2...
> 
> from #37055 on (success on #37073 was owing to disabling the test -- but since
> then we've undone the disabling, then reverted the CL).

Reverting was the right thing to do, thanks.

Powered by Google App Engine
This is Rietveld 408576698