Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScriptState used by EventListener::handleEvent() is wrong #15

Closed
wants to merge 1 commit into from

Conversation

ghostoy
Copy link
Member

@ghostoy ghostoy commented Feb 3, 2015

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

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

git-svn-id: svn://svn.chromium.org/blink/trunk@187861 bbb929c8-8fbe-4397-9dbb-9b2b20218538

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

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

git-svn-id: svn://svn.chromium.org/blink/trunk@187861 bbb929c8-8fbe-4397-9dbb-9b2b20218538

Conflicts:
	Source/bindings/core/v8/V8AbstractEventListener.cpp
	Source/bindings/core/v8/V8AbstractEventListener.h
	Source/bindings/core/v8/V8ErrorHandler.h
	Source/bindings/core/v8/V8EventListener.h
	Source/bindings/core/v8/V8LazyEventListener.cpp
	Source/bindings/core/v8/V8LazyEventListener.h
	Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp
	Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.h
	Source/core/xml/DocumentXSLT.cpp
@rogerwang rogerwang closed this Mar 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants