Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 616ee3ad0af62e8881afda4b94d4bef09198682f
      
https://github.com/WebKit/WebKit/commit/616ee3ad0af62e8881afda4b94d4bef09198682f
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-text-plain-prefix-format-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-text-plain-prefix-format.html
    M Source/WebCore/dom/DataTransfer.cpp

  Log Message:
  -----------
  DataTransfer treats any format starting with "text/plain" (e.g. 
"text/plainfoo") as text/plain
https://bugs.webkit.org/show_bug.cgi?id=326468
rdar://189265567

Reviewed by Ryosuke Niwa.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

normalizeType() mapped every format that started with "text/plain" to 
text/plain,
because the check had no ";". As a result, setData("text/plainfoo", ...) 
overwrote
the text/plain item, getData("text/plainfoo") returned the text/plain data, and
clearData("text/plainfoo") removed text/plain.

The HTML spec only normalizes the exact strings "text" and "url". This patch
matches "text/plain" exactly, or requires a ";" after "text/plain", the same way
the text/uri-list and text/html checks next to it already do. This matches 
Blink.
Formats with MIME parameters, such as "text/plain;charset=utf-8", still map to
text/plain.

Test: 
imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-text-plain-prefix-format.html

* 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-text-plain-prefix-format-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-text-plain-prefix-format.html:
 Added.
* Source/WebCore/dom/DataTransfer.cpp:
(WebCore::normalizeType):

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



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

Reply via email to