// The history operation in renderer is redirected to browser.
ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function (event, method, ...args) {
var ref
- return (ref = event.sender)[method].apply(ref, args)
+ (ref = event.sender)[method].apply(ref, args)
})
ipcMain.on('ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER', function (event, method, ...args) {
var ref
- return event.returnValue = (ref = event.sender)[method].apply(ref, args)
+ event.returnValue = (ref = event.sender)[method].apply(ref, args)
})
// JavaScript implementation of Chromium's NavigationController.
// Go to index.
this.currentIndex = this.pendingIndex
this.pendingIndex = -1
- return this.history[this.currentIndex] = url
+ this.history[this.currentIndex] = url
} else if (replaceEntry) {
// Non-user initialized navigation.
- return this.history[this.currentIndex] = url
+ this.history[this.currentIndex] = url
} else {
// Normal navigation. Clear history.
this.history = this.history.slice(0, this.currentIndex + 1)
this.history = []
this.currentIndex = -1
this.pendingIndex = -1
- return this.inPageIndex = -1
+ this.inPageIndex = -1
}
NavigationController.prototype.goBack = function () {
method = ref1[name]
if (method instanceof Function) {
(function (name, method) {
- return webContents[name] = function () {
+ webContents[name] = function () {
return method.apply(controller, arguments)
}
})(name, method)
const asyncWebFrameMethods = function (requestId, method, callback, ...args) {
this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, result) {
- if (callback)
- callback(result)
+ if (callback) callback(result)
})
}
callback = hasUserGesture
hasUserGesture = false
}
- if (this.getURL() && !this.isLoading())
+ if (this.getURL() && !this.isLoading()) {
return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture)
- else
+ } else {
return this.once('did-finish-load', asyncWebFrameMethods.bind(this, requestId, 'executeJavaScript', callback, code, hasUserGesture))
+ }
}
// Dispatch IPC messages to the ipc module.
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args))
})
webContents.on('ipc-message-sync', function (event, [channel, ...args]) {
+ /* eslint-disable */
+ // standard complains: Getter is not present
Object.defineProperty(event, 'returnValue', {
set: function (value) {
return event.sendReply(JSON.stringify(value))
}
})
+ /* eslint-enable */
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args))
})
// Always returns EOF for stdin stream.
var Readable = require('stream').Readable
- var stdin = new Readable
+ var stdin = new Readable()
stdin.push(null)
process.__defineGetter__('stdin', function () {
return stdin
// Capture the location of the function and put it in the ID string,
// so that release errors can be tracked down easily.
regexp = /at (.*)/gi
- stackString = (new Error).stack
+ stackString = (new Error()).stack
while ((match = regexp.exec(stackString)) !== null) {
location = match[1]
if (location.indexOf('(native)') !== -1) {
return this[newName].apply(this, arguments)
}
if (typeof object === 'function') {
- return object.prototype[oldName] = newMethod
+ object.prototype[oldName] = newMethod
} else {
- return object[oldName] = newMethod
+ object[oldName] = newMethod
}
}
deprecate.member = function (object, method, member) {
var warned
warned = false
- return object.prototype[method] = function () {
+ object.prototype[method] = function () {
if (!(warned || process.noDeprecation)) {
warned = true
deprecate.warn(method, member + '.' + method)
-/* globals $, xit */
+/* globals $ */
(function () {
const asar = process.binding('atom_common_asar')
deprecate.warn('ipc module', 'require("electron").ipcRenderer')
// Routes events of ipcRenderer.
-var ipc = new EventEmitter
+var ipc = new EventEmitter()
ipcRenderer.emit = function (channel, event, ...args) {
ipc.emit.apply(ipc, [channel].concat(args))
const v8Util = process.atomBinding('v8_util')
const IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap
-const callbacksRegistry = new CallbacksRegistry
+const callbacksRegistry = new CallbacksRegistry()
var includes = [].includes
-var remoteObjectCache = new IDWeakMap
+var remoteObjectCache = new IDWeakMap()
// Check for circular reference.
var isCircular = function (field, visited) {
} else if ((value != null ? value.constructor.name : void 0) === 'Promise') {
return {
type: 'promise',
- then: valueToMeta(function (v) { value.then(v); })
+ then: valueToMeta(function (v) { value.then(v) })
}
} else if ((value != null) && typeof value === 'object' && v8Util.getHiddenValue(value, 'atomId')) {
return {
// This matches |getObjectMemebers| in rpc-server.
let setObjectMembers = function (object, metaId, members) {
for (let member of members) {
- if (object.hasOwnProperty(member.name))
- continue
+ if (object.hasOwnProperty(member.name)) continue
let descriptor = { enumerable: member.enumerable }
if (member.type === 'method') {
// Populate object's prototype from descriptor.
// This matches |getObjectPrototype| in rpc-server.
let setObjectPrototype = function (object, metaId, descriptor) {
- if (descriptor === null)
- return
+ if (descriptor === null) return
let proto = {}
setObjectMembers(proto, metaId, descriptor.members)
setObjectPrototype(proto, metaId, descriptor.proto)
case 'exception':
throw new Error(meta.message + '\n' + meta.stack)
default:
- if (remoteObjectCache.has(meta.id))
- return remoteObjectCache.get(meta.id)
+ if (remoteObjectCache.has(meta.id)) return remoteObjectCache.get(meta.id)
if (meta.type === 'function') {
// A shadow class to represent the remote function object.
obj = (function () {
switch (meta.type) {
case 'error':
- return new Error
+ return new Error()
default:
return {}
}
// The global variable will be used by ipc for event dispatching
var v8Util = process.atomBinding('v8_util')
-v8Util.setHiddenValue(global, 'ipc', new events.EventEmitter)
+v8Util.setHiddenValue(global, 'ipc', new events.EventEmitter())
// Use electron module after everything is ready.
const electron = require('electron')
+/* globals Event */
+
'use strict'
const ipcRenderer = require('electron').ipcRenderer
}
ipcRenderer.on('ATOM_RENDERER_WINDOW_VISIBILITY_CHANGE', function (event, isVisible, isMinimized) {
- var hasChanged = _isVisible != isVisible || _isMinimized != isMinimized
+ var hasChanged = _isVisible !== isVisible || _isMinimized !== isMinimized
if (hasChanged) {
_isVisible = isVisible
setValueIgnoreMutation (value) {
this.ignoreMutation = true
this.setValue(value)
- return this.ignoreMutation = false
+ this.ignoreMutation = false
}
// Defines this attribute as a property on the webview node.
let requestId = getNextId()
ipcRenderer.send('ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', requestId, internal.guestInstanceId, 'executeJavaScript', code, hasUserGesture)
ipcRenderer.once(`ATOM_RENDERER_ASYNC_CALL_TO_GUEST_VIEW_RESPONSE_${requestId}`, function (event, result) {
- if (callback)
- callback(result)
+ if (callback) callback(result)
})
}
electron.hideInternalModules()
try {
require('clipboard')
- } catch(err) {
+ } catch (err) {
assert.equal(err.message, "Cannot find module 'clipboard'")
done()
}