Merge pull request #4109 from atom/const

[WIP] Use `const` for requires
This commit is contained in:
Cheng Zhao 2016-01-15 16:32:07 +08:00
commit 3875b30fcf
44 changed files with 314 additions and 437 deletions

View file

@ -1,15 +1,13 @@
var EventEmitter, Menu, app, appPath, bindings, deprecate, downloadItemBindings, fn, i, len, name, ref, ref1, session, wrapDownloadItem,
slice = [].slice;
const deprecate = require('electron').deprecate;
const session = require('electron').session;
const Menu = require('electron').Menu;
const EventEmitter = require('events').EventEmitter;
ref = require('electron'), deprecate = ref.deprecate, session = ref.session, Menu = ref.Menu;
const bindings = process.atomBinding('app');
const downloadItemBindings = process.atomBinding('download_item');
const app = bindings.app;
EventEmitter = require('events').EventEmitter;
bindings = process.atomBinding('app');
downloadItemBindings = process.atomBinding('download_item');
app = bindings.app;
var slice = [].slice;
app.__proto__ = EventEmitter.prototype;
@ -43,7 +41,7 @@ if (process.platform === 'darwin') {
};
}
appPath = null;
var appPath = null;
app.setAppPath = function(path) {
return appPath = path;
@ -54,17 +52,18 @@ app.getAppPath = function() {
};
// Routes the events to webContents.
ref1 = ['login', 'certificate-error', 'select-client-certificate'];
fn = function(name) {
var ref1 = ['login', 'certificate-error', 'select-client-certificate'];
var fn = function(name) {
return app.on(name, function() {
var args, event, webContents;
event = arguments[0], webContents = arguments[1], args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
return webContents.emit.apply(webContents, [name, event].concat(slice.call(args)));
});
};
var i, len, name;
for (i = 0, len = ref1.length; i < len; i++) {
name = ref1[i];
fn(name);
fn(ref1[i]);
}
// Deprecated.
@ -106,7 +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) {
var wrapDownloadItem = function(downloadItem) {
// downloadItem is an EventEmitter.
downloadItem.__proto__ = EventEmitter.prototype;

View file

@ -1,8 +1,5 @@
var autoUpdater, deprecate;
deprecate = require('electron').deprecate;
autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
const deprecate = require('electron').deprecate;
const autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
// Deprecated.
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');

View file

@ -1,8 +1,5 @@
var EventEmitter, autoUpdater;
EventEmitter = require('events').EventEmitter;
autoUpdater = process.atomBinding('auto_updater').autoUpdater;
const EventEmitter = require('events').EventEmitter;
const autoUpdater = process.atomBinding('auto_updater').autoUpdater;
autoUpdater.__proto__ = EventEmitter.prototype;

View file

@ -1,16 +1,12 @@
var AutoUpdater, EventEmitter, app, squirrelUpdate, url,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
const app = require('electron').app;
const EventEmitter = require('events').EventEmitter;
const url = require('url');
const squirrelUpdate = require('./squirrel-update-win');
app = require('electron').app;
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
EventEmitter = require('events').EventEmitter;
url = require('url');
squirrelUpdate = require('./squirrel-update-win');
AutoUpdater = (function(superClass) {
var AutoUpdater = (function(superClass) {
extend(AutoUpdater, superClass);
function AutoUpdater() {

View file

@ -1,22 +1,18 @@
var appFolder, exeName, fs, path, spawn, spawnUpdate, updateExe;
fs = require('fs');
path = require('path');
spawn = require('child_process').spawn;
const fs = require('fs');
const path = require('path');
const spawn = require('child_process').spawn;
// i.e. my-app/app-0.1.13/
appFolder = path.dirname(process.execPath);
const appFolder = path.dirname(process.execPath);
// i.e. my-app/Update.exe
updateExe = path.resolve(appFolder, '..', 'Update.exe');
const updateExe = path.resolve(appFolder, '..', 'Update.exe');
exeName = path.basename(process.execPath);
const exeName = path.basename(process.execPath);
// Spawn a command and invoke the callback when it completes with an error
// and the output from standard out.
spawnUpdate = function(args, detached, callback) {
var spawnUpdate = function(args, detached, callback) {
var error, error1, errorEmitted, spawnedProcess, stderr, stdout;
try {
spawnedProcess = spawn(updateExe, args, {

View file

@ -1,10 +1,7 @@
var BrowserWindow, EventEmitter, deprecate, ipcMain, ref;
ref = require('electron'), ipcMain = ref.ipcMain, deprecate = ref.deprecate;
EventEmitter = require('events').EventEmitter;
BrowserWindow = process.atomBinding('window').BrowserWindow;
const ipcMain = require('electron').ipcMain;
const deprecate = require('electron').deprecate;
const EventEmitter = require('events').EventEmitter;
const BrowserWindow = process.atomBinding('window').BrowserWindow;
BrowserWindow.prototype.__proto__ = EventEmitter.prototype;

View file

@ -1,27 +1,25 @@
var BrowserWindow, api, app, binding, checkAppInitialized, fileDialogProperties, j, len, messageBoxOptions, messageBoxTypes, parseArgs, ref, ref1, v8Util,
slice = [].slice,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
const app = require('electron').app;
const BrowserWindow = require('electron').BrowserWindow;
const binding = process.atomBinding('dialog');
const v8Util = process.atomBinding('v8_util');
ref = require('electron'), app = ref.app, BrowserWindow = ref.BrowserWindow;
var slice = [].slice;
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
binding = process.atomBinding('dialog');
v8Util = process.atomBinding('v8_util');
fileDialogProperties = {
var fileDialogProperties = {
openFile: 1 << 0,
openDirectory: 1 << 1,
multiSelections: 1 << 2,
createDirectory: 1 << 3
};
messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'];
var messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'];
messageBoxOptions = {
var messageBoxOptions = {
noLink: 1 << 0
};
parseArgs = function(window, options, callback) {
var parseArgs = function(window, options, callback) {
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
// Shift.
callback = options;
@ -36,7 +34,7 @@ parseArgs = function(window, options, callback) {
return [window, options, callback];
};
checkAppInitialized = function() {
var checkAppInitialized = function() {
if (!app.isReady()) {
throw new Error('dialog module can only be used after app is ready');
}
@ -164,7 +162,8 @@ module.exports = {
};
// Mark standard asynchronous functions.
ref1 = ['showMessageBox', 'showOpenDialog', 'showSaveDialog'];
var ref1 = ['showMessageBox', 'showOpenDialog', 'showSaveDialog'];
var j, len, api;
for (j = 0, len = ref1.length; j < len; j++) {
api = ref1[j];
v8Util.setHiddenValue(module.exports[api], 'asynchronous', true);

View file

@ -1,6 +1,4 @@
var common;
common = require('../../../../common/api/lib/exports/electron');
const common = require('../../../../common/api/lib/exports/electron');
// Import common modules.

View file

@ -1,5 +1,3 @@
var EventEmitter;
EventEmitter = require('events').EventEmitter;
const EventEmitter = require('events').EventEmitter;
module.exports = new EventEmitter;

View file

@ -1,6 +1,5 @@
var deprecate, ipcMain, ref;
ref = require('electron'), deprecate = ref.deprecate, ipcMain = ref.ipcMain;
const deprecate = require('electron').deprecate;
const ipcMain = require('electron').ipcMain;
// This module is deprecated, we mirror everything from ipcMain.
deprecate.warn('ipc module', 'require("electron").ipcMain');

View file

@ -26,8 +26,8 @@ MenuItem = (function() {
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'];
function MenuItem(options) {
var Menu, click, ref;
Menu = require('electron').Menu;
var click, ref;
const Menu = require('electron').Menu;
click = options.click, this.selector = options.selector, this.type = options.type, this.role = options.role, this.label = options.label, this.sublabel = options.sublabel, this.accelerator = options.accelerator, this.icon = options.icon, this.enabled = options.enabled, this.visible = options.visible, this.checked = options.checked, this.submenu = options.submenu;
if ((this.submenu != null) && this.submenu.constructor !== Menu) {
this.submenu = Menu.buildFromTemplate(this.submenu);

View file

@ -1,19 +1,15 @@
var BrowserWindow, EventEmitter, Menu, MenuItem, applicationMenu, bindings, generateGroupId, indexOfItemById, indexToInsertByPosition, nextGroupId, ref, v8Util;
ref = require('electron'), BrowserWindow = ref.BrowserWindow, MenuItem = ref.MenuItem;
EventEmitter = require('events').EventEmitter;
v8Util = process.atomBinding('v8_util');
bindings = process.atomBinding('menu');
const BrowserWindow = require('electron').BrowserWindow;
const MenuItem = require('electron').MenuItem;
const EventEmitter = require('events').EventEmitter;
const v8Util = process.atomBinding('v8_util');
const bindings = process.atomBinding('menu');
// Automatically generated radio menu item's group id.
nextGroupId = 0;
var 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 generateGroupId = function(items, pos) {
var i, item, j, k, ref1, ref2, ref3;
if (pos > 0) {
for (i = j = ref1 = pos - 1; ref1 <= 0 ? j <= 0 : j >= 0; i = ref1 <= 0 ? ++j : --j) {
@ -40,7 +36,7 @@ generateGroupId = function(items, pos) {
};
// Returns the index of item according to |id|.
indexOfItemById = function(items, id) {
var indexOfItemById = function(items, id) {
var i, item, j, len;
for (i = j = 0, len = items.length; j < len; i = ++j) {
item = items[i];
@ -52,7 +48,7 @@ indexOfItemById = function(items, id) {
};
// Returns the index of where to insert the item according to |position|.
indexToInsertByPosition = function(items, position) {
var indexToInsertByPosition = function(items, position) {
var id, insertIndex, query, ref1;
if (!position) {
return items.length;
@ -87,7 +83,7 @@ indexToInsertByPosition = function(items, position) {
return insertIndex;
};
Menu = bindings.Menu;
const Menu = bindings.Menu;
Menu.prototype.__proto__ = EventEmitter.prototype;
@ -265,7 +261,7 @@ Menu.prototype._callMenuWillShow = function() {
return results;
};
applicationMenu = null;
var applicationMenu = null;
Menu.setApplicationMenu = function(menu) {
var j, len, results, w, windows;

View file

@ -1,7 +1,6 @@
var NavigationController, ipcMain,
slice = [].slice;
const ipcMain = require('electron').ipcMain;
ipcMain = require('electron').ipcMain;
var slice = [].slice;
// The history operation in renderer is redirected to browser.
ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function() {
@ -21,7 +20,7 @@ ipcMain.on('ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER', function() {
// control on user land, and only rely on WebContents.loadURL for navigation.
// This helps us avoid Chromium's various optimizations so we can ensure renderer
// process is restarted everytime.
NavigationController = (function() {
var NavigationController = (function() {
function NavigationController(webContents) {
this.webContents = webContents;
this.clearHistory();

View file

@ -1,8 +1,5 @@
var EventEmitter, powerMonitor;
EventEmitter = require('events').EventEmitter;
powerMonitor = process.atomBinding('power_monitor').powerMonitor;
const EventEmitter = require('events').EventEmitter;
const powerMonitor = process.atomBinding('power_monitor').powerMonitor;
powerMonitor.__proto__ = EventEmitter.prototype;

View file

@ -1,15 +1,13 @@
var app, logAndThrow, protocol;
app = require('electron').app;
const app = require('electron').app;
if (!app.isReady()) {
throw new Error('Can not initialize protocol module before app is ready');
}
protocol = process.atomBinding('protocol').protocol;
const protocol = process.atomBinding('protocol').protocol;
// Warn about removed APIs.
logAndThrow = function(callback, message) {
var logAndThrow = function(callback, message) {
console.error(message);
if (callback) {
return callback(new Error(message));

View file

@ -1,8 +1,5 @@
var EventEmitter, screen;
EventEmitter = require('events').EventEmitter;
screen = process.atomBinding('screen').screen;
const EventEmitter = require('events').EventEmitter;
const screen = process.atomBinding('screen').screen;
screen.__proto__ = EventEmitter.prototype;

View file

@ -1,10 +1,6 @@
var EventEmitter, PERSIST_PERFIX, bindings, wrapSession;
EventEmitter = require('events').EventEmitter;
bindings = process.atomBinding('session');
PERSIST_PERFIX = 'persist:';
const EventEmitter = require('events').EventEmitter;
const bindings = process.atomBinding('session');
const PERSIST_PERFIX = 'persist:';
// Returns the Session from |partition| string.
exports.fromPartition = function(partition) {
@ -29,7 +25,7 @@ Object.defineProperty(exports, 'defaultSession', {
}
});
wrapSession = function(session) {
var wrapSession = function(session) {
// session is an EventEmitter.
return session.__proto__ = EventEmitter.prototype;
};

View file

@ -1,10 +1,6 @@
var EventEmitter, Tray, deprecate;
deprecate = require('electron').deprecate;
EventEmitter = require('events').EventEmitter;
Tray = process.atomBinding('tray').Tray;
const deprecate = require('electron').deprecate;
const EventEmitter = require('events').EventEmitter;
const Tray = process.atomBinding('tray').Tray;
Tray.prototype.__proto__ = EventEmitter.prototype;

View file

@ -1,21 +1,22 @@
'use strict';
var EventEmitter, Menu, NavigationController, PDFPageSize, binding, deprecate, getNextId, ipcMain, nextId, ref, session, wrapWebContents,
slice = [].slice;
const EventEmitter = require('events').EventEmitter;
const deprecate = require('electron').deprecate;
const ipcMain = require('electron').ipcMain;
const session = require('electron').session;
const NavigationController = require('electron').NavigationController;
const Menu = require('electron').Menu;
EventEmitter = require('events').EventEmitter;
const binding = process.atomBinding('web_contents');
ref = require('electron'), deprecate = ref.deprecate, ipcMain = ref.ipcMain, session = ref.session, NavigationController = ref.NavigationController, Menu = ref.Menu;
let slice = [].slice;
let nextId = 0;
binding = process.atomBinding('web_contents');
nextId = 0;
getNextId = function() {
let getNextId = function() {
return ++nextId;
};
PDFPageSize = {
let PDFPageSize = {
A5: {
custom_display_name: "A5",
height_microns: 210000,
@ -64,7 +65,7 @@ const webFrameMethods = [
'setZoomLevelLimits',
];
wrapWebContents = function(webContents) {
let wrapWebContents = function(webContents) {
// webContents is an EventEmitter.
var controller, method, name, ref1;
webContents.__proto__ = EventEmitter.prototype;

View file

@ -1,33 +1,28 @@
var app, electron, extensionInfoMap, fs, getExtensionInfoFromPath, getHostForPath, getPathForHost, hostPathMap, hostPathMapNextKey, loadedExtensions, loadedExtensionsPath, path, url;
electron = require('electron');
fs = require('fs');
path = require('path');
url = require('url');
const electron = require('electron');
const app = electron.app;
const fs = require('fs');
const path = require('path');
const url = require('url');
// Mapping between hostname and file path.
hostPathMap = {};
var hostPathMap = {};
var hostPathMapNextKey = 0;
hostPathMapNextKey = 0;
getHostForPath = function(path) {
var getHostForPath = function(path) {
var key;
key = "extension-" + (++hostPathMapNextKey);
hostPathMap[key] = path;
return key;
};
getPathForHost = function(host) {
var getPathForHost = function(host) {
return hostPathMap[host];
};
// Cache extensionInfo.
extensionInfoMap = {};
var extensionInfoMap = {};
getExtensionInfoFromPath = function(srcDirectory) {
var getExtensionInfoFromPath = function(srcDirectory) {
var manifest, page;
manifest = JSON.parse(fs.readFileSync(path.join(srcDirectory, 'manifest.json')));
if (extensionInfoMap[manifest.name] == null) {
@ -51,11 +46,8 @@ getExtensionInfoFromPath = function(srcDirectory) {
};
// The loaded extensions cache and its persistent path.
loadedExtensions = null;
loadedExtensionsPath = null;
// Persistent loaded extensions.
app = electron.app;
var loadedExtensions = null;
var loadedExtensionsPath = null;
app.on('will-quit', function() {
var e, error1, error2;

View file

@ -1,15 +1,12 @@
var deepEqual, desktopCapturer, ipcMain, requestsQueue;
const ipcMain = require('electron').ipcMain;
const desktopCapturer = process.atomBinding('desktop_capturer').desktopCapturer;
ipcMain = require('electron').ipcMain;
desktopCapturer = process.atomBinding('desktop_capturer').desktopCapturer;
deepEqual = function(opt1, opt2) {
var deepEqual = function(opt1, opt2) {
return JSON.stringify(opt1) === JSON.stringify(opt2);
};
// A queue for holding all requests from renderer process.
requestsQueue = [];
var requestsQueue = [];
ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureWindow, captureScreen, thumbnailSize, id) {
var request;

View file

@ -1,33 +1,30 @@
var attachGuest, createGuest, destroyGuest, embedderElementsMap, getNextInstanceId, guestInstances, ipcMain, moveLastToFirst, nextInstanceId, ref, reverseEmbedderElementsMap, supportedWebViewEvents, webContents, webViewManager,
slice = [].slice;
const ipcMain = require('electron').ipcMain;
const webContents = require('electron').webContents;
ref = require('electron'), ipcMain = ref.ipcMain, webContents = ref.webContents;
var slice = [].slice;
// Doesn't exist in early initialization.
webViewManager = null;
var 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'];
var 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'];
nextInstanceId = 0;
guestInstances = {};
embedderElementsMap = {};
reverseEmbedderElementsMap = {};
var nextInstanceId = 0;
var guestInstances = {};
var embedderElementsMap = {};
var reverseEmbedderElementsMap = {};
// Moves the last element of array to the first one.
moveLastToFirst = function(list) {
var moveLastToFirst = function(list) {
return list.unshift(list.pop());
};
// Generate guestInstanceId.
getNextInstanceId = function(webContents) {
var getNextInstanceId = function(webContents) {
return ++nextInstanceId;
};
// Create a new guest instance.
createGuest = function(embedder, params) {
var createGuest = function(embedder, params) {
var destroy, destroyEvents, event, fn, guest, i, id, j, len, len1, listeners;
if (webViewManager == null) {
webViewManager = process.atomBinding('web_view_manager');
@ -139,7 +136,7 @@ createGuest = function(embedder, params) {
};
// Attach the guest to an element of embedder.
attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
var attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
var guest, key, oldGuestInstanceId, ref1, webPreferences;
guest = guestInstances[guestInstanceId].guest;
@ -173,7 +170,7 @@ attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
};
// Destroy an existing guest instance.
destroyGuest = function(embedder, id) {
var destroyGuest = function(embedder, id) {
var key;
webViewManager.removeGuest(embedder, id);
guestInstances[id].guest.destroy();

View file

@ -1,15 +1,14 @@
var BrowserWindow, createGuest, frameToGuest, ipcMain, mergeBrowserWindowOptions, mergeOptions, ref, v8Util,
hasProp = {}.hasOwnProperty,
slice = [].slice;
const ipcMain = require('electron').ipcMain;
const BrowserWindow = require('electron').BrowserWindow;
ref = require('electron'), ipcMain = ref.ipcMain, BrowserWindow = ref.BrowserWindow;
const v8Util = process.atomBinding('v8_util');
v8Util = process.atomBinding('v8_util');
frameToGuest = {};
var hasProp = {}.hasOwnProperty;
var slice = [].slice;
var frameToGuest = {};
// Copy attribute of |parent| to |child| if it is not defined in |child|.
mergeOptions = function(child, parent) {
var mergeOptions = function(child, parent) {
var key, value;
for (key in parent) {
if (!hasProp.call(parent, key)) continue;
@ -26,7 +25,7 @@ mergeOptions = function(child, parent) {
};
// Merge |options| with the |embedder|'s window's options.
mergeBrowserWindowOptions = function(embedder, options) {
var mergeBrowserWindowOptions = function(embedder, options) {
if (embedder.browserWindowOptions != null) {
// Inherit the original options if it is a BrowserWindow.
@ -43,7 +42,7 @@ mergeBrowserWindowOptions = function(embedder, options) {
};
// Create a new guest created by |embedder| with |options|.
createGuest = function(embedder, url, frameName, options) {
var createGuest = function(embedder, url, frameName, options) {
var closedByEmbedder, closedByUser, guest, guestId, ref1;
guest = frameToGuest[frameName];
if (frameName && (guest != null)) {

View file

@ -1,13 +1,9 @@
var Module, Readable, app, consoleLog, e, error1, fs, globalPaths, i, len, mainStartupScript, packageJson, packagePath, path, searchPaths, stdin, streamWrite, util,
slice = [].slice;
const fs = require('fs');
const path = require('path');
const util = require('util');
const Module = require('module');
fs = require('fs');
path = require('path');
util = require('util');
Module = require('module');
var slice = [].slice;
// We modified the original process.argv to let node.js load the atom.js,
// we need to restore it here.
@ -19,7 +15,7 @@ require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths
// Import common settings.
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
globalPaths = Module.globalPaths;
var globalPaths = Module.globalPaths;
if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib'));
@ -31,12 +27,12 @@ globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib', 'exports'));
if (process.platform === 'win32') {
// Redirect node's console to use our own implementations, since node can not
// handle console output when running as GUI program.
consoleLog = function() {
var consoleLog = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return process.log(util.format.apply(util, args) + "\n");
};
streamWrite = function(chunk, encoding, callback) {
var streamWrite = function(chunk, encoding, callback) {
if (Buffer.isBuffer(chunk)) {
chunk = chunk.toString(encoding);
}
@ -50,8 +46,8 @@ if (process.platform === 'win32') {
process.stdout.write = process.stderr.write = streamWrite;
// Always returns EOF for stdin stream.
Readable = require('stream').Readable;
stdin = new Readable;
var Readable = require('stream').Readable;
var stdin = new Readable;
stdin.push(null);
process.__defineGetter__('stdin', function() {
return stdin;
@ -75,7 +71,7 @@ process.on('uncaughtException', function(error) {
});
// Emit 'exit' event on quit.
app = require('electron').app;
var app = require('electron').app;
app.on('quit', function(event, exitCode) {
return process.emit('exit', exitCode);
@ -92,20 +88,17 @@ 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'];
var packageJson = null;
var searchPaths = ['app', 'app.asar', 'default_app'];
var i, len, packagePath;
for (i = 0, len = searchPaths.length; i < len; i++) {
packagePath = searchPaths[i];
try {
packagePath = path.join(process.resourcesPath, packagePath);
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json')));
break;
} catch (error1) {
e = error1;
} catch (error) {
continue;
}
}
@ -153,7 +146,7 @@ require('./chrome-extension');
require('./desktop-capturer');
// Set main startup script of the app.
mainStartupScript = packageJson.main || 'index.js';
var 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

@ -1,12 +1,10 @@
var EventEmitter, ObjectsRegistry, v8Util,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
const EventEmitter = require('events').EventEmitter;
const v8Util = process.atomBinding('v8_util');
EventEmitter = require('events').EventEmitter;
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
var hasProp = {}.hasOwnProperty;
v8Util = process.atomBinding('v8_util');
ObjectsRegistry = (function(superClass) {
var ObjectsRegistry = (function(superClass) {
extend(ObjectsRegistry, superClass);
function ObjectsRegistry() {

View file

@ -1,20 +1,14 @@
var IDWeakMap, callFunction, electron, exceptionToMeta, ipcMain, objectsRegistry, path, plainObjectToMeta, unwrapArgs, v8Util, valueToMeta,
slice = [].slice;
const path = require('path');
const electron = require('electron');
const ipcMain = electron.ipcMain;
const objectsRegistry = require('./objects-registry');
const v8Util = process.atomBinding('v8_util');
const IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap;
path = require('path');
electron = require('electron');
ipcMain = electron.ipcMain;
objectsRegistry = require('./objects-registry');
v8Util = process.atomBinding('v8_util');
IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap;
var slice = [].slice;
// Convert a real value into meta data.
valueToMeta = function(sender, value, optimizeSimpleObject) {
var valueToMeta = function(sender, value, optimizeSimpleObject) {
var el, field, i, len, meta, name;
if (optimizeSimpleObject == null) {
optimizeSimpleObject = false;
@ -97,7 +91,7 @@ valueToMeta = function(sender, value, optimizeSimpleObject) {
};
// Convert object to meta by value.
plainObjectToMeta = function(obj) {
var plainObjectToMeta = function(obj) {
return Object.getOwnPropertyNames(obj).map(function(name) {
return {
name: name,
@ -107,7 +101,7 @@ plainObjectToMeta = function(obj) {
};
// Convert Error into meta data.
exceptionToMeta = function(error) {
var exceptionToMeta = function(error) {
return {
type: 'exception',
message: error.message,
@ -116,7 +110,7 @@ exceptionToMeta = function(error) {
};
// Convert array of meta data from renderer into array of real values.
unwrapArgs = function(sender, args) {
var unwrapArgs = function(sender, args) {
var metaToValue;
metaToValue = function(meta) {
var i, len, member, ref, rendererReleased, ret, returnValue;
@ -187,7 +181,7 @@ unwrapArgs = function(sender, args) {
// Call a function and send reply asynchronously if it's a an asynchronous
// style function and the caller didn't pass a callback.
callFunction = function(event, func, caller, args) {
var callFunction = function(event, func, caller, args) {
var e, error1, funcMarkedAsync, funcName, funcPassedCallback, ref, ret;
funcMarkedAsync = v8Util.getHiddenValue(func, 'asynchronous');
funcPassedCallback = typeof args[args.length - 1] === 'function';

View file

@ -1,18 +1,11 @@
var CrashReporter, binding, crashRepoter, electron, fs, os, path, spawn;
const fs = require('fs');
const os = require('os');
const path = require('path');
const spawn = require('child_process').spawn;
const electron = require('electron');
const binding = process.atomBinding('crash_reporter');
fs = require('fs');
os = require('os');
path = require('path');
spawn = require('child_process').spawn;
electron = require('electron');
binding = process.atomBinding('crash_reporter');
CrashReporter = (function() {
var CrashReporter = (function() {
function CrashReporter() {}
CrashReporter.prototype.start = function(options) {
@ -99,6 +92,4 @@ CrashReporter = (function() {
})();
crashRepoter = new CrashReporter;
module.exports = crashRepoter;
module.exports = new CrashReporter;

View file

@ -1,7 +1,6 @@
// Do not expose the internal modules to `require`.
exports.hideInternalModules = function() {
var globalPaths;
globalPaths = require('module').globalPaths;
var globalPaths = require('module').globalPaths;
if (globalPaths.length === 3) {
// Remove the "common/api/lib" and "browser-or-renderer/api/lib".

View file

@ -1,8 +1,5 @@
var deprecate, nativeImage;
deprecate = require('electron').deprecate;
nativeImage = process.atomBinding('native_image');
const deprecate = require('electron').deprecate;
const nativeImage = process.atomBinding('native_image');
// Deprecated.
deprecate.rename(nativeImage, 'createFromDataUrl', 'createFromDataURL');

View file

@ -1,19 +1,15 @@
(function () {
var asar, asarStatsToFsStats, cachedArchives, child_process, fakeTime, getOrCreateArchive, gid, invalidArchiveError, nextInode, notDirError, notFoundError, overrideAPI, overrideAPISync, path, splitPath, uid, util,
hasProp = {}.hasOwnProperty;
const asar = process.binding('atom_common_asar');
const child_process = require('child_process');
const path = require('path');
const util = require('util');
asar = process.binding('atom_common_asar');
child_process = require('child_process');
path = require('path');
util = require('util');
var hasProp = {}.hasOwnProperty;
// Cache asar archive objects.
cachedArchives = {};
var cachedArchives = {};
getOrCreateArchive = function(p) {
var getOrCreateArchive = function(p) {
var archive;
archive = cachedArchives[p];
if (archive != null) {
@ -39,13 +35,14 @@ process.on('exit', function() {
});
// Separate asar package's path from full path.
splitPath = function(p) {
var splitPath = function(p) {
var index;
// shortcut to disable asar.
var index;
if (process.noAsar) {
return [false];
}
if (typeof p !== 'string') {
return [false];
}
@ -61,15 +58,15 @@ splitPath = function(p) {
};
// Convert asar archive's Stats object to fs's Stats object.
nextInode = 0;
var nextInode = 0;
uid = process.getuid != null ? process.getuid() : 0;
var uid = process.getuid != null ? process.getuid() : 0;
gid = process.getgid != null ? process.getgid() : 0;
var gid = process.getgid != null ? process.getgid() : 0;
fakeTime = new Date();
var fakeTime = new Date();
asarStatsToFsStats = function(stats) {
var asarStatsToFsStats = function(stats) {
return {
dev: 1,
ino: ++nextInode,
@ -108,7 +105,7 @@ asarStatsToFsStats = function(stats) {
};
// Create a ENOENT error.
notFoundError = function(asarPath, filePath, callback) {
var notFoundError = function(asarPath, filePath, callback) {
var error;
error = new Error("ENOENT, " + filePath + " not found in " + asarPath);
error.code = "ENOENT";
@ -122,7 +119,7 @@ notFoundError = function(asarPath, filePath, callback) {
};
// Create a ENOTDIR error.
notDirError = function(callback) {
var notDirError = function(callback) {
var error;
error = new Error('ENOTDIR, not a directory');
error.code = 'ENOTDIR';
@ -136,7 +133,7 @@ notDirError = function(callback) {
};
// Create invalid archive error.
invalidArchiveError = function(asarPath, callback) {
var invalidArchiveError = function(asarPath, callback) {
var error;
error = new Error("Invalid package " + asarPath);
if (typeof callback !== 'function') {
@ -148,7 +145,7 @@ invalidArchiveError = function(asarPath, callback) {
};
// Override APIs that rely on passing file path instead of content to C++.
overrideAPISync = function(module, name, arg) {
var overrideAPISync = function(module, name, arg) {
var old;
if (arg == null) {
arg = 0;
@ -174,7 +171,7 @@ overrideAPISync = function(module, name, arg) {
};
};
overrideAPI = function(module, name, arg) {
var overrideAPI = function(module, name, arg) {
var old;
if (arg == null) {
arg = 0;

View file

@ -1,12 +1,7 @@
var Module, fs, path, timers, wrapWithActivateUvLoop;
fs = require('fs');
path = require('path');
timers = require('timers');
Module = require('module');
const fs = require('fs');
const path = require('path');
const timers = require('timers');
const Module = require('module');
process.atomBinding = function(name) {
var e, error;
@ -32,7 +27,7 @@ if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
// which would delay the callbacks for arbitrary long time. So we should
// initiatively activate the uv loop once setImmediate and process.nextTick is
// called.
wrapWithActivateUvLoop = function(func) {
var wrapWithActivateUvLoop = function(func) {
return function() {
process.activateUvLoop();
return func.apply(this, arguments);

View file

@ -1,8 +1,5 @@
var Module, path;
path = require('path');
Module = require('module');
const path = require('path');
const Module = require('module');
// Clear Node's global search paths.
Module.globalPaths.length = 0;

View file

@ -1,16 +1,15 @@
var getNextId, ipcRenderer, isValid, nativeImage, nextId, ref,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
const ipcRenderer = require('electron').ipcRenderer;
const nativeImage = require('electron').nativeImage;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, nativeImage = ref.nativeImage;
var nextId = 0;
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
nextId = 0;
getNextId = function() {
var getNextId = function() {
return ++nextId;
};
// |options.type| can not be empty and has to include 'window' or 'screen'.
isValid = function(options) {
var isValid = function(options) {
return ((options != null ? options.types : void 0) != null) && Array.isArray(options.types);
};

View file

@ -1,6 +1,4 @@
var common;
common = require('../../../../common/api/lib/exports/electron');
const common = require('../../../../common/api/lib/exports/electron');
// Import common modules.
common.defineProperties(exports);

View file

@ -1,14 +1,11 @@
var EventEmitter, binding, ipcRenderer, v8Util,
slice = [].slice;
const EventEmitter = require('events').EventEmitter;
const binding = process.atomBinding('ipc');
const v8Util = process.atomBinding('v8_util');
EventEmitter = require('events').EventEmitter;
binding = process.atomBinding('ipc');
v8Util = process.atomBinding('v8_util');
var slice = [].slice;
// Created by init.coffee.
ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
ipcRenderer.send = function() {
var args;

View file

@ -1,15 +1,14 @@
var EventEmitter, deprecate, ipc, ipcRenderer, method, ref,
slice = [].slice;
const ipcRenderer = require('electron').ipcRenderer;
const deprecate = require('electron').deprecate;
const EventEmitter = require('events').EventEmitter;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, deprecate = ref.deprecate;
EventEmitter = require('events').EventEmitter;
var slice = [].slice;
// This module is deprecated, we mirror everything from ipcRenderer.
deprecate.warn('ipc module', 'require("electron").ipcRenderer');
// Routes events of ipcRenderer.
ipc = new EventEmitter;
var ipc = new EventEmitter;
ipcRenderer.emit = function() {
var args, channel, event;
@ -19,7 +18,7 @@ ipcRenderer.emit = function() {
};
// Deprecated.
for (method in ipcRenderer) {
for (var method in ipcRenderer) {
if (method.startsWith('send')) {
ipc[method] = ipcRenderer[method];
}

View file

@ -1,14 +1,13 @@
var CallbacksRegistry, browserModules, builtinCache, callbacksRegistry, createRemoteMemberFunction, createRemoteMemberProperty, fn, ipcRenderer, isCircular, metaToPlainObject, metaToValue, moduleCache, name, processCache, ref, v8Util, webContentsCache, windowCache, wrapArgs,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
const ipcRenderer = require('electron').ipcRenderer;
const CallbacksRegistry = require('electron').CallbacksRegistry;
const v8Util = process.atomBinding('v8_util');
ref = require('electron'), ipcRenderer = ref.ipcRenderer, CallbacksRegistry = ref.CallbacksRegistry;
const callbacksRegistry = new CallbacksRegistry;
v8Util = process.atomBinding('v8_util');
callbacksRegistry = new CallbacksRegistry;
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
// Check for circular reference.
isCircular = function(field, visited) {
var isCircular = function(field, visited) {
if (typeof field === 'object') {
if (indexOf.call(visited, field) >= 0) {
return true;
@ -19,7 +18,7 @@ isCircular = function(field, visited) {
};
// Convert the arguments object into an array of meta data.
wrapArgs = function(args, visited) {
var wrapArgs = function(args, visited) {
var valueToMeta;
if (visited == null) {
visited = [];
@ -87,7 +86,7 @@ wrapArgs = function(args, visited) {
};
// Convert meta data from browser into real value.
metaToValue = function(meta) {
var metaToValue = function(meta) {
var RemoteFunction, el, i, j, len, len1, member, ref1, ref2, results, ret;
switch (meta.type) {
case 'value':
@ -169,7 +168,7 @@ metaToValue = function(meta) {
};
// Construct a plain object from the meta.
metaToPlainObject = function(meta) {
var metaToPlainObject = function(meta) {
var i, len, name, obj, ref1, ref2, value;
obj = (function() {
switch (meta.type) {
@ -190,7 +189,7 @@ metaToPlainObject = function(meta) {
// Create a RemoteMemberFunction instance.
// This function's content should not be inlined into metaToValue, otherwise V8
// may consider it circular reference.
createRemoteMemberFunction = function(metaId, name) {
var createRemoteMemberFunction = function(metaId, name) {
var RemoteMemberFunction;
return RemoteMemberFunction = (function() {
function RemoteMemberFunction() {
@ -216,7 +215,7 @@ createRemoteMemberFunction = function(metaId, name) {
// Create configuration for defineProperty.
// This function's content should not be inlined into metaToValue, otherwise V8
// may consider it circular reference.
createRemoteMemberProperty = function(metaId, name) {
var createRemoteMemberProperty = function(metaId, name) {
return {
enumerable: true,
configurable: false,
@ -245,25 +244,24 @@ ipcRenderer.on('ATOM_RENDERER_RELEASE_CALLBACK', function(event, id) {
});
// List all built-in modules in browser process.
browserModules = require('../../../browser/api/lib/exports/electron');
const browserModules = require('../../../browser/api/lib/exports/electron');
// And add a helper receiver for each one.
fn = function(name) {
var fn = function(name) {
return Object.defineProperty(exports, name, {
get: function() {
return exports.getBuiltin(name);
}
});
};
for (name in browserModules) {
for (var name in browserModules) {
fn(name);
}
// Get remote module.
// (Just like node's require, the modules are cached permanently, note that this
// is safe leak since the object is not expected to get freed in browser)
moduleCache = {};
var moduleCache = {};
exports.require = function(module) {
var meta;
@ -274,13 +272,11 @@ exports.require = function(module) {
return moduleCache[module] = metaToValue(meta);
};
// Optimize require('electron').
moduleCache.electron = exports;
// Alias to remote.require('electron').xxx.
builtinCache = {};
var builtinCache = {};
exports.getBuiltin = function(module) {
var meta;
@ -292,7 +288,7 @@ exports.getBuiltin = function(module) {
};
// Get current BrowserWindow object.
windowCache = null;
var windowCache = null;
exports.getCurrentWindow = function() {
var meta;
@ -304,7 +300,7 @@ exports.getCurrentWindow = function() {
};
// Get current WebContents object.
webContentsCache = null;
var webContentsCache = null;
exports.getCurrentWebContents = function() {
var meta;
@ -323,7 +319,7 @@ exports.getGlobal = function(name) {
};
// Get the process object in browser.
processCache = null;
var processCache = null;
exports.__defineGetter__('process', function() {
if (processCache == null) {

View file

@ -1,8 +1,5 @@
var chrome, url;
url = require('url');
chrome = window.chrome = window.chrome || {};
const url = require('url');
const chrome = window.chrome = window.chrome || {};
chrome.extension = {
getURL: function(path) {

View file

@ -1,14 +1,9 @@
'user strict';
var Module, arg, error, error1, events, globalPaths, i, len, nodeIntegration, path, pathname, preloadScript, ref, url, v8Util;
events = require('events');
path = require('path');
url = require('url');
Module = require('module');
const events = require('events');
const path = require('path');
const url = require('url');
const Module = require('module');
// We modified the original process.argv to let node.js load the
@ -23,7 +18,7 @@ require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths
// Import common settings.
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
globalPaths = Module.globalPaths;
var globalPaths = Module.globalPaths;
if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib'));
@ -33,7 +28,7 @@ if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib', 'exports'));
// The global variable will be used by ipc for event dispatching
v8Util = process.atomBinding('v8_util');
var v8Util = process.atomBinding('v8_util');
v8Util.setHiddenValue(global, 'ipc', new events.EventEmitter);
@ -46,9 +41,11 @@ electron.ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_WEB_FRAME_METHOD', (event, m
});
// Process command line arguments.
nodeIntegration = 'false';
var nodeIntegration = 'false';
var preloadScript = null;
ref = process.argv;
var ref = process.argv;
var i, len, arg;
for (i = 0, len = ref.length; i < len; i++) {
arg = ref[i];
if (arg.indexOf('--guest-instance-id=') === 0) {
@ -90,7 +87,7 @@ if (nodeIntegration === 'true' || nodeIntegration === 'all' || nodeIntegration =
// Set the __filename to the path of html file if it is file: protocol.
if (window.location.protocol === 'file:') {
pathname = process.platform === 'win32' && window.location.pathname[0] === '/' ? window.location.pathname.substr(1) : window.location.pathname;
var pathname = process.platform === 'win32' && window.location.pathname[0] === '/' ? window.location.pathname.substr(1) : window.location.pathname;
global.__filename = path.normalize(decodeURIComponent(pathname));
global.__dirname = path.dirname(global.__filename);
@ -132,8 +129,7 @@ if (nodeIntegration === 'true' || nodeIntegration === 'all' || nodeIntegration =
if (preloadScript) {
try {
require(preloadScript);
} catch (error1) {
error = error1;
} catch (error) {
if (error.code === 'MODULE_NOT_FOUND') {
console.error("Unable to load preload script " + preloadScript);
} else {

View file

@ -1,5 +1,3 @@
var convertToMenuTemplate, createFileSelectorElement, createMenu, pathToHtml5FileObject, showFileChooserDialog;
window.onload = function() {
// Use menu API to show context menu.
InspectorFrontendHost.showContextMenuAtPoint = createMenu;
@ -8,7 +6,7 @@ window.onload = function() {
return WebInspector.createFileSelectorElement = createFileSelectorElement;
};
convertToMenuTemplate = function(items) {
var convertToMenuTemplate = function(items) {
var fn, i, item, len, template;
template = [];
fn = function(item) {
@ -45,11 +43,10 @@ convertToMenuTemplate = function(items) {
return template;
};
createMenu = function(x, y, items, document) {
var Menu, menu, remote;
remote = require('electron').remote;
Menu = remote.Menu;
menu = Menu.buildFromTemplate(convertToMenuTemplate(items));
var createMenu = function(x, y, items, document) {
const remote = require('electron').remote;
const Menu = remote.Menu;
const menu = Menu.buildFromTemplate(convertToMenuTemplate(items));
// The menu is expected to show asynchronously.
return setTimeout(function() {
@ -57,7 +54,7 @@ createMenu = function(x, y, items, document) {
});
};
showFileChooserDialog = function(callback) {
var showFileChooserDialog = function(callback) {
var dialog, files, remote;
remote = require('electron').remote;
dialog = remote.dialog;
@ -67,7 +64,7 @@ showFileChooserDialog = function(callback) {
}
};
pathToHtml5FileObject = function(path) {
var pathToHtml5FileObject = function(path) {
var blob, fs;
fs = require('fs');
blob = new Blob([fs.readFileSync(path)]);
@ -75,7 +72,7 @@ pathToHtml5FileObject = function(path) {
return blob;
};
createFileSelectorElement = function(callback) {
var createFileSelectorElement = function(callback) {
var fileSelectorElement;
fileSelectorElement = document.createElement('span');
fileSelectorElement.style.display = 'none';

View file

@ -1,18 +1,18 @@
var BrowserWindowProxy, a, getHistoryOperation, ipcRenderer, ref, remote, resolveURL, sendHistoryOperation,
slice = [].slice;
const ipcRenderer = require('electron').ipcRenderer;
const remote = require('electron').remote;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, remote = ref.remote;
var slice = [].slice;
// Helper function to resolve relative url.
a = window.top.document.createElement('a');
var a = window.top.document.createElement('a');
resolveURL = function(url) {
var resolveURL = function(url) {
a.href = url;
return a.href;
};
// Window object returned by "window.open".
BrowserWindowProxy = (function() {
var BrowserWindowProxy = (function() {
BrowserWindowProxy.proxies = {};
BrowserWindowProxy.getOrCreate = function(guestId) {
@ -180,13 +180,13 @@ ipcRenderer.on('ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', function(event, sourceId,
});
// Forward history operations to browser.
sendHistoryOperation = function() {
var sendHistoryOperation = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return ipcRenderer.send.apply(ipcRenderer, ['ATOM_SHELL_NAVIGATION_CONTROLLER'].concat(slice.call(args)));
};
getHistoryOperation = function() {
var getHistoryOperation = function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return ipcRenderer.sendSync.apply(ipcRenderer, ['ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER'].concat(slice.call(args)));

View file

@ -1,11 +1,10 @@
var DEPRECATED_EVENTS, WEB_VIEW_EVENTS, dispatchEvent, ipcRenderer, ref, requestId, webFrame,
slice = [].slice;
const ipcRenderer = require('electron').ipcRenderer;
const webFrame = require('electron').webFrame;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, webFrame = ref.webFrame;
var slice = [].slice;
var requestId = 0;
requestId = 0;
WEB_VIEW_EVENTS = {
var WEB_VIEW_EVENTS = {
'load-commit': ['url', 'isMainFrame'],
'did-finish-load': [],
'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL'],
@ -38,11 +37,11 @@ WEB_VIEW_EVENTS = {
'found-in-page': ['result']
};
DEPRECATED_EVENTS = {
var DEPRECATED_EVENTS = {
'page-title-updated': 'page-title-set'
};
dispatchEvent = function() {
var dispatchEvent = function() {
var args, domEvent, eventKey, eventName, f, i, j, len, ref1, webView;
webView = arguments[0], eventName = arguments[1], eventKey = arguments[2], args = 4 <= arguments.length ? slice.call(arguments, 3) : [];
if (DEPRECATED_EVENTS[eventName] != null) {

View file

@ -1,26 +1,23 @@
var AllowTransparencyAttribute, AutosizeAttribute, AutosizeDimensionAttribute, BooleanAttribute, HttpReferrerAttribute, PartitionAttribute, PreloadAttribute, SrcAttribute, UserAgentAttribute, WebViewAttribute, WebViewImpl, a, guestViewInternal, remote, resolveURL, webViewConstants,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
const WebViewImpl = require('./web-view');
const guestViewInternal = require('./guest-view-internal');
const webViewConstants = require('./web-view-constants');
const remote = require('electron').remote;
WebViewImpl = require('./web-view');
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
guestViewInternal = require('./guest-view-internal');
webViewConstants = require('./web-view-constants');
remote = require('electron').remote;
var hasProp = {}.hasOwnProperty;
// Helper function to resolve url set in attribute.
a = document.createElement('a');
var a = document.createElement('a');
resolveURL = function(url) {
var resolveURL = function(url) {
a.href = url;
return a.href;
};
// Attribute objects.
// Default implementation of a WebView attribute.
WebViewAttribute = (function() {
var WebViewAttribute = (function() {
function WebViewAttribute(name, webViewImpl) {
this.name = name;
this.value = webViewImpl.webviewNode[name] || '';
@ -71,7 +68,7 @@ WebViewAttribute = (function() {
})();
// An attribute that is treated as a Boolean.
BooleanAttribute = (function(superClass) {
var BooleanAttribute = (function(superClass) {
extend(BooleanAttribute, superClass);
function BooleanAttribute(name, webViewImpl) {
@ -95,7 +92,7 @@ BooleanAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that specifies whether transparency is allowed in the webview.
AllowTransparencyAttribute = (function(superClass) {
var AllowTransparencyAttribute = (function(superClass) {
extend(AllowTransparencyAttribute, superClass);
function AllowTransparencyAttribute(webViewImpl) {
@ -114,7 +111,7 @@ AllowTransparencyAttribute = (function(superClass) {
})(BooleanAttribute);
// Attribute used to define the demension limits of autosizing.
AutosizeDimensionAttribute = (function(superClass) {
var AutosizeDimensionAttribute = (function(superClass) {
extend(AutosizeDimensionAttribute, superClass);
function AutosizeDimensionAttribute(name, webViewImpl) {
@ -147,7 +144,7 @@ AutosizeDimensionAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that specifies whether the webview should be autosized.
AutosizeAttribute = (function(superClass) {
var AutosizeAttribute = (function(superClass) {
extend(AutosizeAttribute, superClass);
function AutosizeAttribute(webViewImpl) {
@ -161,7 +158,7 @@ AutosizeAttribute = (function(superClass) {
})(BooleanAttribute);
// Attribute representing the state of the storage partition.
PartitionAttribute = (function(superClass) {
var PartitionAttribute = (function(superClass) {
extend(PartitionAttribute, superClass);
function PartitionAttribute(webViewImpl) {
@ -189,7 +186,7 @@ PartitionAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that handles the location and navigation of the webview.
SrcAttribute = (function(superClass) {
var SrcAttribute = (function(superClass) {
extend(SrcAttribute, superClass);
function SrcAttribute(webViewImpl) {
@ -292,7 +289,7 @@ SrcAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute specifies HTTP referrer.
HttpReferrerAttribute = (function(superClass) {
var HttpReferrerAttribute = (function(superClass) {
extend(HttpReferrerAttribute, superClass);
function HttpReferrerAttribute(webViewImpl) {
@ -304,7 +301,7 @@ HttpReferrerAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute specifies user agent
UserAgentAttribute = (function(superClass) {
var UserAgentAttribute = (function(superClass) {
extend(UserAgentAttribute, superClass);
function UserAgentAttribute(webViewImpl) {
@ -316,7 +313,7 @@ UserAgentAttribute = (function(superClass) {
})(WebViewAttribute);
// Attribute that set preload script.
PreloadAttribute = (function(superClass) {
var PreloadAttribute = (function(superClass) {
extend(PreloadAttribute, superClass);
function PreloadAttribute(webViewImpl) {

View file

@ -1,26 +1,26 @@
'user strict';
var WebViewImpl, deprecate, getNextId, guestViewInternal, ipcRenderer, listener, nextId, ref, registerBrowserPluginElement, registerWebViewElement, remote, useCapture, v8Util, webFrame, webViewConstants,
hasProp = {}.hasOwnProperty,
slice = [].slice;
const deprecate = require('electron').deprecate;
const webFrame = require('electron').webFrame;
const remote = require('electron').remote;
const ipcRenderer = require('electron').ipcRenderer;
ref = require('electron'), deprecate = ref.deprecate, webFrame = ref.webFrame, remote = ref.remote, ipcRenderer = ref.ipcRenderer;
const v8Util = process.atomBinding('v8_util');
const guestViewInternal = require('./guest-view-internal');
const webViewConstants = require('./web-view-constants');
v8Util = process.atomBinding('v8_util');
guestViewInternal = require('./guest-view-internal');
webViewConstants = require('./web-view-constants');
var hasProp = {}.hasOwnProperty;
var slice = [].slice;
// ID generator.
nextId = 0;
var nextId = 0;
getNextId = function() {
var getNextId = function() {
return ++nextId;
};
// Represents the internal state of the WebView node.
WebViewImpl = (function() {
var WebViewImpl = (function() {
function WebViewImpl(webviewNode) {
var shadowRoot;
this.webviewNode = webviewNode;
@ -274,7 +274,7 @@ WebViewImpl = (function() {
})();
// Registers browser plugin <object> custom element.
registerBrowserPluginElement = function() {
var registerBrowserPluginElement = function() {
var proto;
proto = Object.create(HTMLObjectElement.prototype);
proto.createdCallback = function() {
@ -310,7 +310,7 @@ registerBrowserPluginElement = function() {
};
// Registers <webview> custom element.
registerWebViewElement = function() {
var registerWebViewElement = function() {
var createBlockHandler, createNonBlockHandler, i, j, len, len1, m, methods, nonblockMethods, proto;
proto = Object.create(HTMLObjectElement.prototype);
proto.createdCallback = function() {
@ -444,9 +444,9 @@ registerWebViewElement = function() {
return delete proto.attributeChangedCallback;
};
useCapture = true;
var useCapture = true;
listener = function(event) {
var listener = function(event) {
if (document.readyState === 'loading') {
return;
}