зеркало из https://github.com/electron/electron.git
Add failing spec for notification permission crash
This commit is contained in:
Родитель
92f8c105d9
Коммит
dda3fcef91
|
@ -0,0 +1,10 @@
|
|||
<script>
|
||||
var n1 = new Notification('Electron Notification.requestPermission test 1')
|
||||
var n2 = new Notification('Electron Notification.requestPermission test 2')
|
||||
Notification.requestPermission().then((result) => {
|
||||
n1.close()
|
||||
n2.close()
|
||||
|
||||
require('electron').ipcRenderer.sendToHost('message', result)
|
||||
})
|
||||
</script>
|
|
@ -946,6 +946,24 @@ describe('<webview> tag', function () {
|
|||
setUpRequestHandler(webview, 'openExternal', done)
|
||||
document.body.appendChild(webview)
|
||||
})
|
||||
|
||||
it('emits when using Notification.requestPermission', function (done) {
|
||||
webview.addEventListener('ipc-message', function (e) {
|
||||
assert.equal(e.channel, 'message')
|
||||
assert.deepEqual(e.args, ['granted'])
|
||||
done()
|
||||
})
|
||||
webview.src = 'file://' + fixtures + '/pages/permissions/notification.html'
|
||||
webview.partition = 'permissionTest'
|
||||
webview.setAttribute('nodeintegration', 'on')
|
||||
session.fromPartition(webview.partition).setPermissionRequestHandler(function (webContents, permission, callback) {
|
||||
if (webContents.getId() === webview.getId()) {
|
||||
assert.equal(permission, 'notifications')
|
||||
callback(true)
|
||||
}
|
||||
})
|
||||
document.body.appendChild(webview)
|
||||
})
|
||||
})
|
||||
|
||||
describe('<webview>.getWebContents', function () {
|
||||
|
|
Загрузка…
Ссылка в новой задаче