summaryrefslogtreecommitdiff
path: root/fxjs/cjs_color.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-10-12 18:49:02 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-12 18:49:02 +0000
commit88dbd543bd0efe6acac20438037616e66b35e47b (patch)
treee5ea722802e9d276a259127708417834edd68ac8 /fxjs/cjs_color.cpp
parent96b124c8143753b0103f93029a1bfe8cc9d5ca36 (diff)
downloadpdfium-88dbd543bd0efe6acac20438037616e66b35e47b.tar.xz
Add test for CJS_Color properties.
Return a more precise error in one case. Change-Id: I21e4ef6b30be5f44d35922640643bffb9cb4b5e4 Reviewed-on: https://pdfium-review.googlesource.com/c/43950 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_color.cpp')
-rw-r--r--fxjs/cjs_color.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/fxjs/cjs_color.cpp b/fxjs/cjs_color.cpp
index bba4513b67..06c61f87d4 100644
--- a/fxjs/cjs_color.cpp
+++ b/fxjs/cjs_color.cpp
@@ -258,9 +258,12 @@ CJS_Result CJS_Color::GetPropertyHelper(CJS_Runtime* pRuntime, CFX_Color* var) {
CJS_Result CJS_Color::SetPropertyHelper(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp,
CFX_Color* var) {
- if (vp.IsEmpty() || !vp->IsArray())
+ if (vp.IsEmpty())
return CJS_Result::Failure(JSMessage::kParamError);
+ if (!vp->IsArray())
+ return CJS_Result::Failure(JSMessage::kTypeError);
+
*var = ConvertArrayToPWLColor(pRuntime, pRuntime->ToArray(vp));
return CJS_Result::Success();
}