Merge pull request #4109 from atom/const
[WIP] Use `const` for requires
This commit is contained in:
commit
3875b30fcf
44 changed files with 314 additions and 437 deletions
|
@ -1,15 +1,13 @@
|
||||||
var EventEmitter, Menu, app, appPath, bindings, deprecate, downloadItemBindings, fn, i, len, name, ref, ref1, session, wrapDownloadItem,
|
const deprecate = require('electron').deprecate;
|
||||||
slice = [].slice;
|
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;
|
var slice = [].slice;
|
||||||
|
|
||||||
bindings = process.atomBinding('app');
|
|
||||||
|
|
||||||
downloadItemBindings = process.atomBinding('download_item');
|
|
||||||
|
|
||||||
app = bindings.app;
|
|
||||||
|
|
||||||
app.__proto__ = EventEmitter.prototype;
|
app.__proto__ = EventEmitter.prototype;
|
||||||
|
|
||||||
|
@ -43,7 +41,7 @@ if (process.platform === 'darwin') {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
appPath = null;
|
var appPath = null;
|
||||||
|
|
||||||
app.setAppPath = function(path) {
|
app.setAppPath = function(path) {
|
||||||
return appPath = path;
|
return appPath = path;
|
||||||
|
@ -54,17 +52,18 @@ app.getAppPath = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Routes the events to webContents.
|
// Routes the events to webContents.
|
||||||
ref1 = ['login', 'certificate-error', 'select-client-certificate'];
|
var ref1 = ['login', 'certificate-error', 'select-client-certificate'];
|
||||||
fn = function(name) {
|
var fn = function(name) {
|
||||||
return app.on(name, function() {
|
return app.on(name, function() {
|
||||||
var args, event, webContents;
|
var args, event, webContents;
|
||||||
event = arguments[0], webContents = arguments[1], args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
|
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)));
|
return webContents.emit.apply(webContents, [name, event].concat(slice.call(args)));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var i, len, name;
|
||||||
for (i = 0, len = ref1.length; i < len; i++) {
|
for (i = 0, len = ref1.length; i < len; i++) {
|
||||||
name = ref1[i];
|
name = ref1[i];
|
||||||
fn(name);
|
fn(ref1[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated.
|
// Deprecated.
|
||||||
|
@ -106,7 +105,7 @@ deprecate.event(app, 'activate-with-no-open-windows', 'activate', function(event
|
||||||
deprecate.event(app, 'select-certificate', 'select-client-certificate');
|
deprecate.event(app, 'select-certificate', 'select-client-certificate');
|
||||||
|
|
||||||
// Wrappers for native classes.
|
// Wrappers for native classes.
|
||||||
wrapDownloadItem = function(downloadItem) {
|
var wrapDownloadItem = function(downloadItem) {
|
||||||
|
|
||||||
// downloadItem is an EventEmitter.
|
// downloadItem is an EventEmitter.
|
||||||
downloadItem.__proto__ = EventEmitter.prototype;
|
downloadItem.__proto__ = EventEmitter.prototype;
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
var autoUpdater, deprecate;
|
const deprecate = require('electron').deprecate;
|
||||||
|
const autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
|
||||||
deprecate = require('electron').deprecate;
|
|
||||||
|
|
||||||
autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
|
|
||||||
|
|
||||||
// Deprecated.
|
// Deprecated.
|
||||||
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');
|
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
var EventEmitter, autoUpdater;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
const autoUpdater = process.atomBinding('auto_updater').autoUpdater;
|
||||||
EventEmitter = require('events').EventEmitter;
|
|
||||||
|
|
||||||
autoUpdater = process.atomBinding('auto_updater').autoUpdater;
|
|
||||||
|
|
||||||
autoUpdater.__proto__ = EventEmitter.prototype;
|
autoUpdater.__proto__ = EventEmitter.prototype;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
var AutoUpdater, EventEmitter, app, squirrelUpdate, url,
|
const app = require('electron').app;
|
||||||
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; },
|
const EventEmitter = require('events').EventEmitter;
|
||||||
hasProp = {}.hasOwnProperty;
|
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;
|
var AutoUpdater = (function(superClass) {
|
||||||
|
|
||||||
url = require('url');
|
|
||||||
|
|
||||||
squirrelUpdate = require('./squirrel-update-win');
|
|
||||||
|
|
||||||
AutoUpdater = (function(superClass) {
|
|
||||||
extend(AutoUpdater, superClass);
|
extend(AutoUpdater, superClass);
|
||||||
|
|
||||||
function AutoUpdater() {
|
function AutoUpdater() {
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
var appFolder, exeName, fs, path, spawn, spawnUpdate, updateExe;
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
fs = require('fs');
|
const spawn = require('child_process').spawn;
|
||||||
|
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
spawn = require('child_process').spawn;
|
|
||||||
|
|
||||||
// i.e. my-app/app-0.1.13/
|
// 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
|
// 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
|
// Spawn a command and invoke the callback when it completes with an error
|
||||||
// and the output from standard out.
|
// and the output from standard out.
|
||||||
spawnUpdate = function(args, detached, callback) {
|
var spawnUpdate = function(args, detached, callback) {
|
||||||
var error, error1, errorEmitted, spawnedProcess, stderr, stdout;
|
var error, error1, errorEmitted, spawnedProcess, stderr, stdout;
|
||||||
try {
|
try {
|
||||||
spawnedProcess = spawn(updateExe, args, {
|
spawnedProcess = spawn(updateExe, args, {
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
var BrowserWindow, EventEmitter, deprecate, ipcMain, ref;
|
const ipcMain = require('electron').ipcMain;
|
||||||
|
const deprecate = require('electron').deprecate;
|
||||||
ref = require('electron'), ipcMain = ref.ipcMain, deprecate = ref.deprecate;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
const BrowserWindow = process.atomBinding('window').BrowserWindow;
|
||||||
EventEmitter = require('events').EventEmitter;
|
|
||||||
|
|
||||||
BrowserWindow = process.atomBinding('window').BrowserWindow;
|
|
||||||
|
|
||||||
BrowserWindow.prototype.__proto__ = EventEmitter.prototype;
|
BrowserWindow.prototype.__proto__ = EventEmitter.prototype;
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
var BrowserWindow, api, app, binding, checkAppInitialized, fileDialogProperties, j, len, messageBoxOptions, messageBoxTypes, parseArgs, ref, ref1, v8Util,
|
const app = require('electron').app;
|
||||||
slice = [].slice,
|
const BrowserWindow = require('electron').BrowserWindow;
|
||||||
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 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');
|
var fileDialogProperties = {
|
||||||
|
|
||||||
v8Util = process.atomBinding('v8_util');
|
|
||||||
|
|
||||||
fileDialogProperties = {
|
|
||||||
openFile: 1 << 0,
|
openFile: 1 << 0,
|
||||||
openDirectory: 1 << 1,
|
openDirectory: 1 << 1,
|
||||||
multiSelections: 1 << 2,
|
multiSelections: 1 << 2,
|
||||||
createDirectory: 1 << 3
|
createDirectory: 1 << 3
|
||||||
};
|
};
|
||||||
|
|
||||||
messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'];
|
var messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'];
|
||||||
|
|
||||||
messageBoxOptions = {
|
var messageBoxOptions = {
|
||||||
noLink: 1 << 0
|
noLink: 1 << 0
|
||||||
};
|
};
|
||||||
|
|
||||||
parseArgs = function(window, options, callback) {
|
var parseArgs = function(window, options, callback) {
|
||||||
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
|
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
|
||||||
// Shift.
|
// Shift.
|
||||||
callback = options;
|
callback = options;
|
||||||
|
@ -36,7 +34,7 @@ parseArgs = function(window, options, callback) {
|
||||||
return [window, options, callback];
|
return [window, options, callback];
|
||||||
};
|
};
|
||||||
|
|
||||||
checkAppInitialized = function() {
|
var checkAppInitialized = function() {
|
||||||
if (!app.isReady()) {
|
if (!app.isReady()) {
|
||||||
throw new Error('dialog module can only be used after app is ready');
|
throw new Error('dialog module can only be used after app is ready');
|
||||||
}
|
}
|
||||||
|
@ -164,7 +162,8 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mark standard asynchronous functions.
|
// 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++) {
|
for (j = 0, len = ref1.length; j < len; j++) {
|
||||||
api = ref1[j];
|
api = ref1[j];
|
||||||
v8Util.setHiddenValue(module.exports[api], 'asynchronous', true);
|
v8Util.setHiddenValue(module.exports[api], 'asynchronous', true);
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
var common;
|
const common = require('../../../../common/api/lib/exports/electron');
|
||||||
|
|
||||||
common = require('../../../../common/api/lib/exports/electron');
|
|
||||||
|
|
||||||
|
|
||||||
// Import common modules.
|
// Import common modules.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
var EventEmitter;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
|
||||||
EventEmitter = require('events').EventEmitter;
|
|
||||||
|
|
||||||
module.exports = new EventEmitter;
|
module.exports = new EventEmitter;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
var deprecate, ipcMain, ref;
|
const deprecate = require('electron').deprecate;
|
||||||
|
const ipcMain = require('electron').ipcMain;
|
||||||
ref = require('electron'), deprecate = ref.deprecate, ipcMain = ref.ipcMain;
|
|
||||||
|
|
||||||
// This module is deprecated, we mirror everything from ipcMain.
|
// This module is deprecated, we mirror everything from ipcMain.
|
||||||
deprecate.warn('ipc module', 'require("electron").ipcMain');
|
deprecate.warn('ipc module', 'require("electron").ipcMain');
|
||||||
|
|
|
@ -26,8 +26,8 @@ MenuItem = (function() {
|
||||||
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'];
|
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'];
|
||||||
|
|
||||||
function MenuItem(options) {
|
function MenuItem(options) {
|
||||||
var Menu, click, ref;
|
var click, ref;
|
||||||
Menu = require('electron').Menu;
|
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;
|
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) {
|
if ((this.submenu != null) && this.submenu.constructor !== Menu) {
|
||||||
this.submenu = Menu.buildFromTemplate(this.submenu);
|
this.submenu = Menu.buildFromTemplate(this.submenu);
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
var BrowserWindow, EventEmitter, Menu, MenuItem, applicationMenu, bindings, generateGroupId, indexOfItemById, indexToInsertByPosition, nextGroupId, ref, v8Util;
|
const BrowserWindow = require('electron').BrowserWindow;
|
||||||
|
const MenuItem = require('electron').MenuItem;
|
||||||
ref = require('electron'), BrowserWindow = ref.BrowserWindow, MenuItem = ref.MenuItem;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
const v8Util = process.atomBinding('v8_util');
|
||||||
EventEmitter = require('events').EventEmitter;
|
const bindings = process.atomBinding('menu');
|
||||||
|
|
||||||
v8Util = process.atomBinding('v8_util');
|
|
||||||
|
|
||||||
bindings = process.atomBinding('menu');
|
|
||||||
|
|
||||||
// Automatically generated radio menu item's group id.
|
// 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,
|
// Search between seperators to find a radio menu item and return its group id,
|
||||||
// otherwise generate a group id.
|
// otherwise generate a group id.
|
||||||
generateGroupId = function(items, pos) {
|
var generateGroupId = function(items, pos) {
|
||||||
var i, item, j, k, ref1, ref2, ref3;
|
var i, item, j, k, ref1, ref2, ref3;
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
for (i = j = ref1 = pos - 1; ref1 <= 0 ? j <= 0 : j >= 0; i = ref1 <= 0 ? ++j : --j) {
|
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|.
|
// Returns the index of item according to |id|.
|
||||||
indexOfItemById = function(items, id) {
|
var indexOfItemById = function(items, id) {
|
||||||
var i, item, j, len;
|
var i, item, j, len;
|
||||||
for (i = j = 0, len = items.length; j < len; i = ++j) {
|
for (i = j = 0, len = items.length; j < len; i = ++j) {
|
||||||
item = items[i];
|
item = items[i];
|
||||||
|
@ -52,7 +48,7 @@ indexOfItemById = function(items, id) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns the index of where to insert the item according to |position|.
|
// 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;
|
var id, insertIndex, query, ref1;
|
||||||
if (!position) {
|
if (!position) {
|
||||||
return items.length;
|
return items.length;
|
||||||
|
@ -87,7 +83,7 @@ indexToInsertByPosition = function(items, position) {
|
||||||
return insertIndex;
|
return insertIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
Menu = bindings.Menu;
|
const Menu = bindings.Menu;
|
||||||
|
|
||||||
Menu.prototype.__proto__ = EventEmitter.prototype;
|
Menu.prototype.__proto__ = EventEmitter.prototype;
|
||||||
|
|
||||||
|
@ -265,7 +261,7 @@ Menu.prototype._callMenuWillShow = function() {
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
applicationMenu = null;
|
var applicationMenu = null;
|
||||||
|
|
||||||
Menu.setApplicationMenu = function(menu) {
|
Menu.setApplicationMenu = function(menu) {
|
||||||
var j, len, results, w, windows;
|
var j, len, results, w, windows;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
var NavigationController, ipcMain,
|
const ipcMain = require('electron').ipcMain;
|
||||||
slice = [].slice;
|
|
||||||
|
|
||||||
ipcMain = require('electron').ipcMain;
|
var slice = [].slice;
|
||||||
|
|
||||||
// The history operation in renderer is redirected to browser.
|
// The history operation in renderer is redirected to browser.
|
||||||
ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function() {
|
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.
|
// 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
|
// This helps us avoid Chromium's various optimizations so we can ensure renderer
|
||||||
// process is restarted everytime.
|
// process is restarted everytime.
|
||||||
NavigationController = (function() {
|
var NavigationController = (function() {
|
||||||
function NavigationController(webContents) {
|
function NavigationController(webContents) {
|
||||||
this.webContents = webContents;
|
this.webContents = webContents;
|
||||||
this.clearHistory();
|
this.clearHistory();
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
var EventEmitter, powerMonitor;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
const powerMonitor = process.atomBinding('power_monitor').powerMonitor;
|
||||||
EventEmitter = require('events').EventEmitter;
|
|
||||||
|
|
||||||
powerMonitor = process.atomBinding('power_monitor').powerMonitor;
|
|
||||||
|
|
||||||
powerMonitor.__proto__ = EventEmitter.prototype;
|
powerMonitor.__proto__ = EventEmitter.prototype;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
var app, logAndThrow, protocol;
|
const app = require('electron').app;
|
||||||
|
|
||||||
app = require('electron').app;
|
|
||||||
|
|
||||||
if (!app.isReady()) {
|
if (!app.isReady()) {
|
||||||
throw new Error('Can not initialize protocol module before app is ready');
|
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.
|
// Warn about removed APIs.
|
||||||
logAndThrow = function(callback, message) {
|
var logAndThrow = function(callback, message) {
|
||||||
console.error(message);
|
console.error(message);
|
||||||
if (callback) {
|
if (callback) {
|
||||||
return callback(new Error(message));
|
return callback(new Error(message));
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
var EventEmitter, screen;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
const screen = process.atomBinding('screen').screen;
|
||||||
EventEmitter = require('events').EventEmitter;
|
|
||||||
|
|
||||||
screen = process.atomBinding('screen').screen;
|
|
||||||
|
|
||||||
screen.__proto__ = EventEmitter.prototype;
|
screen.__proto__ = EventEmitter.prototype;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
var EventEmitter, PERSIST_PERFIX, bindings, wrapSession;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
const bindings = process.atomBinding('session');
|
||||||
EventEmitter = require('events').EventEmitter;
|
const PERSIST_PERFIX = 'persist:';
|
||||||
|
|
||||||
bindings = process.atomBinding('session');
|
|
||||||
|
|
||||||
PERSIST_PERFIX = 'persist:';
|
|
||||||
|
|
||||||
// Returns the Session from |partition| string.
|
// Returns the Session from |partition| string.
|
||||||
exports.fromPartition = function(partition) {
|
exports.fromPartition = function(partition) {
|
||||||
|
@ -29,7 +25,7 @@ Object.defineProperty(exports, 'defaultSession', {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapSession = function(session) {
|
var wrapSession = function(session) {
|
||||||
// session is an EventEmitter.
|
// session is an EventEmitter.
|
||||||
return session.__proto__ = EventEmitter.prototype;
|
return session.__proto__ = EventEmitter.prototype;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
var EventEmitter, Tray, deprecate;
|
const deprecate = require('electron').deprecate;
|
||||||
|
const EventEmitter = require('events').EventEmitter;
|
||||||
deprecate = require('electron').deprecate;
|
const Tray = process.atomBinding('tray').Tray;
|
||||||
|
|
||||||
EventEmitter = require('events').EventEmitter;
|
|
||||||
|
|
||||||
Tray = process.atomBinding('tray').Tray;
|
|
||||||
|
|
||||||
Tray.prototype.__proto__ = EventEmitter.prototype;
|
Tray.prototype.__proto__ = EventEmitter.prototype;
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var EventEmitter, Menu, NavigationController, PDFPageSize, binding, deprecate, getNextId, ipcMain, nextId, ref, session, wrapWebContents,
|
const EventEmitter = require('events').EventEmitter;
|
||||||
slice = [].slice;
|
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');
|
let getNextId = function() {
|
||||||
|
|
||||||
nextId = 0;
|
|
||||||
|
|
||||||
getNextId = function() {
|
|
||||||
return ++nextId;
|
return ++nextId;
|
||||||
};
|
};
|
||||||
|
|
||||||
PDFPageSize = {
|
let PDFPageSize = {
|
||||||
A5: {
|
A5: {
|
||||||
custom_display_name: "A5",
|
custom_display_name: "A5",
|
||||||
height_microns: 210000,
|
height_microns: 210000,
|
||||||
|
@ -64,7 +65,7 @@ const webFrameMethods = [
|
||||||
'setZoomLevelLimits',
|
'setZoomLevelLimits',
|
||||||
];
|
];
|
||||||
|
|
||||||
wrapWebContents = function(webContents) {
|
let wrapWebContents = function(webContents) {
|
||||||
// webContents is an EventEmitter.
|
// webContents is an EventEmitter.
|
||||||
var controller, method, name, ref1;
|
var controller, method, name, ref1;
|
||||||
webContents.__proto__ = EventEmitter.prototype;
|
webContents.__proto__ = EventEmitter.prototype;
|
||||||
|
|
|
@ -1,33 +1,28 @@
|
||||||
var app, electron, extensionInfoMap, fs, getExtensionInfoFromPath, getHostForPath, getPathForHost, hostPathMap, hostPathMapNextKey, loadedExtensions, loadedExtensionsPath, path, url;
|
const electron = require('electron');
|
||||||
|
const app = electron.app;
|
||||||
electron = require('electron');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
fs = require('fs');
|
const url = require('url');
|
||||||
|
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
url = require('url');
|
|
||||||
|
|
||||||
// Mapping between hostname and file path.
|
// Mapping between hostname and file path.
|
||||||
hostPathMap = {};
|
var hostPathMap = {};
|
||||||
|
var hostPathMapNextKey = 0;
|
||||||
|
|
||||||
hostPathMapNextKey = 0;
|
var getHostForPath = function(path) {
|
||||||
|
|
||||||
getHostForPath = function(path) {
|
|
||||||
var key;
|
var key;
|
||||||
key = "extension-" + (++hostPathMapNextKey);
|
key = "extension-" + (++hostPathMapNextKey);
|
||||||
hostPathMap[key] = path;
|
hostPathMap[key] = path;
|
||||||
return key;
|
return key;
|
||||||
};
|
};
|
||||||
|
|
||||||
getPathForHost = function(host) {
|
var getPathForHost = function(host) {
|
||||||
return hostPathMap[host];
|
return hostPathMap[host];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cache extensionInfo.
|
// Cache extensionInfo.
|
||||||
extensionInfoMap = {};
|
var extensionInfoMap = {};
|
||||||
|
|
||||||
getExtensionInfoFromPath = function(srcDirectory) {
|
var getExtensionInfoFromPath = function(srcDirectory) {
|
||||||
var manifest, page;
|
var manifest, page;
|
||||||
manifest = JSON.parse(fs.readFileSync(path.join(srcDirectory, 'manifest.json')));
|
manifest = JSON.parse(fs.readFileSync(path.join(srcDirectory, 'manifest.json')));
|
||||||
if (extensionInfoMap[manifest.name] == null) {
|
if (extensionInfoMap[manifest.name] == null) {
|
||||||
|
@ -51,11 +46,8 @@ getExtensionInfoFromPath = function(srcDirectory) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// The loaded extensions cache and its persistent path.
|
// The loaded extensions cache and its persistent path.
|
||||||
loadedExtensions = null;
|
var loadedExtensions = null;
|
||||||
loadedExtensionsPath = null;
|
var loadedExtensionsPath = null;
|
||||||
|
|
||||||
// Persistent loaded extensions.
|
|
||||||
app = electron.app;
|
|
||||||
|
|
||||||
app.on('will-quit', function() {
|
app.on('will-quit', function() {
|
||||||
var e, error1, error2;
|
var e, error1, error2;
|
||||||
|
|
|
@ -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;
|
var deepEqual = function(opt1, opt2) {
|
||||||
|
|
||||||
desktopCapturer = process.atomBinding('desktop_capturer').desktopCapturer;
|
|
||||||
|
|
||||||
deepEqual = function(opt1, opt2) {
|
|
||||||
return JSON.stringify(opt1) === JSON.stringify(opt2);
|
return JSON.stringify(opt1) === JSON.stringify(opt2);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A queue for holding all requests from renderer process.
|
// 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) {
|
ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureWindow, captureScreen, thumbnailSize, id) {
|
||||||
var request;
|
var request;
|
||||||
|
|
|
@ -1,33 +1,30 @@
|
||||||
var attachGuest, createGuest, destroyGuest, embedderElementsMap, getNextInstanceId, guestInstances, ipcMain, moveLastToFirst, nextInstanceId, ref, reverseEmbedderElementsMap, supportedWebViewEvents, webContents, webViewManager,
|
const ipcMain = require('electron').ipcMain;
|
||||||
slice = [].slice;
|
const webContents = require('electron').webContents;
|
||||||
|
|
||||||
ref = require('electron'), ipcMain = ref.ipcMain, webContents = ref.webContents;
|
var slice = [].slice;
|
||||||
|
|
||||||
// Doesn't exist in early initialization.
|
// 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;
|
var nextInstanceId = 0;
|
||||||
|
var guestInstances = {};
|
||||||
guestInstances = {};
|
var embedderElementsMap = {};
|
||||||
|
var reverseEmbedderElementsMap = {};
|
||||||
embedderElementsMap = {};
|
|
||||||
|
|
||||||
reverseEmbedderElementsMap = {};
|
|
||||||
|
|
||||||
// Moves the last element of array to the first one.
|
// Moves the last element of array to the first one.
|
||||||
moveLastToFirst = function(list) {
|
var moveLastToFirst = function(list) {
|
||||||
return list.unshift(list.pop());
|
return list.unshift(list.pop());
|
||||||
};
|
};
|
||||||
|
|
||||||
// Generate guestInstanceId.
|
// Generate guestInstanceId.
|
||||||
getNextInstanceId = function(webContents) {
|
var getNextInstanceId = function(webContents) {
|
||||||
return ++nextInstanceId;
|
return ++nextInstanceId;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a new guest instance.
|
// 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;
|
var destroy, destroyEvents, event, fn, guest, i, id, j, len, len1, listeners;
|
||||||
if (webViewManager == null) {
|
if (webViewManager == null) {
|
||||||
webViewManager = process.atomBinding('web_view_manager');
|
webViewManager = process.atomBinding('web_view_manager');
|
||||||
|
@ -139,7 +136,7 @@ createGuest = function(embedder, params) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Attach the guest to an element of embedder.
|
// 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;
|
var guest, key, oldGuestInstanceId, ref1, webPreferences;
|
||||||
guest = guestInstances[guestInstanceId].guest;
|
guest = guestInstances[guestInstanceId].guest;
|
||||||
|
|
||||||
|
@ -173,7 +170,7 @@ attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Destroy an existing guest instance.
|
// Destroy an existing guest instance.
|
||||||
destroyGuest = function(embedder, id) {
|
var destroyGuest = function(embedder, id) {
|
||||||
var key;
|
var key;
|
||||||
webViewManager.removeGuest(embedder, id);
|
webViewManager.removeGuest(embedder, id);
|
||||||
guestInstances[id].guest.destroy();
|
guestInstances[id].guest.destroy();
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
var BrowserWindow, createGuest, frameToGuest, ipcMain, mergeBrowserWindowOptions, mergeOptions, ref, v8Util,
|
const ipcMain = require('electron').ipcMain;
|
||||||
hasProp = {}.hasOwnProperty,
|
const BrowserWindow = require('electron').BrowserWindow;
|
||||||
slice = [].slice;
|
|
||||||
|
|
||||||
ref = require('electron'), ipcMain = ref.ipcMain, BrowserWindow = ref.BrowserWindow;
|
const v8Util = process.atomBinding('v8_util');
|
||||||
|
|
||||||
v8Util = process.atomBinding('v8_util');
|
var hasProp = {}.hasOwnProperty;
|
||||||
|
var slice = [].slice;
|
||||||
frameToGuest = {};
|
var frameToGuest = {};
|
||||||
|
|
||||||
// Copy attribute of |parent| to |child| if it is not defined in |child|.
|
// 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;
|
var key, value;
|
||||||
for (key in parent) {
|
for (key in parent) {
|
||||||
if (!hasProp.call(parent, key)) continue;
|
if (!hasProp.call(parent, key)) continue;
|
||||||
|
@ -26,7 +25,7 @@ mergeOptions = function(child, parent) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Merge |options| with the |embedder|'s window's options.
|
// Merge |options| with the |embedder|'s window's options.
|
||||||
mergeBrowserWindowOptions = function(embedder, options) {
|
var mergeBrowserWindowOptions = function(embedder, options) {
|
||||||
if (embedder.browserWindowOptions != null) {
|
if (embedder.browserWindowOptions != null) {
|
||||||
|
|
||||||
// Inherit the original options if it is a BrowserWindow.
|
// 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|.
|
// 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;
|
var closedByEmbedder, closedByUser, guest, guestId, ref1;
|
||||||
guest = frameToGuest[frameName];
|
guest = frameToGuest[frameName];
|
||||||
if (frameName && (guest != null)) {
|
if (frameName && (guest != null)) {
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
var Module, Readable, app, consoleLog, e, error1, fs, globalPaths, i, len, mainStartupScript, packageJson, packagePath, path, searchPaths, stdin, streamWrite, util,
|
const fs = require('fs');
|
||||||
slice = [].slice;
|
const path = require('path');
|
||||||
|
const util = require('util');
|
||||||
|
const Module = require('module');
|
||||||
|
|
||||||
fs = require('fs');
|
var slice = [].slice;
|
||||||
|
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
util = require('util');
|
|
||||||
|
|
||||||
Module = require('module');
|
|
||||||
|
|
||||||
// We modified the original process.argv to let node.js load the atom.js,
|
// We modified the original process.argv to let node.js load the atom.js,
|
||||||
// we need to restore it here.
|
// we need to restore it here.
|
||||||
|
@ -19,7 +15,7 @@ require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths
|
||||||
// Import common settings.
|
// Import common settings.
|
||||||
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
|
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
|
||||||
|
|
||||||
globalPaths = Module.globalPaths;
|
var globalPaths = Module.globalPaths;
|
||||||
|
|
||||||
if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
|
if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
|
||||||
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib'));
|
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib'));
|
||||||
|
@ -31,12 +27,12 @@ globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib', 'exports'));
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
// Redirect node's console to use our own implementations, since node can not
|
// Redirect node's console to use our own implementations, since node can not
|
||||||
// handle console output when running as GUI program.
|
// handle console output when running as GUI program.
|
||||||
consoleLog = function() {
|
var consoleLog = function() {
|
||||||
var args;
|
var args;
|
||||||
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||||
return process.log(util.format.apply(util, args) + "\n");
|
return process.log(util.format.apply(util, args) + "\n");
|
||||||
};
|
};
|
||||||
streamWrite = function(chunk, encoding, callback) {
|
var streamWrite = function(chunk, encoding, callback) {
|
||||||
if (Buffer.isBuffer(chunk)) {
|
if (Buffer.isBuffer(chunk)) {
|
||||||
chunk = chunk.toString(encoding);
|
chunk = chunk.toString(encoding);
|
||||||
}
|
}
|
||||||
|
@ -50,8 +46,8 @@ if (process.platform === 'win32') {
|
||||||
process.stdout.write = process.stderr.write = streamWrite;
|
process.stdout.write = process.stderr.write = streamWrite;
|
||||||
|
|
||||||
// Always returns EOF for stdin stream.
|
// Always returns EOF for stdin stream.
|
||||||
Readable = require('stream').Readable;
|
var Readable = require('stream').Readable;
|
||||||
stdin = new Readable;
|
var stdin = new Readable;
|
||||||
stdin.push(null);
|
stdin.push(null);
|
||||||
process.__defineGetter__('stdin', function() {
|
process.__defineGetter__('stdin', function() {
|
||||||
return stdin;
|
return stdin;
|
||||||
|
@ -75,7 +71,7 @@ process.on('uncaughtException', function(error) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Emit 'exit' event on quit.
|
// Emit 'exit' event on quit.
|
||||||
app = require('electron').app;
|
var app = require('electron').app;
|
||||||
|
|
||||||
app.on('quit', function(event, exitCode) {
|
app.on('quit', function(event, exitCode) {
|
||||||
return process.emit('exit', exitCode);
|
return process.emit('exit', exitCode);
|
||||||
|
@ -92,20 +88,17 @@ require('./guest-view-manager');
|
||||||
|
|
||||||
require('./guest-window-manager');
|
require('./guest-window-manager');
|
||||||
|
|
||||||
|
|
||||||
// Now we try to load app's package.json.
|
// Now we try to load app's package.json.
|
||||||
packageJson = null;
|
var packageJson = null;
|
||||||
|
var searchPaths = ['app', 'app.asar', 'default_app'];
|
||||||
searchPaths = ['app', 'app.asar', 'default_app'];
|
var i, len, packagePath;
|
||||||
|
|
||||||
for (i = 0, len = searchPaths.length; i < len; i++) {
|
for (i = 0, len = searchPaths.length; i < len; i++) {
|
||||||
packagePath = searchPaths[i];
|
packagePath = searchPaths[i];
|
||||||
try {
|
try {
|
||||||
packagePath = path.join(process.resourcesPath, packagePath);
|
packagePath = path.join(process.resourcesPath, packagePath);
|
||||||
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json')));
|
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json')));
|
||||||
break;
|
break;
|
||||||
} catch (error1) {
|
} catch (error) {
|
||||||
e = error1;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +146,7 @@ require('./chrome-extension');
|
||||||
require('./desktop-capturer');
|
require('./desktop-capturer');
|
||||||
|
|
||||||
// Set main startup script of the app.
|
// 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++.
|
// Finally load app's main.js and transfer control to C++.
|
||||||
Module._load(path.join(packagePath, mainStartupScript), Module, true);
|
Module._load(path.join(packagePath, mainStartupScript), Module, true);
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
var EventEmitter, ObjectsRegistry, v8Util,
|
const EventEmitter = require('events').EventEmitter;
|
||||||
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; },
|
const v8Util = process.atomBinding('v8_util');
|
||||||
hasProp = {}.hasOwnProperty;
|
|
||||||
|
|
||||||
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');
|
var ObjectsRegistry = (function(superClass) {
|
||||||
|
|
||||||
ObjectsRegistry = (function(superClass) {
|
|
||||||
extend(ObjectsRegistry, superClass);
|
extend(ObjectsRegistry, superClass);
|
||||||
|
|
||||||
function ObjectsRegistry() {
|
function ObjectsRegistry() {
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
var IDWeakMap, callFunction, electron, exceptionToMeta, ipcMain, objectsRegistry, path, plainObjectToMeta, unwrapArgs, v8Util, valueToMeta,
|
const path = require('path');
|
||||||
slice = [].slice;
|
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');
|
var slice = [].slice;
|
||||||
|
|
||||||
electron = require('electron');
|
|
||||||
|
|
||||||
ipcMain = electron.ipcMain;
|
|
||||||
|
|
||||||
objectsRegistry = require('./objects-registry');
|
|
||||||
|
|
||||||
v8Util = process.atomBinding('v8_util');
|
|
||||||
|
|
||||||
IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap;
|
|
||||||
|
|
||||||
// Convert a real value into meta data.
|
// 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;
|
var el, field, i, len, meta, name;
|
||||||
if (optimizeSimpleObject == null) {
|
if (optimizeSimpleObject == null) {
|
||||||
optimizeSimpleObject = false;
|
optimizeSimpleObject = false;
|
||||||
|
@ -97,7 +91,7 @@ valueToMeta = function(sender, value, optimizeSimpleObject) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert object to meta by value.
|
// Convert object to meta by value.
|
||||||
plainObjectToMeta = function(obj) {
|
var plainObjectToMeta = function(obj) {
|
||||||
return Object.getOwnPropertyNames(obj).map(function(name) {
|
return Object.getOwnPropertyNames(obj).map(function(name) {
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
|
@ -107,7 +101,7 @@ plainObjectToMeta = function(obj) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert Error into meta data.
|
// Convert Error into meta data.
|
||||||
exceptionToMeta = function(error) {
|
var exceptionToMeta = function(error) {
|
||||||
return {
|
return {
|
||||||
type: 'exception',
|
type: 'exception',
|
||||||
message: error.message,
|
message: error.message,
|
||||||
|
@ -116,7 +110,7 @@ exceptionToMeta = function(error) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert array of meta data from renderer into array of real values.
|
// Convert array of meta data from renderer into array of real values.
|
||||||
unwrapArgs = function(sender, args) {
|
var unwrapArgs = function(sender, args) {
|
||||||
var metaToValue;
|
var metaToValue;
|
||||||
metaToValue = function(meta) {
|
metaToValue = function(meta) {
|
||||||
var i, len, member, ref, rendererReleased, ret, returnValue;
|
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
|
// Call a function and send reply asynchronously if it's a an asynchronous
|
||||||
// style function and the caller didn't pass a callback.
|
// 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;
|
var e, error1, funcMarkedAsync, funcName, funcPassedCallback, ref, ret;
|
||||||
funcMarkedAsync = v8Util.getHiddenValue(func, 'asynchronous');
|
funcMarkedAsync = v8Util.getHiddenValue(func, 'asynchronous');
|
||||||
funcPassedCallback = typeof args[args.length - 1] === 'function';
|
funcPassedCallback = typeof args[args.length - 1] === 'function';
|
||||||
|
|
|
@ -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');
|
var CrashReporter = (function() {
|
||||||
|
|
||||||
os = require('os');
|
|
||||||
|
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
spawn = require('child_process').spawn;
|
|
||||||
|
|
||||||
electron = require('electron');
|
|
||||||
|
|
||||||
binding = process.atomBinding('crash_reporter');
|
|
||||||
|
|
||||||
CrashReporter = (function() {
|
|
||||||
function CrashReporter() {}
|
function CrashReporter() {}
|
||||||
|
|
||||||
CrashReporter.prototype.start = function(options) {
|
CrashReporter.prototype.start = function(options) {
|
||||||
|
@ -99,6 +92,4 @@ CrashReporter = (function() {
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
crashRepoter = new CrashReporter;
|
module.exports = new CrashReporter;
|
||||||
|
|
||||||
module.exports = crashRepoter;
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Do not expose the internal modules to `require`.
|
// Do not expose the internal modules to `require`.
|
||||||
exports.hideInternalModules = function() {
|
exports.hideInternalModules = function() {
|
||||||
var globalPaths;
|
var globalPaths = require('module').globalPaths;
|
||||||
globalPaths = require('module').globalPaths;
|
|
||||||
if (globalPaths.length === 3) {
|
if (globalPaths.length === 3) {
|
||||||
|
|
||||||
// Remove the "common/api/lib" and "browser-or-renderer/api/lib".
|
// Remove the "common/api/lib" and "browser-or-renderer/api/lib".
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
var deprecate, nativeImage;
|
const deprecate = require('electron').deprecate;
|
||||||
|
const nativeImage = process.atomBinding('native_image');
|
||||||
deprecate = require('electron').deprecate;
|
|
||||||
|
|
||||||
nativeImage = process.atomBinding('native_image');
|
|
||||||
|
|
||||||
// Deprecated.
|
// Deprecated.
|
||||||
deprecate.rename(nativeImage, 'createFromDataUrl', 'createFromDataURL');
|
deprecate.rename(nativeImage, 'createFromDataUrl', 'createFromDataURL');
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
(function () {
|
(function () {
|
||||||
var asar, asarStatsToFsStats, cachedArchives, child_process, fakeTime, getOrCreateArchive, gid, invalidArchiveError, nextInode, notDirError, notFoundError, overrideAPI, overrideAPISync, path, splitPath, uid, util,
|
const asar = process.binding('atom_common_asar');
|
||||||
hasProp = {}.hasOwnProperty;
|
const child_process = require('child_process');
|
||||||
|
const path = require('path');
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
asar = process.binding('atom_common_asar');
|
var hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
child_process = require('child_process');
|
|
||||||
|
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
util = require('util');
|
|
||||||
|
|
||||||
// Cache asar archive objects.
|
// Cache asar archive objects.
|
||||||
cachedArchives = {};
|
var cachedArchives = {};
|
||||||
|
|
||||||
getOrCreateArchive = function(p) {
|
var getOrCreateArchive = function(p) {
|
||||||
var archive;
|
var archive;
|
||||||
archive = cachedArchives[p];
|
archive = cachedArchives[p];
|
||||||
if (archive != null) {
|
if (archive != null) {
|
||||||
|
@ -39,13 +35,14 @@ process.on('exit', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Separate asar package's path from full path.
|
// Separate asar package's path from full path.
|
||||||
splitPath = function(p) {
|
var splitPath = function(p) {
|
||||||
|
var index;
|
||||||
|
|
||||||
// shortcut to disable asar.
|
// shortcut to disable asar.
|
||||||
var index;
|
|
||||||
if (process.noAsar) {
|
if (process.noAsar) {
|
||||||
return [false];
|
return [false];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof p !== 'string') {
|
if (typeof p !== 'string') {
|
||||||
return [false];
|
return [false];
|
||||||
}
|
}
|
||||||
|
@ -61,15 +58,15 @@ splitPath = function(p) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert asar archive's Stats object to fs's Stats object.
|
// 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 {
|
return {
|
||||||
dev: 1,
|
dev: 1,
|
||||||
ino: ++nextInode,
|
ino: ++nextInode,
|
||||||
|
@ -108,7 +105,7 @@ asarStatsToFsStats = function(stats) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a ENOENT error.
|
// Create a ENOENT error.
|
||||||
notFoundError = function(asarPath, filePath, callback) {
|
var notFoundError = function(asarPath, filePath, callback) {
|
||||||
var error;
|
var error;
|
||||||
error = new Error("ENOENT, " + filePath + " not found in " + asarPath);
|
error = new Error("ENOENT, " + filePath + " not found in " + asarPath);
|
||||||
error.code = "ENOENT";
|
error.code = "ENOENT";
|
||||||
|
@ -122,7 +119,7 @@ notFoundError = function(asarPath, filePath, callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a ENOTDIR error.
|
// Create a ENOTDIR error.
|
||||||
notDirError = function(callback) {
|
var notDirError = function(callback) {
|
||||||
var error;
|
var error;
|
||||||
error = new Error('ENOTDIR, not a directory');
|
error = new Error('ENOTDIR, not a directory');
|
||||||
error.code = 'ENOTDIR';
|
error.code = 'ENOTDIR';
|
||||||
|
@ -136,7 +133,7 @@ notDirError = function(callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create invalid archive error.
|
// Create invalid archive error.
|
||||||
invalidArchiveError = function(asarPath, callback) {
|
var invalidArchiveError = function(asarPath, callback) {
|
||||||
var error;
|
var error;
|
||||||
error = new Error("Invalid package " + asarPath);
|
error = new Error("Invalid package " + asarPath);
|
||||||
if (typeof callback !== 'function') {
|
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++.
|
// 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;
|
var old;
|
||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
arg = 0;
|
arg = 0;
|
||||||
|
@ -174,7 +171,7 @@ overrideAPISync = function(module, name, arg) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
overrideAPI = function(module, name, arg) {
|
var overrideAPI = function(module, name, arg) {
|
||||||
var old;
|
var old;
|
||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
arg = 0;
|
arg = 0;
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
var Module, fs, path, timers, wrapWithActivateUvLoop;
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
fs = require('fs');
|
const timers = require('timers');
|
||||||
|
const Module = require('module');
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
timers = require('timers');
|
|
||||||
|
|
||||||
Module = require('module');
|
|
||||||
|
|
||||||
process.atomBinding = function(name) {
|
process.atomBinding = function(name) {
|
||||||
var e, error;
|
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
|
// which would delay the callbacks for arbitrary long time. So we should
|
||||||
// initiatively activate the uv loop once setImmediate and process.nextTick is
|
// initiatively activate the uv loop once setImmediate and process.nextTick is
|
||||||
// called.
|
// called.
|
||||||
wrapWithActivateUvLoop = function(func) {
|
var wrapWithActivateUvLoop = function(func) {
|
||||||
return function() {
|
return function() {
|
||||||
process.activateUvLoop();
|
process.activateUvLoop();
|
||||||
return func.apply(this, arguments);
|
return func.apply(this, arguments);
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
var Module, path;
|
const path = require('path');
|
||||||
|
const Module = require('module');
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
Module = require('module');
|
|
||||||
|
|
||||||
// Clear Node's global search paths.
|
// Clear Node's global search paths.
|
||||||
Module.globalPaths.length = 0;
|
Module.globalPaths.length = 0;
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
var getNextId, ipcRenderer, isValid, nativeImage, nextId, ref,
|
const ipcRenderer = require('electron').ipcRenderer;
|
||||||
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 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;
|
var getNextId = function() {
|
||||||
|
|
||||||
getNextId = function() {
|
|
||||||
return ++nextId;
|
return ++nextId;
|
||||||
};
|
};
|
||||||
|
|
||||||
// |options.type| can not be empty and has to include 'window' or 'screen'.
|
// |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);
|
return ((options != null ? options.types : void 0) != null) && Array.isArray(options.types);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
var common;
|
const common = require('../../../../common/api/lib/exports/electron');
|
||||||
|
|
||||||
common = require('../../../../common/api/lib/exports/electron');
|
|
||||||
|
|
||||||
// Import common modules.
|
// Import common modules.
|
||||||
common.defineProperties(exports);
|
common.defineProperties(exports);
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
var EventEmitter, binding, ipcRenderer, v8Util,
|
const EventEmitter = require('events').EventEmitter;
|
||||||
slice = [].slice;
|
const binding = process.atomBinding('ipc');
|
||||||
|
const v8Util = process.atomBinding('v8_util');
|
||||||
|
|
||||||
EventEmitter = require('events').EventEmitter;
|
var slice = [].slice;
|
||||||
|
|
||||||
binding = process.atomBinding('ipc');
|
|
||||||
|
|
||||||
v8Util = process.atomBinding('v8_util');
|
|
||||||
|
|
||||||
// Created by init.coffee.
|
// Created by init.coffee.
|
||||||
ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
|
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
|
||||||
|
|
||||||
ipcRenderer.send = function() {
|
ipcRenderer.send = function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
var EventEmitter, deprecate, ipc, ipcRenderer, method, ref,
|
const ipcRenderer = require('electron').ipcRenderer;
|
||||||
slice = [].slice;
|
const deprecate = require('electron').deprecate;
|
||||||
|
const EventEmitter = require('events').EventEmitter;
|
||||||
|
|
||||||
ref = require('electron'), ipcRenderer = ref.ipcRenderer, deprecate = ref.deprecate;
|
var slice = [].slice;
|
||||||
|
|
||||||
EventEmitter = require('events').EventEmitter;
|
|
||||||
|
|
||||||
// This module is deprecated, we mirror everything from ipcRenderer.
|
// This module is deprecated, we mirror everything from ipcRenderer.
|
||||||
deprecate.warn('ipc module', 'require("electron").ipcRenderer');
|
deprecate.warn('ipc module', 'require("electron").ipcRenderer');
|
||||||
|
|
||||||
// Routes events of ipcRenderer.
|
// Routes events of ipcRenderer.
|
||||||
ipc = new EventEmitter;
|
var ipc = new EventEmitter;
|
||||||
|
|
||||||
ipcRenderer.emit = function() {
|
ipcRenderer.emit = function() {
|
||||||
var args, channel, event;
|
var args, channel, event;
|
||||||
|
@ -19,7 +18,7 @@ ipcRenderer.emit = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Deprecated.
|
// Deprecated.
|
||||||
for (method in ipcRenderer) {
|
for (var method in ipcRenderer) {
|
||||||
if (method.startsWith('send')) {
|
if (method.startsWith('send')) {
|
||||||
ipc[method] = ipcRenderer[method];
|
ipc[method] = ipcRenderer[method];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
var CallbacksRegistry, browserModules, builtinCache, callbacksRegistry, createRemoteMemberFunction, createRemoteMemberProperty, fn, ipcRenderer, isCircular, metaToPlainObject, metaToValue, moduleCache, name, processCache, ref, v8Util, webContentsCache, windowCache, wrapArgs,
|
const ipcRenderer = require('electron').ipcRenderer;
|
||||||
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 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');
|
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; };
|
||||||
|
|
||||||
callbacksRegistry = new CallbacksRegistry;
|
|
||||||
|
|
||||||
// Check for circular reference.
|
// Check for circular reference.
|
||||||
isCircular = function(field, visited) {
|
var isCircular = function(field, visited) {
|
||||||
if (typeof field === 'object') {
|
if (typeof field === 'object') {
|
||||||
if (indexOf.call(visited, field) >= 0) {
|
if (indexOf.call(visited, field) >= 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,7 +18,7 @@ isCircular = function(field, visited) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert the arguments object into an array of meta data.
|
// Convert the arguments object into an array of meta data.
|
||||||
wrapArgs = function(args, visited) {
|
var wrapArgs = function(args, visited) {
|
||||||
var valueToMeta;
|
var valueToMeta;
|
||||||
if (visited == null) {
|
if (visited == null) {
|
||||||
visited = [];
|
visited = [];
|
||||||
|
@ -87,7 +86,7 @@ wrapArgs = function(args, visited) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert meta data from browser into real value.
|
// 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;
|
var RemoteFunction, el, i, j, len, len1, member, ref1, ref2, results, ret;
|
||||||
switch (meta.type) {
|
switch (meta.type) {
|
||||||
case 'value':
|
case 'value':
|
||||||
|
@ -169,7 +168,7 @@ metaToValue = function(meta) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Construct a plain object from the meta.
|
// Construct a plain object from the meta.
|
||||||
metaToPlainObject = function(meta) {
|
var metaToPlainObject = function(meta) {
|
||||||
var i, len, name, obj, ref1, ref2, value;
|
var i, len, name, obj, ref1, ref2, value;
|
||||||
obj = (function() {
|
obj = (function() {
|
||||||
switch (meta.type) {
|
switch (meta.type) {
|
||||||
|
@ -190,7 +189,7 @@ metaToPlainObject = function(meta) {
|
||||||
// Create a RemoteMemberFunction instance.
|
// Create a RemoteMemberFunction instance.
|
||||||
// This function's content should not be inlined into metaToValue, otherwise V8
|
// This function's content should not be inlined into metaToValue, otherwise V8
|
||||||
// may consider it circular reference.
|
// may consider it circular reference.
|
||||||
createRemoteMemberFunction = function(metaId, name) {
|
var createRemoteMemberFunction = function(metaId, name) {
|
||||||
var RemoteMemberFunction;
|
var RemoteMemberFunction;
|
||||||
return RemoteMemberFunction = (function() {
|
return RemoteMemberFunction = (function() {
|
||||||
function RemoteMemberFunction() {
|
function RemoteMemberFunction() {
|
||||||
|
@ -216,7 +215,7 @@ createRemoteMemberFunction = function(metaId, name) {
|
||||||
// Create configuration for defineProperty.
|
// Create configuration for defineProperty.
|
||||||
// This function's content should not be inlined into metaToValue, otherwise V8
|
// This function's content should not be inlined into metaToValue, otherwise V8
|
||||||
// may consider it circular reference.
|
// may consider it circular reference.
|
||||||
createRemoteMemberProperty = function(metaId, name) {
|
var createRemoteMemberProperty = function(metaId, name) {
|
||||||
return {
|
return {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: false,
|
configurable: false,
|
||||||
|
@ -245,25 +244,24 @@ ipcRenderer.on('ATOM_RENDERER_RELEASE_CALLBACK', function(event, id) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// List all built-in modules in browser process.
|
// 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.
|
// And add a helper receiver for each one.
|
||||||
fn = function(name) {
|
var fn = function(name) {
|
||||||
return Object.defineProperty(exports, name, {
|
return Object.defineProperty(exports, name, {
|
||||||
get: function() {
|
get: function() {
|
||||||
return exports.getBuiltin(name);
|
return exports.getBuiltin(name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
for (name in browserModules) {
|
for (var name in browserModules) {
|
||||||
fn(name);
|
fn(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get remote module.
|
// Get remote module.
|
||||||
// (Just like node's require, the modules are cached permanently, note that this
|
// (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)
|
// is safe leak since the object is not expected to get freed in browser)
|
||||||
moduleCache = {};
|
var moduleCache = {};
|
||||||
|
|
||||||
exports.require = function(module) {
|
exports.require = function(module) {
|
||||||
var meta;
|
var meta;
|
||||||
|
@ -274,13 +272,11 @@ exports.require = function(module) {
|
||||||
return moduleCache[module] = metaToValue(meta);
|
return moduleCache[module] = metaToValue(meta);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Optimize require('electron').
|
// Optimize require('electron').
|
||||||
moduleCache.electron = exports;
|
moduleCache.electron = exports;
|
||||||
|
|
||||||
|
|
||||||
// Alias to remote.require('electron').xxx.
|
// Alias to remote.require('electron').xxx.
|
||||||
builtinCache = {};
|
var builtinCache = {};
|
||||||
|
|
||||||
exports.getBuiltin = function(module) {
|
exports.getBuiltin = function(module) {
|
||||||
var meta;
|
var meta;
|
||||||
|
@ -292,7 +288,7 @@ exports.getBuiltin = function(module) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get current BrowserWindow object.
|
// Get current BrowserWindow object.
|
||||||
windowCache = null;
|
var windowCache = null;
|
||||||
|
|
||||||
exports.getCurrentWindow = function() {
|
exports.getCurrentWindow = function() {
|
||||||
var meta;
|
var meta;
|
||||||
|
@ -304,7 +300,7 @@ exports.getCurrentWindow = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get current WebContents object.
|
// Get current WebContents object.
|
||||||
webContentsCache = null;
|
var webContentsCache = null;
|
||||||
|
|
||||||
exports.getCurrentWebContents = function() {
|
exports.getCurrentWebContents = function() {
|
||||||
var meta;
|
var meta;
|
||||||
|
@ -323,7 +319,7 @@ exports.getGlobal = function(name) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get the process object in browser.
|
// Get the process object in browser.
|
||||||
processCache = null;
|
var processCache = null;
|
||||||
|
|
||||||
exports.__defineGetter__('process', function() {
|
exports.__defineGetter__('process', function() {
|
||||||
if (processCache == null) {
|
if (processCache == null) {
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
var chrome, url;
|
const url = require('url');
|
||||||
|
const chrome = window.chrome = window.chrome || {};
|
||||||
url = require('url');
|
|
||||||
|
|
||||||
chrome = window.chrome = window.chrome || {};
|
|
||||||
|
|
||||||
chrome.extension = {
|
chrome.extension = {
|
||||||
getURL: function(path) {
|
getURL: function(path) {
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
'user strict';
|
'user strict';
|
||||||
|
|
||||||
var Module, arg, error, error1, events, globalPaths, i, len, nodeIntegration, path, pathname, preloadScript, ref, url, v8Util;
|
const events = require('events');
|
||||||
|
const path = require('path');
|
||||||
events = require('events');
|
const url = require('url');
|
||||||
|
const Module = require('module');
|
||||||
path = require('path');
|
|
||||||
|
|
||||||
url = require('url');
|
|
||||||
|
|
||||||
Module = require('module');
|
|
||||||
|
|
||||||
|
|
||||||
// We modified the original process.argv to let node.js load the
|
// 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.
|
// Import common settings.
|
||||||
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
|
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
|
||||||
|
|
||||||
globalPaths = Module.globalPaths;
|
var globalPaths = Module.globalPaths;
|
||||||
|
|
||||||
if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
|
if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
|
||||||
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib'));
|
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'));
|
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib', 'exports'));
|
||||||
|
|
||||||
// The global variable will be used by ipc for event dispatching
|
// 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);
|
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.
|
// 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++) {
|
for (i = 0, len = ref.length; i < len; i++) {
|
||||||
arg = ref[i];
|
arg = ref[i];
|
||||||
if (arg.indexOf('--guest-instance-id=') === 0) {
|
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.
|
// Set the __filename to the path of html file if it is file: protocol.
|
||||||
if (window.location.protocol === 'file:') {
|
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.__filename = path.normalize(decodeURIComponent(pathname));
|
||||||
global.__dirname = path.dirname(global.__filename);
|
global.__dirname = path.dirname(global.__filename);
|
||||||
|
|
||||||
|
@ -132,8 +129,7 @@ if (nodeIntegration === 'true' || nodeIntegration === 'all' || nodeIntegration =
|
||||||
if (preloadScript) {
|
if (preloadScript) {
|
||||||
try {
|
try {
|
||||||
require(preloadScript);
|
require(preloadScript);
|
||||||
} catch (error1) {
|
} catch (error) {
|
||||||
error = error1;
|
|
||||||
if (error.code === 'MODULE_NOT_FOUND') {
|
if (error.code === 'MODULE_NOT_FOUND') {
|
||||||
console.error("Unable to load preload script " + preloadScript);
|
console.error("Unable to load preload script " + preloadScript);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
var convertToMenuTemplate, createFileSelectorElement, createMenu, pathToHtml5FileObject, showFileChooserDialog;
|
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
// Use menu API to show context menu.
|
// Use menu API to show context menu.
|
||||||
InspectorFrontendHost.showContextMenuAtPoint = createMenu;
|
InspectorFrontendHost.showContextMenuAtPoint = createMenu;
|
||||||
|
@ -8,7 +6,7 @@ window.onload = function() {
|
||||||
return WebInspector.createFileSelectorElement = createFileSelectorElement;
|
return WebInspector.createFileSelectorElement = createFileSelectorElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
convertToMenuTemplate = function(items) {
|
var convertToMenuTemplate = function(items) {
|
||||||
var fn, i, item, len, template;
|
var fn, i, item, len, template;
|
||||||
template = [];
|
template = [];
|
||||||
fn = function(item) {
|
fn = function(item) {
|
||||||
|
@ -45,11 +43,10 @@ convertToMenuTemplate = function(items) {
|
||||||
return template;
|
return template;
|
||||||
};
|
};
|
||||||
|
|
||||||
createMenu = function(x, y, items, document) {
|
var createMenu = function(x, y, items, document) {
|
||||||
var Menu, menu, remote;
|
const remote = require('electron').remote;
|
||||||
remote = require('electron').remote;
|
const Menu = remote.Menu;
|
||||||
Menu = remote.Menu;
|
const menu = Menu.buildFromTemplate(convertToMenuTemplate(items));
|
||||||
menu = Menu.buildFromTemplate(convertToMenuTemplate(items));
|
|
||||||
|
|
||||||
// The menu is expected to show asynchronously.
|
// The menu is expected to show asynchronously.
|
||||||
return setTimeout(function() {
|
return setTimeout(function() {
|
||||||
|
@ -57,7 +54,7 @@ createMenu = function(x, y, items, document) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
showFileChooserDialog = function(callback) {
|
var showFileChooserDialog = function(callback) {
|
||||||
var dialog, files, remote;
|
var dialog, files, remote;
|
||||||
remote = require('electron').remote;
|
remote = require('electron').remote;
|
||||||
dialog = remote.dialog;
|
dialog = remote.dialog;
|
||||||
|
@ -67,7 +64,7 @@ showFileChooserDialog = function(callback) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pathToHtml5FileObject = function(path) {
|
var pathToHtml5FileObject = function(path) {
|
||||||
var blob, fs;
|
var blob, fs;
|
||||||
fs = require('fs');
|
fs = require('fs');
|
||||||
blob = new Blob([fs.readFileSync(path)]);
|
blob = new Blob([fs.readFileSync(path)]);
|
||||||
|
@ -75,7 +72,7 @@ pathToHtml5FileObject = function(path) {
|
||||||
return blob;
|
return blob;
|
||||||
};
|
};
|
||||||
|
|
||||||
createFileSelectorElement = function(callback) {
|
var createFileSelectorElement = function(callback) {
|
||||||
var fileSelectorElement;
|
var fileSelectorElement;
|
||||||
fileSelectorElement = document.createElement('span');
|
fileSelectorElement = document.createElement('span');
|
||||||
fileSelectorElement.style.display = 'none';
|
fileSelectorElement.style.display = 'none';
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
var BrowserWindowProxy, a, getHistoryOperation, ipcRenderer, ref, remote, resolveURL, sendHistoryOperation,
|
const ipcRenderer = require('electron').ipcRenderer;
|
||||||
slice = [].slice;
|
const remote = require('electron').remote;
|
||||||
|
|
||||||
ref = require('electron'), ipcRenderer = ref.ipcRenderer, remote = ref.remote;
|
var slice = [].slice;
|
||||||
|
|
||||||
// Helper function to resolve relative url.
|
// 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;
|
a.href = url;
|
||||||
return a.href;
|
return a.href;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Window object returned by "window.open".
|
// Window object returned by "window.open".
|
||||||
BrowserWindowProxy = (function() {
|
var BrowserWindowProxy = (function() {
|
||||||
BrowserWindowProxy.proxies = {};
|
BrowserWindowProxy.proxies = {};
|
||||||
|
|
||||||
BrowserWindowProxy.getOrCreate = function(guestId) {
|
BrowserWindowProxy.getOrCreate = function(guestId) {
|
||||||
|
@ -180,13 +180,13 @@ ipcRenderer.on('ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', function(event, sourceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Forward history operations to browser.
|
// Forward history operations to browser.
|
||||||
sendHistoryOperation = function() {
|
var sendHistoryOperation = function() {
|
||||||
var args;
|
var args;
|
||||||
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||||
return ipcRenderer.send.apply(ipcRenderer, ['ATOM_SHELL_NAVIGATION_CONTROLLER'].concat(slice.call(args)));
|
return ipcRenderer.send.apply(ipcRenderer, ['ATOM_SHELL_NAVIGATION_CONTROLLER'].concat(slice.call(args)));
|
||||||
};
|
};
|
||||||
|
|
||||||
getHistoryOperation = function() {
|
var getHistoryOperation = function() {
|
||||||
var args;
|
var args;
|
||||||
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||||
return ipcRenderer.sendSync.apply(ipcRenderer, ['ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER'].concat(slice.call(args)));
|
return ipcRenderer.sendSync.apply(ipcRenderer, ['ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER'].concat(slice.call(args)));
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
var DEPRECATED_EVENTS, WEB_VIEW_EVENTS, dispatchEvent, ipcRenderer, ref, requestId, webFrame,
|
const ipcRenderer = require('electron').ipcRenderer;
|
||||||
slice = [].slice;
|
const webFrame = require('electron').webFrame;
|
||||||
|
|
||||||
ref = require('electron'), ipcRenderer = ref.ipcRenderer, webFrame = ref.webFrame;
|
var slice = [].slice;
|
||||||
|
var requestId = 0;
|
||||||
|
|
||||||
requestId = 0;
|
var WEB_VIEW_EVENTS = {
|
||||||
|
|
||||||
WEB_VIEW_EVENTS = {
|
|
||||||
'load-commit': ['url', 'isMainFrame'],
|
'load-commit': ['url', 'isMainFrame'],
|
||||||
'did-finish-load': [],
|
'did-finish-load': [],
|
||||||
'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL'],
|
'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL'],
|
||||||
|
@ -38,11 +37,11 @@ WEB_VIEW_EVENTS = {
|
||||||
'found-in-page': ['result']
|
'found-in-page': ['result']
|
||||||
};
|
};
|
||||||
|
|
||||||
DEPRECATED_EVENTS = {
|
var DEPRECATED_EVENTS = {
|
||||||
'page-title-updated': 'page-title-set'
|
'page-title-updated': 'page-title-set'
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatchEvent = function() {
|
var dispatchEvent = function() {
|
||||||
var args, domEvent, eventKey, eventName, f, i, j, len, ref1, webView;
|
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) : [];
|
webView = arguments[0], eventName = arguments[1], eventKey = arguments[2], args = 4 <= arguments.length ? slice.call(arguments, 3) : [];
|
||||||
if (DEPRECATED_EVENTS[eventName] != null) {
|
if (DEPRECATED_EVENTS[eventName] != null) {
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
var AllowTransparencyAttribute, AutosizeAttribute, AutosizeDimensionAttribute, BooleanAttribute, HttpReferrerAttribute, PartitionAttribute, PreloadAttribute, SrcAttribute, UserAgentAttribute, WebViewAttribute, WebViewImpl, a, guestViewInternal, remote, resolveURL, webViewConstants,
|
const WebViewImpl = require('./web-view');
|
||||||
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; },
|
const guestViewInternal = require('./guest-view-internal');
|
||||||
hasProp = {}.hasOwnProperty;
|
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');
|
var hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
webViewConstants = require('./web-view-constants');
|
|
||||||
|
|
||||||
remote = require('electron').remote;
|
|
||||||
|
|
||||||
// Helper function to resolve url set in attribute.
|
// 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;
|
a.href = url;
|
||||||
return a.href;
|
return a.href;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Attribute objects.
|
// Attribute objects.
|
||||||
// Default implementation of a WebView attribute.
|
// Default implementation of a WebView attribute.
|
||||||
WebViewAttribute = (function() {
|
var WebViewAttribute = (function() {
|
||||||
function WebViewAttribute(name, webViewImpl) {
|
function WebViewAttribute(name, webViewImpl) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = webViewImpl.webviewNode[name] || '';
|
this.value = webViewImpl.webviewNode[name] || '';
|
||||||
|
@ -71,7 +68,7 @@ WebViewAttribute = (function() {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// An attribute that is treated as a Boolean.
|
// An attribute that is treated as a Boolean.
|
||||||
BooleanAttribute = (function(superClass) {
|
var BooleanAttribute = (function(superClass) {
|
||||||
extend(BooleanAttribute, superClass);
|
extend(BooleanAttribute, superClass);
|
||||||
|
|
||||||
function BooleanAttribute(name, webViewImpl) {
|
function BooleanAttribute(name, webViewImpl) {
|
||||||
|
@ -95,7 +92,7 @@ BooleanAttribute = (function(superClass) {
|
||||||
})(WebViewAttribute);
|
})(WebViewAttribute);
|
||||||
|
|
||||||
// Attribute that specifies whether transparency is allowed in the webview.
|
// Attribute that specifies whether transparency is allowed in the webview.
|
||||||
AllowTransparencyAttribute = (function(superClass) {
|
var AllowTransparencyAttribute = (function(superClass) {
|
||||||
extend(AllowTransparencyAttribute, superClass);
|
extend(AllowTransparencyAttribute, superClass);
|
||||||
|
|
||||||
function AllowTransparencyAttribute(webViewImpl) {
|
function AllowTransparencyAttribute(webViewImpl) {
|
||||||
|
@ -114,7 +111,7 @@ AllowTransparencyAttribute = (function(superClass) {
|
||||||
})(BooleanAttribute);
|
})(BooleanAttribute);
|
||||||
|
|
||||||
// Attribute used to define the demension limits of autosizing.
|
// Attribute used to define the demension limits of autosizing.
|
||||||
AutosizeDimensionAttribute = (function(superClass) {
|
var AutosizeDimensionAttribute = (function(superClass) {
|
||||||
extend(AutosizeDimensionAttribute, superClass);
|
extend(AutosizeDimensionAttribute, superClass);
|
||||||
|
|
||||||
function AutosizeDimensionAttribute(name, webViewImpl) {
|
function AutosizeDimensionAttribute(name, webViewImpl) {
|
||||||
|
@ -147,7 +144,7 @@ AutosizeDimensionAttribute = (function(superClass) {
|
||||||
})(WebViewAttribute);
|
})(WebViewAttribute);
|
||||||
|
|
||||||
// Attribute that specifies whether the webview should be autosized.
|
// Attribute that specifies whether the webview should be autosized.
|
||||||
AutosizeAttribute = (function(superClass) {
|
var AutosizeAttribute = (function(superClass) {
|
||||||
extend(AutosizeAttribute, superClass);
|
extend(AutosizeAttribute, superClass);
|
||||||
|
|
||||||
function AutosizeAttribute(webViewImpl) {
|
function AutosizeAttribute(webViewImpl) {
|
||||||
|
@ -161,7 +158,7 @@ AutosizeAttribute = (function(superClass) {
|
||||||
})(BooleanAttribute);
|
})(BooleanAttribute);
|
||||||
|
|
||||||
// Attribute representing the state of the storage partition.
|
// Attribute representing the state of the storage partition.
|
||||||
PartitionAttribute = (function(superClass) {
|
var PartitionAttribute = (function(superClass) {
|
||||||
extend(PartitionAttribute, superClass);
|
extend(PartitionAttribute, superClass);
|
||||||
|
|
||||||
function PartitionAttribute(webViewImpl) {
|
function PartitionAttribute(webViewImpl) {
|
||||||
|
@ -189,7 +186,7 @@ PartitionAttribute = (function(superClass) {
|
||||||
})(WebViewAttribute);
|
})(WebViewAttribute);
|
||||||
|
|
||||||
// Attribute that handles the location and navigation of the webview.
|
// Attribute that handles the location and navigation of the webview.
|
||||||
SrcAttribute = (function(superClass) {
|
var SrcAttribute = (function(superClass) {
|
||||||
extend(SrcAttribute, superClass);
|
extend(SrcAttribute, superClass);
|
||||||
|
|
||||||
function SrcAttribute(webViewImpl) {
|
function SrcAttribute(webViewImpl) {
|
||||||
|
@ -292,7 +289,7 @@ SrcAttribute = (function(superClass) {
|
||||||
})(WebViewAttribute);
|
})(WebViewAttribute);
|
||||||
|
|
||||||
// Attribute specifies HTTP referrer.
|
// Attribute specifies HTTP referrer.
|
||||||
HttpReferrerAttribute = (function(superClass) {
|
var HttpReferrerAttribute = (function(superClass) {
|
||||||
extend(HttpReferrerAttribute, superClass);
|
extend(HttpReferrerAttribute, superClass);
|
||||||
|
|
||||||
function HttpReferrerAttribute(webViewImpl) {
|
function HttpReferrerAttribute(webViewImpl) {
|
||||||
|
@ -304,7 +301,7 @@ HttpReferrerAttribute = (function(superClass) {
|
||||||
})(WebViewAttribute);
|
})(WebViewAttribute);
|
||||||
|
|
||||||
// Attribute specifies user agent
|
// Attribute specifies user agent
|
||||||
UserAgentAttribute = (function(superClass) {
|
var UserAgentAttribute = (function(superClass) {
|
||||||
extend(UserAgentAttribute, superClass);
|
extend(UserAgentAttribute, superClass);
|
||||||
|
|
||||||
function UserAgentAttribute(webViewImpl) {
|
function UserAgentAttribute(webViewImpl) {
|
||||||
|
@ -316,7 +313,7 @@ UserAgentAttribute = (function(superClass) {
|
||||||
})(WebViewAttribute);
|
})(WebViewAttribute);
|
||||||
|
|
||||||
// Attribute that set preload script.
|
// Attribute that set preload script.
|
||||||
PreloadAttribute = (function(superClass) {
|
var PreloadAttribute = (function(superClass) {
|
||||||
extend(PreloadAttribute, superClass);
|
extend(PreloadAttribute, superClass);
|
||||||
|
|
||||||
function PreloadAttribute(webViewImpl) {
|
function PreloadAttribute(webViewImpl) {
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
'user strict';
|
'user strict';
|
||||||
|
|
||||||
var WebViewImpl, deprecate, getNextId, guestViewInternal, ipcRenderer, listener, nextId, ref, registerBrowserPluginElement, registerWebViewElement, remote, useCapture, v8Util, webFrame, webViewConstants,
|
const deprecate = require('electron').deprecate;
|
||||||
hasProp = {}.hasOwnProperty,
|
const webFrame = require('electron').webFrame;
|
||||||
slice = [].slice;
|
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');
|
var hasProp = {}.hasOwnProperty;
|
||||||
|
var slice = [].slice;
|
||||||
guestViewInternal = require('./guest-view-internal');
|
|
||||||
|
|
||||||
webViewConstants = require('./web-view-constants');
|
|
||||||
|
|
||||||
// ID generator.
|
// ID generator.
|
||||||
nextId = 0;
|
var nextId = 0;
|
||||||
|
|
||||||
getNextId = function() {
|
var getNextId = function() {
|
||||||
return ++nextId;
|
return ++nextId;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Represents the internal state of the WebView node.
|
// Represents the internal state of the WebView node.
|
||||||
WebViewImpl = (function() {
|
var WebViewImpl = (function() {
|
||||||
function WebViewImpl(webviewNode) {
|
function WebViewImpl(webviewNode) {
|
||||||
var shadowRoot;
|
var shadowRoot;
|
||||||
this.webviewNode = webviewNode;
|
this.webviewNode = webviewNode;
|
||||||
|
@ -274,7 +274,7 @@ WebViewImpl = (function() {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Registers browser plugin <object> custom element.
|
// Registers browser plugin <object> custom element.
|
||||||
registerBrowserPluginElement = function() {
|
var registerBrowserPluginElement = function() {
|
||||||
var proto;
|
var proto;
|
||||||
proto = Object.create(HTMLObjectElement.prototype);
|
proto = Object.create(HTMLObjectElement.prototype);
|
||||||
proto.createdCallback = function() {
|
proto.createdCallback = function() {
|
||||||
|
@ -310,7 +310,7 @@ registerBrowserPluginElement = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Registers <webview> custom element.
|
// Registers <webview> custom element.
|
||||||
registerWebViewElement = function() {
|
var registerWebViewElement = function() {
|
||||||
var createBlockHandler, createNonBlockHandler, i, j, len, len1, m, methods, nonblockMethods, proto;
|
var createBlockHandler, createNonBlockHandler, i, j, len, len1, m, methods, nonblockMethods, proto;
|
||||||
proto = Object.create(HTMLObjectElement.prototype);
|
proto = Object.create(HTMLObjectElement.prototype);
|
||||||
proto.createdCallback = function() {
|
proto.createdCallback = function() {
|
||||||
|
@ -444,9 +444,9 @@ registerWebViewElement = function() {
|
||||||
return delete proto.attributeChangedCallback;
|
return delete proto.attributeChangedCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
useCapture = true;
|
var useCapture = true;
|
||||||
|
|
||||||
listener = function(event) {
|
var listener = function(event) {
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue