• Ehsan Karamad's avatar
    [ MimeHandlerView ] Cleaning up MimeHandlerViewEmbedder when disallowed · 841c2e84
    Ehsan Karamad authored
    The process of creating MimeHandlerView is:
      * Navigation to resource starts
      * MimeHandlerViewEmbedder is created
      * HTMLPlugInElement::UpdatePlugin is called
      * MimeHandlerViewContainerManager is notified
      * HTMLPlugInElement creates a frame
      * MimeHandlerViewEmbedder observes the new frame and attaches
        GuestView, and destroys itself.
    
    These steps are legitimately disturbed when the embedder is not
    authorized to load plugins (e.g., in <webview> when using permissions).
    In such cases, the update from HTMLPlugInElement does not reach the
    MimeHandlerViewContainerManager and also a plugin frame is not created.
    Therefore, MimeHandlerViewEmbedder does not get destroyed.
    
    This CL will change the update process so that even for blocked plugins
    the MHVCM is notified (of the failure) which gives it a chance to notify
    the browser in turn and clean up the MimeHandlerViewEmbedder.
    
    In line with the change, the test:
      WebViewPluginTest.TestLoadPluginInternalResource
    is modified to assert no MimeHandlerViewEmbedders are lying around.
    
    Bug: 967045
    Change-Id: Ic63a980883240fe8098a4ee8d5e3ae3b9cc46415
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1629071Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
    Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
    Reviewed-by: default avatarEhsan Karamad <ekaramad@chromium.org>
    Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
    Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
    Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#663982}
    841c2e84
chrome_extensions_renderer_client.cc 15.8 KB