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

Issue 823263002: ScriptState used by EventListener::handleEvent() is wrong (Closed)

Created:
5 years, 12 months ago by haraken
Modified:
5 years, 11 months ago
CC:
blink-reviews, blink-reviews-bindings_chromium.org, arv+blink
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

ScriptState used by EventListener::handleEvent() is wrong This CL is a revert of r175241 (which was landed 6 months ago), essentially. Currently an event listener is fired in a ScriptState that installed the event listener, but this is wrong. An event listener must be fired in a ScriptState that is calculated based on the ExecutionContext that fired the event listener and the world that installed the event listener. This is what we had been doing before r175241, and this CL restores the behavior. See an added test case for more details. The new behavior aligns with the spec and Firefox. One tricky part is how to handle a beforeunload event. A return value of a beforeunload event needs to be fired in a ScriptState that installed the beforeunload event listener. To achieve the behavior, this CL records the ScriptState onto V8AbstractEventListener::m_scriptStateForBeforeUnload. BUG=422227 TEST=event-should-be-dispatched-for-correct-frame.html,before-unload-return-bad-value.html Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=187861

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 4

Patch Set 6 : #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+145 lines, -150 lines) Patch
M LayoutTests/fast/events/before-unload-return-bad-value.html View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M LayoutTests/fast/events/before-unload-return-bad-value-expected.txt View 1 2 3 4 5 1 chunk +1 line, -2 lines 0 comments Download
A LayoutTests/fast/events/event-should-be-dispatched-for-correct-frame.html View 1 1 chunk +25 lines, -0 lines 0 comments Download
A + LayoutTests/fast/events/event-should-be-dispatched-for-correct-frame-expected.txt View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/core/v8/ScriptState.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/core/v8/V8AbstractEventListener.h View 3 4 5 3 chunks +10 lines, -19 lines 0 comments Download
M Source/bindings/core/v8/V8AbstractEventListener.cpp View 1 2 3 4 5 5 chunks +32 lines, -35 lines 0 comments Download
M Source/bindings/core/v8/V8ErrorHandler.h View 1 chunk +1 line, -3 lines 0 comments Download
M Source/bindings/core/v8/V8ErrorHandler.cpp View 1 2 2 chunks +7 lines, -8 lines 0 comments Download
M Source/bindings/core/v8/V8EventListener.h View 1 chunk +2 lines, -4 lines 0 comments Download
M Source/bindings/core/v8/V8EventListener.cpp View 2 chunks +8 lines, -8 lines 0 comments Download
M Source/bindings/core/v8/V8LazyEventListener.h View 1 chunk +1 line, -6 lines 0 comments Download
M Source/bindings/core/v8/V8LazyEventListener.cpp View 1 2 5 chunks +23 lines, -33 lines 0 comments Download
M Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.h View 1 chunk +3 lines, -3 lines 0 comments Download
M Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp View 3 chunks +16 lines, -16 lines 3 comments Download
M Source/core/frame/LocalDOMWindow.cpp View 1 2 3 4 5 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/xml/DocumentXSLT.cpp View 3 chunks +5 lines, -5 lines 0 comments Download
M Source/web/tests/CustomEventTest.cpp View 2 chunks +5 lines, -5 lines 0 comments Download

Messages

