[webkit-changes] [WebKit/WebKit] 4a5699: URL text fragment directives not fully stripped fr...

megangardner noreply at github.com
Tue Mar 19 15:16:00 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a5699e1eec867490b0a1dad99e74b76a2e21029
      https://github.com/WebKit/WebKit/commit/4a5699e1eec867490b0a1dad99e74b76a2e21029
  Author: Megan Gardner <megan_gardner at apple.com>
  Date:   2024-03-19 (Tue, 19 Mar 2024)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html
    M Source/WTF/wtf/URL.cpp
    M Source/WTF/wtf/URL.h
    M Source/WebCore/dom/Document.cpp

  Log Message:
  -----------
  URL text fragment directives not fully stripped from Javascript
https://bugs.webkit.org/show_bug.cgi?id=271017
rdar://107326333

Reviewed by Ryosuke Niwa.

When re-adding the fragment to the URL after consuming any STTF parts,
we were not testing to see if the fragment was fully consumed or not.
Since empty fragments are used for many cases
there was no testing to see if the fragment was empty before adding the
'#' back with an empty fragment, so we would end up with a URL with a '#'
and an empty fragment when the page was navigated to with a STTF.
In this case, we do not want an empty fragment, so we should clear the
fragment instead of setting it when there is nothing left of the fragment
after consumption.

* LayoutTests/imported/w3c/web-platform-tests/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html:
* Source/WTF/wtf/URL.cpp:
(WTF::URL::consumeFragmentDirective):
(WTF::URL::setFragmentIdentifier):
(WTF::URL::consumefragmentDirective): Deleted.
* Source/WTF/wtf/URL.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setURL):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list