]> khamidou — GitHub mirrors - electron.git/commitdiff
Don't allow duplicate object in a parsed array
authorCheng Zhao <zcbenz@gmail.com>
Thu, 8 Jan 2015 07:20:03 +0000 (23:20 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 8 Jan 2015 07:20:03 +0000 (23:20 -0800)
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.

atom/common/native_mate_converters/v8_value_converter.cc
spec/api-ipc-spec.coffee

index 4d808b356bc715320193985a90e7674fec5e64cd..d40bc33dec726896071e549e70a82872173b951c 100644 (file)
@@ -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
index 826b094e5341dd1ad3607b77da9a15c4e6a86243..c63997af7e784c0e0d86fb7a7824ec5991cf222b 100644 (file)
@@ -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'