mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: use IPC helpers in window-setup (#17948)
This commit is contained in:
committed by
Alexey Kuzmin
parent
c3ae476deb
commit
419ce494e9
@@ -618,9 +618,9 @@ describe('chromium feature', () => {
|
||||
w.close()
|
||||
})
|
||||
|
||||
it('does nothing when origin of current window does not match opener', (done) => {
|
||||
it('fails when origin of current window does not match opener', (done) => {
|
||||
listener = (event) => {
|
||||
expect(event.data).to.equal('')
|
||||
expect(event.data).to.equal(null)
|
||||
done()
|
||||
}
|
||||
window.addEventListener('message', listener)
|
||||
@@ -666,10 +666,10 @@ describe('chromium feature', () => {
|
||||
if (webview != null) webview.remove()
|
||||
})
|
||||
|
||||
it('does nothing when origin of webview src URL does not match opener', (done) => {
|
||||
it('fails when origin of webview src URL does not match opener', (done) => {
|
||||
webview = new WebView()
|
||||
webview.addEventListener('console-message', (e) => {
|
||||
expect(e.message).to.equal('')
|
||||
expect(e.message).to.equal('null')
|
||||
done()
|
||||
})
|
||||
webview.setAttribute('allowpopups', 'on')
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.opener.postMessage(window.opener.location.href, '*')
|
||||
try {
|
||||
window.opener.postMessage(window.opener.location.href, '*')
|
||||
} catch {
|
||||
window.opener.postMessage(null, '*')
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user