[seed] Fixing _to_boolean conversion in seed
- From: Danilo Cesar Lemes de Paula <danilocesar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Fixing _to_boolean conversion in seed
- Date: Wed, 24 Aug 2016 17:57:49 +0000 (UTC)
commit 3681229231fc00cc6fed442a3c2a357bb1088e7b
Author: Danilo Cesar Lemes de Paula <danilo cesar collabora co uk>
Date: Wed Aug 24 14:54:33 2016 -0300
Fixing _to_boolean conversion in seed
According to ECMA 262 3th edition SPEC [1], _to_boolean should return:
FALSE when the argument is NULL OR Undefined.
This fix should cover that and get ride of some warnings/exceptions.
[1]
http://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%203rd%20edition,%20December%201999.pdf
* section 9
libseed/seed-types.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 9f5449b..a937f78 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -1760,7 +1760,7 @@ gboolean
seed_value_to_boolean(JSContextRef ctx, JSValueRef val, JSValueRef* exception)
{
if (!JSValueIsBoolean(ctx, val) && !JSValueIsNumber(ctx, val)) {
- if (!JSValueIsNull(ctx, val)) {
+ if (!JSValueIsNull(ctx, val) && !JSValueIsUndefined(ctx, val)) {
seed_make_exception(eng->context, exception, "ConversionError",
"Can not convert Javascript value to boolean");
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]