Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7eafa6d173c51bb1ae370ed57a4fb050d1351474
      
https://github.com/WebKit/WebKit/commit/7eafa6d173c51bb1ae370ed57a4fb050d1351474
  Author: Megan Gardner <[email protected]>
  Date:   2025-06-18 (Wed, 18 Jun 2025)

  Changed paths:
    A 
LayoutTests/http/tests/scroll-to-text-fragment/generation-selecting-only-whitespace-does-not-crash-expected.txt
    A 
LayoutTests/http/tests/scroll-to-text-fragment/generation-selecting-only-whitespace-does-not-crash.html
    M Source/WebCore/dom/FragmentDirectiveGenerator.cpp

  Log Message:
  -----------
  Attempting to generate a text fragment from only whitespace should not crash 
the web process.
https://bugs.webkit.org/show_bug.cgi?id=294695
rdar://153254264

Reviewed by Abrar Rahman Protyasha.

When trimming whitespace off of a range, I did not verify that
the range did not end up as collapsed. Add some checks to make sure
that the range is not collapsed instead of letting a crash happen.

* 
LayoutTests/http/tests/scroll-to-text-fragment/generation-selecting-only-whitespace-does-not-crash-expected.txt:
 Added.
* 
LayoutTests/http/tests/scroll-to-text-fragment/generation-selecting-only-whitespace-does-not-crash.html:
 Added.
* Source/WebCore/dom/FragmentDirectiveGenerator.cpp:
(WebCore::startVisiblePositionForRangeRemovingLeadingWhitespace):
(WebCore::endVisiblePositionForRangeRemovingTrailingWhitespace):
(WebCore::FragmentDirectiveGenerator::generateFragmentDirective):

Canonical link: https://commits.webkit.org/296402@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to