commit
				
					
						a52285596e
					
				
			
		
					 14 changed files with 89 additions and 144 deletions
				
			
		| 
						 | 
				
			
			@ -9,8 +9,6 @@ const bindings = process.atomBinding('app');
 | 
			
		|||
const downloadItemBindings = process.atomBinding('download_item');
 | 
			
		||||
const app = bindings.app;
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
 | 
			
		||||
app.__proto__ = EventEmitter.prototype;
 | 
			
		||||
 | 
			
		||||
app.setApplicationMenu = function(menu) {
 | 
			
		||||
| 
						 | 
				
			
			@ -57,10 +55,8 @@ app.getAppPath = function() {
 | 
			
		|||
// Routes the events to webContents.
 | 
			
		||||
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)));
 | 
			
		||||
  return app.on(name, function(event, webContents, ...args) {
 | 
			
		||||
    return webContents.emit.apply(webContents, [name, event].concat(args));
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
var i, len;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,10 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
const app = require('electron').app;
 | 
			
		||||
const BrowserWindow = require('electron').BrowserWindow;
 | 
			
		||||
const binding = process.atomBinding('dialog');
 | 
			
		||||
const v8Util = process.atomBinding('v8_util');
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
var includes = [].includes;
 | 
			
		||||
 | 
			
		||||
var fileDialogProperties = {
 | 
			
		||||
| 
						 | 
				
			
			@ -41,9 +42,8 @@ var checkAppInitialized = function() {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  showOpenDialog: function() {
 | 
			
		||||
    var args, callback, options, prop, properties, ref1, value, window, wrappedCallback;
 | 
			
		||||
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
  showOpenDialog: function(...args) {
 | 
			
		||||
    var callback, options, prop, properties, ref1, value, window, wrappedCallback;
 | 
			
		||||
    checkAppInitialized();
 | 
			
		||||
    ref1 = parseArgs.apply(null, args), window = ref1[0], options = ref1[1], callback = ref1[2];
 | 
			
		||||
    if (options == null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -79,9 +79,9 @@ module.exports = {
 | 
			
		|||
    } : null;
 | 
			
		||||
    return binding.showOpenDialog(String(options.title), String(options.defaultPath), options.filters, properties, window, wrappedCallback);
 | 
			
		||||
  },
 | 
			
		||||
  showSaveDialog: function() {
 | 
			
		||||
    var args, callback, options, ref1, window, wrappedCallback;
 | 
			
		||||
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
 | 
			
		||||
  showSaveDialog: function(...args) {
 | 
			
		||||
    var callback, options, ref1, window, wrappedCallback;
 | 
			
		||||
    checkAppInitialized();
 | 
			
		||||
    ref1 = parseArgs.apply(null, args), window = ref1[0], options = ref1[1], callback = ref1[2];
 | 
			
		||||
    if (options == null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -103,9 +103,9 @@ module.exports = {
 | 
			
		|||
    } : null;
 | 
			
		||||
    return binding.showSaveDialog(String(options.title), String(options.defaultPath), options.filters, window, wrappedCallback);
 | 
			
		||||
  },
 | 
			
		||||
  showMessageBox: function() {
 | 
			
		||||
    var args, callback, flags, i, j, len, messageBoxType, options, ref1, ref2, ref3, text, window;
 | 
			
		||||
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
 | 
			
		||||
  showMessageBox: function(...args) {
 | 
			
		||||
    var callback, flags, i, j, len, messageBoxType, options, ref1, ref2, ref3, text, window;
 | 
			
		||||
    checkAppInitialized();
 | 
			
		||||
    ref1 = parseArgs.apply(null, args), window = ref1[0], options = ref1[1], callback = ref1[2];
 | 
			
		||||
    if (options == null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -154,9 +154,8 @@ module.exports = {
 | 
			
		|||
    flags = options.noLink ? messageBoxOptions.noLink : 0;
 | 
			
		||||
    return binding.showMessageBox(messageBoxType, options.buttons, options.defaultId, options.cancelId, flags, options.title, options.message, options.detail, options.icon, window, callback);
 | 
			
		||||
  },
 | 
			
		||||
  showErrorBox: function() {
 | 
			
		||||
    var args;
 | 
			
		||||
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
 | 
			
		||||
  showErrorBox: function(...args) {
 | 
			
		||||
    return binding.showErrorBox.apply(binding, args);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,18 +2,14 @@
 | 
			
		|||
 | 
			
		||||
const ipcMain = require('electron').ipcMain;
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
 | 
			
		||||
// The history operation in renderer is redirected to browser.
 | 
			
		||||
ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function() {
 | 
			
		||||
  var args, event, method, ref;
 | 
			
		||||
  event = arguments[0], method = arguments[1], args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
 | 
			
		||||
ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function(event, method, ...args) {
 | 
			
		||||
  var ref;
 | 
			
		||||
  return (ref = event.sender)[method].apply(ref, args);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
ipcMain.on('ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER', function() {
 | 
			
		||||
  var args, event, method, ref;
 | 
			
		||||
  event = arguments[0], method = arguments[1], args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
 | 
			
		||||
ipcMain.on('ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER', function(event, method, ...args) {
 | 
			
		||||
  var ref;
 | 
			
		||||
  return event.returnValue = (ref = event.sender)[method].apply(ref, args);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ const Menu = require('electron').Menu;
 | 
			
		|||
const binding = process.atomBinding('web_contents');
 | 
			
		||||
const debuggerBinding = process.atomBinding('debugger');
 | 
			
		||||
 | 
			
		||||
let  slice = [].slice;
 | 
			
		||||
let slice = [].slice;
 | 
			
		||||
let nextId = 0;
 | 
			
		||||
 | 
			
		||||
let getNextId = function() {
 | 
			
		||||
| 
						 | 
				
			
			@ -74,13 +74,11 @@ let wrapWebContents = function(webContents) {
 | 
			
		|||
  webContents.setMaxListeners(0);
 | 
			
		||||
 | 
			
		||||
  // WebContents::send(channel, args..)
 | 
			
		||||
  webContents.send = function() {
 | 
			
		||||
    var args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
 | 
			
		||||
    var channel = arguments[0];
 | 
			
		||||
  webContents.send = function(channel, ...args) {
 | 
			
		||||
    if (channel == null) {
 | 
			
		||||
      throw new Error('Missing required channel argument');
 | 
			
		||||
    }
 | 
			
		||||
    return this._send(channel, slice.call(args));
 | 
			
		||||
    return this._send(channel, args);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  // The navigation controller.
 | 
			
		||||
| 
						 | 
				
			
			@ -99,8 +97,7 @@ let wrapWebContents = function(webContents) {
 | 
			
		|||
 | 
			
		||||
  // Mapping webFrame methods.
 | 
			
		||||
  for (let method of webFrameMethods) {
 | 
			
		||||
    webContents[method] = function() {
 | 
			
		||||
      let args = Array.prototype.slice.call(arguments);
 | 
			
		||||
    webContents[method] = function(...args) {
 | 
			
		||||
      this.send('ELECTRON_INTERNAL_RENDERER_WEB_FRAME_METHOD', method, args);
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -152,30 +149,26 @@ let wrapWebContents = function(webContents) {
 | 
			
		|||
  });
 | 
			
		||||
 | 
			
		||||
  // This error occurs when host could not be found.
 | 
			
		||||
  webContents.on('did-fail-provisional-load', function() {
 | 
			
		||||
    var args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
 | 
			
		||||
  webContents.on('did-fail-provisional-load', function(...args) {
 | 
			
		||||
    // Calling loadURL during this event might cause crash, so delay the event
 | 
			
		||||
    // until next tick.
 | 
			
		||||
    setImmediate(() => {
 | 
			
		||||
      this.emit.apply(this, ['did-fail-load'].concat(slice.call(args)));
 | 
			
		||||
      this.emit.apply(this, ['did-fail-load'].concat(args));
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  // Delays the page-title-updated event to next tick.
 | 
			
		||||
  webContents.on('-page-title-updated', function() {
 | 
			
		||||
    var args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
  webContents.on('-page-title-updated', function(...args) {
 | 
			
		||||
    setImmediate(() => {
 | 
			
		||||
      this.emit.apply(this, ['page-title-updated'].concat(slice.call(args)));
 | 
			
		||||
      this.emit.apply(this, ['page-title-updated'].concat(args));
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  // Deprecated.
 | 
			
		||||
  deprecate.rename(webContents, 'loadUrl', 'loadURL');
 | 
			
		||||
  deprecate.rename(webContents, 'getUrl', 'getURL');
 | 
			
		||||
  deprecate.event(webContents, 'page-title-set', 'page-title-updated', function() {
 | 
			
		||||
    var args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
    return this.emit.apply(this, ['page-title-set'].concat(slice.call(args)));
 | 
			
		||||
  deprecate.event(webContents, 'page-title-set', 'page-title-updated', function(...args) {
 | 
			
		||||
    return this.emit.apply(this, ['page-title-set'].concat(args));
 | 
			
		||||
  });
 | 
			
		||||
  return webContents.printToPDF = function(options, callback) {
 | 
			
		||||
    var printingSetting;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
const ipcMain = require('electron').ipcMain;
 | 
			
		||||
const webContents = require('electron').webContents;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -136,9 +138,8 @@ var createGuest = function(embedder, params) {
 | 
			
		|||
 | 
			
		||||
  // Dispatch events to embedder.
 | 
			
		||||
  fn = function(event) {
 | 
			
		||||
    return guest.on(event, function() {
 | 
			
		||||
      var args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
 | 
			
		||||
      return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-" + guest.viewInstanceId, event].concat(slice.call(args)));
 | 
			
		||||
    return guest.on(event, function(_, ...args) {
 | 
			
		||||
      return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-" + guest.viewInstanceId, event].concat(args));
 | 
			
		||||
    });
 | 
			
		||||
  };
 | 
			
		||||
  for (j = 0, len1 = supportedWebViewEvents.length; j < len1; j++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -154,9 +155,8 @@ var createGuest = function(embedder, params) {
 | 
			
		|||
  });
 | 
			
		||||
 | 
			
		||||
  // Autosize.
 | 
			
		||||
  guest.on('size-changed', function() {
 | 
			
		||||
    var args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
 | 
			
		||||
    return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED-" + guest.viewInstanceId].concat(slice.call(args)));
 | 
			
		||||
  guest.on('size-changed', function(_, ...args) {
 | 
			
		||||
    return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED-" + guest.viewInstanceId].concat(args));
 | 
			
		||||
  });
 | 
			
		||||
  return id;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,9 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
const ipcMain = require('electron').ipcMain;
 | 
			
		||||
const BrowserWindow = require('electron').BrowserWindow;
 | 
			
		||||
 | 
			
		||||
var hasProp = {}.hasOwnProperty;
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
var frameToGuest = {};
 | 
			
		||||
 | 
			
		||||
// Copy attribute of |parent| to |child| if it is not defined in |child|.
 | 
			
		||||
| 
						 | 
				
			
			@ -81,9 +82,8 @@ var createGuest = function(embedder, url, frameName, options) {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
// Routed window.open messages.
 | 
			
		||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', function() {
 | 
			
		||||
  var args, event, frameName, options, url;
 | 
			
		||||
  event = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
 | 
			
		||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', function(event, ...args) {
 | 
			
		||||
  var frameName, options, url;
 | 
			
		||||
  url = args[0], frameName = args[1], options = args[2];
 | 
			
		||||
  options = mergeBrowserWindowOptions(event.sender, options);
 | 
			
		||||
  event.sender.emit('new-window', event, url, frameName, 'new-window', options);
 | 
			
		||||
| 
						 | 
				
			
			@ -99,9 +99,8 @@ ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', function(event, guest
 | 
			
		|||
  return (ref1 = BrowserWindow.fromId(guestId)) != null ? ref1.destroy() : void 0;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', function() {
 | 
			
		||||
  var args, guestId, method, ref1;
 | 
			
		||||
  event = arguments[0], guestId = arguments[1], method = arguments[2], args = 4 <= arguments.length ? slice.call(arguments, 3) : [];
 | 
			
		||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', function(event, guestId, method, ...args) {
 | 
			
		||||
  var ref1;
 | 
			
		||||
  return event.returnValue = (ref1 = BrowserWindow.fromId(guestId)) != null ? ref1[method].apply(ref1, args) : void 0;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -117,8 +116,7 @@ ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', function(event,
 | 
			
		|||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', function() {
 | 
			
		||||
  var args, guestId, method, ref1, ref2;
 | 
			
		||||
  guestId = arguments[1], method = arguments[2], args = 4 <= arguments.length ? slice.call(arguments, 3) : [];
 | 
			
		||||
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', function(event, guestId, method, ...args) {
 | 
			
		||||
  var ref1, ref2;
 | 
			
		||||
  return (ref1 = BrowserWindow.fromId(guestId)) != null ? (ref2 = ref1.webContents) != null ? ref2[method].apply(ref2, args) : void 0 : void 0;
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,11 +1,11 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
const fs = require('fs');
 | 
			
		||||
const path = require('path');
 | 
			
		||||
const util = require('util');
 | 
			
		||||
const Module = require('module');
 | 
			
		||||
const v8 = require('v8');
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
 | 
			
		||||
// We modified the original process.argv to let node.js load the atom.js,
 | 
			
		||||
// we need to restore it here.
 | 
			
		||||
process.argv.splice(1, 1);
 | 
			
		||||
| 
						 | 
				
			
			@ -28,9 +28,7 @@ globalPaths.push(path.join(__dirname, 'api', '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.
 | 
			
		||||
  var consoleLog = function() {
 | 
			
		||||
    var args;
 | 
			
		||||
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
  var consoleLog = function(...args) {
 | 
			
		||||
    return process.log(util.format.apply(util, args) + "\n");
 | 
			
		||||
  };
 | 
			
		||||
  var streamWrite = function(chunk, encoding, callback) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,5 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
 | 
			
		||||
const v8Util = process.atomBinding('v8_util');
 | 
			
		||||
 | 
			
		||||
class CallbacksRegistry {
 | 
			
		||||
| 
						 | 
				
			
			@ -46,16 +44,14 @@ class CallbacksRegistry {
 | 
			
		|||
    return (ref = this.callbacks[id]) != null ? ref : function() {};
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  call() {
 | 
			
		||||
    var args, id, ref;
 | 
			
		||||
    id = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
 | 
			
		||||
    return (ref = this.get(id)).call.apply(ref, [global].concat(slice.call(args)));
 | 
			
		||||
  call(id, ...args) {
 | 
			
		||||
    var ref;
 | 
			
		||||
    return (ref = this.get(id)).call.apply(ref, [global].concat(args));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  apply() {
 | 
			
		||||
    var args, id, ref;
 | 
			
		||||
    id = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
 | 
			
		||||
    return (ref = this.get(id)).apply.apply(ref, [global].concat(slice.call(args)));
 | 
			
		||||
  apply(id, ...args) {
 | 
			
		||||
    var ref;
 | 
			
		||||
    return (ref = this.get(id)).apply.apply(ref, [global].concat(args));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  remove(id) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,5 @@
 | 
			
		|||
// Deprecate a method.
 | 
			
		||||
var deprecate,
 | 
			
		||||
  slice = [].slice;
 | 
			
		||||
 | 
			
		||||
deprecate = function(oldName, newName, fn) {
 | 
			
		||||
const deprecate = function(oldName, newName, fn) {
 | 
			
		||||
  var warned;
 | 
			
		||||
  warned = false;
 | 
			
		||||
  return function() {
 | 
			
		||||
| 
						 | 
				
			
			@ -64,10 +61,7 @@ deprecate.property = function(object, property, method) {
 | 
			
		|||
deprecate.event = function(emitter, oldName, newName, fn) {
 | 
			
		||||
  var warned;
 | 
			
		||||
  warned = false;
 | 
			
		||||
  return emitter.on(newName, function() {
 | 
			
		||||
    var args;
 | 
			
		||||
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
 | 
			
		||||
  return emitter.on(newName, function(...args) {
 | 
			
		||||
    // there is listeners for old API.
 | 
			
		||||
    if (this.listenerCount(oldName) > 0) {
 | 
			
		||||
      if (!(warned || process.noDeprecation)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +71,7 @@ deprecate.event = function(emitter, oldName, newName, fn) {
 | 
			
		|||
      if (fn != null) {
 | 
			
		||||
        return fn.apply(this, arguments);
 | 
			
		||||
      } else {
 | 
			
		||||
        return this.emit.apply(this, [oldName].concat(slice.call(args)));
 | 
			
		||||
        return this.emit.apply(this, [oldName].concat(args));
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,27 +1,21 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
const binding = process.atomBinding('ipc');
 | 
			
		||||
const v8Util = process.atomBinding('v8_util');
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
 | 
			
		||||
// Created by init.js.
 | 
			
		||||
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
 | 
			
		||||
 | 
			
		||||
ipcRenderer.send = function() {
 | 
			
		||||
  var args;
 | 
			
		||||
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
  return binding.send('ipc-message', slice.call(args));
 | 
			
		||||
ipcRenderer.send = function(...args) {
 | 
			
		||||
  return binding.send('ipc-message', args);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
ipcRenderer.sendSync = function() {
 | 
			
		||||
  var args;
 | 
			
		||||
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
  return JSON.parse(binding.sendSync('ipc-message-sync', slice.call(args)));
 | 
			
		||||
ipcRenderer.sendSync = function(...args) {
 | 
			
		||||
  return JSON.parse(binding.sendSync('ipc-message-sync', args));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
ipcRenderer.sendToHost = function() {
 | 
			
		||||
  var args;
 | 
			
		||||
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
  return binding.send('ipc-message-host', slice.call(args));
 | 
			
		||||
ipcRenderer.sendToHost = function(...args) {
 | 
			
		||||
  return binding.send('ipc-message-host', args);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports = ipcRenderer;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,18 +2,14 @@ const ipcRenderer = require('electron').ipcRenderer;
 | 
			
		|||
const deprecate = require('electron').deprecate;
 | 
			
		||||
const 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.
 | 
			
		||||
var ipc = new EventEmitter;
 | 
			
		||||
 | 
			
		||||
ipcRenderer.emit = function() {
 | 
			
		||||
  var channel = arguments[0];
 | 
			
		||||
  var args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
 | 
			
		||||
  ipc.emit.apply(ipc, [channel].concat(slice.call(args)));
 | 
			
		||||
ipcRenderer.emit = function(channel, event, ...args) {
 | 
			
		||||
  ipc.emit.apply(ipc, [channel].concat(args));
 | 
			
		||||
  return EventEmitter.prototype.emit.apply(ipcRenderer, arguments);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
const ipcRenderer = require('electron').ipcRenderer;
 | 
			
		||||
const remote = require('electron').remote;
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
 | 
			
		||||
// Cache browser window visibility
 | 
			
		||||
var _isVisible = true;
 | 
			
		||||
var _isMinimized = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,10 +71,8 @@ var BrowserWindowProxy = (function() {
 | 
			
		|||
    return ipcRenderer.send('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', this.guestId, message, targetOrigin, location.origin);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  BrowserWindowProxy.prototype["eval"] = function() {
 | 
			
		||||
    var args;
 | 
			
		||||
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
    return ipcRenderer.send.apply(ipcRenderer, ['ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', this.guestId, 'executeJavaScript'].concat(slice.call(args)));
 | 
			
		||||
  BrowserWindowProxy.prototype["eval"] = function(...args) {
 | 
			
		||||
    return ipcRenderer.send.apply(ipcRenderer, ['ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', this.guestId, 'executeJavaScript'].concat(args));
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  return BrowserWindowProxy;
 | 
			
		||||
| 
						 | 
				
			
			@ -223,16 +219,12 @@ ipcRenderer.on('ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', function(event, sourceId,
 | 
			
		|||
});
 | 
			
		||||
 | 
			
		||||
// Forward history operations to browser.
 | 
			
		||||
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)));
 | 
			
		||||
var sendHistoryOperation = function(...args) {
 | 
			
		||||
  return ipcRenderer.send.apply(ipcRenderer, ['ATOM_SHELL_NAVIGATION_CONTROLLER'].concat(args));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
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)));
 | 
			
		||||
var getHistoryOperation = function(...args) {
 | 
			
		||||
  return ipcRenderer.sendSync.apply(ipcRenderer, ['ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER'].concat(args));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
window.history.back = function() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,9 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
const ipcRenderer = require('electron').ipcRenderer;
 | 
			
		||||
const webFrame = require('electron').webFrame;
 | 
			
		||||
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
var requestId = 0;
 | 
			
		||||
var requestId= 0;
 | 
			
		||||
 | 
			
		||||
var WEB_VIEW_EVENTS = {
 | 
			
		||||
  'load-commit': ['url', 'isMainFrame'],
 | 
			
		||||
| 
						 | 
				
			
			@ -41,11 +42,10 @@ var DEPRECATED_EVENTS = {
 | 
			
		|||
  'page-title-updated': 'page-title-set'
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
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) : [];
 | 
			
		||||
var dispatchEvent = function(webView, eventName, eventKey, ...args) {
 | 
			
		||||
  var domEvent, f, i, j, len, ref1;
 | 
			
		||||
  if (DEPRECATED_EVENTS[eventName] != null) {
 | 
			
		||||
    dispatchEvent.apply(null, [webView, DEPRECATED_EVENTS[eventName], eventKey].concat(slice.call(args)));
 | 
			
		||||
    dispatchEvent.apply(null, [webView, DEPRECATED_EVENTS[eventName], eventKey].concat(args));
 | 
			
		||||
  }
 | 
			
		||||
  domEvent = new Event(eventName);
 | 
			
		||||
  ref1 = WEB_VIEW_EVENTS[eventKey];
 | 
			
		||||
| 
						 | 
				
			
			@ -61,22 +61,19 @@ var dispatchEvent = function() {
 | 
			
		|||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  registerEvents: function(webView, viewInstanceId) {
 | 
			
		||||
    ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-" + viewInstanceId, function() {
 | 
			
		||||
      var eventName = arguments[1];
 | 
			
		||||
      var args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
 | 
			
		||||
      return dispatchEvent.apply(null, [webView, eventName, eventName].concat(slice.call(args)));
 | 
			
		||||
    ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-" + viewInstanceId, function(event, eventName, ...args) {
 | 
			
		||||
      return dispatchEvent.apply(null, [webView, eventName, eventName].concat(args));
 | 
			
		||||
    });
 | 
			
		||||
    ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + viewInstanceId, function() {
 | 
			
		||||
      var channel = arguments[1];
 | 
			
		||||
      var args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
 | 
			
		||||
 | 
			
		||||
    ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + viewInstanceId, function(event, channel, ...args) {
 | 
			
		||||
      var domEvent = new Event('ipc-message');
 | 
			
		||||
      domEvent.channel = channel;
 | 
			
		||||
      domEvent.args = slice.call(args);
 | 
			
		||||
      domEvent.args = args;
 | 
			
		||||
      return webView.dispatchEvent(domEvent);
 | 
			
		||||
    });
 | 
			
		||||
    return ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED-" + viewInstanceId, function() {
 | 
			
		||||
      var args, domEvent, f, i, j, len, ref1;
 | 
			
		||||
      args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
 | 
			
		||||
 | 
			
		||||
    return ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED-" + viewInstanceId, function(event, ...args) {
 | 
			
		||||
      var domEvent, f, i, j, len, ref1;
 | 
			
		||||
      domEvent = new Event('size-changed');
 | 
			
		||||
      ref1 = ['oldWidth', 'oldHeight', 'newWidth', 'newHeight'];
 | 
			
		||||
      for (i = j = 0, len = ref1.length; j < len; i = ++j) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,6 @@ const guestViewInternal = require('./guest-view-internal');
 | 
			
		|||
const webViewConstants = require('./web-view-constants');
 | 
			
		||||
 | 
			
		||||
var hasProp = {}.hasOwnProperty;
 | 
			
		||||
var slice = [].slice;
 | 
			
		||||
 | 
			
		||||
// ID generator.
 | 
			
		||||
var nextId = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -392,9 +391,8 @@ var registerWebViewElement = function() {
 | 
			
		|||
 | 
			
		||||
  // Forward proto.foo* method calls to WebViewImpl.foo*.
 | 
			
		||||
  createBlockHandler = function(m) {
 | 
			
		||||
    return function() {
 | 
			
		||||
      var args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
      var internal = v8Util.getHiddenValue(this, 'internal');
 | 
			
		||||
    return function(...args) {
 | 
			
		||||
      const internal = v8Util.getHiddenValue(this, 'internal');
 | 
			
		||||
      if (internal.webContents) {
 | 
			
		||||
        return internal.webContents[m].apply(internal.webContents, args);
 | 
			
		||||
      } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -407,11 +405,9 @@ var registerWebViewElement = function() {
 | 
			
		|||
    proto[m] = createBlockHandler(m);
 | 
			
		||||
  }
 | 
			
		||||
  createNonBlockHandler = function(m) {
 | 
			
		||||
    return function() {
 | 
			
		||||
      var args, internal;
 | 
			
		||||
      args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
 | 
			
		||||
      internal = v8Util.getHiddenValue(this, 'internal');
 | 
			
		||||
      return ipcRenderer.send.apply(ipcRenderer, ['ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', null, internal.guestInstanceId, m].concat(slice.call(args)));
 | 
			
		||||
    return function(...args) {
 | 
			
		||||
      const internal = v8Util.getHiddenValue(this, 'internal');
 | 
			
		||||
      return ipcRenderer.send.apply(ipcRenderer, ['ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', null, internal.guestInstanceId, m].concat(args));
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  for (j = 0, len1 = nonblockMethods.length; j < len1; j++) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue