summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/messaging_bindings.cc
diff options
context:
space:
mode:
authorbashi <bashi@chromium.org>2015-07-07 00:33:25 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-07 07:34:13 +0000
commitb0d8158fa3aa27c4649ba672288c2f7add39f30a (patch)
tree350d4eaf726c7ff57c23804f5f211bff5c31e002 /extensions/renderer/messaging_bindings.cc
parent1b6bdca04657bf4572e6cb5bc077a3a9834e9c14 (diff)
downloadchromium_src-b0d8158fa3aa27c4649ba672288c2f7add39f30a.zip
chromium_src-b0d8158fa3aa27c4649ba672288c2f7add39f30a.tar.gz
chromium_src-b0d8158fa3aa27c4649ba672288c2f7add39f30a.tar.bz2
extensions: Add undefined check in DispatchOnConnectToScriptContext()
CallModuleMethod() could return undefined so call site should check it before casting a specific type. BUG=505904 Review URL: https://codereview.chromium.org/1221923002 Cr-Commit-Position: refs/heads/master@{#337566}
Diffstat (limited to 'extensions/renderer/messaging_bindings.cc')
-rw-r--r--extensions/renderer/messaging_bindings.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc
index cbdd283..dd8b54d 100644
--- a/extensions/renderer/messaging_bindings.cc
+++ b/extensions/renderer/messaging_bindings.cc
@@ -54,6 +54,7 @@ namespace extensions {
using v8_helpers::ToV8String;
using v8_helpers::ToV8StringUnsafe;
+using v8_helpers::IsEmptyOrUndefied;
namespace {
@@ -429,7 +430,7 @@ void DispatchOnConnectToScriptContext(
script_context->module_system()->CallModuleMethod(
"messaging", "dispatchOnConnect", arraysize(arguments), arguments);
- if (!retval.IsEmpty()) {
+ if (!IsEmptyOrUndefied(retval)) {
CHECK(retval->IsBoolean());
*port_created |= retval.As<v8::Boolean>()->Value();
} else {