function BrowserView() { [native code] }n/a
function BrowserWindow() { [native code] }...
options = {frame: false, height: 768, width: 1024, x: 0, y: 0};
// init browserWindow;
try {
options.BrowserWindow = require("browser-window");
} catch (ignore) {
options.BrowserWindow = require("electron").BrowserWindow;
}
options.browserWindow = new options.BrowserWindow(options);
// goto next step when webpage is loaded
/* istanbul ignore next */
try {
options.browserWindow.webContents.once("did-stop-loading", onNext);
} catch (ignore) {
setTimeout(onNext, 10000);
}
...function Menu() { [native code] }n/a
MenuItem = function (options) {
const {Menu} = require('electron')
// Preserve extra fields specified by user
for (let key in options) {
if (!(key in this)) this[key] = options[key]
}
if (typeof this.role === 'string' || this.role instanceof String) {
this.role = this.role.toLowerCase()
}
this.submenu = this.submenu || roles.getDefaultSubmenu(this.role)
if (this.submenu != null && this.submenu.constructor !== Menu) {
this.submenu = Menu.buildFromTemplate(this.submenu)
}
if (this.type == null && this.submenu != null) {
this.type = 'submenu'
}
if (this.type === 'submenu' && (this.submenu == null || this.submenu.constructor !== Menu)) {
throw new Error('Invalid submenu')
}
this.overrideReadOnlyProperty('type', 'normal')
this.overrideReadOnlyProperty('role')
this.overrideReadOnlyProperty('accelerator')
this.overrideReadOnlyProperty('icon')
this.overrideReadOnlyProperty('submenu')
this.overrideProperty('label', roles.getDefaultLabel(this.role))
this.overrideProperty('sublabel', '')
this.overrideProperty('enabled', true)
this.overrideProperty('visible', true)
this.overrideProperty('checked', false)
if (!MenuItem.types.includes(this.type)) {
throw new Error(`Unknown menu item type: ${this.type}`)
}
this.overrideReadOnlyProperty('commandId', ++nextCommandId)
const click = options.click
this.click = (event, focusedWindow, focusedWebContents) => {
// Manually flip the checked flags when clicked.
if (this.type === 'checkbox' || this.type === 'radio') {
this.checked = !this.checked
}
if (!roles.execute(this.role, focusedWindow, focusedWebContents)) {
if (typeof click === 'function') {
click(this, focusedWindow, event)
} else if (typeof this.selector === 'string' && process.platform === 'darwin') {
Menu.sendActionToFirstResponder(this.selector)
}
}
}
}n/a
function Notification() { [native code] }n/a
class TouchBar extends EventEmitter {
// Bind a touch bar to a window
static _setOnWindow (touchBar, window) {
if (window._touchBar != null) {
window._touchBar._removeFromWindow(window)
}
if (touchBar == null) {
window._setTouchBarItems([])
return
}
if (Array.isArray(touchBar)) {
touchBar = new TouchBar(touchBar)
}
touchBar._addToWindow(window)
}
constructor (options) {
super()
if (options == null) {
throw new Error('Must specify options object as first argument')
}
let {items, escapeItem} = options
// FIXME Support array as first argument, remove in 2.0
if (Array.isArray(options)) {
items = options
escapeItem = null
}
if (!Array.isArray(items)) {
items = []
}
this.changeListener = (item) => {
this.emit('change', item.id, item.type)
}
this.windowListeners = {}
this.items = {}
this.ordereredItems = []
this.escapeItem = escapeItem
const registerItem = (item) => {
this.items[item.id] = item
item.on('change', this.changeListener)
if (item.child instanceof TouchBar) {
item.child.ordereredItems.forEach(registerItem)
}
}
items.forEach((item) => {
if (!(item instanceof TouchBarItem)) {
throw new Error('Each item must be an instance of TouchBarItem')
}
this.ordereredItems.push(item)
registerItem(item)
})
}
set escapeItem (item) {
if (item != null && !(item instanceof TouchBarItem)) {
throw new Error('Escape item must be an instance of TouchBarItem')
}
if (this.escapeItem != null) {
this.escapeItem.removeListener('change', this.changeListener)
}
this._escapeItem = item
if (this.escapeItem != null) {
this.escapeItem.on('change', this.changeListener)
}
this.emit('escape-item-change', item)
}
get escapeItem () {
return this._escapeItem
}
_addToWindow (window) {
const {id} = window
// Already added to window
if (this.windowListeners.hasOwnProperty(id)) return
window._touchBar = this
const changeListener = (itemID) => {
window._refreshTouchBarItem(itemID)
}
this.on('change', changeListener)
const escapeItemListener = (item) => {
window._setEscapeTouchBarItem(item != null ? item : {})
}
this.on('escape-item-change', escapeItemListener)
const interactionListener = (event, itemID, details) => {
let item = this.items[itemID]
if (item == null && this.escapeItem != null && this.escapeItem.id === itemID) {
item = this.escapeItem
}
if (item != null && item.onInteraction != null) {
item.onInteraction(details)
}
}
window.on('-touch-bar-interaction', interactionListener)
const removeListeners = () => {
this.removeListener('change', changeListener)
this.removeListener('escape-item-change', escapeItemListener)
window.removeListener('-touch-bar-interaction', interactionListener)
window.removeListener('closed', removeListeners)
window._touchBar = null
delete this.windowListeners[id]
const unregisterItems = (items) => {
for (const item of items) {
item.removeListener('change', this.changeListener)
if (item.child instanceof TouchBar) {
unregisterItems(item.child.ordereredItems)
}
}
}
unregisterItems(this.ordereredItems)
if (this.escapeItem) {
this.escapeItem.removeListener('change', this.changeListener)
}
}
window.once('closed', removeListeners)
this.windowListeners[id] = removeListeners
window._setTouchBarItems(this.ordereredItems)
escapeItemListener(this.escapeItem)
}
_removeFromWindow (window) {
const removeListeners = this.windowListe...n/a
function Tray() { [native code] }n/a
assertThrow = function (passed, message){__cov_8230f44fc325c.f['4']++;__cov_8230f44fc325c.s['23']++;var error;__cov_8230f44fc325c.s['24']++;if(
passed){__cov_8230f44fc325c.b['3'][0]++;__cov_8230f44fc325c.s['25']++;return;}else{__cov_8230f44fc325c.b['3'][1]++;}__cov_8230f44fc325c
.s['26']++;error=(__cov_8230f44fc325c.b['5'][0]++,message)&&(__cov_8230f44fc325c.b['5'][1]++,typeof message.message==='string')&&(
__cov_8230f44fc325c.b['5'][2]++,typeof message.stack==='string')?(__cov_8230f44fc325c.b['4'][0]++,message):(__cov_8230f44fc325c.
b['4'][1]++,new Error(typeof message==='string'?(__cov_8230f44fc325c.b['6'][0]++,message):(__cov_8230f44fc325c.b['6'][1]++,JSON.
stringify(message,null,4))));__cov_8230f44fc325c.s['27']++;throw error;}n/a
functionOrNop = function (fnc){__cov_8230f44fc325c.f['5']++;__cov_8230f44fc325c.s['29']++;return(__cov_8230f44fc325c.b['7'][0]++,fnc)||(__cov_8230f44fc325c
.b['7'][1]++,local.nop);}n/a
identity = function (value){__cov_8230f44fc325c.f['6']++;__cov_8230f44fc325c.s['31']++;return value;}n/a
nop = function (){__cov_8230f44fc325c.f['7']++;__cov_8230f44fc325c.s['33']++;return;}n/a
objectAssignDefault = function (target, source){__cov_8230f44fc325c.f['8']++;__cov_8230f44fc325c.s['35']++;Object.keys(source).forEach(function(key){__cov_8230f44fc325c
.f['9']++;__cov_8230f44fc325c.s['36']++;if((__cov_8230f44fc325c.b['9'][0]++,target[key]===null)||(__cov_8230f44fc325c.b['9'][1]++,
target[key]===undefined)||(__cov_8230f44fc325c.b['9'][2]++,target[key]==='')){__cov_8230f44fc325c.b['8'][0]++;__cov_8230f44fc325c
.s['37']++;target[key]=(__cov_8230f44fc325c.b['10'][0]++,target[key])||(__cov_8230f44fc325c.b['10'][1]++,source[key]);}else{__cov_8230f44fc325c
.b['8'][1]++;}});}n/a
function BrowserView() { [native code] }n/a
fromId = function () { [native code] }n/a
(webContents) => {
for (const view of BrowserView.getAllViews()) {
if (view.webContents.equal(webContents)) return view
}
return null
}n/a
getAllViews = function () { [native code] }n/a
function destroy() { [native code] }n/a
function isDestroyed() { [native code] }n/a
function setAutoResize() { [native code] }n/a
function setBackgroundColor() { [native code] }n/a
function setBounds() { [native code] }n/a
function BrowserWindow() { [native code] }...
options = {frame: false, height: 768, width: 1024, x: 0, y: 0};
// init browserWindow;
try {
options.BrowserWindow = require("browser-window");
} catch (ignore) {
options.BrowserWindow = require("electron").BrowserWindow;
}
options.browserWindow = new options.BrowserWindow(options);
// goto next step when webpage is loaded
/* istanbul ignore next */
try {
options.browserWindow.webContents.once("did-stop-loading", onNext);
} catch (ignore) {
setTimeout(onNext, 10000);
}
...addDevToolsExtension = function (srcDirectory) {
const manifestName = BrowserWindow.addExtension(srcDirectory)
if (manifestName) {
devToolsExtensionNames.add(manifestName)
}
return manifestName
}n/a
addExtension = function (srcDirectory) {
const manifest = getManifestFromPath(srcDirectory)
if (manifest) {
loadExtension(manifest)
for (const webContents of getAllWebContents()) {
if (isWindowOrWebView(webContents)) {
loadDevToolsExtensions(webContents, [manifest])
}
}
return manifest.name
}
}n/a
(browserView) => {
for (const window of BrowserWindow.getAllWindows()) {
if (window.getBrowserView() === browserView) return window
}
return null
}n/a
(webContents) => {
for (const window of BrowserWindow.getAllWindows()) {
const {devToolsWebContents} = window
if (devToolsWebContents != null && devToolsWebContents.equal(webContents)) {
return window
}
}
}n/a
fromId = function () { [native code] }n/a
(webContents) => {
for (const window of BrowserWindow.getAllWindows()) {
if (window.webContents.equal(webContents)) return window
}
}n/a
getAllWindows = function () { [native code] }n/a
getDevToolsExtensions = function () {
const extensions = BrowserWindow.getExtensions()
const devExtensions = {}
Array.from(devToolsExtensionNames).forEach(function (name) {
if (!extensions[name]) return
devExtensions[name] = extensions[name]
})
return devExtensions
}n/a
getExtensions = function () {
const extensions = {}
Object.keys(manifestNameMap).forEach(function (name) {
const manifest = manifestNameMap[name]
extensions[name] = {name: manifest.name, version: manifest.version}
})
return extensions
}n/a
() => {
for (let window of BrowserWindow.getAllWindows()) {
if (window.isFocused() || window.isDevToolsFocused()) return window
}
return null
}n/a
removeDevToolsExtension = function (name) {
BrowserWindow.removeExtension(name)
devToolsExtensionNames.delete(name)
}n/a
removeExtension = function (name) {
const manifest = manifestNameMap[name]
if (!manifest) return
removeBackgroundPages(manifest)
removeContentScripts(manifest)
delete manifestMap[manifest.extensionId]
delete manifestNameMap[name]
}n/a
_init = function () {
// Avoid recursive require.
const {app} = require('electron')
// Simulate the application menu on platforms other than macOS.
if (process.platform !== 'darwin') {
const menu = app.getApplicationMenu()
if (menu) this.setMenu(menu)
}
// Make new windows requested by links behave like "window.open"
this.webContents.on('-new-window', (event, url, frameName,
disposition, additionalFeatures,
postData) => {
const options = {
show: true,
width: 800,
height: 600
}
ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN',
event, url, frameName, disposition,
options, additionalFeatures, postData)
})
this.webContents.on('-web-contents-created', (event, webContents, url,
frameName) => {
v8Util.setHiddenValue(webContents, 'url-framename', {url, frameName})
})
// Create a new browser window for the native implementation of
// "window.open", used in sandbox and nativeWindowOpen mode
this.webContents.on('-add-new-contents', (event, webContents, disposition,
userGesture, left, top, width,
height) => {
let urlFrameName = v8Util.getHiddenValue(webContents, 'url-framename')
if ((disposition !== 'foreground-tab' && disposition !== 'new-window' &&
disposition !== 'background-tab') || !urlFrameName) {
event.preventDefault()
return
}
if (webContents.getLastWebPreferences().nodeIntegration === true) {
const message =
'Enabling Node.js integration in child windows opened with the ' +
'"nativeWindowOpen" option will cause memory leaks, please turn off ' +
'the "nodeIntegration" option.\\n' +
'See https://github.com/electron/electron/pull/15076 for more.'
// console is only available after DOM is created.
const printWarning = () => this.webContents.executeJavaScript(`console.warn('${message}')`)
if (this.webContents.isDomReady()) {
printWarning()
} else {
this.webContents.once('dom-ready', printWarning)
}
}
let {url, frameName} = urlFrameName
v8Util.deleteHiddenValue(webContents, 'url-framename')
const options = {
show: true,
x: left,
y: top,
width: width || 800,
height: height || 600,
webContents: webContents
}
ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN',
event, url, frameName, disposition, options)
})
// window.resizeTo(...)
// window.moveTo(...)
this.webContents.on('move', (event, size) => {
this.setBounds(size)
})
// Hide the auto-hide menu when webContents is focused.
this.webContents.on('activate', () => {
if (process.platform !== 'darwin' && this.isMenuBarAutoHide() && this.isMenuBarVisible()) {
this.setMenuBarVisibility(false)
}
})
// Change window title to page title.
this.webContents.on('page-title-updated', (event, title) => {
// Route the event to BrowserWindow.
this.emit('page-title-updated', event, title)
if (!this.isDestroyed() && !event.defaultPrevented) this.setTitle(title)
})
// Sometimes the webContents doesn't get focus when window is shown, so we
// have to force focusing on webContents in this case. The safest way is to
// focus it when we first start to load URL, if we do it earlier it won't
// have effect, if we do it later we might move focus in the page.
//
// Though this hack is only needed on macOS when the app is launched from
// Finder, we stil...n/a
function _refreshTouchBarItem() { [native code] }n/a
function _setEscapeTouchBarItem() { [native code] }n/a
function _setTouchBarItems() { [native code] }n/a
function blur() { [native code] }...
if (this.keyboardNavigationActive)
return;
// Remove focus to make any visible tooltips disappear -- otherwise they'll
// still be visible on screen when the toolbar is off screen.
if ((this.toolbar_ && document.activeElement == this.toolbar_) ||
document.activeElement == this.zoomToolbar_) {
document.activeElement.blur();
}
if (this.toolbar_)
this.toolbar_.hide();
this.zoomToolbar_.hide();
},
...function blurWebView() { [native code] }n/a
capturePage(...args) {
return this.webContents.capturePage(...args)
}...
(options.browserWindow.loadUrl || options.browserWindow.loadURL).call(
options.browserWindow,
"https://electron.atom.io"
);
break;
case 3:
// screenshot webpage
options.browserWindow.capturePage(options, onNext);
break;
case 4:
// screenshot
/* istanbul ignore next */
try {
data = data.toPng();
} catch (ignore) {
...function center() { [native code] }n/a
function close() { [native code] }...
AssociatedInterfacePtrController.prototype.isBound = function() {
return this.interfaceEndpointClient_ !== null;
};
AssociatedInterfacePtrController.prototype.reset = function() {
this.version = 0;
if (this.interfaceEndpointClient_) {
this.interfaceEndpointClient_.close();
this.interfaceEndpointClient_ = null;
}
if (this.proxy_) {
this.proxy_ = null;
}
};
...closeDevTools() {
return this.webContents.closeDevTools()
}n/a
function closeFilePreview() { [native code] }n/a
function destroy() { [native code] }n/a
function flashFrame() { [native code] }n/a
function focus() { [native code] }...
},
deny: function() {
var password = /** @type {!PaperInputElement} */ (this.$.password);
password.disabled = false;
this.$.submit.disabled = false;
this.invalid = true;
password.focus();
password.inputElement.select();
},
submit: function() {
var password = /** @type {!PaperInputElement} */ (this.$.password);
if (password.value.length == 0)
return;
...function focusOnWebView() { [native code] }n/a
function getBounds() { [native code] }n/a
function getBrowserView() { [native code] }n/a
function getChildWindows() { [native code] }n/a
function getContentBounds() { [native code] }n/a
function getContentSize() { [native code] }n/a
function getMaximumSize() { [native code] }n/a
function getMinimumSize() { [native code] }n/a
function getNativeWindowHandle() { [native code] }n/a
function getOpacity() { [native code] }n/a
function getParentWindow() { [native code] }n/a
function getPosition() { [native code] }n/a
function getRepresentedFilename() { [native code] }n/a
function getSize() { [native code] }n/a
function getTitle() { [native code] }n/a
getURL(...args) {
return this.webContents.getURL()
}n/a
function hasShadow() { [native code] }n/a
function hide() { [native code] }...
// still be visible on screen when the toolbar is off screen.
if ((this.toolbar_ && document.activeElement == this.toolbar_) ||
document.activeElement == this.zoomToolbar_) {
document.activeElement.blur();
}
if (this.toolbar_)
this.toolbar_.hide();
this.zoomToolbar_.hide();
},
/**
* Hide the toolbar after the HIDE_TIMEOUT has elapsed.
*/
hideToolbarsAfterTimeout: function() {
...inspectElement(...args) {
return this.webContents.inspectElement(...args)
}n/a
inspectServiceWorker() {
return this.webContents.inspectServiceWorker()
}n/a
function isAlwaysOnTop() { [native code] }n/a
function isClosable() { [native code] }n/a
function isDestroyed() { [native code] }n/a
isDevToolsFocused() {
return this.webContents.isDevToolsFocused()
}n/a
isDevToolsOpened() {
return this.webContents.isDevToolsOpened()
}n/a
function isDocumentEdited() { [native code] }n/a
function isEnabled() { [native code] }n/a
function isFocused() { [native code] }n/a
function isFullScreen() { [native code] }n/a
function isFullScreenable() { [native code] }n/a
function isKiosk() { [native code] }n/a
function isMaximizable() { [native code] }n/a
function isMaximized() { [native code] }n/a
function isMenuBarAutoHide() { [native code] }n/a
function isMenuBarVisible() { [native code] }n/a
function isMinimizable() { [native code] }n/a
function isMinimized() { [native code] }n/a
function isModal() { [native code] }n/a
function isMovable() { [native code] }n/a
function isResizable() { [native code] }n/a
function isSimpleFullScreen() { [native code] }n/a
function isVisible() { [native code] }...
this.sideToolbarAllowedOnly_ = false;
// Allow the top toolbar to be shown if the mouse moves to the top edge.
if (this.isMouseNearTopToolbar_)
this.sideToolbarAllowedOnly_ = false;
// Tapping the screen with toolbars open tries to close them.
if (touchInteractionActive && this.zoomToolbar_.isVisible()) {
this.hideToolbarsIfAllowed();
return;
}
// Show the toolbars if the mouse is near the top or bottom-right of the
// screen, if the mouse moved fast, or if the touchscreen was tapped.
if (this.isMouseNearTopToolbar_ || this.isMouseNearSideToolbar_ ||
...function isVisibleOnAllWorkspaces() { [native code] }n/a
function isWebViewFocused() { [native code] }n/a
loadFile(filePath) {
return this.webContents.loadFile(filePath)
}n/a
loadURL(...args) {
return this.webContents.loadURL(...args)
}n/a
function maximize() { [native code] }n/a
function minimize() { [native code] }n/a
openDevTools(...args) {
return this.webContents.openDevTools(...args)
}n/a
function previewFile() { [native code] }n/a
reload(...args) {
return this.webContents.reload(...args)
}n/a
function restore() { [native code] }n/a
send(...args) {
return this.webContents.send(...args)
}...
listErrorCodes(data['errorCodes']);
} catch (e) {
$('pages').innerText = 'Could not parse the error codes data. ' +
'Try reloading the page.';
}
}
});
xhr.send();
}
return {
initialize: initialize
};
});
...function setAlwaysOnTop() { [native code] }n/a
function setAspectRatio() { [native code] }n/a
function setAutoHideMenuBar() { [native code] }n/a
function setBackgroundColor() { [native code] }n/a
function setBounds() { [native code] }n/a
function setBrowserView() { [native code] }n/a
function setClosable() { [native code] }n/a
function setContentBounds() { [native code] }n/a
function setContentProtection() { [native code] }n/a
function setContentSize() { [native code] }n/a
function setDocumentEdited() { [native code] }n/a
function setEnabled() { [native code] }n/a
function setFocusable() { [native code] }n/a
function setFullScreen() { [native code] }n/a
function setFullScreenable() { [native code] }n/a
function setHasShadow() { [native code] }n/a
function setIcon() { [native code] }n/a
function setIgnoreMouseEvents() { [native code] }n/a
function setKiosk() { [native code] }n/a
function setMaximizable() { [native code] }n/a
function setMaximumSize() { [native code] }n/a
function setMenu() { [native code] }n/a
function setMenuBarVisibility() { [native code] }n/a
function setMinimizable() { [native code] }n/a
function setMinimumSize() { [native code] }n/a
function setMovable() { [native code] }n/a
function setOpacity() { [native code] }n/a
function setOverlayIcon() { [native code] }n/a
function setParentWindow() { [native code] }n/a
function setPosition() { [native code] }n/a
function setProgressBar() { [native code] }n/a
function setRepresentedFilename() { [native code] }n/a
function setResizable() { [native code] }n/a
function setSheetOffset() { [native code] }n/a
function setSimpleFullScreen() { [native code] }n/a
function setSize() { [native code] }n/a
function setSkipTaskbar() { [native code] }n/a
function setThumbarButtons() { [native code] }n/a
function setTitle() { [native code] }n/a
setTouchBar(touchBar) {
electron.TouchBar._setOnWindow(touchBar, this)
}n/a
function setVibrancy() { [native code] }n/a
function setVisibleOnAllWorkspaces() { [native code] }n/a
function show() { [native code] }...
*/
updateProgress_: function(progress) {
if (this.toolbar_)
this.toolbar_.loadProgress = progress;
if (progress == -1) {
// Document load failed.
this.errorScreen_.show();
this.sizer_.style.display = 'none';
if (this.passwordScreen_.active) {
this.passwordScreen_.deny();
this.passwordScreen_.close();
}
this.loadState_ = LoadState.FAILED;
this.sendDocumentLoadedMessage_();
...showDefinitionForSelection() {
return this.webContents.showDefinitionForSelection()
}n/a
function showInactive() { [native code] }n/a
toggleDevTools() {
return this.webContents.toggleDevTools()
}n/a
function unmaximize() { [native code] }n/a
function Menu() { [native code] }n/a
buildFromTemplate = function (template) {
if (!Array.isArray(template)) {
throw new TypeError('Invalid template for Menu')
}
const menu = new Menu()
const filtered = removeExtraSeparators(template)
const positioned = []
let idx = 0
// sort template by position
filtered.forEach(item => {
idx = (item.position) ? indexToInsertByPosition(positioned, item.position) : idx += 1
positioned.splice(idx, 0, item)
})
// add each item from positioned menu to application menu
positioned.forEach((item) => {
if (typeof item !== 'object') {
throw new TypeError('Invalid template for MenuItem')
}
menu.append(new MenuItem(item))
})
return menu
}n/a
() => applicationMenu
n/a
setApplicationMenu = function (menu) {
if (menu && menu.constructor !== Menu) {
throw new TypeError('Invalid menu')
}
applicationMenu = menu
if (process.platform === 'darwin') {
if (!menu) return
menu._callMenuWillShow()
bindings.setApplicationMenu(menu)
} else {
const windows = BrowserWindow.getAllWindows()
return windows.map(w => w.setMenu(menu))
}
}n/a
_callMenuWillShow = function () {
if (this.delegate) this.delegate.menuWillShow(this)
this.items.forEach(item => {
if (item.submenu) item.submenu._callMenuWillShow()
})
}n/a
_init = function () {
this.commandsMap = {}
this.groupsMap = {}
this.items = []
this.delegate = delegate
}n/a
append = function (item) {
return this.insert(this.getItemCount(), item)
}n/a
function clear() { [native code] }...
requestOrHandle, this.nextBindingId_));
++this.nextBindingId_;
};
BindingSet.prototype.closeAllBindings = function() {
for (var entry of this.bindings_.values())
entry.close();
this.bindings_.clear();
};
BindingSet.prototype.setConnectionErrorHandler = function(callback) {
this.errorHandler_ = callback;
};
BindingSet.prototype.onConnectionError = function(bindingId, reason) {
...closePopup = function (window) {
if (window && window.constructor !== BrowserWindow) {
this.closePopupAt(window.id)
} else {
// Passing -1 (invalid) would make closePopupAt close the all menu runners
// belong to this menu.
this.closePopupAt(-1)
}
}n/a
function closePopupAt() { [native code] }n/a
function destroy() { [native code] }n/a
function getCommandIdAt() { [native code] }n/a
function getIndexOfCommandId() { [native code] }n/a
function getItemCount() { [native code] }n/a
function getLabelAt() { [native code] }n/a
getMenuItemById = function (id) {
const items = this.items
let found = items.find(item => item.id === id) || null
for (let i = 0; !found && i < items.length; i++) {
if (items[i].submenu) {
found = items[i].submenu.getMenuItemById(id)
}
}
return found
}n/a
function getSublabelAt() { [native code] }n/a
insert = function (pos, item) {
if ((item ? item.constructor : void 0) !== MenuItem) {
throw new TypeError('Invalid item')
}
// insert item depending on its type
insertItemByType.call(this, item, pos)
// set item properties
if (item.sublabel) this.setSublabel(pos, item.sublabel)
if (item.icon) this.setIcon(pos, item.icon)
if (item.role) this.setRole(pos, item.role)
// Make menu accessable to items.
item.overrideReadOnlyProperty('menu', this)
// Remember the items.
this.items.splice(pos, 0, item)
this.commandsMap[item.commandId] = item
}n/a
function insertCheckItem() { [native code] }n/a
function insertItem() { [native code] }n/a
function insertRadioItem() { [native code] }n/a
function insertSeparator() { [native code] }n/a
function insertSubMenu() { [native code] }n/a
function isDestroyed() { [native code] }n/a
function isEnabledAt() { [native code] }n/a
function isItemCheckedAt() { [native code] }n/a
function isVisibleAt() { [native code] }n/a
popup = function (options) {
if (options == null || typeof options !== 'object') {
throw new TypeError('Options must be an object')
}
let {window, x, y, positioningItem, callback} = options
// no callback passed
if (!callback || typeof callback !== 'function') callback = () => {}
// set defaults
if (typeof x !== 'number') x = -1
if (typeof y !== 'number') y = -1
if (typeof positioningItem !== 'number') positioningItem = -1
// find which window to use
const wins = BrowserWindow.getAllWindows()
if (!wins || wins.indexOf(window) === -1) {
window = BrowserWindow.getFocusedWindow()
if (!window && wins && wins.length > 0) {
window = wins[0]
}
if (!window) {
throw new Error(`Cannot open Menu without a BrowserWindow present`)
}
}
this.popupAt(window, x, y, positioningItem, callback)
return { browserWindow: window, x, y, position: positioningItem }
}n/a
function popupAt() { [native code] }n/a
function setIcon() { [native code] }n/a
function setRole() { [native code] }n/a
function setSublabel() { [native code] }n/a
MenuItem = function (options) {
const {Menu} = require('electron')
// Preserve extra fields specified by user
for (let key in options) {
if (!(key in this)) this[key] = options[key]
}
if (typeof this.role === 'string' || this.role instanceof String) {
this.role = this.role.toLowerCase()
}
this.submenu = this.submenu || roles.getDefaultSubmenu(this.role)
if (this.submenu != null && this.submenu.constructor !== Menu) {
this.submenu = Menu.buildFromTemplate(this.submenu)
}
if (this.type == null && this.submenu != null) {
this.type = 'submenu'
}
if (this.type === 'submenu' && (this.submenu == null || this.submenu.constructor !== Menu)) {
throw new Error('Invalid submenu')
}
this.overrideReadOnlyProperty('type', 'normal')
this.overrideReadOnlyProperty('role')
this.overrideReadOnlyProperty('accelerator')
this.overrideReadOnlyProperty('icon')
this.overrideReadOnlyProperty('submenu')
this.overrideProperty('label', roles.getDefaultLabel(this.role))
this.overrideProperty('sublabel', '')
this.overrideProperty('enabled', true)
this.overrideProperty('visible', true)
this.overrideProperty('checked', false)
if (!MenuItem.types.includes(this.type)) {
throw new Error(`Unknown menu item type: ${this.type}`)
}
this.overrideReadOnlyProperty('commandId', ++nextCommandId)
const click = options.click
this.click = (event, focusedWindow, focusedWebContents) => {
// Manually flip the checked flags when clicked.
if (this.type === 'checkbox' || this.type === 'radio') {
this.checked = !this.checked
}
if (!roles.execute(this.role, focusedWindow, focusedWebContents)) {
if (typeof click === 'function') {
click(this, focusedWindow, event)
} else if (typeof this.selector === 'string' && process.platform === 'darwin') {
Menu.sendActionToFirstResponder(this.selector)
}
}
}
}n/a
getDefaultRoleAccelerator = function () {
return roles.getDefaultAccelerator(this.role)
}n/a
overrideProperty = function (name, defaultValue = null) {
if (this[name] == null) {
this[name] = defaultValue
}
}n/a
overrideReadOnlyProperty = function (name, defaultValue) {
this.overrideProperty(name, defaultValue)
Object.defineProperty(this, name, {
enumerable: true,
writable: false,
value: this[name]
})
}n/a
function Notification() { [native code] }n/a
isSupported = function () { [native code] }n/a
function close() { [native code] }...
AssociatedInterfacePtrController.prototype.isBound = function() {
return this.interfaceEndpointClient_ !== null;
};
AssociatedInterfacePtrController.prototype.reset = function() {
this.version = 0;
if (this.interfaceEndpointClient_) {
this.interfaceEndpointClient_.close();
this.interfaceEndpointClient_ = null;
}
if (this.proxy_) {
this.proxy_ = null;
}
};
...function destroy() { [native code] }n/a
function isDestroyed() { [native code] }n/a
function show() { [native code] }...
*/
updateProgress_: function(progress) {
if (this.toolbar_)
this.toolbar_.loadProgress = progress;
if (progress == -1) {
// Document load failed.
this.errorScreen_.show();
this.sizer_.style.display = 'none';
if (this.passwordScreen_.active) {
this.passwordScreen_.deny();
this.passwordScreen_.close();
}
this.loadState_ = LoadState.FAILED;
this.sendDocumentLoadedMessage_();
...class TouchBar extends EventEmitter {
// Bind a touch bar to a window
static _setOnWindow (touchBar, window) {
if (window._touchBar != null) {
window._touchBar._removeFromWindow(window)
}
if (touchBar == null) {
window._setTouchBarItems([])
return
}
if (Array.isArray(touchBar)) {
touchBar = new TouchBar(touchBar)
}
touchBar._addToWindow(window)
}
constructor (options) {
super()
if (options == null) {
throw new Error('Must specify options object as first argument')
}
let {items, escapeItem} = options
// FIXME Support array as first argument, remove in 2.0
if (Array.isArray(options)) {
items = options
escapeItem = null
}
if (!Array.isArray(items)) {
items = []
}
this.changeListener = (item) => {
this.emit('change', item.id, item.type)
}
this.windowListeners = {}
this.items = {}
this.ordereredItems = []
this.escapeItem = escapeItem
const registerItem = (item) => {
this.items[item.id] = item
item.on('change', this.changeListener)
if (item.child instanceof TouchBar) {
item.child.ordereredItems.forEach(registerItem)
}
}
items.forEach((item) => {
if (!(item instanceof TouchBarItem)) {
throw new Error('Each item must be an instance of TouchBarItem')
}
this.ordereredItems.push(item)
registerItem(item)
})
}
set escapeItem (item) {
if (item != null && !(item instanceof TouchBarItem)) {
throw new Error('Escape item must be an instance of TouchBarItem')
}
if (this.escapeItem != null) {
this.escapeItem.removeListener('change', this.changeListener)
}
this._escapeItem = item
if (this.escapeItem != null) {
this.escapeItem.on('change', this.changeListener)
}
this.emit('escape-item-change', item)
}
get escapeItem () {
return this._escapeItem
}
_addToWindow (window) {
const {id} = window
// Already added to window
if (this.windowListeners.hasOwnProperty(id)) return
window._touchBar = this
const changeListener = (itemID) => {
window._refreshTouchBarItem(itemID)
}
this.on('change', changeListener)
const escapeItemListener = (item) => {
window._setEscapeTouchBarItem(item != null ? item : {})
}
this.on('escape-item-change', escapeItemListener)
const interactionListener = (event, itemID, details) => {
let item = this.items[itemID]
if (item == null && this.escapeItem != null && this.escapeItem.id === itemID) {
item = this.escapeItem
}
if (item != null && item.onInteraction != null) {
item.onInteraction(details)
}
}
window.on('-touch-bar-interaction', interactionListener)
const removeListeners = () => {
this.removeListener('change', changeListener)
this.removeListener('escape-item-change', escapeItemListener)
window.removeListener('-touch-bar-interaction', interactionListener)
window.removeListener('closed', removeListeners)
window._touchBar = null
delete this.windowListeners[id]
const unregisterItems = (items) => {
for (const item of items) {
item.removeListener('change', this.changeListener)
if (item.child instanceof TouchBar) {
unregisterItems(item.child.ordereredItems)
}
}
}
unregisterItems(this.ordereredItems)
if (this.escapeItem) {
this.escapeItem.removeListener('change', this.changeListener)
}
}
window.once('closed', removeListeners)
this.windowListeners[id] = removeListeners
window._setTouchBarItems(this.ordereredItems)
escapeItemListener(this.escapeItem)
}
_removeFromWindow (window) {
const removeListeners = this.windowListe...n/a
class TouchBarButton extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
this._addImmutableProperty('type', 'button')
const {click, icon, iconPosition, label, backgroundColor} = config
this._addLiveProperty('label', label)
this._addLiveProperty('backgroundColor', backgroundColor)
this._addLiveProperty('icon', icon)
this._addLiveProperty('iconPosition', iconPosition)
if (typeof click === 'function') {
this._addImmutableProperty('onInteraction', () => {
config.click()
})
}
}
}n/a
class TouchBarColorPicker extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
this._addImmutableProperty('type', 'colorpicker')
const {availableColors, change, selectedColor} = config
this._addLiveProperty('availableColors', availableColors)
this._addLiveProperty('selectedColor', selectedColor)
if (typeof change === 'function') {
this._addImmutableProperty('onInteraction', (details) => {
this._selectedColor = details.color
change(details.color)
})
}
}
}n/a
class TouchBarGroup extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
this._addImmutableProperty('type', 'group')
const defaultChild = (config.items instanceof TouchBar) ? config.items : new TouchBar(config.items)
this._addLiveProperty('child', defaultChild)
this.child.ordereredItems.forEach((item) => item._addParent(this))
}
}n/a
class TouchBarLabel extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
this._addImmutableProperty('type', 'label')
this._addLiveProperty('label', config.label)
this._addLiveProperty('textColor', config.textColor)
}
}n/a
class TouchBarPopover extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
this._addImmutableProperty('type', 'popover')
this._addLiveProperty('label', config.label)
this._addLiveProperty('icon', config.icon)
this._addLiveProperty('showCloseButton', config.showCloseButton)
const defaultChild = (config.items instanceof TouchBar) ? config.items : new TouchBar(config.items)
this._addLiveProperty('child', defaultChild)
this.child.ordereredItems.forEach((item) => item._addParent(this))
}
}n/a
class TouchBarScrubber extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
const {items, selectedStyle, overlayStyle, showArrowButtons, continuous, mode} = config
let {select, highlight} = config
this._addImmutableProperty('type', 'scrubber')
this._addLiveProperty('items', items)
this._addLiveProperty('selectedStyle', selectedStyle || null)
this._addLiveProperty('overlayStyle', overlayStyle || null)
this._addLiveProperty('showArrowButtons', showArrowButtons || false)
this._addLiveProperty('mode', mode || 'free')
this._addLiveProperty('continuous', typeof continuous === 'undefined' ? true : continuous)
if (typeof select === 'function' || typeof highlight === 'function') {
if (select == null) select = () => {}
if (highlight == null) highlight = () => {}
this._addImmutableProperty('onInteraction', (details) => {
if (details.type === 'select' && typeof select === 'function') {
select(details.selectedIndex)
} else if (details.type === 'highlight' && typeof highlight === 'function') {
highlight(details.highlightedIndex)
}
})
}
}
}n/a
class TouchBarSegmentedControl extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
const {segmentStyle, segments, selectedIndex, change, mode} = config
this._addImmutableProperty('type', 'segmented_control')
this._addLiveProperty('segmentStyle', segmentStyle)
this._addLiveProperty('segments', segments || [])
this._addLiveProperty('selectedIndex', selectedIndex)
this._addLiveProperty('mode', mode)
if (typeof change === 'function') {
this._addImmutableProperty('onInteraction', (details) => {
this._selectedIndex = details.selectedIndex
change(details.selectedIndex, details.isSelected)
})
}
}
}n/a
class TouchBarSlider extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
this._addImmutableProperty('type', 'slider')
const {change, label, minValue, maxValue, value} = config
this._addLiveProperty('label', label)
this._addLiveProperty('minValue', minValue)
this._addLiveProperty('maxValue', maxValue)
this._addLiveProperty('value', value)
if (typeof change === 'function') {
this._addImmutableProperty('onInteraction', (details) => {
this._value = details.value
change(details.value)
})
}
}
}n/a
class TouchBarSpacer extends TouchBarItem {
constructor (config) {
super()
if (config == null) config = {}
this._addImmutableProperty('type', 'spacer')
this._addImmutableProperty('size', config.size)
}
}n/a
function Tray() { [native code] }n/a
function destroy() { [native code] }n/a
function displayBalloon() { [native code] }n/a
function getBounds() { [native code] }n/a
function isDestroyed() { [native code] }n/a
function popUpContextMenu() { [native code] }n/a
function setContextMenu() { [native code] }n/a
setHighlightMode = function (param) {
if (!process.noDeprecations && typeof param === 'boolean') {
if (param) {
deprecate.warn('tray.setHighlightMode(true)', `tray.setHighlightMode("on")`)
} else {
deprecate.warn('tray.setHighlightMode(false)', `tray.setHighlightMode("off")`)
}
}
return nativeSetHighlightMode.call(this, param)
}n/a
function setImage() { [native code] }n/a
function setPressedImage() { [native code] }n/a
function setTitle() { [native code] }n/a
function setToolTip() { [native code] }n/a
allowNTLMCredentialsForAllDomains = function (allow) {
if (!process.noDeprecations) {
deprecate.warn('app.allowNTLMCredentialsForAllDomains', 'session.allowNTLMCredentialsForDomains')
}
let domains = allow ? '*' : ''
if (!this.isReady()) {
this.commandLine.appendSwitch('auth-server-whitelist', domains)
} else {
electron.session.defaultSession.allowNTLMCredentialsForDomains(domains)
}
}n/a
getApplicationMenu() {
return Menu.getApplicationMenu()
}n/a
setApplicationMenu(menu) {
return Menu.setApplicationMenu(menu)
}n/a
(event, webContents, ...args) => {
webContents.emit(name, event, ...args)
}n/a
(event, webContents, ...args) => {
webContents.emit(name, event, ...args)
}n/a
quit = function (event, exitCode) {
process.emit('exit', exitCode)
}n/a
(event, webContents, ...args) => {
webContents.emit(name, event, ...args)
}n/a
session-created = function (ses) {
ses.protocol.registerBufferProtocol('chrome-extension', chromeExtensionHandler, function (error) {
if (error) {
console.error(`Unable to register chrome-extension protocol: ${error}`)
}
})
}n/a
web-contents-created = function (event, webContents) {
if (!isWindowOrWebView(webContents)) return
hookWebContentsEvents(webContents)
webContents.on('devtools-opened', function () {
loadDevToolsExtensions(webContents, Object.values(manifestMap))
})
}n/a
will-quit = function () {
try {
const loadedDevToolsExtensions = Array.from(devToolsExtensionNames)
.map(name => manifestNameMap[name].srcDirectory)
if (loadedDevToolsExtensions.length > 0) {
try {
fs.mkdirSync(path.dirname(loadedDevToolsExtensionsPath))
} catch (error) {
// Ignore error
}
fs.writeFileSync(loadedDevToolsExtensionsPath, JSON.stringify(loadedDevToolsExtensions))
} else {
fs.unlinkSync(loadedDevToolsExtensionsPath)
}
} catch (error) {
// Ignore error
}
}n/a
() => {
if (app.listeners('window-all-closed').length === 1 && !option.interactive) {
app.quit()
}
}n/a
appendArgument(...args) {
const castedArgs = args.map((arg) => {
return typeof arg !== 'string' ? `${arg}` : arg
})
return bindings.appendArgument(...castedArgs)
}n/a
appendSwitch(...args) {
const castedArgs = args.map((arg) => {
return typeof arg !== 'string' ? `${arg}` : arg
})
return bindings.appendSwitch(...castedArgs)
}n/a
availableFormats = function () { [native code] }n/a
clear = function () { [native code] }...
requestOrHandle, this.nextBindingId_));
++this.nextBindingId_;
};
BindingSet.prototype.closeAllBindings = function() {
for (var entry of this.bindings_.values())
entry.close();
this.bindings_.clear();
};
BindingSet.prototype.setConnectionErrorHandler = function(callback) {
this.errorHandler_ = callback;
};
BindingSet.prototype.onConnectionError = function(bindingId, reason) {
...has = function () { [native code] }...
if (this.nextInterfaceIdValue_ >= types.kInterfaceIdNamespaceMask) {
this.nextInterfaceIdValue_ = 1;
}
id = this.nextInterfaceIdValue_++;
if (this.setInterfaceIdNamespaceBit_) {
id += types.kInterfaceIdNamespaceMask;
}
} while (this.endpoints_.has(id));
var endpoint = new InterfaceEndpoint(this, id);
this.endpoints_.set(id, endpoint);
if (this.encounteredError_) {
this.updateEndpointStateMayRemove(endpoint,
EndpointStateUpdateType.PEER_ENDPOINT_CLOSED);
}
...read = function () { [native code] }n/a
readBookmark = function () { [native code] }n/a
readBuffer = function () { [native code] }n/a
readFindText = function () { [native code] }n/a
readHTML = function () { [native code] }n/a
readHtml = function () {
if (!process.noDeprecations) {
deprecate.warn('clipboard.readHtml', 'clipboard.readHTML')
}
return clipboard.readHTML()
}n/a
readImage = function () { [native code] }n/a
readRTF = function () { [native code] }n/a
readRtf = function () {
if (!process.noDeprecations) {
deprecate.warn('clipboard.readRtf', 'clipboard.writeRTF')
}
return clipboard.readRTF()
}n/a
readText = function () { [native code] }n/a
write = function () { [native code] }...
local.child.on("exit", process.exit);
local.child.stdout.on("data", function (chunk, encoding, cb) {
// bug-workaround - force electron v1.8.x and higher to exit after running command
// --help|-h
switch (process.argv[2]) {
case "--help":
case "-h":
process.stdout.write(chunk, encoding, cb);
local.child.kill();
break;
default:
process.stdout.write(chunk, encoding, cb);
}
});
}());
...writeBookmark = function () { [native code] }n/a
writeBuffer = function () { [native code] }n/a
writeFindText = function () { [native code] }n/a
writeHTML = function () { [native code] }n/a
writeHtml = function () {
if (!process.noDeprecations) {
deprecate.warn('clipboard.writeHtml', 'clipboard.writeHTML')
}
return clipboard.writeHTML()
}n/a
writeImage = function () { [native code] }n/a
writeRTF = function () { [native code] }n/a
writeRtf = function () {
if (!process.noDeprecations) {
deprecate.warn('clipboard.writeRtf', 'clipboard.writeRTF')
}
return clipboard.writeRTF()
}n/a
writeText = function () { [native code] }n/a
getCategories = function () { [native code] }n/a
getTraceBufferUsage = function () { [native code] }n/a
startRecording = function () { [native code] }n/a
stopRecording = function () { [native code] }n/a
showCertificateTrustDialog = function (...args) {
let [window, options, callback] = parseArgs(...args)
if (options == null || typeof options !== 'object') {
throw new TypeError('options must be an object')
}
let {certificate, message} = options
if (certificate == null || typeof certificate !== 'object') {
throw new TypeError('certificate must be an object')
}
if (message == null) {
message = ''
} else if (typeof message !== 'string') {
throw new TypeError('message must be a string')
}
return binding.showCertificateTrustDialog(window, certificate, message, callback)
}n/a
showErrorBox = function (...args) {
return binding.showErrorBox(...args)
}n/a
showMessageBox = function (...args) {
checkAppInitialized()
let [window, options, callback] = parseArgs(...args)
if (options == null) {
options = {
type: 'none'
}
}
let {
buttons, cancelId, checkboxLabel, checkboxChecked, defaultId, detail,
icon, message, title, type
} = options
if (type == null) {
type = 'none'
}
const messageBoxType = messageBoxTypes.indexOf(type)
if (messageBoxType === -1) {
throw new TypeError('Invalid message box type')
}
if (buttons == null) {
buttons = []
} else if (!Array.isArray(buttons)) {
throw new TypeError('Buttons must be an array')
}
if (options.normalizeAccessKeys) {
buttons = buttons.map(normalizeAccessKey)
}
if (title == null) {
title = ''
} else if (typeof title !== 'string') {
throw new TypeError('Title must be a string')
}
if (message == null) {
message = ''
} else if (typeof message !== 'string') {
throw new TypeError('Message must be a string')
}
if (detail == null) {
detail = ''
} else if (typeof detail !== 'string') {
throw new TypeError('Detail must be a string')
}
checkboxChecked = !!checkboxChecked
if (checkboxLabel == null) {
checkboxLabel = ''
} else if (typeof checkboxLabel !== 'string') {
throw new TypeError('checkboxLabel must be a string')
}
if (icon == null) {
icon = null
}
if (defaultId == null) {
defaultId = -1
}
// Choose a default button to get selected when dialog is cancelled.
if (cancelId == null) {
cancelId = 0
for (let i = 0; i < buttons.length; i++) {
const text = buttons[i].toLowerCase()
if (text === 'cancel' || text === 'no') {
cancelId = i
break
}
}
}
const flags = options.noLink ? messageBoxOptions.noLink : 0
return binding.showMessageBox(messageBoxType, buttons, defaultId, cancelId,
flags, title, message, detail, checkboxLabel,
checkboxChecked, icon, window, callback)
}n/a
showOpenDialog = function (...args) {
checkAppInitialized()
let [window, options, callback] = parseArgs(...args)
if (options == null) {
options = {
title: 'Open',
properties: ['openFile']
}
}
let {buttonLabel, defaultPath, filters, properties, title, message, securityScopedBookmarks = false} = options
if (properties == null) {
properties = ['openFile']
} else if (!Array.isArray(properties)) {
throw new TypeError('Properties must be an array')
}
let dialogProperties = 0
for (const prop in fileDialogProperties) {
if (properties.includes(prop)) {
dialogProperties |= fileDialogProperties[prop]
}
}
if (title == null) {
title = ''
} else if (typeof title !== 'string') {
throw new TypeError('Title must be a string')
}
if (buttonLabel == null) {
buttonLabel = ''
} else if (typeof buttonLabel !== 'string') {
throw new TypeError('Button label must be a string')
}
if (defaultPath == null) {
defaultPath = ''
} else if (typeof defaultPath !== 'string') {
throw new TypeError('Default path must be a string')
}
if (filters == null) {
filters = []
}
if (message == null) {
message = ''
} else if (typeof message !== 'string') {
throw new TypeError('Message must be a string')
}
const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
return success ? callback(result, bookmarkData) : callback()
} : null
const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, window}
settings.properties = dialogProperties
return binding.showOpenDialog(settings, wrappedCallback)
}n/a
showSaveDialog = function (...args) {
checkAppInitialized()
let [window, options, callback] = parseArgs(...args)
if (options == null) {
options = {
title: 'Save'
}
}
let {buttonLabel, defaultPath, filters, title, message, securityScopedBookmarks = false, nameFieldLabel, showsTagField} = options
if (title == null) {
title = ''
} else if (typeof title !== 'string') {
throw new TypeError('Title must be a string')
}
if (buttonLabel == null) {
buttonLabel = ''
} else if (typeof buttonLabel !== 'string') {
throw new TypeError('Button label must be a string')
}
if (defaultPath == null) {
defaultPath = ''
} else if (typeof defaultPath !== 'string') {
throw new TypeError('Default path must be a string')
}
if (filters == null) {
filters = []
}
if (message == null) {
message = ''
} else if (typeof message !== 'string') {
throw new TypeError('Message must be a string')
}
if (nameFieldLabel == null) {
nameFieldLabel = ''
} else if (typeof nameFieldLabel !== 'string') {
throw new TypeError('Name field label must be a string')
}
if (showsTagField == null) {
showsTagField = true
}
const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
return success ? callback(result, bookmarkData) : callback()
} : null
const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, nameFieldLabel, showsTagField, window
}
return binding.showSaveDialog(settings, wrappedCallback)
}n/a
() => false
n/a
() => ''
n/a
(productID, quantity, callback) => {
throw new Error('The inAppPurchase module can only be used on macOS')
}n/a
removeAllListeners = function (...args) {
if (args.length === 0) {
throw new Error('Removing all listeners from ipcMain will make Electron internals stop working. Please specify a event name
')
}
removeAllListeners(...args)
}n/a
CHROME_I18N_MANIFEST = function (event, extensionId) {
event.returnValue = manifestMap[extensionId]
}n/a
CHROME_RUNTIME_CONNECT = function (event, extensionId, connectInfo) {
const page = backgroundPages[extensionId]
if (!page) {
console.error(`Connect to unknown extension ${extensionId}`)
return
}
const portId = ++nextId
event.returnValue = {tabId: page.webContents.id, portId: portId}
event.sender.once('render-view-deleted', () => {
if (page.webContents.isDestroyed()) return
page.webContents.sendToAll(`CHROME_PORT_DISCONNECT_${portId}`)
})
page.webContents.sendToAll(`CHROME_RUNTIME_ONCONNECT_${extensionId}`, event.sender.id, portId, connectInfo)
}n/a
CHROME_RUNTIME_SENDMESSAGE = function (event, extensionId, message, originResultID) {
const page = backgroundPages[extensionId]
if (!page) {
console.error(`Connect to unknown extension ${extensionId}`)
return
}
page.webContents.sendToAll(`CHROME_RUNTIME_ONMESSAGE_${extensionId}`, event.sender.id, message, resultID)
ipcMain.once(`CHROME_RUNTIME_ONMESSAGE_RESULT_${resultID}`, (event, result) => {
event.sender.send(`CHROME_RUNTIME_SENDMESSAGE_RESULT_${originResultID}`, result)
})
resultID++
}n/a
CHROME_TABS_EXECUTESCRIPT = function (event, requestId, tabId, extensionId, details) {
const contents = webContents.fromId(tabId)
if (!contents) {
console.error(`Sending message to unknown tab ${tabId}`)
return
}
let code, url
if (details.file) {
const manifest = manifestMap[extensionId]
code = String(fs.readFileSync(path.join(manifest.srcDirectory, details.file)))
url = `chrome-extension://${extensionId}${details.file}`
} else {
code = details.code
url = `chrome-extension://${extensionId}/${String(Math.random()).substr(2, 8)}.js`
}
contents.send('CHROME_TABS_EXECUTESCRIPT', event.sender.id, requestId, extensionId, url, code)
}n/a
CHROME_TABS_SEND_MESSAGE = function (event, tabId, extensionId, isBackgroundPage, message, originResultID) {
const contents = webContents.fromId(tabId)
if (!contents) {
console.error(`Sending message to unknown tab ${tabId}`)
return
}
const senderTabId = isBackgroundPage ? null : event.sender.id
contents.sendToAll(`CHROME_RUNTIME_ONMESSAGE_${extensionId}`, senderTabId, message, resultID)
ipcMain.once(`CHROME_RUNTIME_ONMESSAGE_RESULT_${resultID}`, (event, result) => {
event.sender.send(`CHROME_TABS_SEND_MESSAGE_RESULT_${originResultID}`, result)
})
resultID++
}n/a
ELECTRON_BROWSER_ASYNC_CALL_TO_GUEST_VIEW = function (event, requestId, guestInstanceId, method, ...args) {
try {
let guestViewManager = require('./guest-view-manager')
let guest = guestViewManager.getGuest(guestInstanceId)
if (requestId) {
const responseCallback = function (result) {
event.sender.send(`ELECTRON_RENDERER_ASYNC_CALL_TO_GUEST_VIEW_RESPONSE_${requestId}`, result)
}
args.push(responseCallback)
}
guest[method].apply(guest, args)
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_CONSTRUCTOR = function (event, contextId, id, args) {
try {
args = unwrapArgs(event.sender, contextId, args)
let constructor = objectsRegistry.get(id)
if (constructor == null) {
throwRPCError(`Cannot call constructor on missing remote object ${id}`)
}
// Call new with array of arguments.
// http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible
let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)))()
event.returnValue = valueToMeta(event.sender, contextId, obj)
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
(event, contextId) => {
objectsRegistry.clear(event.sender, contextId)
event.returnValue = null
}n/a
ELECTRON_BROWSER_CURRENT_WEB_CONTENTS = function (event, contextId) {
event.returnValue = valueToMeta(event.sender, contextId, event.sender)
}n/a
ELECTRON_BROWSER_CURRENT_WINDOW = function (event, contextId) {
try {
event.returnValue = valueToMeta(event.sender, contextId, event.sender.getOwnerBrowserWindow())
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_DEREFERENCE = function (event, contextId, id) {
objectsRegistry.remove(event.sender, contextId, id)
}n/a
(event, captureWindow, captureScreen, thumbnailSize, id) => {
const request = {
id,
options: {
captureWindow,
captureScreen,
thumbnailSize
},
webContents: event.sender
}
requestsQueue.push(request)
if (requestsQueue.length === 1) {
desktopCapturer.startHandling(captureWindow, captureScreen, thumbnailSize)
}
// If the WebContents is destroyed before receiving result, just remove the
// reference from requestsQueue to make the module not send the result to it.
event.sender.once('destroyed', () => {
request.webContents = null
})
}n/a
ELECTRON_BROWSER_FUNCTION_CALL = function (event, contextId, id, args) {
try {
args = unwrapArgs(event.sender, contextId, args)
let func = objectsRegistry.get(id)
if (func == null) {
throwRPCError(`Cannot call function on missing remote object ${id}`)
}
callFunction(event, contextId, func, global, args)
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_GET_BUILTIN = function (event, contextId, module) {
try {
event.returnValue = valueToMeta(event.sender, contextId, electron[module])
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_GLOBAL = function (event, contextId, name) {
try {
event.returnValue = valueToMeta(event.sender, contextId, global[name])
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_GUEST_WEB_CONTENTS = function (event, contextId, guestInstanceId) {
try {
let guestViewManager = require('./guest-view-manager')
event.returnValue = valueToMeta(event.sender, contextId, guestViewManager.getGuest(guestInstanceId))
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_MEMBER_CALL = function (event, contextId, id, method, args) {
try {
args = unwrapArgs(event.sender, contextId, args)
let obj = objectsRegistry.get(id)
if (obj == null) {
throwRPCError(`Cannot call function '${method}' on missing remote object ${id}`)
}
callFunction(event, contextId, obj[method], obj, args)
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_MEMBER_CONSTRUCTOR = function (event, contextId, id, method, args) {
try {
args = unwrapArgs(event.sender, contextId, args)
let object = objectsRegistry.get(id)
if (object == null) {
throwRPCError(`Cannot call constructor '${method}' on missing remote object ${id}`)
}
// Call new with array of arguments.
let constructor = object[method]
let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)))()
event.returnValue = valueToMeta(event.sender, contextId, obj)
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_MEMBER_GET = function (event, contextId, id, name) {
try {
let obj = objectsRegistry.get(id)
if (obj == null) {
throwRPCError(`Cannot get property '${name}' on missing remote object ${id}`)
}
event.returnValue = valueToMeta(event.sender, contextId, obj[name])
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_MEMBER_SET = function (event, contextId, id, name, args) {
try {
args = unwrapArgs(event.sender, contextId, args)
let obj = objectsRegistry.get(id)
if (obj == null) {
throwRPCError(`Cannot set property '${name}' on missing remote object ${id}`)
}
obj[name] = args[0]
event.returnValue = null
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_REQUIRE = function (event, contextId, module) {
try {
event.returnValue = valueToMeta(event.sender, contextId, process.mainModule.require(module))
} catch (error) {
event.returnValue = exceptionToMeta(error)
}
}n/a
ELECTRON_BROWSER_SEND_TO = function (event, sendToAll, webContentsId, channel, ...args) {
let contents = webContents.fromId(webContentsId)
if (!contents) {
console.error(`Sending message to WebContents with unknown ID ${webContentsId}`)
return
}
if (sendToAll) {
contents.sendToAll(channel, ...args)
} else {
contents.send(channel, ...args)
}
}n/a
ELECTRON_BROWSER_WINDOW_ALERT = function (event, message, title) {
if (message == null) message = ''
if (title == null) title = ''
const dialogProperties = {
message: `${message}`,
title: `${title}`,
buttons: ['OK']
}
event.returnValue = event.sender.isOffscreen()
? electron.dialog.showMessageBox(dialogProperties)
: electron.dialog.showMessageBox(
event.sender.getOwnerBrowserWindow(), dialogProperties)
}n/a
ELECTRON_BROWSER_WINDOW_CLOSE = function (event) {
const window = event.sender.getOwnerBrowserWindow()
if (window) {
window.close()
}
event.returnValue = null
}n/a
ELECTRON_BROWSER_WINDOW_CONFIRM = function (event, message, title) {
if (message == null) message = ''
if (title == null) title = ''
const dialogProperties = {
message: `${message}`,
title: `${title}`,
buttons: ['OK', 'Cancel'],
cancelId: 1
}
event.returnValue = !(event.sender.isOffscreen()
? electron.dialog.showMessageBox(dialogProperties)
: electron.dialog.showMessageBox(
event.sender.getOwnerBrowserWindow(), dialogProperties))
}n/a
ELECTRON_GUEST_VIEW_MANAGER_ATTACH_GUEST = function (event, elementInstanceId, guestInstanceId, params) {
attachGuest(event, elementInstanceId, guestInstanceId, params)
}n/a
ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST = function (event, params, requestId) {
event.sender.send(`ELECTRON_RESPONSE_${requestId}`, createGuest(event.sender, params))
}n/a
ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST_SYNC = function (event, params) {
event.returnValue = createGuest(event.sender, params)
}n/a
ELECTRON_GUEST_VIEW_MANAGER_DESTROY_GUEST = function (event, guestInstanceId) {
destroyGuest(event.sender, guestInstanceId)
}n/a
ELECTRON_GUEST_VIEW_MANAGER_SET_SIZE = function (event, guestInstanceId, params) {
const guest = getGuest(guestInstanceId)
if (guest != null) guest.setSize(params)
}n/a
ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN = function (event, url, frameName, disposition, options, additionalFeatures, postData) {
options = mergeBrowserWindowOptions(event.sender, options)
event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures)
const {newGuest} = event
if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
if (newGuest != null) {
if (options.webContents === newGuest.webContents) {
// the webContents is not changed, so set defaultPrevented to false to
// stop the callers of this event from destroying the webContents.
event.defaultPrevented = false
}
event.returnValue = setupGuest(event.sender, frameName, newGuest, options)
} else {
event.returnValue = null
}
} else {
event.returnValue = createGuest(event.sender, url, frameName, options, postData)
}
}n/a
ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD = function (event, guestId, method, ...args) {
const guestContents = webContents.fromId(guestId)
if (guestContents == null) return
if (canAccessWindow(event.sender, guestContents)) {
guestContents[method](...args)
} else {
console.error(`Blocked ${event.sender.getURL()} from calling ${method} on its opener.`)
}
}n/a
ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD_SYNC = function (event, guestId, method, ...args) {
const guestContents = webContents.fromId(guestId)
if (guestContents == null) {
event.returnValue = null
return
}
if (canAccessWindow(event.sender, guestContents)) {
event.returnValue = guestContents[method](...args)
} else {
console.error(`Blocked ${event.sender.getURL()} from calling ${method} on its opener.`)
event.returnValue = null
}
}n/a
ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSE = function (event, guestId) {
const guestContents = webContents.fromId(guestId)
if (guestContents == null) return
if (!canAccessWindow(event.sender, guestContents)) {
console.error(`Blocked ${event.sender.getURL()} from closing its opener.`)
return
}
const guestWindow = getGuestWindow(guestContents)
if (guestWindow != null) guestWindow.destroy()
}n/a
ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD = function (event, guestId, method, ...args) {
const guestContents = webContents.fromId(guestId)
if (guestContents == null) {
event.returnValue = null
return
}
if (!canAccessWindow(event.sender, guestContents)) {
console.error(`Blocked ${event.sender.getURL()} from calling ${method} on its opener.`)
event.returnValue = null
return
}
const guestWindow = getGuestWindow(guestContents)
if (guestWindow != null) {
event.returnValue = guestWindow[method](...args)
} else {
event.returnValue = null
}
}n/a
(event, url, frameName, features) => {
if (url == null || url === '') url = 'about:blank'
if (frameName == null) frameName = ''
if (features == null) features = ''
const options = {}
const ints = ['x', 'y', 'width', 'height', 'minWidth', 'maxWidth', 'minHeight', 'maxHeight', 'zoomFactor']
const webPreferences = ['zoomFactor', 'nodeIntegration', 'preload', 'javascript', 'contextIsolation', 'webviewTag']
const disposition = 'new-window'
// Used to store additional features
const additionalFeatures = []
// Parse the features
parseFeaturesString(features, function (key, value) {
if (value === undefined) {
additionalFeatures.push(key)
} else {
// Don't allow webPreferences to be set since it must be an object
// that cannot be directly overridden
if (key === 'webPreferences') return
if (webPreferences.includes(key)) {
if (options.webPreferences == null) {
options.webPreferences = {}
}
options.webPreferences[key] = value
} else {
options[key] = value
}
}
})
if (options.left) {
if (options.x == null) {
options.x = options.left
}
}
if (options.top) {
if (options.y == null) {
options.y = options.top
}
}
if (options.title == null) {
options.title = frameName
}
if (options.width == null) {
options.width = 800
}
if (options.height == null) {
options.height = 600
}
for (const name of ints) {
if (options[name] != null) {
options[name] = parseInt(options[name], 10)
}
}
ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', event,
url, frameName, disposition, options, additionalFeatures)
}n/a
ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE = function (event, guestId, message, targetOrigin, sourceOrigin) {
if (targetOrigin == null) {
targetOrigin = '*'
}
const guestContents = webContents.fromId(guestId)
if (guestContents == null) return
// The W3C does not seem to have word on how postMessage should work when the
// origins do not match, so we do not do |canAccessWindow| check here since
// postMessage across origins is useful and not harmful.
if (targetOrigin === '*' || isSameOrigin(guestContents.getURL(), targetOrigin)) {
const sourceId = event.sender.id
guestContents.send('ELECTRON_GUEST_WINDOW_POSTMESSAGE', sourceId, message, sourceOrigin)
}
}n/a
ELECTRON_NAVIGATION_CONTROLLER = function (event, method, ...args) {
event.sender[method](...args)
}n/a
ELECTRON_SYNC_NAVIGATION_CONTROLLER = function (event, method, ...args) {
event.returnValue = event.sender[method](...args)
}n/a
() => {}...
../../v8/src/compiler/wasm-compiler.cc:4141 ../../v8/src/compiler/wasm-compiler.cc:4163 wasm-compilation phase 1 ok: %u bytes, %
0.3f ms decode, %zu nodes, %0.3f ms pipeline
Compiling wasm function #%d failed Compiling wasm function #%d:%.*s failed WASM_function wasm-code-generation ok: %u bytes, %0.
3f ms code generation
%s#%d:%.*s:%.*s (wasm) ../../v8/src/wasm/wasm-module.h BoundsCheck(ref.offset(), ref.length()) ../../v8/src/handles.h (location_
) != nullptr vector::_M_emplace_back_aux %s: %s @+%u V8.Builtin_GlobalDecodeURI V8.Builtin_GlobalDecodeURIComponent V8.Builtin_GlobalEncodeURI
V8.Builtin_GlobalEncodeURIComponent V8.Builtin_GlobalEscape V8.Builtin_GlobalUnescape V8.Builtin_GlobalEval ../../v8/src/compiler
/code-assembler.cc descriptor.GetParameterCount() + 2 == (sizeof(ArraySizeHelper(nodes))) descriptor.GetParameterCount() + 1 == (
sizeof(ArraySizeHelper(nodes))) { , "