render-view-deleted.html 899 B

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <script>
  7. const {ipcRenderer, remote} = require('electron')
  8. const contents = remote.getCurrentWebContents()
  9. // This should not trigger a dereference and a remote getURL call should not fail
  10. contents.emit('render-view-deleted', {}, 'not-a-process-id')
  11. try {
  12. contents.getURL()
  13. } catch (error) {
  14. ipcRenderer.send('error-message', 'Unexpected error on getURL call')
  15. }
  16. // This should trigger a dereference and a remote getURL call should fail
  17. contents.emit('render-view-deleted', {}, contents.getProcessId())
  18. try {
  19. contents.getURL()
  20. ipcRenderer.send('error-message', 'No error thrown')
  21. } catch (error) {
  22. ipcRenderer.send('error-message', error.message)
  23. }
  24. </script>
  25. </head>
  26. <body>
  27. </body>
  28. </html>