Javascript Integration - Passing empty array in JS now maps to empty list/array instead of null (#2829)

* Set empty list instead of null

* Added QUnit Test for testing Empty Array
This commit is contained in:
Angshuman Agarwal
2019-07-20 03:17:44 +01:00
committed by Alex Maitland
parent b072d97c1b
commit 48eaff87dc
2 changed files with 15 additions and 7 deletions
@@ -1,4 +1,4 @@
// Copyright © 2015 The CefSharp Authors. All rights reserved.
// Copyright © 2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
@@ -59,20 +59,17 @@ namespace CefSharp
{
int arrLength = obj->GetArrayLength();
std::vector<CefString> keys;
auto array = CefListValue::Create();
if (arrLength > 0 && obj->GetKeys(keys))
{
auto array = CefListValue::Create();
for (int i = 0; i < arrLength; i++)
{
SerializeV8Object(obj->GetValue(keys[i]), array, i, callbackRegistry, seen);
}
list->SetList(index, array);
}
else
{
list->SetNull(index);
}
list->SetList(index, array);
}
else if (obj->IsFunction())
{