• Ehsan Karamad's avatar
    [ MimeHandlerView ] Fix cross-origin postMessage · 1c63176f
    Ehsan Karamad authored
    When a.com embeds a PDF in b.com, {embed, object}.postMessages sends the
    messages from a.com to the WebRemoteFrame corresponding to the GuestView.
    
    On the browser side, the target RenderFrameHost is determined to be the outer
    WebContents's frame that is used to attach MimeHandlerViewGuest. This means
    at the end of routing, the IPC ends up going to a dead RenderFrameHost (dropped
    on the way since there is no RenderFrame to handle it).
    
    This CL fixes this issue by a) checking if target RenderFrameHost is live, and
    b) if not try to find an inner delegate or drop the message.
    
    Note that this CL fixes several tests which currently fail (or timeout) with
    --enable-features=MimeHandlerViewInCrossProcessFrame (the list of such tests
    is included in the linked bug). This CL fixes some of those tests and together
    with https://crrev.com/c/1607425 should make most tests including all of the
    PDFExtensionTest* pass (with the flag).
    
    Bug: 961786
    Change-Id: I876b971f40d54f3386e23b9750420bbfc1bbbe01
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606769
    Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
    Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
    Reviewed-by: default avatarŁukasz Anforowicz <lukasza@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#659259}
    1c63176f
web_contents_impl.h 83.4 KB