Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 308f0d6959afbde603dfff151fb8dc02d4b170b5..4120e19007d764c2499334530b2508725849baaf 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -374,6 +374,9 @@ static RenderViewImpl* FromRoutingID(int32 routing_id) { |
} |
static WebKit::WebFrame* FindFrameByID(WebKit::WebFrame* root, int frame_id) { |
+ if (frame_id == -1) |
+ return root; |
+ |
for (WebFrame* frame = root; frame; frame = frame->traverseNext(false)) { |
if (frame->identifier() == frame_id) |
return frame; |
@@ -3820,6 +3823,9 @@ void RenderViewImpl::CreateFrameTree(WebKit::WebFrame* frame, |
} |
WebKit::WebFrame* RenderViewImpl::GetFrameByMappedID(int frame_id) { |
+ if (frame_id == -1) |
+ return webview()->mainFrame(); |
+ |
std::map<int, int>::iterator it = active_frame_id_map_.find(frame_id); |
if (it == active_frame_id_map_.end()) |
return NULL; |
@@ -6152,10 +6158,15 @@ void RenderViewImpl::OnUpdatedFrameTree( |
int process_id, |
int route_id, |
const std::string& frame_tree) { |
+ if (frame_tree.empty()) |
+ return; |
+ |
base::DictionaryValue* frames = NULL; |
scoped_ptr<base::Value> tree(base::JSONReader::Read(frame_tree)); |
- if (tree.get() && tree->IsType(base::Value::TYPE_DICTIONARY)) |
- tree->GetAsDictionary(&frames); |
+ if (tree.get() && tree->IsType(base::Value::TYPE_DICTIONARY)) { |
+ if (!tree->GetAsDictionary(&frames)) |
+ return; |
+ } |
updating_frame_tree_ = true; |
active_frame_id_map_.clear(); |