diff options
author | sammc <sammc@chromium.org> | 2015-01-15 20:38:53 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-16 04:40:02 +0000 |
commit | 02d138dca286c1429d1f1f6fa2dbcdd6d4304bd0 (patch) | |
tree | 8fa30ece8aefd7466a7d4f458f5a0aee31024576 /extensions/renderer/guest_view | |
parent | 6f35f92af0e73d407b3ebde95019e93775631a5d (diff) | |
download | chromium_src-02d138dca286c1429d1f1f6fa2dbcdd6d4304bd0.zip chromium_src-02d138dca286c1429d1f1f6fa2dbcdd6d4304bd0.tar.gz chromium_src-02d138dca286c1429d1f1f6fa2dbcdd6d4304bd0.tar.bz2 |
Abort streams when the containing RenderFrameHost navigates or closes.
Previously, streams used by MimeHandlerViewGuest can be leaked if the
guest is closed before it finishes reading from the stream, blocking
further access to that resource. This CL adds tracking of
RenderFrameHosts containing MimeHandlerViewGuests and aborts the
corresponding streams when the containing RenderFrameHost navigates or
closes.
BUG=436345
Review URL: https://codereview.chromium.org/834113003
Cr-Commit-Position: refs/heads/master@{#311839}
Diffstat (limited to 'extensions/renderer/guest_view')
-rw-r--r-- | extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc | 13 | ||||
-rw-r--r-- | extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h | 8 |
2 files changed, 8 insertions, 13 deletions
diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc index 85f6930..a7c19b2 100644 --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc @@ -112,7 +112,7 @@ void MimeHandlerViewContainer::DidFinishLoading() { void MimeHandlerViewContainer::DidReceiveData(const char* data, int data_length) { - html_string_ += std::string(data, data_length); + view_id_ += std::string(data, data_length); } bool MimeHandlerViewContainer::OnMessageReceived(const IPC::Message& message) { @@ -142,7 +142,7 @@ void MimeHandlerViewContainer::didReceiveData(blink::WebURLLoader* /* unused */, const char* data, int data_length, int /* unused */) { - html_string_ += std::string(data, data_length); + view_id_ += std::string(data, data_length); } void MimeHandlerViewContainer::didFinishLoading( @@ -226,17 +226,12 @@ void MimeHandlerViewContainer::OnMimeHandlerViewGuestOnLoadCompleted( } void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() { - // The loader has completed loading |html_string_| so we can dispose it. + // The loader has completed loading |view_id_| so we can dispose it. loader_.reset(); - // Parse the stream URL to ensure it's valid. - GURL stream_url(html_string_); - DCHECK(!stream_url.spec().empty()); - DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone); render_frame()->Send(new ExtensionHostMsg_CreateMimeHandlerViewGuest( - render_frame()->GetRoutingID(), stream_url.spec(), original_url_.spec(), - mime_type_, element_instance_id())); + render_frame()->GetRoutingID(), view_id_, element_instance_id())); } } // namespace extensions diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h index 2fca1fb..aaad340 100644 --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ -#define EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ +#ifndef EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ +#define EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ #include "base/memory/linked_ptr.h" #include "base/memory/weak_ptr.h" @@ -73,7 +73,7 @@ class MimeHandlerViewContainer : public GuestViewContainer, const std::string mime_type_; // The URL of the extension to navigate to. - std::string html_string_; + std::string view_id_; // Whether the plugin is embedded or not. bool is_embedded_; @@ -107,4 +107,4 @@ class MimeHandlerViewContainer : public GuestViewContainer, } // namespace extensions -#endif // EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ +#endif // EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ |