Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dd66a76087bf040eddc29668efff80bd3fe885b8
https://github.com/WebKit/WebKit/commit/dd66a76087bf040eddc29668efff80bd3fe885b8
Author: Wenson Hsieh <[email protected]>
Date: 2026-04-30 (Thu, 30 Apr 2026)
Changed paths:
M
LayoutTests/http/tests/text-extraction/debug-text-extraction-subframes-expected.txt
M Source/WebCore/page/text-extraction/TextExtraction.cpp
M Source/WebCore/page/text-extraction/TextExtractionTypes.h
M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
Log Message:
-----------
[AutoFill Debugging] Omit origin for same-origin iframes and shorten
cross-origin iframe origins in debug text
https://bugs.webkit.org/show_bug.cgi?id=313705
rdar://175902701
Reviewed by Abrar Rahman Protyasha.
Follow-up to 305471@main. To further reduce noise in the debug text output of
text extraction, omit
the iframe origin entirely when the iframe is same-origin with its embedding
document, and apply the
same URL-shortening heuristic used for links and image sources when emitting
cross-origin iframe
origins (i.e. drop the scheme prefix and trailing slash).
For example, given a top-level document at `https://webkit.org/` with
same-origin iframe
`https://webkit.org/foo.html` and cross-origin iframe `https://example.com/`,
the debug text
previously emitted:
iframe [...] origin='https://webkit.org/'
iframe [...] origin='https://example.com/'
…and now emits:
iframe [...]
iframe [...] origin='example.com'
Test: TextExtractionTests.SubframeOriginInDebugText
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
*
LayoutTests/http/tests/text-extraction/debug-text-extraction-subframes-expected.txt:
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::shortenedURLString):
Factor the URL-shortening heuristic previously inlined inside the link
extraction
code path into a file-scope helper, so it can also be reused when computing the
shortened origin for iframes.
(WebCore::TextExtraction::extractItemData):
Compute `isSameOriginAsParent` by comparing the iframe's content origin against
the
embedding document's security origin, and populate the shortened origin using
the
helper above when the iframe is cross-origin.
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
Add `shortenedOrigin` and `isSameOriginAsParent` to `IFrameData`, mirroring how
`LinkItemData` carries both `completedURL` and `shortenedURLString`.
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::populateJSONForItem):
(WebKit::addPartsForItem):
Skip emitting the `origin` / `src` attribute entirely for same-origin iframes,
and
emit the pre-shortened origin for cross-origin iframes across all three output
formats (JSON, plain text, and HTML).
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Plumb the new fields through IPC.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::TEST(TextExtractionTests, SubframeOriginInDebugText)):
Add a test to exercise this change.
Canonical link: https://commits.webkit.org/312377@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications