diff options
author | bashi <bashi@chromium.org> | 2015-06-29 22:44:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-30 05:45:07 +0000 |
commit | facd48b87e81813aabcb7bccd7ae98d6db089cd6 (patch) | |
tree | 66becb105cf71f4ea01a129932ea197479e35ae5 /extensions/renderer/guest_view | |
parent | 309e0545fa27c4469a673d4057a8d4e280bbdda1 (diff) | |
download | chromium_src-facd48b87e81813aabcb7bccd7ae98d6db089cd6.zip chromium_src-facd48b87e81813aabcb7bccd7ae98d6db089cd6.tar.gz chromium_src-facd48b87e81813aabcb7bccd7ae98d6db089cd6.tar.bz2 |
extensions: Use V8 Maybe version of GetFunction()
Also use As<v8::Object>() for return value of gin::CreateHandle()
because it should always be an object.
BUG=479065
Review URL: https://codereview.chromium.org/1208333002
Cr-Commit-Position: refs/heads/master@{#336731}
Diffstat (limited to 'extensions/renderer/guest_view')
-rw-r--r-- | extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc index fb95d21..e351282 100644 --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc @@ -43,7 +43,9 @@ class ScriptableObject : public gin::Wrappable<ScriptableObject>, base::WeakPtr<MimeHandlerViewContainer> container) { ScriptableObject* scriptable_object = new ScriptableObject(isolate, container); - return gin::CreateHandle(isolate, scriptable_object).ToV8()->ToObject(); + return gin::CreateHandle(isolate, scriptable_object) + .ToV8() + .As<v8::Object>(); } // gin::NamedPropertyInterceptor @@ -58,8 +60,13 @@ class ScriptableObject : public gin::Wrappable<ScriptableObject>, isolate, base::Bind(&MimeHandlerViewContainer::PostMessage, container_, isolate))); } - return v8::Local<v8::FunctionTemplate>::New( - isolate, post_message_function_template_)->GetFunction(); + v8::Local<v8::FunctionTemplate> function_template = + v8::Local<v8::FunctionTemplate>::New(isolate, + post_message_function_template_); + v8::Local<v8::Function> function; + if (function_template->GetFunction(isolate->GetCurrentContext()) + .ToLocal(&function)) + return function; } return v8::Local<v8::Value>(); } |