Resolve request mapping issues with swapped out frames and browser-side navigation (issue #2290)

This commit is contained in:
Marshall Greenblatt
2017-10-26 14:17:00 -04:00
parent 2733a561e4
commit 4787b45db2
16 changed files with 245 additions and 286 deletions

View File

@@ -26,7 +26,6 @@
#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_view.h"
#include "content/renderer/navigation_state_impl.h"
#include "content/renderer/render_view_impl.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLError.h"
@@ -413,12 +412,6 @@ void CefBrowserImpl::AddFrameObject(int64_t frame_id,
manager->Add(tracked_object);
}
bool CefBrowserImpl::is_swapped_out() const {
content::RenderViewImpl* render_view_impl =
static_cast<content::RenderViewImpl*>(render_view());
return (!render_view_impl || render_view_impl->is_swapped_out());
}
// RenderViewObserver methods.
// -----------------------------------------------------------------------------
@@ -668,9 +661,6 @@ void CefBrowserImpl::OnResponseAck(int request_id) {
}
void CefBrowserImpl::OnLoadingStateChange(bool isLoading) {
if (is_swapped_out())
return;
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (app.get()) {
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
@@ -689,9 +679,6 @@ void CefBrowserImpl::OnLoadingStateChange(bool isLoading) {
}
void CefBrowserImpl::OnLoadStart(blink::WebLocalFrame* frame) {
if (is_swapped_out())
return;
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (app.get()) {
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
@@ -706,9 +693,6 @@ void CefBrowserImpl::OnLoadStart(blink::WebLocalFrame* frame) {
}
void CefBrowserImpl::OnLoadEnd(blink::WebLocalFrame* frame) {
if (is_swapped_out())
return;
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (app.get()) {
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
@@ -726,9 +710,6 @@ void CefBrowserImpl::OnLoadEnd(blink::WebLocalFrame* frame) {
void CefBrowserImpl::OnLoadError(blink::WebLocalFrame* frame,
const blink::WebURLError& error) {
if (is_swapped_out())
return;
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (app.get()) {
CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();

View File

@@ -105,8 +105,6 @@ class CefBrowserImpl : public CefBrowser, public content::RenderViewObserver {
return content::RenderViewObserver::render_view();
}
bool is_swapped_out() const;
// RenderViewObserver methods.
void OnDestruct() override;
void DidStartLoading() override;

View File

@@ -73,7 +73,6 @@
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_view_visitor.h"
#include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_widget.h"
#include "extensions/common/switches.h"
#include "extensions/renderer/renderer_extension_registry.h"
@@ -837,27 +836,18 @@ void CefContentRendererClient::BrowserCreated(
if (!render_view || !render_frame)
return;
// Swapped out RenderWidgets will be created in the parent/owner process for
// frames that are hosted in a separate process (e.g. guest views or OOP
// frames). Don't create any CEF objects for swapped out RenderWidgets.
content::RenderFrameImpl* render_frame_impl =
static_cast<content::RenderFrameImpl*>(render_frame);
if (render_frame_impl->GetRenderWidget()->is_swapped_out())
return;
// Don't create another browser or guest view object if one already exists for
// the view.
if (GetBrowserForView(render_view).get() || HasGuestViewForView(render_view))
return;
const int render_view_routing_id = render_view->GetRoutingID();
const int render_frame_routing_id = render_frame->GetRoutingID();
// Retrieve the browser information synchronously. This will also register
// the routing ids with the browser info object in the browser process.
CefProcessHostMsg_GetNewBrowserInfo_Params params;
content::RenderThread::Get()->Send(new CefProcessHostMsg_GetNewBrowserInfo(
render_view_routing_id, render_frame_routing_id, &params));
render_frame_routing_id, &params));
if (params.browser_id == 0) {
// The popup may have been canceled during creation.
return;