Skip to content

Commit ccbf730

Browse files
committed
check frame in GetCurrentRenderView
1 parent c5230db commit ccbf730

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/api/bindings_common.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using blink::WebView;
4040
namespace {
4141
RenderView* GetRenderView(v8::Handle<v8::Context> ctx) {
4242
WebLocalFrame* frame = WebLocalFrame::frameForContext(ctx);
43-
if (!frame)
43+
if (!frame || !frame->isNodeJS())
4444
return NULL;
4545

4646
WebView* view = frame->view();

src/api/dispatcher_bindings.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,13 @@ void DispatcherBindings::CallStaticMethod(
453453
// static
454454
void DispatcherBindings::CrashRenderer(
455455
const v8::FunctionCallbackInfo<v8::Value>& args) {
456+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
457+
RenderView* render_view = GetCurrentRenderView();
458+
if (!render_view) {
459+
args.GetReturnValue().Set(isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(isolate,
460+
"Unable to get render view in CallObjectMethod"))));
461+
return;
462+
}
456463
int* ptr = NULL;
457464
*ptr = 1;
458465
}

0 commit comments

Comments
 (0)