Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: chrome/renderer/net/net_error_page_controller.cc

Issue 259993003: Make sure gin Handles exist before using them (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/dom_automation_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/net/net_error_page_controller.h" 5 #include "chrome/renderer/net/net_error_page_controller.h"
6 6
7 #include "base/strings/string_piece.h" 7 #include "base/strings/string_piece.h"
8 #include "chrome/renderer/net/net_error_helper.h" 8 #include "chrome/renderer/net/net_error_helper.h"
9 #include "content/public/renderer/render_frame.h" 9 #include "content/public/renderer/render_frame.h"
10 #include "gin/handle.h" 10 #include "gin/handle.h"
(...skipping 10 matching lines...) Expand all
21 v8::HandleScope handle_scope(isolate); 21 v8::HandleScope handle_scope(isolate);
22 v8::Handle<v8::Context> context = 22 v8::Handle<v8::Context> context =
23 render_frame->GetWebFrame()->mainWorldScriptContext(); 23 render_frame->GetWebFrame()->mainWorldScriptContext();
24 if (context.IsEmpty()) 24 if (context.IsEmpty())
25 return; 25 return;
26 26
27 v8::Context::Scope context_scope(context); 27 v8::Context::Scope context_scope(context);
28 28
29 gin::Handle<NetErrorPageController> controller = gin::CreateHandle( 29 gin::Handle<NetErrorPageController> controller = gin::CreateHandle(
30 isolate, new NetErrorPageController(render_frame)); 30 isolate, new NetErrorPageController(render_frame));
31 if (controller.IsEmpty())
32 return;
33
31 v8::Handle<v8::Object> global = context->Global(); 34 v8::Handle<v8::Object> global = context->Global();
32 global->Set(gin::StringToV8(isolate, "errorPageController"), 35 global->Set(gin::StringToV8(isolate, "errorPageController"),
33 controller.ToV8()); 36 controller.ToV8());
34 } 37 }
35 38
36 bool NetErrorPageController::LoadStaleButtonClick() { 39 bool NetErrorPageController::LoadStaleButtonClick() {
37 if (!render_frame()) 40 if (!render_frame())
38 return false; 41 return false;
39 42
40 NetErrorHelper* net_error_helper = 43 NetErrorHelper* net_error_helper =
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 isolate) 83 isolate)
81 .SetMethod("loadStaleButtonClick", 84 .SetMethod("loadStaleButtonClick",
82 &NetErrorPageController::LoadStaleButtonClick) 85 &NetErrorPageController::LoadStaleButtonClick)
83 .SetMethod("reloadButtonClick", 86 .SetMethod("reloadButtonClick",
84 &NetErrorPageController::ReloadButtonClick) 87 &NetErrorPageController::ReloadButtonClick)
85 .SetMethod("moreButtonClick", 88 .SetMethod("moreButtonClick",
86 &NetErrorPageController::MoreButtonClick); 89 &NetErrorPageController::MoreButtonClick);
87 } 90 }
88 91
89 void NetErrorPageController::OnDestruct() {} 92 void NetErrorPageController::OnDestruct() {}
OLDNEW
« no previous file with comments | « no previous file | content/renderer/dom_automation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698