Skip to content

Commit 609e3ec

Browse files
committed
Don't allow duplicate object in a parsed array
This feature was introduced to fix electron#874 but caused the converter to go through a deep nested object sometimes, which made program crash on Windows. So we have to revert the fix even though it makes a regression. Fixes atom/atom#4904.
1 parent 640c8f8 commit 609e3ec

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

atom/common/native_mate_converters/v8_value_converter.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,7 @@ base::Value* V8ValueConverter::FromV8Array(
294294
if (!val->HasRealIndexedProperty(i))
295295
continue;
296296

297-
// When parsing elements in an array, we use a new state so we can have the
298-
// same object showed twice in array.
299-
FromV8ValueState new_state;
300-
base::Value* child = FromV8ValueImpl(&new_state, child_v8, isolate);
297+
base::Value* child = FromV8ValueImpl(state, child_v8, isolate);
301298
if (child)
302299
result->Append(child);
303300
else

spec/api-ipc-spec.coffee

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ describe 'ipc module', ->
6060
done()
6161
ipc.send 'message', obj
6262

63-
it 'should work when sending the same object twice in one message', (done) ->
64-
obj = key: 'some'
65-
ipc.once 'message', (message) ->
66-
assert.deepEqual message[0], obj
67-
assert.deepEqual message[1], obj
68-
done()
69-
ipc.send 'message', [obj, obj]
70-
7163
describe 'ipc.sendSync', ->
7264
it 'can be replied by setting event.returnValue', ->
7365
msg = ipc.sendSync 'echo', 'test'

0 commit comments

Comments
 (0)