diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 4b5b025f973cb63c9c2b61bd19502a66923afa23..160098c2349629834826605f17b3402c5640ec47 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2012-01-23 Hayato Ito + + 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 Switch media/audio-data-url.html layout test to base64-encoded WAV data. diff --git a/LayoutTests/fast/events/focus-remove-focuesed-node-expected.txt b/LayoutTests/fast/events/focus-remove-focuesed-node-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..452ab4b86dd6d1a0db158a2542a1e80499682434 --- /dev/null +++ b/LayoutTests/fast/events/focus-remove-focuesed-node-expected.txt @@ -0,0 +1,3 @@ +Test for making sure that a crash does not happen when a focused node is removed in processing focusin eventListner. + + diff --git a/LayoutTests/fast/events/focus-remove-focuesed-node.html b/LayoutTests/fast/events/focus-remove-focuesed-node.html new file mode 100644 index 0000000000000000000000000000000000000000..6dd176aa1d76b783d65376a713eb356c113c049d --- /dev/null +++ b/LayoutTests/fast/events/focus-remove-focuesed-node.html @@ -0,0 +1,25 @@ + + + + + + +

Test for making sure that a crash does not happen when a focused node is removed in processing focusin eventListner.

+

+

+ + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index ad3c5dd4e50db9164ba11912a5127444f5aa0e24..6a73b46b981bd5c3ed0fff0542231cc08fc0fe27 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2012-01-23 Hayato Ito + + 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 [windows] Convert usages of GetDC to HWndDC Part 1. diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index c596bdd5cc7bc4bd2a8ebd868bcb93786d8d7455..3abb3ada9bcb51f01f02475a8191673bdea8a1a1 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -3444,6 +3444,13 @@ bool Document::setFocusedNode(PassRefPtr 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 is m. m_focusedNode->dispatchFocusInEvent(eventNames().DOMFocusInEvent, oldFocusedNode); // DOM level 2 for compatibility.