Changeset 230087 in webkit


Ignore:
Timestamp:
Mar 29, 2018 4:05:06 PM (6 years ago)
Author:
Wenson Hsieh
Message:

FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
https://bugs.webkit.org/show_bug.cgi?id=183395
<rdar://problem/38055732>

Reviewed by Zalan Bujtas.

Source/WebCore:

In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
mitigation by wrapping the Frame in a Ref when firing the appearance update timer, and ensuring that layout is
really up to date before calling updateAppearanceAfterLayoutOrStyleChange() from the timer.

Test: editing/selection/iframe-update-selection-appearance.html

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::appearanceUpdateTimerFired):

LayoutTests:

Add a new layout test that passes if we didn't crash.

  • editing/selection/iframe-update-selection-appearance-expected.txt: Added.
  • editing/selection/iframe-update-selection-appearance.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r230072 r230087  
     12018-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
     4        https://bugs.webkit.org/show_bug.cgi?id=183395
     5        <rdar://problem/38055732>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Add a new layout test that passes if we didn't crash.
     10
     11        * editing/selection/iframe-update-selection-appearance-expected.txt: Added.
     12        * editing/selection/iframe-update-selection-appearance.html: Added.
     13
    1142018-03-29  Per Arne Vollan  <pvollan@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r230083 r230087  
     12018-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
     4        https://bugs.webkit.org/show_bug.cgi?id=183395
     5        <rdar://problem/38055732>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
     10        FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
     11        mitigation by wrapping the Frame in a Ref when firing the appearance update timer, and ensuring that layout is
     12        really up to date before calling updateAppearanceAfterLayoutOrStyleChange() from the timer.
     13
     14        Test: editing/selection/iframe-update-selection-appearance.html
     15
     16        * editing/FrameSelection.cpp:
     17        (WebCore::FrameSelection::appearanceUpdateTimerFired):
     18
    1192018-03-29  Daniel Bates  <dabates@apple.com>
    220
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r227983 r230087  
    24422442void FrameSelection::appearanceUpdateTimerFired()
    24432443{
     2444    Ref<Frame> protectedFrame(*m_frame);
     2445    if (auto* document = protectedFrame->document())
     2446        document->updateLayoutIgnorePendingStylesheets();
     2447
    24442448    updateAppearanceAfterLayoutOrStyleChange();
    24452449}
Note: See TracChangeset for help on using the changeset viewer.