New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 664676 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 9
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Firing an event should create the Event object in the relevant realm of the target

Project Member Reported by domenic@chromium.org, Nov 12 2016

Issue description

Consider the test case in https://github.com/w3c/web-platform-tests/pull/4088, which:

1. Creates a form in frames[0]
2. Appends it to frames[1].document.body
3. Calls frame0Form.reset()

The reset() algorithm says to "fire an event named reset at _form_". The question is: what realm should the resulting Event object be created in? That is, is event.constructor frames[0].Event, or frames[1].Event, or even window.Event?

We recently realized this was underspecified and specced the relevant realm of the event target: in this case, frame0Form, whose relevant realm is frames[0], so it should be frames[0].Event. This seems like the natural choice.

Chrome however chooses frames[1]. Maybe its heuristic is to choose the relevant realm of the node document of the target? But this doesn't make sense for non-Node EventTargets, like IndexedDB objects, so it seems like a bad heuristic.

I think we should update to match the spec, but am open to changing the spec too, if we have good reason. I realize we didn't get a full discussion from Chrome developers when merging the spec change. That discussion was at https://github.com/whatwg/dom/issues/352, and my testing was faulty at the time, which is why I didn't consult with anyone from Chrome. Let me know.
 

Comment 1 by hayato@chromium.org, Nov 14 2016

Status: Available (was: Untriaged)
I think "the relevant realm of the target" makes a lot of sense and it's consistent to other portions of the spec.  document.createElement() creates a new object in the relevant realm of |document|, so it's quite natural and consistent that domObj.fireEvent() creates a new event object in the relevant realm of |domObj|.

That is really great to hear :). The spec reflects that decision and a simple test is up at https://github.com/w3c/web-platform-tests/pull/4088 which we will now work to merge.

Comment 4 by tkent@chromium.org, Mar 15 2017

Components: -Blink>DOM>Events Blink>DOM
Remove Blink>DOM>Events

Comment 5 by hayato@chromium.org, Aug 28 2017

Cc: -yukishiino@chromium.org
Components: -Blink>DOM
Owner: yukishiino@chromium.org
Status: Assigned (was: Available)
yukishiino@, could you work on this?
Cc: haraken@chromium.org peria@chromium.org yukishiino@chromium.org
Owner: yukiy@google.com
Regarding to EventListener, this was fixed in this CL:
https://chromium-review.googlesource.com/c/chromium/src/+/1172234
Status: Started (was: Assigned)
Project Member

Comment 8 by bugdroid1@chromium.org, Oct 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1b2f95835607dbb9c6021df8893fb18f4c7aee9e

commit 1b2f95835607dbb9c6021df8893fb18f4c7aee9e
Author: Yuki Yamada <yukiy@google.com>
Date: Fri Oct 05 09:20:48 2018

Create new EventHandler and base class for EventListener/EventHandler

This CL implements these classes in Blink:
JSBasedEventListener                       (The base class for
 |                                          EventLisntener/EventHandler)
 +- JSEventListener                        (Implements EventListener)
 +- JSEventHandler                         (Implements EventHandler and
     |                                      other special types)
     +- JSEventHandlerForContentAttribute  (Supports lazy compilation
                                            for content attribute)
EventHandlers start to support incumbent realm using
blink::V8EventHandlerNonNull that inherits blink::CallbackFunctionBase.
(EventListener already supports incumbent realm.)

These four classes are no longer referenced from anywhere:
  blink::V8AbstractEventListener
  blink::V8EventListenerOrEventHandler
  blink::V8ErrorHandler
  blink::V8LazyEventListener
Although these are no longer necessary, this CL does not remove them
so that we can easily switch which classes to use in case new classes
contains some problems.

regarding  crbug.com/759461  :
OnErrorEventHandler for content attribute, which has different number
of arguments, gets supported by blink::JSEventHandler and
blink::JSEventHandlerForContentAttribute.

regarding  crbug.com/664676  :
|js_event| in the relevant realm of |event|'s target is created in
blink::JSBasedEventListener::handleEvent().

Bug:  872138 ,  849236 ,  759461 ,  664676 ,  606900 
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I356734fc16611277ad9f3f279a676e7dc8083408
Reviewed-on: https://chromium-review.googlesource.com/c/1215512
Commit-Queue: Yuki Yamada <yukiy@google.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597054}
[delete] https://crrev.com/2555486fd96872f6b98f9ad54c541d7ee2b6fcb1/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/events/onerroreventhandler-expected.txt
[delete] https://crrev.com/2555486fd96872f6b98f9ad54c541d7ee2b6fcb1/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/processing-model-2/body-onerror-compile-error-data-url-expected.txt
[delete] https://crrev.com/2555486fd96872f6b98f9ad54c541d7ee2b6fcb1/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/processing-model-2/body-onerror-compile-error-expected.txt
[delete] https://crrev.com/2555486fd96872f6b98f9ad54c541d7ee2b6fcb1/third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/processing-model-2/body-onerror-runtime-error-expected.txt
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/WebKit/LayoutTests/fast/events/before-unload-return-bad-value.html
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/WebKit/LayoutTests/fast/events/window-onerror-11-expected.txt
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/WebKit/LayoutTests/fast/performance/detached-event-timestamp.html
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/inline-event-handler-blocked-after-injecting-meta-expected.txt
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/bindings.gni
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/BUILD.gn
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_event_handler.h
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_event_listener.cc
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/js_event_listener.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/script_event_listener.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/script_event_listener.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/v8_abstract_event_handler.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/v8_event_listener_helper.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/v8_event_listener_helper.h
[delete] https://crrev.com/2555486fd96872f6b98f9ad54c541d7ee2b6fcb1/third_party/blink/renderer/bindings/core/v8/v8_event_listener_impl.cc
[delete] https://crrev.com/2555486fd96872f6b98f9ad54c541d7ee2b6fcb1/third_party/blink/renderer/bindings/core/v8/v8_event_listener_impl.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/v8_event_listener_or_event_handler.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/core/v8/v8_lazy_event_listener.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/scripts/v8_attributes.py
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/scripts/v8_types.py
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_node.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/core_idl_files.gni
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/dom/events/event_listener.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/dom/events/event_listener_map.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/dom/events/event_target.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/dom/events/event_target.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/frame/dom_window.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/frame/dom_window.h
[add] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/html/event_handler.idl
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/html/html_body_element.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/html/html_frame_element_base.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/html/html_frame_set_element.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/inspector/thread_debugger.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/svg/svg_script_element.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/svg/svg_svg_element.cc
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/core/workers/worker_global_scope.h
[modify] https://crrev.com/1b2f95835607dbb9c6021df8893fb18f4c7aee9e/third_party/blink/renderer/platform/bindings/v8_private_property.h

Status: Fixed (was: Started)

Sign in to add a comment