InnerText returning cross-origin iframe text

8 views
Skip to first unread message

Salvador Guerrero Ramos

unread,
1:15 PM (6 hours ago) 1:15 PM
to blin...@chromium.org, Siddhartha S
Hi

I've been working on a prototype that uses the Element.innerText API to get text from a web page (I'm calling this API with InnerTextAgent). In some web pages the resulting text includes text from cross-origin iframes (e.g. embedded tweets). My expectation is that this would work similarly to the InnerText JS API, which does not return iframe text.


Is this the right API to use for this scenario? I'd like to replicate the behavior of the JS API.

Dave Tapuska

unread,
1:23 PM (6 hours ago) 1:23 PM
to Salvador Guerrero Ramos, blin...@chromium.org, Siddhartha S
You really need to debug ShouldContentExtractionIncludeIframe

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADBxXZE-fbBq1zRXJq%2Bk57RAVCbom2a%3DNLkgcMKKVss3ifbAhg%40mail.gmail.com.

Salvador Guerrero Ramos

unread,
4:46 PM (3 hours ago) 4:46 PM
to Dave Tapuska, blin...@chromium.org, Siddhartha S
I added log statements to that method as well as its caller InnerTextBuilder::Build. Build() gets the innerText of the HTMLElement it receives, and then iterates through its child_iframes and calls ShouldContentExtractionIncludeIframe on each one. According to the logs the innerText from the argument already contains the iframe text, even before iterating through the iframes.

On Android ShouldContentExtractionIncludeIframe gets called with 3rd party iframes, and it correctly determines that the origins are different so it returns false. On desktop, ShouldContentExtractionIncludeIframe only gets called on about:blank frames.

--Salvador
Reply all
Reply to author
Forward
0 new messages