mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Merge branch 'master' into native-window-open
This commit is contained in:
@@ -76,13 +76,9 @@ BrowserWindow.prototype._init = function () {
|
||||
|
||||
// Change window title to page title.
|
||||
this.webContents.on('page-title-updated', (event, title) => {
|
||||
// The page-title-updated event is not emitted immediately (see #3645), so
|
||||
// when the callback is called the BrowserWindow might have been closed.
|
||||
if (this.isDestroyed()) return
|
||||
|
||||
// Route the event to BrowserWindow.
|
||||
this.emit('page-title-updated', event, title)
|
||||
if (!event.defaultPrevented) this.setTitle(title)
|
||||
if (!this.isDestroyed() && !event.defaultPrevented) this.setTitle(title)
|
||||
})
|
||||
|
||||
// Sometimes the webContents doesn't get focus when window is shown, so we
|
||||
|
||||
@@ -264,16 +264,17 @@ TouchBar.TouchBarSegmentedControl = class TouchBarSegmentedControl extends Touch
|
||||
constructor (config) {
|
||||
super()
|
||||
if (config == null) config = {}
|
||||
const {segmentStyle, segments, selectedIndex, change} = config
|
||||
const {segmentStyle, segments, selectedIndex, change, mode} = config
|
||||
this.type = 'segmented_control'
|
||||
this._addLiveProperty('segmentStyle', segmentStyle)
|
||||
this._addLiveProperty('segments', segments || [])
|
||||
this._addLiveProperty('selectedIndex', selectedIndex)
|
||||
this._addLiveProperty('mode', mode)
|
||||
|
||||
if (typeof change === 'function') {
|
||||
this.onInteraction = (details) => {
|
||||
this._selectedIndex = details.selectedIndex
|
||||
change(details.selectedIndex)
|
||||
change(details.selectedIndex, details.isSelected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,13 +268,6 @@ WebContents.prototype._init = function () {
|
||||
this.reload()
|
||||
})
|
||||
|
||||
// Delays the page-title-updated event to next tick.
|
||||
this.on('-page-title-updated', function (...args) {
|
||||
setImmediate(() => {
|
||||
this.emit('page-title-updated', ...args)
|
||||
})
|
||||
})
|
||||
|
||||
app.emit('web-contents-created', {}, this)
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', function (event,
|
||||
// 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 (guestContents.getURL().indexOf(targetOrigin) === 0 || targetOrigin === '*') {
|
||||
if (targetOrigin === '*' || isSameOrigin(guestContents.getURL(), targetOrigin)) {
|
||||
const sourceId = event.sender.id
|
||||
guestContents.send('ELECTRON_GUEST_WINDOW_POSTMESSAGE', sourceId, message, sourceOrigin)
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@ const preloadSrc = fs.readFileSync(preloadPath).toString()
|
||||
// access to things like `process.atomBinding`).
|
||||
const preloadProcess = new events.EventEmitter()
|
||||
preloadProcess.crash = () => binding.crash()
|
||||
preloadProcess.hang = () => binding.hang()
|
||||
preloadProcess.getProcessMemoryInfo = () => binding.getProcessMemoryInfo()
|
||||
preloadProcess.getSystemMemoryInfo = () => binding.getSystemMemoryInfo()
|
||||
process.platform = preloadProcess.platform = electron.remote.process.platform
|
||||
process.execPath = preloadProcess.execPath = electron.remote.process.execPath
|
||||
process.on('exit', () => preloadProcess.emit('exit'))
|
||||
|
||||
Reference in New Issue
Block a user