diff options
author | bashi <bashi@chromium.org> | 2015-07-14 17:07:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-15 00:07:42 +0000 |
commit | 5794de27616c0f294e1eff2c7bccaf0ad6933a99 (patch) | |
tree | 971971ae10e0a1c3135d08bacb2cf9386401abc4 /extensions/renderer/messaging_bindings.cc | |
parent | 54c405e5ef445eb423ff7a992b0752afe6fc4222 (diff) | |
download | chromium_src-5794de27616c0f294e1eff2c7bccaf0ad6933a99.zip chromium_src-5794de27616c0f294e1eff2c7bccaf0ad6933a99.tar.gz chromium_src-5794de27616c0f294e1eff2c7bccaf0ad6933a99.tar.bz2 |
extensions: |has_port| could be undefined in DeliverMessageToScriptContext
Similar to crrev.com/b0d8158fa3aa27c4649ba672288c2f7add39f30a
The return value of CallModuleMethod() could be undefined when an
exception was thrown.
BUG=509829
Review URL: https://codereview.chromium.org/1240543002
Cr-Commit-Position: refs/heads/master@{#338778}
Diffstat (limited to 'extensions/renderer/messaging_bindings.cc')
-rw-r--r-- | extensions/renderer/messaging_bindings.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc index dd8b54d..4017309 100644 --- a/extensions/renderer/messaging_bindings.cc +++ b/extensions/renderer/messaging_bindings.cc @@ -451,8 +451,11 @@ void DeliverMessageToScriptContext(const Message& message, v8::Local<v8::Value> has_port = script_context->module_system()->CallModuleMethod("messaging", "hasPort", 1, &port_id_handle); - - CHECK(!has_port.IsEmpty() && has_port->IsBoolean()); + // Could be empty/undefined if an exception was thrown. + // TODO(kalman): Should this be built into CallModuleMethod? + if (IsEmptyOrUndefied(has_port)) + return; + CHECK(has_port->IsBoolean()); if (!has_port.As<v8::Boolean>()->Value()) return; |