Remove a few CoffeeScript generated junks

This commit is contained in:
Cheng Zhao 2016-02-22 14:15:51 +08:00
parent 59d6e7d6ef
commit d4c954870a

View file

@ -11,8 +11,6 @@ const FUNCTION_PROPERTIES = [
'length', 'name', 'arguments', 'caller', 'prototype', 'length', 'name', 'arguments', 'caller', 'prototype',
]; ];
var slice = [].slice;
// Return the description of object's members: // Return the description of object's members:
let getObjectMemebers = function(object) { let getObjectMemebers = function(object) {
let names = Object.getOwnPropertyNames(object); let names = Object.getOwnPropertyNames(object);
@ -281,14 +279,13 @@ ipcMain.on('ATOM_BROWSER_CURRENT_WEB_CONTENTS', function(event) {
}); });
ipcMain.on('ATOM_BROWSER_CONSTRUCTOR', function(event, id, args) { ipcMain.on('ATOM_BROWSER_CONSTRUCTOR', function(event, id, args) {
var constructor, obj;
try { try {
args = unwrapArgs(event.sender, args); args = unwrapArgs(event.sender, args);
constructor = objectsRegistry.get(id); let constructor = objectsRegistry.get(id);
// Call new with array of arguments. // Call new with array of arguments.
// http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible // http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible
obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))); let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)));
return event.returnValue = valueToMeta(event.sender, obj); return event.returnValue = valueToMeta(event.sender, obj);
} catch (error) { } catch (error) {
return event.returnValue = exceptionToMeta(error); return event.returnValue = exceptionToMeta(error);
@ -296,10 +293,9 @@ ipcMain.on('ATOM_BROWSER_CONSTRUCTOR', function(event, id, args) {
}); });
ipcMain.on('ATOM_BROWSER_FUNCTION_CALL', function(event, id, args) { ipcMain.on('ATOM_BROWSER_FUNCTION_CALL', function(event, id, args) {
var func;
try { try {
args = unwrapArgs(event.sender, args); args = unwrapArgs(event.sender, args);
func = objectsRegistry.get(id); let func = objectsRegistry.get(id);
return callFunction(event, func, global, args); return callFunction(event, func, global, args);
} catch (error) { } catch (error) {
return event.returnValue = exceptionToMeta(error); return event.returnValue = exceptionToMeta(error);
@ -307,13 +303,12 @@ ipcMain.on('ATOM_BROWSER_FUNCTION_CALL', function(event, id, args) {
}); });
ipcMain.on('ATOM_BROWSER_MEMBER_CONSTRUCTOR', function(event, id, method, args) { ipcMain.on('ATOM_BROWSER_MEMBER_CONSTRUCTOR', function(event, id, method, args) {
var constructor, obj;
try { try {
args = unwrapArgs(event.sender, args); args = unwrapArgs(event.sender, args);
constructor = objectsRegistry.get(id)[method]; let constructor = objectsRegistry.get(id)[method];
// Call new with array of arguments. // Call new with array of arguments.
obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))); let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)));
return event.returnValue = valueToMeta(event.sender, obj); return event.returnValue = valueToMeta(event.sender, obj);
} catch (error) { } catch (error) {
return event.returnValue = exceptionToMeta(error); return event.returnValue = exceptionToMeta(error);
@ -321,10 +316,9 @@ ipcMain.on('ATOM_BROWSER_MEMBER_CONSTRUCTOR', function(event, id, method, args)
}); });
ipcMain.on('ATOM_BROWSER_MEMBER_CALL', function(event, id, method, args) { ipcMain.on('ATOM_BROWSER_MEMBER_CALL', function(event, id, method, args) {
var obj;
try { try {
args = unwrapArgs(event.sender, args); args = unwrapArgs(event.sender, args);
obj = objectsRegistry.get(id); let obj = objectsRegistry.get(id);
return callFunction(event, obj[method], obj, args); return callFunction(event, obj[method], obj, args);
} catch (error) { } catch (error) {
return event.returnValue = exceptionToMeta(error); return event.returnValue = exceptionToMeta(error);
@ -332,9 +326,8 @@ ipcMain.on('ATOM_BROWSER_MEMBER_CALL', function(event, id, method, args) {
}); });
ipcMain.on('ATOM_BROWSER_MEMBER_SET', function(event, id, name, value) { ipcMain.on('ATOM_BROWSER_MEMBER_SET', function(event, id, name, value) {
var obj;
try { try {
obj = objectsRegistry.get(id); let obj = objectsRegistry.get(id);
obj[name] = value; obj[name] = value;
return event.returnValue = null; return event.returnValue = null;
} catch (error) { } catch (error) {
@ -343,9 +336,8 @@ ipcMain.on('ATOM_BROWSER_MEMBER_SET', function(event, id, name, value) {
}); });
ipcMain.on('ATOM_BROWSER_MEMBER_GET', function(event, id, name) { ipcMain.on('ATOM_BROWSER_MEMBER_GET', function(event, id, name) {
var obj;
try { try {
obj = objectsRegistry.get(id); let obj = objectsRegistry.get(id);
return event.returnValue = valueToMeta(event.sender, obj[name]); return event.returnValue = valueToMeta(event.sender, obj[name]);
} catch (error) { } catch (error) {
return event.returnValue = exceptionToMeta(error); return event.returnValue = exceptionToMeta(error);
@ -357,21 +349,18 @@ ipcMain.on('ATOM_BROWSER_DEREFERENCE', function(event, id) {
}); });
ipcMain.on('ATOM_BROWSER_GUEST_WEB_CONTENTS', function(event, guestInstanceId) { ipcMain.on('ATOM_BROWSER_GUEST_WEB_CONTENTS', function(event, guestInstanceId) {
var guestViewManager;
try { try {
guestViewManager = require('./guest-view-manager'); let guestViewManager = require('./guest-view-manager');
return event.returnValue = valueToMeta(event.sender, guestViewManager.getGuest(guestInstanceId)); return event.returnValue = valueToMeta(event.sender, guestViewManager.getGuest(guestInstanceId));
} catch (error) { } catch (error) {
return event.returnValue = exceptionToMeta(error); return event.returnValue = exceptionToMeta(error);
} }
}); });
ipcMain.on('ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', function() { ipcMain.on('ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', function(event, guestInstanceId, method, ...args) {
var args, event, guest, guestInstanceId, guestViewManager, method;
event = arguments[0], guestInstanceId = arguments[1], method = arguments[2], args = 4 <= arguments.length ? slice.call(arguments, 3) : [];
try { try {
guestViewManager = require('./guest-view-manager'); let guestViewManager = require('./guest-view-manager');
guest = guestViewManager.getGuest(guestInstanceId); let guest = guestViewManager.getGuest(guestInstanceId);
return guest[method].apply(guest, args); return guest[method].apply(guest, args);
} catch (error) { } catch (error) {
return event.returnValue = exceptionToMeta(error); return event.returnValue = exceptionToMeta(error);