const ipcRenderer = require('electron').ipcRenderer;
const CallbacksRegistry = require('electron').CallbacksRegistry;
const v8Util = process.atomBinding('v8_util');
+const IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap;
const callbacksRegistry = new CallbacksRegistry;
var includes = [].includes;
+var remoteObjectCache = new IDWeakMap;
+
// Check for circular reference.
var isCircular = function(field, visited) {
if (typeof field === 'object') {
}
}
+ if (remoteObjectCache.has(meta.id))
+ return remoteObjectCache.get(meta.id);
+
// Track delegate object's life time, and tell the browser to clean up
// when the object is GCed.
v8Util.setDestructor(ret, function() {
// Remember object's id.
v8Util.setHiddenValue(ret, 'atomId', meta.id);
+ remoteObjectCache.set(meta.id, ret);
return ret;
}
};
});
});
+ describe('remote webContents', function() {
+ it('can return same object with different getters', function() {
+ var contents1 = remote.getCurrentWindow().webContents;
+ var contents2 = remote.getCurrentWebContents();
+ assert(contents1 == contents2);
+ });
+ });
+
describe('ipc.sender.send', function() {
it('should work when sending an object containing id property', function(done) {
var obj = {