|
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
Total comments: 4
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
|
Total messages: 25 (6 generated)
|