Remove extra newlines around comments

This commit is contained in:
Kevin Sawicki 2016-01-14 11:10:12 -08:00
parent 990dc30e8d
commit 030d2a843c
40 changed files with 103 additions and 425 deletions

View file

@ -53,9 +53,7 @@ app.getAppPath = function() {
return appPath;
};
// Routes the events to webContents.
ref1 = ['login', 'certificate-error', 'select-client-certificate'];
fn = function(name) {
return app.on(name, function() {
@ -69,7 +67,6 @@ for (i = 0, len = ref1.length; i < len; i++) {
fn(name);
}
// Deprecated.
app.getHomeDir = deprecate('app.getHomeDir', 'app.getPath', function() {
@ -108,9 +105,7 @@ deprecate.event(app, 'activate-with-no-open-windows', 'activate', function(event
deprecate.event(app, 'select-certificate', 'select-client-certificate');
// Wrappers for native classes.
wrapDownloadItem = function(downloadItem) {
// downloadItem is an EventEmitter.
@ -125,7 +120,5 @@ wrapDownloadItem = function(downloadItem) {
downloadItemBindings._setWrapDownloadItem(wrapDownloadItem);
// Only one App object pemitted.
module.exports = app;

View file

@ -4,11 +4,7 @@ deprecate = require('electron').deprecate;
autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
// Deprecated.
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');
module.exports = autoUpdater;

View file

@ -61,16 +61,12 @@ spawnUpdate = function(args, detached, callback) {
});
};
// Start an instance of the installed app.
exports.processStart = function(callback) {
return spawnUpdate(['--processStart', exeName], true, function() {});
};
// Download the releases specified by the URL and write new results to stdout.
exports.download = function(updateURL, callback) {
return spawnUpdate(['--download', updateURL], false, function(error, stdout) {
var error1, json, ref, ref1, update;
@ -91,14 +87,12 @@ exports.download = function(updateURL, callback) {
// Update the application to the latest remote version specified by URL.
exports.update = function(updateURL, callback) {
return spawnUpdate(['--update', updateURL], false, callback);
};
// Is the Update.exe installed with the current application?
exports.supported = function() {
var error1;
try {

View file

@ -151,7 +151,6 @@ BrowserWindow.fromDevToolsWebContents = function(webContents) {
}
};
// Helpers.
BrowserWindow.prototype.loadURL = function() {
@ -198,7 +197,6 @@ BrowserWindow.prototype.inspectServiceWorker = function() {
return this.webContents.inspectServiceWorker();
};
// Deprecated.
deprecate.member(BrowserWindow, 'undo', 'webContents');

View file

@ -23,14 +23,12 @@ messageBoxOptions = {
parseArgs = function(window, options, callback) {
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
// Shift.
callback = options;
options = window;
window = null;
}
if ((callback == null) && typeof options === 'function') {
// Shift.
callback = options;
options = null;
@ -165,9 +163,7 @@ module.exports = {
}
};
// Mark standard asynchronous functions.
ref1 = ['showMessageBox', 'showOpenDialog', 'showSaveDialog'];
for (j = 0, len = ref1.length; j < len; j++) {
api = ref1[j];

View file

@ -4,7 +4,6 @@ common = require('../../../../common/api/lib/exports/electron');
// Import common modules.
common.defineProperties(exports);
Object.defineProperties(exports, {

View file

@ -2,9 +2,7 @@ var deprecate, ipcMain, ref;
ref = require('electron'), deprecate = ref.deprecate, ipcMain = ref.ipcMain;
// This module is deprecated, we mirror everything from ipcMain.
deprecate.warn('ipc module', 'require("electron").ipcMain');
module.exports = ipcMain;

View file

@ -4,9 +4,7 @@ v8Util = process.atomBinding('v8_util');
nextCommandId = 0;
// Maps role to methods of webContents
rolesMap = {
undo: 'undo',
redo: 'redo',
@ -18,9 +16,7 @@ rolesMap = {
close: 'close'
};
// Maps methods that should be called directly on the BrowserWindow instance
methodInBrowserWindow = {
minimize: true,
close: true

View file

@ -8,17 +8,11 @@ v8Util = process.atomBinding('v8_util');
bindings = process.atomBinding('menu');
// Automatically generated radio menu item's group id.
nextGroupId = 0;
// Search between seperators to find a radio menu item and return its group id,
// otherwise generate a group id.
generateGroupId = function(items, pos) {
var i, item, j, k, ref1, ref2, ref3;
if (pos > 0) {
@ -45,9 +39,7 @@ generateGroupId = function(items, pos) {
return ++nextGroupId;
};
// Returns the index of item according to |id|.
indexOfItemById = function(items, id) {
var i, item, j, len;
for (i = j = 0, len = items.length; j < len; i = ++j) {
@ -59,9 +51,7 @@ indexOfItemById = function(items, id) {
return -1;
};
// Returns the index of where to insert the item according to |position|.
indexToInsertByPosition = function(items, position) {
var id, insertIndex, query, ref1;
if (!position) {
@ -174,7 +164,6 @@ Menu.prototype._init = function() {
Menu.prototype.popup = function(window, x, y) {
if ((window != null ? window.constructor : void 0) !== BrowserWindow) {
// Shift.
y = x;
x = window;
@ -210,7 +199,6 @@ Menu.prototype.insert = function(pos, item) {
this.insertSubMenu(pos, item.commandId, item.label, item.submenu);
break;
case 'radio':
// Grouping radio menu items.
item.overrideReadOnlyProperty('groupId', generateGroupId(this.items, pos));
if ((base = this.groupsMap)[name = item.groupId] == null) {
@ -261,7 +249,6 @@ Menu.prototype.insert = function(pos, item) {
// Force menuWillShow to be called
Menu.prototype._callMenuWillShow = function() {
var item, j, len, ref1, ref2, results;
if ((ref1 = this.delegate) != null) {
@ -323,7 +310,6 @@ Menu.buildFromTemplate = function(template) {
if (item.position) {
insertIndex = indexToInsertByPosition(positionedTemplate, item.position);
} else {
// If no |position| is specified, insert after last item.
insertIndex++;
}

View file

@ -3,9 +3,7 @@ var NavigationController, ipcMain,
ipcMain = require('electron').ipcMain;
// The history operation in renderer is redirected to browser.
ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function() {
var args, event, method, ref;
event = arguments[0], method = arguments[1], args = 3 <= arguments.length ? slice.call(arguments, 2) : [];

View file

@ -8,9 +8,7 @@ if (!app.isReady()) {
protocol = process.atomBinding('protocol').protocol;
// Warn about removed APIs.
logAndThrow = function(callback, message) {
console.error(message);
if (callback) {

View file

@ -6,9 +6,7 @@ bindings = process.atomBinding('session');
PERSIST_PERFIX = 'persist:';
// Returns the Session from |partition| string.
exports.fromPartition = function(partition) {
if (partition == null) {
partition = '';
@ -23,9 +21,7 @@ exports.fromPartition = function(partition) {
}
};
// Returns the default session.
Object.defineProperty(exports, 'defaultSession', {
enumerable: true,
get: function() {
@ -34,7 +30,6 @@ Object.defineProperty(exports, 'defaultSession', {
});
wrapSession = function(session) {
// session is an EventEmitter.
return session.__proto__ = EventEmitter.prototype;
};

View file

@ -9,7 +9,6 @@ Tray = process.atomBinding('tray').Tray;
Tray.prototype.__proto__ = EventEmitter.prototype;
Tray.prototype._init = function() {
// Deprecated.
deprecate.rename(this, 'popContextMenu', 'popUpContextMenu');
deprecate.event(this, 'clicked', 'click');

View file

@ -65,7 +65,6 @@ const webFrameMethods = [
];
wrapWebContents = function(webContents) {
// webContents is an EventEmitter.
var controller, method, name, ref1;
webContents.__proto__ = EventEmitter.prototype;

View file

@ -8,9 +8,7 @@ path = require('path');
url = require('url');
// Mapping between hostname and file path.
hostPathMap = {};
hostPathMapNextKey = 0;
@ -26,9 +24,7 @@ getPathForHost = function(host) {
return hostPathMap[host];
};
// Cache extensionInfo.
extensionInfoMap = {};
getExtensionInfoFromPath = function(srcDirectory) {
@ -54,16 +50,11 @@ getExtensionInfoFromPath = function(srcDirectory) {
}
};
// The loaded extensions cache and its persistent path.
loadedExtensions = null;
loadedExtensionsPath = null;
// Persistent loaded extensions.
app = electron.app;
app.on('will-quit', function() {
@ -83,9 +74,7 @@ app.on('will-quit', function() {
}
});
// We can not use protocol or BrowserWindow until app is ready.
app.once('ready', function() {
var BrowserWindow, chromeExtensionHandler, e, error1, i, init, len, protocol, srcDirectory;
protocol = electron.protocol, BrowserWindow = electron.BrowserWindow;

View file

@ -8,9 +8,7 @@ deepEqual = function(opt1, opt2) {
return JSON.stringify(opt1) === JSON.stringify(opt2);
};
// A queue for holding all requests from renderer process.
requestsQueue = [];
ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureWindow, captureScreen, thumbnailSize, id) {
@ -37,7 +35,6 @@ ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureW
});
desktopCapturer.emit = function(event, name, sources) {
// Receiving sources result from main process, now send them back to renderer.
var captureScreen, captureWindow, handledRequest, i, len, ref, ref1, ref2, request, result, source, thumbnailSize, unhandledRequestsQueue;
handledRequest = requestsQueue.shift(0);

View file

@ -3,9 +3,7 @@ var attachGuest, createGuest, destroyGuest, embedderElementsMap, getNextInstance
ref = require('electron'), ipcMain = ref.ipcMain, webContents = ref.webContents;
// Doesn't exist in early initialization.
webViewManager = null;
supportedWebViewEvents = ['load-commit', 'did-finish-load', 'did-fail-load', 'did-frame-finish-load', 'did-start-loading', 'did-stop-loading', 'did-get-response-details', 'did-get-redirect-request', 'dom-ready', 'console-message', 'devtools-opened', 'devtools-closed', 'devtools-focused', 'new-window', 'will-navigate', 'did-navigate', 'did-navigate-in-page', 'close', 'crashed', 'gpu-crashed', 'plugin-crashed', 'destroyed', 'page-title-updated', 'page-favicon-updated', 'enter-html-full-screen', 'leave-html-full-screen', 'media-started-playing', 'media-paused', 'found-in-page', 'did-change-theme-color'];
@ -18,23 +16,17 @@ embedderElementsMap = {};
reverseEmbedderElementsMap = {};
// Moves the last element of array to the first one.
moveLastToFirst = function(list) {
return list.unshift(list.pop());
};
// Generate guestInstanceId.
getNextInstanceId = function(webContents) {
return ++nextInstanceId;
};
// Create a new guest instance.
createGuest = function(embedder, params) {
var destroy, destroyEvents, event, fn, guest, i, id, j, len, len1, listeners;
if (webViewManager == null) {
@ -146,9 +138,7 @@ createGuest = function(embedder, params) {
return id;
};
// Attach the guest to an element of embedder.
attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
var guest, key, oldGuestInstanceId, ref1, webPreferences;
guest = guestInstances[guestInstanceId].guest;
@ -182,9 +172,7 @@ attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
return reverseEmbedderElementsMap[guestInstanceId] = key;
};
// Destroy an existing guest instance.
destroyGuest = function(embedder, id) {
var key;
webViewManager.removeGuest(embedder, id);
@ -219,17 +207,13 @@ ipcMain.on('ATOM_SHELL_GUEST_VIEW_MANAGER_SET_ALLOW_TRANSPARENCY', function(even
return (ref1 = guestInstances[id]) != null ? ref1.guest.setAllowTransparency(allowtransparency) : void 0;
});
// Returns WebContents from its guest id.
exports.getGuest = function(id) {
var ref1;
return (ref1 = guestInstances[id]) != null ? ref1.guest : void 0;
};
// Returns the embedder of the guest.
exports.getEmbedder = function(id) {
var ref1;
return (ref1 = guestInstances[id]) != null ? ref1.embedder : void 0;

View file

@ -8,9 +8,7 @@ v8Util = process.atomBinding('v8_util');
frameToGuest = {};
// Copy attribute of |parent| to |child| if it is not defined in |child|.
mergeOptions = function(child, parent) {
var key, value;
for (key in parent) {
@ -27,9 +25,7 @@ mergeOptions = function(child, parent) {
return child;
};
// Merge |options| with the |embedder|'s window's options.
mergeBrowserWindowOptions = function(embedder, options) {
if (embedder.browserWindowOptions != null) {
@ -46,9 +42,7 @@ mergeBrowserWindowOptions = function(embedder, options) {
return options;
};
// Create a new guest created by |embedder| with |options|.
createGuest = function(embedder, url, frameName, options) {
var closedByEmbedder, closedByUser, guest, guestId, ref1;
guest = frameToGuest[frameName];
@ -89,9 +83,7 @@ createGuest = function(embedder, url, frameName, options) {
return guest.id;
};
// Routed window.open messages.
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', function() {
var args, event, frameName, options, url;
event = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];

View file

@ -9,12 +9,8 @@ util = require('util');
Module = require('module');
// We modified the original process.argv to let node.js load the atom.js,
// we need to restore it here.
process.argv.splice(1, 1);
// Clear search paths.
@ -62,9 +58,7 @@ if (process.platform === 'win32') {
});
}
// Don't quit on fatal error.
process.on('uncaughtException', function(error) {
// Do nothing if the user has a custom uncaught exception handler.
@ -80,35 +74,26 @@ process.on('uncaughtException', function(error) {
return dialog.showErrorBox('A JavaScript error occurred in the main process', message);
});
// Emit 'exit' event on quit.
app = require('electron').app;
app.on('quit', function(event, exitCode) {
return process.emit('exit', exitCode);
});
// Map process.exit to app.exit, which quits gracefully.
process.exit = app.exit;
// Load the RPC server.
require('./rpc-server');
// Load the guest view manager.
require('./guest-view-manager');
require('./guest-window-manager');
// Now we try to load app's package.json.
packageJson = null;
searchPaths = ['app', 'app.asar', 'default_app'];
@ -132,61 +117,43 @@ if (packageJson == null) {
throw new Error("Unable to find a valid app");
}
// Set application's version.
if (packageJson.version != null) {
app.setVersion(packageJson.version);
}
// Set application's name.
if (packageJson.productName != null) {
app.setName(packageJson.productName);
} else if (packageJson.name != null) {
app.setName(packageJson.name);
}
// Set application's desktop name.
if (packageJson.desktopName != null) {
app.setDesktopName(packageJson.desktopName);
} else {
app.setDesktopName((app.getName()) + ".desktop");
}
// Chrome 42 disables NPAPI plugins by default, reenable them here
app.commandLine.appendSwitch('enable-npapi');
// Set the user path according to application's name.
app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));
app.setAppPath(packagePath);
// Load the chrome extension support.
require('./chrome-extension');
// Load internal desktop-capturer module.
require('./desktop-capturer');
// Set main startup script of the app.
mainStartupScript = packageJson.main || 'index.js';
// Finally load app's main.js and transfer control to C++.
Module._load(path.join(packagePath, mainStartupScript), Module, true);

View file

@ -65,7 +65,6 @@ ObjectsRegistry = (function(superClass) {
}
};
// Clear all references to objects refrenced by the WebContents.
ObjectsRegistry.prototype.clear = function(webContentsId) {
var count, id, ref;
@ -81,7 +80,6 @@ ObjectsRegistry = (function(superClass) {
return delete this.owners[webContentsId];
};
// Private: Saves the object into storage and assigns an ID for it.
ObjectsRegistry.prototype.saveToStorage = function(object) {
var id;
@ -98,7 +96,6 @@ ObjectsRegistry = (function(superClass) {
return id;
};
// Private: Dereference the object from store.
ObjectsRegistry.prototype.dereference = function(id, count) {
var pointer;

View file

@ -13,9 +13,7 @@ v8Util = process.atomBinding('v8_util');
IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap;
// Convert a real value into meta data.
valueToMeta = function(sender, value, optimizeSimpleObject) {
var el, field, i, len, meta, name;
if (optimizeSimpleObject == null) {
@ -98,9 +96,7 @@ valueToMeta = function(sender, value, optimizeSimpleObject) {
return meta;
};
// Convert object to meta by value.
plainObjectToMeta = function(obj) {
return Object.getOwnPropertyNames(obj).map(function(name) {
return {
@ -110,9 +106,7 @@ plainObjectToMeta = function(obj) {
});
};
// Convert Error into meta data.
exceptionToMeta = function(error) {
return {
type: 'exception',
@ -121,9 +115,7 @@ exceptionToMeta = function(error) {
};
};
// Convert array of meta data from renderer into array of real values.
unwrapArgs = function(sender, args) {
var metaToValue;
metaToValue = function(meta) {
@ -157,7 +149,6 @@ unwrapArgs = function(sender, args) {
return returnValue;
};
case 'function':
// Cache the callbacks in renderer.
if (!sender.callbacks) {
sender.callbacks = new IDWeakMap;
@ -221,7 +212,6 @@ callFunction = function(event, func, caller, args) {
}
};
// Send by BrowserWindow when its render view is deleted.
process.on('ATOM_BROWSER_RELEASE_RENDER_VIEW', function(id) {
return objectsRegistry.clear(id);