diff options
author | bashi <bashi@chromium.org> | 2015-07-07 00:33:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-07 07:34:13 +0000 |
commit | b0d8158fa3aa27c4649ba672288c2f7add39f30a (patch) | |
tree | 350d4eaf726c7ff57c23804f5f211bff5c31e002 /extensions/renderer/v8_helpers.h | |
parent | 1b6bdca04657bf4572e6cb5bc077a3a9834e9c14 (diff) | |
download | chromium_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/v8_helpers.h')
-rw-r--r-- | extensions/renderer/v8_helpers.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extensions/renderer/v8_helpers.h b/extensions/renderer/v8_helpers.h index 012cff8..bafeb2d 100644 --- a/extensions/renderer/v8_helpers.h +++ b/extensions/renderer/v8_helpers.h @@ -51,6 +51,11 @@ inline bool IsTrue(v8::Maybe<bool> maybe) { return maybe.IsJust() && maybe.FromJust(); } +// Returns true if |value| is empty or undefined. +inline bool IsEmptyOrUndefied(v8::Local<v8::Value> value) { + return value.IsEmpty() || value->IsUndefined(); +} + // SetProperty() family wraps V8::Object::Set(). Returns true on success. inline bool SetProperty(v8::Local<v8::Context> context, v8::Local<v8::Object> object, |