<ul dir="auto">
<li>Electron version: 1.3.3</li>
<li>Operating system: os x 10.11.4</li>
</ul>
<p dir="auto">Consider this scene:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="let child = {name: 'hello'};
let foo = {id: 1, child: child};
let bar = {id: 2, child: child};
let message = [foo, bar];"><pre class="notranslate"><code class="notranslate">let child = {name: 'hello'};
let foo = {id: 1, child: child};
let bar = {id: 2, child: child};
let message = [foo, bar];
</code></pre></div>
<p dir="auto">i.e. both object <code class="notranslate">boo</code> and <code class="notranslate">bar</code> contains the same object <code class="notranslate">child</code>, when sends the object <code class="notranslate">message</code> from ipcMain to ipcRenderer (or from ipcRenderer to ipcMain),  will get this result:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[
{id:1, child:{name:'hello'}}, 
{id:2, child:null}
]"><pre class="notranslate"><code class="notranslate">[
{id:1, child:{name:'hello'}}, 
{id:2, child:null}
]
</code></pre></div>
<p dir="auto">The property value of 'child' in the second item is <strong>NULL</strong> instead of {name: 'hello'}.</p>
<p dir="auto">But it's ok when send this message by <code class="notranslate">event.returnValue = ...</code> in the ipcMain.on event.</p>
<p dir="auto">I came across a very interesting scenario. There was some missing information in a collection that I sent between two processes.</p>
<p dir="auto">Assume the scenario, Renderer and Process.</p>
<p dir="auto">If I have an array that contains multiple entries of the <strong>same object reference</strong>, only the <strong>first object</strong> will be provided to the receiving side of the message -- the other entries will be <code class="notranslate">null</code>.</p>
<h4 dir="auto">Renderer</h4>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import {ipcRenderer} from 'electron';
var theObject = {foo: 'bar'};
var theList = [theObject, theObject, theObject];
ipcRenderer.send('test', theList);"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span><span class="pl-s1">ipcRenderer</span><span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'electron'</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">theObject</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-c1">foo</span>: <span class="pl-s">'bar'</span><span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">theList</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-s1">theObject</span><span class="pl-kos">,</span> <span class="pl-s1">theObject</span><span class="pl-kos">,</span> <span class="pl-s1">theObject</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-s1">ipcRenderer</span><span class="pl-kos">.</span><span class="pl-en">send</span><span class="pl-kos">(</span><span class="pl-s">'test'</span><span class="pl-kos">,</span> <span class="pl-s1">theList</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h4 dir="auto">Main Process</h4>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import {ipcMain} from 'electron';

ipcMain.on('test', (evt, data) =&gt; {
  console.log(data);
  // this will output [{foo: 'bar'}, null, null];
});"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span><span class="pl-s1">ipcMain</span><span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'electron'</span><span class="pl-kos">;</span>

<span class="pl-s1">ipcMain</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'test'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">evt</span><span class="pl-kos">,</span> <span class="pl-s1">data</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">data</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-c">// this will output [{foo: 'bar'}, null, null];</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<hr>
<p dir="auto">It is only when the object references are distinct from each other does the information remain intact. For example, If we do</p>
<h4 dir="auto">Renderer</h4>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import {ipcRenderer} from 'electron';
var theObject = {foo: 'bar'};
// create new object references for the other two entries, such that all entries are unique by reference
var theList = [theObject, {...theObject}, {...theObject}];
ipcRenderer.send('test', theList);"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span><span class="pl-s1">ipcRenderer</span><span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'electron'</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">theObject</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-c1">foo</span>: <span class="pl-s">'bar'</span><span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-c">// create new object references for the other two entries, such that all entries are unique by reference</span>
<span class="pl-k">var</span> <span class="pl-s1">theList</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-s1">theObject</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>...<span class="pl-s1">theObject</span><span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>...<span class="pl-s1">theObject</span><span class="pl-kos">}</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-s1">ipcRenderer</span><span class="pl-kos">.</span><span class="pl-en">send</span><span class="pl-kos">(</span><span class="pl-s">'test'</span><span class="pl-kos">,</span> <span class="pl-s1">theList</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h4 dir="auto">Main Process</h4>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import {ipcMain} from 'electron';

ipcMain.on('test', (evt, data) =&gt; {
  console.log(data);
  // this will output [{foo: 'bar'}, {foo: 'bar'}, {foo: 'bar'}];
});"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span><span class="pl-s1">ipcMain</span><span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'electron'</span><span class="pl-kos">;</span>

<span class="pl-s1">ipcMain</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'test'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">evt</span><span class="pl-kos">,</span> <span class="pl-s1">data</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">data</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-c">// this will output [{foo: 'bar'}, {foo: 'bar'}, {foo: 'bar'}];</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Then the proper information will be received.</p>
<p dir="auto">I'm not sure if this is a problem with Chromium, and how virtual address space between threads is propagated when sending information between two processes, but clearly a collection of the same object references struggles to be passed around unless they are all distinct references.</p>