[webkit-changes] [WebKit/WebKit] bf199b: Add lookalike character sanitization support when ...

Wenson Hsieh noreply at github.com
Wed Feb 22 21:38:30 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bf199b0c5580ca07d3743f614f1346ea6547f2ce
      https://github.com/WebKit/WebKit/commit/bf199b0c5580ca07d3743f614f1346ea6547f2ce
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-02-22 (Wed, 22 Feb 2023)

  Changed paths:
    M Source/WebCore/Modules/async-clipboard/Clipboard.cpp
    M Source/WebCore/dom/DataTransfer.cpp
    M Source/WebCore/editing/Editor.cpp
    M Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
    M Source/WebCore/page/Page.h

  Log Message:
  -----------
  Add lookalike character sanitization support when reading from the pasteboard
https://bugs.webkit.org/show_bug.cgi?id=252772

Reviewed by Tim Horton.

Call into `Page::sanitizeLookalikeCharacters` from a few additional places, when reading plain text
or URL strings from the pasteboard.

* Source/WebCore/Modules/async-clipboard/Clipboard.cpp:
(WebCore::Clipboard::getType):

Sanitize text and URLs before exposing them through the async clipboard API when pasting.

* Source/WebCore/dom/DataTransfer.cpp:
(WebCore::readURLsFromPasteboardAsString):
(WebCore::DataTransfer::getDataForItem const):
(WebCore::DataTransfer::readStringFromPasteboard const):

Sanitize text and URLs before exposing them through DataTransfer when pasting.

* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainText):
* Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::WebContentReader::readPlainText):
(WebCore::WebContentReader::readURL):

Sanitize before inserting pasted text and URLs in editable areas.

* Source/WebCore/page/Page.h:

Change this `enum` to an `enum class`, and add a new value to represent reading from the pasteboard
(as opposed to writing).

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




More information about the webkit-changes mailing list