Commit 0159d533 authored by hayato@chromium.org's avatar hayato@chromium.org

Fix crash when a focused node is removed while in processing focusin event.

https://bugs.webkit.org/show_bug.cgi?id=76656

Reviewed by Dimitri Glazkov.

Source/WebCore:

Test: fast/events/focus-remove-focuesed-node.html

* dom/Document.cpp:
(WebCore::Document::setFocusedNode):

LayoutTests:

* fast/events/focus-remove-focuesed-node-expected.txt: Added.
* fast/events/focus-remove-focuesed-node.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 52410747
2012-01-23 Hayato Ito <hayato@chromium.org>
Fix crash when a focused node is removed while in processing focusin event.
https://bugs.webkit.org/show_bug.cgi?id=76656
Reviewed by Dimitri Glazkov.
* fast/events/focus-remove-focuesed-node-expected.txt: Added.
* fast/events/focus-remove-focuesed-node.html: Added.
2012-01-23 Andrew Scherkus <scherkus@chromium.org>
Switch media/audio-data-url.html layout test to base64-encoded WAV data.
Test for making sure that a crash does not happen when a focused node is removed in processing focusin eventListner.
<!DOCTYPE html>
<html>
<head>
<script>
function focusinListener(evt) {
try {
this.parentNode.removeChild(this);
} catch(e) {
}
}
function test() {
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
document.getElementById("a").addEventListener('focusin', focusinListener , false);
document.getElementById("a").focus();
}
</script>
</head>
<body onload="test();">
<p>Test for making sure that a crash does not happen when a focused node is removed in processing focusin eventListner.</p>
<pre id="console"></pre>
<h1 tabindex="0" id="a" ></h1>
</body>
</html>
2012-01-23 Hayato Ito <hayato@chromium.org>
Fix crash when a focused node is removed while in processing focusin event.
https://bugs.webkit.org/show_bug.cgi?id=76656
Reviewed by Dimitri Glazkov.
Test: fast/events/focus-remove-focuesed-node.html
* dom/Document.cpp:
(WebCore::Document::setFocusedNode):
2012-01-23 David Levin <levin@chromium.org>
[windows] Convert usages of GetDC to HWndDC Part 1.
......@@ -3444,6 +3444,13 @@ bool Document::setFocusedNode(PassRefPtr<Node> prpNewFocusedNode)
}
m_focusedNode->dispatchFocusInEvent(eventNames().focusinEvent, oldFocusedNode); // DOM level 3 bubbling focus event.
if (m_focusedNode != newFocusedNode) {
// handler shifted focus
focusChangeBlocked = true;
goto SetFocusedNodeDone;
}
// FIXME: We should remove firing DOMFocusInEvent event when we are sure no content depends
// on it, probably when <rdar://problem/8503958> is m.
m_focusedNode->dispatchFocusInEvent(eventNames().DOMFocusInEvent, oldFocusedNode); // DOM level 2 for compatibility.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment