crash-restart.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <html>
  2. <body>
  3. <script type="text/javascript" charset="utf-8">
  4. const {port} = require('url').parse(window.location.href, true).query
  5. const {crashReporter, ipcRenderer} = require('electron')
  6. crashReporter.start({
  7. productName: 'Zombies',
  8. companyName: 'Umbrella Corporation',
  9. submitURL: 'http://127.0.0.1:' + port,
  10. uploadToServer: true,
  11. ignoreSystemCrashHandler: true,
  12. extra: {
  13. extra1: 'extra1',
  14. extra2: 'initial',
  15. extra3: 'extra3'
  16. }
  17. })
  18. if (process.platform === 'win32') {
  19. ipcRenderer.sendSync('crash-service-pid', crashReporter._crashServiceProcess.pid)
  20. }
  21. setImmediate(() => {
  22. if (process.platform === 'darwin') {
  23. crashReporter.addExtraParameter('extra2', 'extra2')
  24. crashReporter.removeExtraParameter('extra3')
  25. } else {
  26. crashReporter.start({
  27. productName: 'Zombies',
  28. companyName: 'Umbrella Corporation',
  29. submitURL: 'http://127.0.0.1:' + port,
  30. uploadToServer: true,
  31. ignoreSystemCrashHandler: true,
  32. extra: {
  33. extra1: 'extra1',
  34. extra2: 'extra2'
  35. }
  36. })
  37. }
  38. setImmediate(() => {
  39. process.crash()
  40. })
  41. })
  42. </script>
  43. </body>
  44. </html>