Changeset 159932 in webkit


Ignore:
Timestamp:
Dec 2, 2013 6:19:10 AM (10 years ago)
Author:
Chris Fleizach
Message:

AX: Crash at WebCore::commonTreeScope
https://bugs.webkit.org/show_bug.cgi?id=125042

Reviewed by Mario Sanchez Prada.

Source/WebCore:

When an AX text marker that references a node in a detached document is used to create a text marker range, a crash occurs
because the method to determine commonTreeScopes does not account for when there are no common tree scopes.

Test: platform/mac/accessibility/ordered-textmarker-crash.html

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::visiblePositionRangeForUnorderedPositions):

  • dom/TreeScope.cpp:

(WebCore::commonTreeScope):

LayoutTests:

  • platform/mac/accessibility/ordered-textmarker-crash-expected.txt: Added.
  • platform/mac/accessibility/ordered-textmarker-crash.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159930 r159932  
     12013-12-02  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Crash at WebCore::commonTreeScope
     4        https://bugs.webkit.org/show_bug.cgi?id=125042
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        * platform/mac/accessibility/ordered-textmarker-crash-expected.txt: Added.
     9        * platform/mac/accessibility/ordered-textmarker-crash.html: Added.
     10
    1112013-12-02  Zan Dobersek  <zdobersek@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r159931 r159932  
     12013-12-02  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Crash at WebCore::commonTreeScope
     4        https://bugs.webkit.org/show_bug.cgi?id=125042
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        When an AX text marker that references a node in a detached document is used to create a text marker range, a crash occurs
     9        because the method to determine commonTreeScopes does not account for when there are no common tree scopes.
     10
     11        Test: platform/mac/accessibility/ordered-textmarker-crash.html
     12
     13        * accessibility/AccessibilityObject.cpp:
     14        (WebCore::AccessibilityObject::visiblePositionRangeForUnorderedPositions):
     15        * dom/TreeScope.cpp:
     16        (WebCore::commonTreeScope):
     17
    1182013-12-02  Nick Diego Yamane  <nick.yamane@openbossa.org>
    219
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r158914 r159932  
    650650        return VisiblePositionRange();
    651651
     652    // If there's no common tree scope between positions, return early.
     653    if (!commonTreeScope(visiblePos1.deepEquivalent().deprecatedNode(), visiblePos2.deepEquivalent().deprecatedNode()))
     654        return VisiblePositionRange();
     655   
    652656    VisiblePosition startPos;
    653657    VisiblePosition endPos;
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r159489 r159932  
    426426    for (; indexA > 0 && indexB > 0 && treeScopesA[indexA - 1] == treeScopesB[indexB - 1]; --indexA, --indexB) { }
    427427
     428    // If the nodes had no common tree scope, return immediately.
     429    if (indexA == treeScopesA.size())
     430        return nullptr;
     431   
    428432    return treeScopesA[indexA] == treeScopesB[indexB] ? treeScopesA[indexA] : nullptr;
    429433}
Note: See TracChangeset for help on using the changeset viewer.