Index: content/browser/frame_host/render_frame_host_manager.cc |
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc |
index 29771b2ab65da73c748a60643a0634acce2ec5a2..2cca8ac3b753e38a64709a43ff524495885189c4 100644 |
--- a/content/browser/frame_host/render_frame_host_manager.cc |
+++ b/content/browser/frame_host/render_frame_host_manager.cc |
@@ -460,9 +460,21 @@ void RenderFrameHostManager::CommitPendingIfNecessary( |
if (render_frame_host == speculative_render_frame_host_.get()) { |
CommitPending(); |
} else if (render_frame_host == render_frame_host_.get()) { |
- // TODO(carlosk): this code doesn't properly handle in-page navigation or |
- // interwoven navigation requests. |
- DCHECK(!speculative_render_frame_host_); |
+ DCHECK(!should_reuse_web_ui_ || web_ui_); |
+ // When the current RenderFrameHost is committing there's still the |
+ // possibility that there is a speculative WebUI to be made active. |
+ // But if there's also a speculative RenderFrameHost set it means the |
+ // WebUI was not meant for the current one. |
+ // TODO(carlosk): this code might not handle interwoven navigation |
+ // requests properly. For example if two navigations, both to the current |
clamy
2015/04/01 15:53:40
nit: "if two navigations to the current RenderFram
carlosk
2015/04/01 18:39:21
Done.
|
+ // RenderFrameHost, requested closely to each other, one requiring a new |
+ // WebUI and the other requiring none, it might happen that a WebUI is set |
+ // when it shouldn't or the other way around. |
+ if (speculative_web_ui_ && !speculative_render_frame_host_) { |
+ CommitPending(); |
+ } else { |
+ CleanUpNavigation(); |
+ } |
} else { |
// No one else should be sending us a DidNavigate in this state. |
DCHECK(false); |
@@ -1637,9 +1649,17 @@ void RenderFrameHostManager::CommitPending() { |
} |
} else { |
// PlzNavigate |
- if (!should_reuse_web_ui_) |
+ if (speculative_web_ui_) { |
+ DCHECK(!should_reuse_web_ui_); |
web_ui_.reset(speculative_web_ui_.release()); |
+ } else if (should_reuse_web_ui_) { |
+ DCHECK(web_ui_); |
+ should_reuse_web_ui_ = false; |
+ } else { |
+ web_ui_.reset(); |
+ } |
DCHECK(!speculative_web_ui_); |
+ DCHECK(!should_reuse_web_ui_); |
} |
// It's possible for the pending_render_frame_host_ to be nullptr when we |