feat: add <webview>.getWebContentsId() (#17407)
This commit is contained in:
parent
9e26dfaa06
commit
546466b209
6 changed files with 32 additions and 24 deletions
|
@ -1124,7 +1124,7 @@ describe('<webview> tag', function () {
|
|||
assert.ok(webview.partition)
|
||||
|
||||
const listener = function (webContents, permission, callback) {
|
||||
if (webContents.id === webview.getWebContents().id) {
|
||||
if (webContents.id === webview.getWebContentsId()) {
|
||||
// requestMIDIAccess with sysex requests both midi and midiSysex so
|
||||
// grant the first midi one and then reject the midiSysex one
|
||||
if (requestedPermission === 'midiSysex' && permission === 'midi') {
|
||||
|
@ -1210,7 +1210,7 @@ describe('<webview> tag', function () {
|
|||
webview.partition = 'permissionTest'
|
||||
webview.setAttribute('nodeintegration', 'on')
|
||||
session.fromPartition(webview.partition).setPermissionRequestHandler((webContents, permission, callback) => {
|
||||
if (webContents.id === webview.getWebContents().id) {
|
||||
if (webContents.id === webview.getWebContentsId()) {
|
||||
assert.strictEqual(permission, 'notifications')
|
||||
setTimeout(() => { callback(true) }, 10)
|
||||
}
|
||||
|
@ -1219,6 +1219,15 @@ describe('<webview> tag', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('<webview>.getWebContentsId', () => {
|
||||
it('can return the WebContents ID', async () => {
|
||||
const src = 'about:blank'
|
||||
await loadWebView(webview, { src })
|
||||
|
||||
expect(webview.getWebContentsId()).to.be.equal(webview.getWebContents().id)
|
||||
})
|
||||
})
|
||||
|
||||
describe('<webview>.getWebContents', () => {
|
||||
it('can return the webcontents associated', async () => {
|
||||
const src = 'about:blank'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue