Browse Source

Don't allow duplicate object in a parsed array

This feature was introduced to fix #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.
Cheng Zhao 10 years ago
parent
commit
609e3ec3ff

+ 1 - 4
atom/common/native_mate_converters/v8_value_converter.cc

@@ -294,10 +294,7 @@ base::Value* V8ValueConverter::FromV8Array(
     if (!val->HasRealIndexedProperty(i))
       continue;
 
-    // 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);
+    base::Value* child = FromV8ValueImpl(state, child_v8, isolate);
     if (child)
       result->Append(child);
     else

+ 0 - 8
spec/api-ipc-spec.coffee

@@ -60,14 +60,6 @@ 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'