streams-gc.html 914 B

12345678910111213141516171819202122
  1. <!DOCTYPE html>
  2. <script src="/resources/testharness.js"></script>
  3. <script src="/resources/testharnessreport.js"></script>
  4. <script src="/js-test-resources/gc.js"></script>
  5. <script src="/js-test-resources/js-test.js"></script>
  6. <script>
  7. 'use strict';
  8. // This is a Blink-specific test because it involves garbage collection.
  9. for (const constructor of [TextEncoderStream, TextDecoderStream]) {
  10. promise_test(async () => {
  11. const transform = new constructor();
  12. if (typeof GCController !== 'undefined')
  13. await asyncGC();
  14. // This test will generally crash on the next line if it fails.
  15. assert_true(transform.readable instanceof ReadableStream,
  16. 'readable side must still be set');
  17. assert_true(transform.writable instanceof WritableStream,
  18. 'writable side must still be set');
  19. }, `${constructor.name} readable and writable properties must survive GC`);
  20. }
  21. </script>