Bug 234446 - ModalContainerObserver should search for text in subframes
Summary: ModalContainerObserver should search for text in subframes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks: 234695
  Show dependency treegraph
 
Reported: 2021-12-17 15:19 PST by Wenson Hsieh
Modified: 2022-01-04 14:00 PST (History)
6 users (show)

See Also:


Attachments
Patch (16.61 KB, patch)
2021-12-26 12:14 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Rebase on trunk (16.55 KB, patch)
2022-01-02 15:18 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2021-12-17 15:19:24 PST
.
Comment 1 Radar WebKit Bug Importer 2021-12-24 15:20:46 PST
<rdar://problem/86897770>
Comment 2 Wenson Hsieh 2021-12-26 12:14:14 PST
Created attachment 447988 [details]
Patch
Comment 3 Wenson Hsieh 2022-01-02 15:18:59 PST
Created attachment 448188 [details]
Rebase on trunk
Comment 4 Tim Horton 2022-01-04 13:08:32 PST
Comment on attachment 448188 [details]
Rebase on trunk

View in context: https://bugs.webkit.org/attachment.cgi?id=448188&action=review

> Source/WebCore/page/ModalContainerObserver.cpp:67
> -    if (!document.url().protocolIsInHTTPFamily())
> +    if (!document.topDocument().url().protocolIsInHTTPFamily())

Should this check both documents? (I'm not sure what the HTTP-family check is *for*, so the answer could easily be yes OR no, I'm not sure)
Comment 5 Wenson Hsieh 2022-01-04 13:26:37 PST
Comment on attachment 448188 [details]
Rebase on trunk

View in context: https://bugs.webkit.org/attachment.cgi?id=448188&action=review

Thanks for the review!

>> Source/WebCore/page/ModalContainerObserver.cpp:67
>> +    if (!document.topDocument().url().protocolIsInHTTPFamily())
> 
> Should this check both documents? (I'm not sure what the HTTP-family check is *for*, so the answer could easily be yes OR no, I'm not sure)

Good question! So I *think* the top document URL check should suffice.

As far as I understand, this check is here because the feature that this "modal container observation" mechanism drives is only intended to take effect when navigating to http URLs, as opposed to file:// or any custom schemes, so this basically just acts as a way to short circuit the detection logic early on in the case where the document isn't HTTP/HTTPS.

In the subframe case in particular, the..."semantically interesting" content of the modal container can come in the form of a data: URL on the iframe or the `srcdoc` attribute, in which case the URL will not be in the HTTP family (but we'll still need to descend into these frames for the purposes of modal container detection) — so in the case where the sub-document is non-HTTP-family, we don't want to bail early here.
Comment 6 EWS 2022-01-04 14:00:00 PST
Committed r287588 (245717@main): <https://commits.webkit.org/245717@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 448188 [details].