Changeset 143074 in webkit


Ignore:
Timestamp:
Feb 15, 2013 5:20:38 PM (11 years ago)
Author:
Simon Fraser
Message:

REGRESSION (r142505?): Crashes in WebCore::ScrollingStateNode::appendChild when using back/forward buttons
https://bugs.webkit.org/show_bug.cgi?id=109826
<rdar://problem/13216100>

Source/WebCore:

Reviewed by Beth Dakin.

Fix a crash when going Back on some pages with fixed position elements.

When a page was being restored from the page cache, and a layout from
FrameLoader::commitProvisionalLoad() caused us to try to register the fixed
position layer before the main scrolling layer, we'd crash trying to dereference
the root node.

Fix by bailing from ScrollingStateTree::attachNode() if we can't find the parent
node.

Test: platform/mac-wk2/tiled-drawing/null-parent-back-crash.html

  • page/scrolling/ScrollingStateTree.cpp:

(WebCore::ScrollingStateTree::attachNode):
(WebCore::ScrollingStateTree::stateNodeForID):

  • page/scrolling/mac/ScrollingCoordinatorMac.mm:

(WebCore::ScrollingCoordinatorMac::updateViewportConstrainedNode):

LayoutTests:

Reviewed by Beth Dakin.

Test having a page with an iframe that navigates forwards then back.

  • platform/mac-wk2/tiled-drawing/null-parent-back-crash.html: Added.
Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143073 r143074  
     12013-02-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        REGRESSION (r142505?): Crashes in WebCore::ScrollingStateNode::appendChild when using back/forward buttons
     4        https://bugs.webkit.org/show_bug.cgi?id=109826
     5        <rdar://problem/13216100>
     6
     7        Reviewed by Beth Dakin.
     8       
     9        Test having a page with an iframe that navigates forwards then back.
     10
     11        * platform/mac-wk2/tiled-drawing/null-parent-back-crash.html: Added.
     12
    1132013-02-15  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r143073 r143074  
     12013-02-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        REGRESSION (r142505?): Crashes in WebCore::ScrollingStateNode::appendChild when using back/forward buttons
     4        https://bugs.webkit.org/show_bug.cgi?id=109826
     5        <rdar://problem/13216100>
     6
     7        Reviewed by Beth Dakin.
     8
     9        Fix a crash when going Back on some pages with fixed position elements.
     10       
     11        When a page was being restored from the page cache, and a layout from
     12        FrameLoader::commitProvisionalLoad() caused us to try to register the fixed
     13        position layer before the main scrolling layer, we'd crash trying to dereference
     14        the root node.
     15       
     16        Fix by bailing from ScrollingStateTree::attachNode() if we can't find the parent
     17        node.
     18
     19        Test: platform/mac-wk2/tiled-drawing/null-parent-back-crash.html
     20
     21        * page/scrolling/ScrollingStateTree.cpp:
     22        (WebCore::ScrollingStateTree::attachNode):
     23        (WebCore::ScrollingStateTree::stateNodeForID):
     24        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
     25        (WebCore::ScrollingCoordinatorMac::updateViewportConstrainedNode):
     26
    1272013-02-15  Simon Fraser  <simon.fraser@apple.com>
    228
  • trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp

    r142691 r143074  
    7474    } else {
    7575        ScrollingStateNode* parent = stateNodeForID(parentID);
     76        if (!parent)
     77            return 0;
     78
    7679        switch (nodeType) {
    7780        case FixedNode: {
     
    9598            break;
    9699        }
    97         default:
    98             ASSERT_NOT_REACHED();
    99100        }
    100101    }
     
    176177        return 0;
    177178
     179    ASSERT(it->value->scrollingNodeID() == scrollLayerID);
    178180    return it->value;
    179181}
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r142691 r143074  
    349349    ASSERT(supportsFixedPositionLayers());
    350350
     351    ScrollingStateNode* node = m_scrollingStateTree->stateNodeForID(nodeID);
     352    if (!node)
     353        return;
     354
    351355    switch (constraints.constraintType()) {
    352356    case ViewportConstraints::FixedPositionConstaint: {
    353         ScrollingStateFixedNode* node = toScrollingStateFixedNode(m_scrollingStateTree->stateNodeForID(nodeID));
    354         setScrollLayerForNode(graphicsLayer, node);
    355         node->updateConstraints((const FixedPositionViewportConstraints&)constraints);
     357        ScrollingStateFixedNode* fixedNode = toScrollingStateFixedNode(node);
     358        setScrollLayerForNode(graphicsLayer, fixedNode);
     359        fixedNode->updateConstraints((const FixedPositionViewportConstraints&)constraints);
    356360        break;
    357361    }
    358362    case ViewportConstraints::StickyPositionConstraint: {
    359         ScrollingStateStickyNode* node = toScrollingStateStickyNode(m_scrollingStateTree->stateNodeForID(nodeID));
    360         setScrollLayerForNode(graphicsLayer, node);
    361         node->updateConstraints((const StickyPositionViewportConstraints&)constraints);
     363        ScrollingStateStickyNode* stickyNode = toScrollingStateStickyNode(node);
     364        setScrollLayerForNode(graphicsLayer, stickyNode);
     365        stickyNode->updateConstraints((const StickyPositionViewportConstraints&)constraints);
    362366        break;
    363367    }
Note: See TracChangeset for help on using the changeset viewer.