Allow same object to appear in one list when parsing V8 array

Fixes #874.
This commit is contained in:
Cheng Zhao 2014-12-16 16:57:42 -08:00
parent 95dd73bd1d
commit 4fc14959a8
2 changed files with 12 additions and 1 deletions

View file

@ -294,7 +294,10 @@ base::Value* V8ValueConverter::FromV8Array(
if (!val->HasRealIndexedProperty(i))
continue;
base::Value* child = FromV8ValueImpl(state, child_v8, isolate);
// When parsing elements in an array, we use a new state so we can have the
// same object showed twice in array.
FromV8ValueState new_state;
base::Value* child = FromV8ValueImpl(&new_state, child_v8, isolate);
if (child)
result->Append(child);
else

View file

@ -60,6 +60,14 @@ describe 'ipc module', ->
done()
ipc.send 'message', obj
it 'should work when sending the same object twice in one message', (done) ->
obj = key: 'some'
ipc.once 'message', (message) ->
assert.deepEqual message[0], obj
assert.deepEqual message[1], obj
done()
ipc.send 'message', [obj, obj]
describe 'ipc.sendSync', ->
it 'can be replied by setting event.returnValue', ->
msg = ipc.sendSync 'echo', 'test'