Merge branch 'master' into native-window-open

This commit is contained in:
Ryohei Ikegami 2017-05-11 13:51:43 +09:00
commit 7ac93045b7
157 changed files with 2239 additions and 1058 deletions

View file

@ -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

View file

@ -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)
}
}
}

View file

@ -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)
}

View file

@ -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)
}