Changeset 190153 in webkit


Ignore:
Timestamp:
Sep 22, 2015 6:42:03 PM (9 years ago)
Author:
rniwa@webkit.org
Message:

Event fired on a detached node does not bubble up
https://bugs.webkit.org/show_bug.cgi?id=149488

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Rebaselined a test now that one more test case passes.

  • web-platform-tests/dom/events/EventTarget-dispatchEvent-expected.txt:

Source/WebCore:

The bug was caused by an explicit check inside EventPath to match an old Firefox behavior (see r19897).
Since Firefox's behavior has changed to match DOM4: https://dom.spec.whatwg.org/#concept-event-dispatch

Fixed the bug by removing the check. The new behavior matches DO4 and behaviors of Firefox and Chrome.

Test: fast/events/event-propagation-in-detached-tree.html

  • dom/EventDispatcher.cpp:

(WebCore::EventPath::EventPath):

LayoutTests:

Added a regression test. Also modified and rebaselined mouseout-dead-node.html added in r19897
since our new behavior matches that of the latest Firefox as well as Chrome.

  • fast/events/event-propagation-in-detached-tree-expected.txt: Added.
  • fast/events/event-propagation-in-detached-tree.html: Added.
  • fast/events/mouseout-dead-node-expected.txt:
  • fast/events/mouseout-dead-node.html:
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r190150 r190153  
     12015-09-22  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Event fired on a detached node does not bubble up
     4        https://bugs.webkit.org/show_bug.cgi?id=149488
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Added a regression test. Also modified and rebaselined mouseout-dead-node.html added in r19897
     9        since our new behavior matches that of the latest Firefox as well as Chrome.
     10
     11        * fast/events/event-propagation-in-detached-tree-expected.txt: Added.
     12        * fast/events/event-propagation-in-detached-tree.html: Added.
     13        * fast/events/mouseout-dead-node-expected.txt:
     14        * fast/events/mouseout-dead-node.html:
     15
    1162015-09-22  Zalan Bujtas  <zalan@apple.com>
    217
  • trunk/LayoutTests/fast/events/mouseout-dead-node-expected.txt

    r85163 r190153  
    44
    55
    6 PASS mouseout
    7 PASS mouseout
     6PASS mouseout 1
     7PASS mouseout 2
     8PASS mouseout 3
     9PASS mouseout 4
    810PASS successfullyParsed is true
    911
  • trunk/LayoutTests/fast/events/mouseout-dead-node.html

    r155267 r190153  
    88<div id="test-container">
    99<div id=d0 style='border:2px solid red'>
    10 <div onmouseout='testFailed("mouseout")'  onmouseover='document.getElementById("d0").innerHTML ="you should see PASS below"'>
    11 <div onmouseout='testFailed("mouseout")'>
    12 <span id=target1 onmouseout='testPassed("mouseout")' >
     10<div onmouseout='testPassed("mouseout 3")'  onmouseover='document.getElementById("d0").innerHTML ="you should see PASS below"'>
     11<div onmouseout='testPassed("mouseout 2")'>
     12<span id=target1 onmouseout='testPassed("mouseout 1")' >
    1313mouse over me
    1414</span>
     
    1717</div>
    1818<div id=d1 style='border:2px solid blue'>
    19 <div id=target2 onmouseout='testPassed("mouseout")'  onmouseover='document.getElementById("d1").innerHTML ="you should see PASS below"' >
     19<div id=target2 onmouseout='testPassed("mouseout 4")'  onmouseover='document.getElementById("d1").innerHTML ="you should see PASS below"' >
    2020mouse over me
    2121</div>
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r190139 r190153  
     12015-09-22  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Event fired on a detached node does not bubble up
     4        https://bugs.webkit.org/show_bug.cgi?id=149488
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Rebaselined a test now that one more test case passes.
     9
     10        * web-platform-tests/dom/events/EventTarget-dispatchEvent-expected.txt:
     11
    1122015-09-22  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventTarget-dispatchEvent-expected.txt

    r189471 r190153  
    1616PASS If the event's dispatch flag is set, an InvalidStateError must be thrown.
    1717PASS Exceptions from event listeners must not be propagated.
    18 FAIL Event listeners added during dispatch should be called assert_array_equals: lengths differ, expected 2 got 0
     18PASS Event listeners added during dispatch should be called
    1919PASS Event listeners should be called in order of addition
    2020
  • trunk/Source/WebCore/ChangeLog

    r190152 r190153  
     12015-09-22  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Event fired on a detached node does not bubble up
     4        https://bugs.webkit.org/show_bug.cgi?id=149488
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The bug was caused by an explicit check inside EventPath to match an old Firefox behavior (see r19897).
     9        Since Firefox's behavior has changed to match DOM4: https://dom.spec.whatwg.org/#concept-event-dispatch
     10
     11        Fixed the bug by removing the check. The new behavior matches DO4 and behaviors of Firefox and Chrome.
     12
     13        Test: fast/events/event-propagation-in-detached-tree.html
     14
     15        * dom/EventDispatcher.cpp:
     16        (WebCore::EventPath::EventPath):
     17
    1182015-09-22  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    219
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r189239 r190153  
    416416EventPath::EventPath(Node& targetNode, Event& event)
    417417{
    418     bool inDocument = targetNode.inDocument();
    419418    bool isSVGElement = targetNode.isSVGElement();
    420419    bool isMouseOrFocusEvent = event.isMouseEvent() || event.isFocusEvent();
     
    438437            else
    439438                m_path.append(std::make_unique<EventContext>(node, currentTarget, target));
    440             if (!inDocument)
    441                 return;
    442439            if (is<ShadowRoot>(*node))
    443440                break;
Note: See TracChangeset for help on using the changeset viewer.