Total messages: 25 (6 generated)
haraken
PTAL
5 years, 12 months ago (2014-12-25 11:53:58 UTC) #2
haraken
Fixed the bot failures. PTAL.
5 years, 11 months ago (2015-01-05 05:37:12 UTC) #3
Jens Widell
https://codereview.chromium.org/823263002/diff/80001/Source/bindings/core/v8/V8AbstractEventListener.cpp File Source/bindings/core/v8/V8AbstractEventListener.cpp (right): https://codereview.chromium.org/823263002/diff/80001/Source/bindings/core/v8/V8AbstractEventListener.cpp#newcode75 Source/bindings/core/v8/V8AbstractEventListener.cpp:75: // the ExecutionContext that fired the the event listener ...
5 years, 11 months ago (2015-01-05 10:00:59 UTC) #5
haraken
Thanks for reviewing the complicated CL... https://codereview.chromium.org/823263002/diff/80001/Source/core/frame/LocalDOMWindow.cpp File Source/core/frame/LocalDOMWindow.cpp (right): https://codereview.chromium.org/823263002/diff/80001/Source/core/frame/LocalDOMWindow.cpp#newcode1595 Source/core/frame/LocalDOMWindow.cpp:1595: // This is ...
5 years, 11 months ago (2015-01-05 10:04:47 UTC) #6
haraken
On 2015/01/05 10:04:47, haraken wrote: > Thanks for reviewing the complicated CL... > > https://codereview.chromium.org/823263002/diff/80001/Source/core/frame/LocalDOMWindow.cpp ...
5 years, 11 months ago (2015-01-05 10:08:07 UTC) #7
Jens Widell
On 2015/01/05 10:04:47, haraken wrote: > Thanks for reviewing the complicated CL... > > https://codereview.chromium.org/823263002/diff/80001/Source/core/frame/LocalDOMWindow.cpp ...
5 years, 11 months ago (2015-01-05 10:30:10 UTC) #8
Jens Widell
On 2015/01/05 10:04:47, haraken wrote: > Thanks for reviewing the complicated CL... > > https://codereview.chromium.org/823263002/diff/80001/Source/core/frame/LocalDOMWindow.cpp ...
5 years, 11 months ago (2015-01-05 10:30:10 UTC) #9
haraken
On 2015/01/05 10:30:10, Jens Widell wrote: > On 2015/01/05 10:04:47, haraken wrote: > > Thanks ...
5 years, 11 months ago (2015-01-05 10:34:15 UTC) #10
haraken
On 2015/01/05 10:34:15, haraken wrote: > On 2015/01/05 10:30:10, Jens Widell wrote: > > On ...
5 years, 11 months ago (2015-01-05 10:59:33 UTC) #11
Jens Widell
LGTM
5 years, 11 months ago (2015-01-05 11:06:26 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/823263002/100001
5 years, 11 months ago (2015-01-05 11:11:32 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/44765)
5 years, 11 months ago (2015-01-05 13:06:07 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/823263002/100001
5 years, 11 months ago (2015-01-05 15:00:30 UTC) #18
commit-bot: I haz the power
Committed patchset #6 (id:100001) as https://src.chromium.org/viewvc/blink?view=rev&revision=187861
5 years, 11 months ago (2015-01-05 15:58:39 UTC) #19
sof
Seeing some fast/workers/termination-early.html crashes developing, https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Linux_Oilpan_ASAN/4700/layout-test-results/fast/workers/termination-early-crash-log.txt http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20Oilpan%20Leak/builds/6312 might this be involved?
5 years, 11 months ago (2015-01-06 08:52:04 UTC) #21
sof
https://codereview.chromium.org/823263002/diff/100001/Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp File Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp (left): https://codereview.chromium.org/823263002/diff/100001/Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp#oldcode63 Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp:63: if (!scriptState()->contextIsValid()) Why is this check no longer needed?
5 years, 11 months ago (2015-01-06 08:55:25 UTC) #22
Jens Widell
https://codereview.chromium.org/823263002/diff/100001/Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp File Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp (left): https://codereview.chromium.org/823263002/diff/100001/Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp#oldcode63 Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp:63: if (!scriptState()->contextIsValid()) On 2015/01/06 08:55:24, sof wrote: > Why ...
5 years, 11 months ago (2015-01-06 08:59:01 UTC) #23
Jens Widell
https://codereview.chromium.org/823263002/diff/100001/Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp File Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp (right): https://codereview.chromium.org/823263002/diff/100001/Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp#newcode66 Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp:66: v8::Handle<v8::Value> jsEvent = toV8(event, scriptState->context()->Global(), isolate()); I note that ...
5 years, 11 months ago (2015-01-06 09:28:59 UTC) #24
haraken
5 years, 11 months ago (2015-01-06 09:37:32 UTC) #25
Message was sent while issue was closed.
Thanks for the report. Looking (though I haven't yet succeeded in reproducing
the crash...)

Powered by Google App Engine
This is Rietveld 408576698