Changeset 261018 in webkit
- Timestamp:
- May 1, 2020 1:50:18 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r261004 r261018 1 2020-05-01 Jack Lee <shihchieh_lee@apple.com> 2 3 Nullptr crash in EditCommand::EditCommand via CompositeEditCommand::removeNode 4 https://bugs.webkit.org/show_bug.cgi?id=207600 5 6 Reviewed by Geoffrey Garen. 7 8 Reduce run time for this test case. 9 10 * editing/inserting/insert-list-then-edit-command-crash.html: 11 1 12 2020-05-01 Eric Carlson <eric.carlson@apple.com> 2 13 -
trunk/LayoutTests/editing/inserting/insert-list-then-edit-command-crash.html
r260831 r261018 1 < body><image></image><form id=form contentEditable=true><object data=? onload=objectOnLoad()></object></form><dialog open="true">a</dialog>1 <div style="width: 1px; height: 1px;"></div><div contentEditable=true><object data="?" onload=objectOnLoad()></object></div><span>text</span> 2 2 <script> 3 document.getSelection().empty();4 document.execCommand("selectAll", false);5 3 if (window.testRunner) { 6 4 testRunner.dumpAsText(); … … 8 6 } 9 7 8 document.getSelection().empty(); 9 document.execCommand("selectAll", false); 10 10 11 function objectOnLoad() { 11 12 document.execCommand("insertUnorderedList", false); 12 13 document.execCommand("italic", false); 13 requestAnimationFrame(function () { 14 document.body.innerHTML = "<p> Tests inserting list followed by an edit command. The test passes if WebKit doesn't crash or hit an assertion.</p>"; 15 if (window.testRunner) 16 testRunner.notifyDone(); 17 }); 14 document.body.innerHTML = "<p> Tests inserting list followed by an edit command. The test passes if WebKit doesn't crash or hit an assertion.</p>"; 15 testRunner.notifyDone(); 18 16 } 19 17 </script> -
trunk/Source/WebCore/ChangeLog
r261017 r261018 1 2020-05-01 Jack Lee <shihchieh_lee@apple.com> 2 3 Nullptr crash in EditCommand::EditCommand via CompositeEditCommand::removeNode 4 https://bugs.webkit.org/show_bug.cgi?id=207600 5 <rdar://problem/56969450> 6 7 Reviewed by Geoffrey Garen. 8 9 Second part of the fix. Remove m_frame in FrameSelection so it will not be 10 inadvertently used and cause this crash. 11 12 No new tests, covered by existing test. 13 14 * editing/AlternativeTextController.cpp: 15 (WebCore::AlternativeTextController::rootViewRectForRange const): 16 * editing/FrameSelection.cpp: 17 (WebCore::FrameSelection::FrameSelection): 18 (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): 19 (WebCore::FrameSelection::modify): 20 (WebCore::FrameSelection::selectFrameElementInParentIfFullySelected): 21 (WebCore::FrameSelection::setFocusedElementIfNeeded): 22 (WebCore::FrameSelection::shouldDeleteSelection const): 23 (WebCore::FrameSelection::shouldDeleteSelection): 24 (WebCore::FrameSelection::revealSelection): 25 (WebCore::FrameSelection:: shouldChangeSelection): 26 (WebCore::FrameSelection::shouldChangeSelection const): 27 * editing/FrameSelection.h: 28 * editing/atk/FrameSelectionAtk.cpp: 29 (WebCore::FrameSelection::notifyAccessibilityForSelectionChange): 30 * editing/mac/FrameSelectionMac.mm: 31 (WebCore::FrameSelection::notifyAccessibilityForSelectionChange): 32 1 33 2020-05-01 Darin Adler <darin@apple.com> 2 34 -
trunk/Source/WebCore/editing/AlternativeTextController.cpp
r260831 r261018 343 343 FloatRect AlternativeTextController::rootViewRectForRange(const SimpleRange& range) const 344 344 { 345 auto* view = m_document. frame()->view();345 auto* view = m_document.view(); 346 346 if (!view) 347 347 return { }; -
trunk/Source/WebCore/editing/FrameSelection.cpp
r260855 r261018 147 147 FrameSelection::FrameSelection(Document* document) 148 148 : m_document(document) 149 , m_frame(document? document->frame() : nullptr)150 149 , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation()) 151 150 , m_granularity(CharacterGranularity) … … 158 157 , m_caretPaint(true) 159 158 , m_isCaretBlinkingSuspended(false) 160 , m_focused( m_frame && m_frame->page() && m_frame->page()->focusController().focusedFrame() == m_frame)159 , m_focused(document && document->frame() && document->page() && document->page()->focusController().focusedFrame() == document->frame()) 161 160 , m_shouldShowBlockCursor(false) 162 161 , m_pendingSelectionUpdate(false) … … 337 336 newSelection.setIsDirectional(true); 338 337 339 if (!m_ frame) {338 if (!m_document || !m_document->frame()) { 340 339 m_selection = newSelection; 341 340 return false; … … 343 342 344 343 // <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at FrameSelection::setSelection 345 // if document->frame() == m_ framewe can get into an infinite loop344 // if document->frame() == m_document->frame() we can get into an infinite loop 346 345 if (Document* newSelectionDocument = newSelection.base().document()) { 347 346 if (RefPtr<Frame> newSelectionFrame = newSelectionDocument->frame()) { 348 if (newSelectionFrame != m_ frame&& newSelectionDocument != m_document) {349 newSelection Frame->selection().setSelection(newSelection, options, AXTextStateChangeIntent(), align, granularity);347 if (newSelectionFrame != m_document->frame() && newSelectionDocument != m_document) { 348 newSelectionDocument->selection().setSelection(newSelection, options, AXTextStateChangeIntent(), align, granularity); 350 349 // It's possible that during the above set selection, this FrameSelection has been modified by 351 350 // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since … … 385 384 auto* oldFocusedElement = m_document->focusedElement(); 386 385 setFocusedElementIfNeeded(); 386 if (!m_document->frame()) 387 return false; 387 388 // FIXME: Should not be needed. 388 389 if (m_document->focusedElement() != oldFocusedElement) … … 1378 1379 return false; 1379 1380 1380 if ( isSpatialNavigationEnabled(m_frame))1381 if (m_document && isSpatialNavigationEnabled(m_document->frame())) { 1381 1382 if (!wasRange && alter == AlterationMove && position == originalStartPosition) 1382 1383 return false; 1384 } 1383 1385 1384 1386 if (m_document && AXObjectCache::accessibilityEnabled()) { … … 1933 1935 { 1934 1936 // Find the parent frame; if there is none, then we have nothing to do. 1935 Frame* parent = m_ frame->tree().parent();1937 Frame* parent = m_document->frame()->tree().parent(); 1936 1938 if (!parent) 1937 1939 return; 1938 Page* page = m_ frame->page();1940 Page* page = m_document->page(); 1939 1941 if (!page) 1940 1942 return; … … 1949 1951 1950 1952 // Get to the <iframe> or <frame> (or even <object>) element in the parent frame. 1951 Element* ownerElement = m_ frame->ownerElement();1953 Element* ownerElement = m_document->ownerElement(); 1952 1954 if (!ownerElement) 1953 1955 return; … … 2254 2256 if (caretBrowsing) { 2255 2257 if (Element* anchor = enclosingAnchorElement(m_selection.base())) { 2256 m_document->page()->focusController().setFocusedElement(anchor, *m_ frame);2258 m_document->page()->focusController().setFocusedElement(anchor, *m_document->frame()); 2257 2259 return; 2258 2260 } … … 2266 2268 // work in the long term, but this is the safest fix at this time. 2267 2269 if (target->isMouseFocusable() && !isFrameElement(target)) { 2268 m_document->page()->focusController().setFocusedElement(target, *m_ frame);2270 m_document->page()->focusController().setFocusedElement(target, *m_document->frame()); 2269 2271 return; 2270 2272 } … … 2275 2277 2276 2278 if (caretBrowsing) 2277 m_document->page()->focusController().setFocusedElement(nullptr, *m_ frame);2279 m_document->page()->focusController().setFocusedElement(nullptr, *m_document->frame()); 2278 2280 } 2279 2281 … … 2301 2303 { 2302 2304 #if PLATFORM(IOS_FAMILY) 2303 if (m_ frame->selectionChangeCallbacksDisabled())2305 if (m_document->frame() && m_document->frame()->selectionChangeCallbacksDisabled()) 2304 2306 return true; 2305 2307 #endif … … 2412 2414 updateAppearance(); 2413 2415 if (m_document->page()) 2414 m_document->page()->chrome().client().notifyRevealedSelectionByScrollingFrame(*m_ frame);2416 m_document->page()->chrome().client().notifyRevealedSelectionByScrollingFrame(*m_document->frame()); 2415 2417 } 2416 2418 } … … 2446 2448 { 2447 2449 #if PLATFORM(IOS_FAMILY) 2448 if (m_ frame->selectionChangeCallbacksDisabled())2450 if (m_document->frame() && m_document->frame()->selectionChangeCallbacksDisabled()) 2449 2451 return true; 2450 2452 #endif -
trunk/Source/WebCore/editing/FrameSelection.h
r260855 r261018 339 339 340 340 Document* m_document; 341 Frame* m_frame;342 341 343 342 LayoutUnit m_xPosForVerticalArrowNavigation; -
trunk/Source/WebCore/editing/atk/FrameSelectionAtk.cpp
r251798 r261018 98 98 return; 99 99 100 AXObjectCache* cache = m_ frame->document()->existingAXObjectCache();100 AXObjectCache* cache = m_document->existingAXObjectCache(); 101 101 if (!cache) 102 102 return; -
trunk/Source/WebCore/editing/mac/FrameSelectionMac.mm
r237266 r261018 35 35 void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent& intent) 36 36 { 37 Document* document = m_frame->document();38 39 37 if (m_selection.start().isNotNull() && m_selection.end().isNotNull()) { 40 if (AXObjectCache* cache = document->existingAXObjectCache())38 if (AXObjectCache* cache = m_document->existingAXObjectCache()) 41 39 cache->postTextStateChangeNotification(m_selection.start(), intent, m_selection); 42 40 } … … 47 45 return; 48 46 49 RenderView* renderView = document->renderView();47 RenderView* renderView = m_document->renderView(); 50 48 if (!renderView) 51 49 return; 52 FrameView* frameView = m_ frame->view();50 FrameView* frameView = m_document->view(); 53 51 if (!frameView) 54 52 return;
Note: See TracChangeset
for help on using the changeset viewer.