Changeset 192433 in webkit


Ignore:
Timestamp:
Nov 13, 2015 10:36:31 AM (8 years ago)
Author:
jiewen_tan@apple.com
Message:

Element::focus() should acquire the ownership of Frame.
https://bugs.webkit.org/show_bug.cgi?id=150204
<rdar://problem/23136794>

Reviewed by Brent Fulgham.

Source/WebCore:

The FrameSelection::setSelection method sometimes releases the last reference to a frame.
When this happens, the Element::updateFocusAppearance would attempt to use dereferenced memory.
Instead, we should ensure that the Frame lifetime is guaranteed to extend through the duration
of the method call.

Test: editing/selection/focus-iframe-removal-crash.html

  • dom/Element.cpp:

(WebCore::Element::updateFocusAppearance):

LayoutTests:

  • editing/selection/focus-iframe-removal-crash-expected.txt: Added.
  • editing/selection/focus-iframe-removal-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r192432 r192433  
     12015-11-13  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Element::focus() should acquire the ownership of Frame.
     4        https://bugs.webkit.org/show_bug.cgi?id=150204
     5        <rdar://problem/23136794>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * editing/selection/focus-iframe-removal-crash-expected.txt: Added.
     10        * editing/selection/focus-iframe-removal-crash.html: Added.
     11
    1122015-11-13  Tim Horton  <timothy_horton@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r192414 r192433  
     12015-11-13  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Element::focus() should acquire the ownership of Frame.
     4        https://bugs.webkit.org/show_bug.cgi?id=150204
     5        <rdar://problem/23136794>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        The FrameSelection::setSelection method sometimes releases the last reference to a frame.
     10        When this happens, the Element::updateFocusAppearance would attempt to use dereferenced memory.
     11        Instead, we should ensure that the Frame lifetime is guaranteed to extend through the duration
     12        of the method call.
     13
     14        Test: editing/selection/focus-iframe-removal-crash.html
     15
     16        * dom/Element.cpp:
     17        (WebCore::Element::updateFocusAppearance):
     18
    1192015-11-13  Sergio Villar Senin  <svillar@igalia.com>
    220
  • trunk/Source/WebCore/dom/Element.cpp

    r192354 r192433  
    22532253{
    22542254    if (isRootEditableElement()) {
    2255         Frame* frame = document().frame();
     2255        // Keep frame alive in this method, since setSelection() may release the last reference to |frame|.
     2256        RefPtr<Frame> frame = document().frame();
    22562257        if (!frame)
    22572258            return;
Note: See TracChangeset for help on using the changeset viewer.