test_blob_worker_crash.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!--
  2. Any copyright is dedicated to the Public Domain.
  3. http://creativecommons.org/publicdomain/zero/1.0/
  4. -->
  5. <html>
  6. <head>
  7. <title>Indexed Database Blob Worker Crash Test</title>
  8. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  10. <script type="text/javascript;version=1.7">
  11. /*
  12. * This tests ensures that if the last live reference to a Blob is on the
  13. * worker and the database has already been shutdown, that there is no crash
  14. * when the owning page gets cleaned up which causes the termination of the
  15. * worker which in turn garbage collects during its shutdown.
  16. *
  17. * We do the IndexedDB stuff in the iframe so we can kill it as part of our
  18. * test. Doing it out here is no good.
  19. */
  20. function testSteps()
  21. {
  22. info("Open iframe, wait for it to do its IndexedDB stuff.");
  23. let iframe = document.getElementById("iframe1");
  24. window.addEventListener("message", grabEventAndContinueHandler, false);
  25. // Put it in a different origin to be safe
  26. iframe.src = //"http://example.org" +
  27. window.location.pathname.replace(
  28. "test_blob_worker_crash.html",
  29. "blob_worker_crash_iframe.html");
  30. let event = yield unexpectedSuccessHandler;
  31. is(event.data.result, "ready", "worker initialized correctly");
  32. info("Trigger a GC to clean-up the iframe's main-thread IndexedDB");
  33. scheduleGC();
  34. yield undefined;
  35. info("Kill the iframe, forget about it, trigger a GC.");
  36. iframe.parentNode.removeChild(iframe);
  37. iframe = null;
  38. scheduleGC();
  39. yield undefined;
  40. info("If we are still alive, then we win!");
  41. ok('Did not crash / trigger an assert!');
  42. finishTest();
  43. yield undefined;
  44. }
  45. </script>
  46. <script type="text/javascript;version=1.7" src="helpers.js"></script>
  47. </head>
  48. <body onload="runTest();"></body>
  49. <iframe id="iframe1"></iframe>
  50. </html>