edd5c4b9bb
RenderProcessHost switch can happen between ipc calls when speculative process are invvolved, which will lead to deletion of entries on current context. Use OS process handles to uniquely associate a destruction handler for a render process.
32 lines
905 B
HTML
32 lines
905 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title></title>
|
|
<script>
|
|
const {ipcRenderer, remote} = require('electron')
|
|
|
|
const contents = remote.getCurrentWebContents()
|
|
|
|
// This should not trigger a dereference and a remote getURL call should not fail
|
|
contents.emit('render-view-deleted', {}, 'not-a-process-id')
|
|
try {
|
|
contents.getURL()
|
|
} catch (error) {
|
|
ipcRenderer.send('error-message', 'Unexpected error on getURL call')
|
|
}
|
|
|
|
// This should trigger a dereference and a remote getURL call should fail
|
|
contents.emit('render-view-deleted', {}, '', contents.getOSProcessId())
|
|
try {
|
|
contents.getURL()
|
|
ipcRenderer.send('error-message', 'No error thrown')
|
|
} catch (error) {
|
|
ipcRenderer.send('error-message', error.message)
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
</body>
|
|
</html>
|