QueuingStrategy-same-instance.html 1.0 KB

12345678910111213141516171819202122232425
  1. <script src="../include.js"></script>
  2. <script>
  3. test(() => {
  4. const realm = new ShadowRealm();
  5. const result = realm.evaluate(`
  6. (() => {
  7. let str = "";
  8. for (const QueuingStrategy of [CountQueuingStrategy, ByteLengthQueuingStrategy]) {
  9. const size1 = (new QueuingStrategy({ highWaterMark: 5 })).size;
  10. const size2 = (new QueuingStrategy({ highWaterMark: 10 })).size;
  11. str += \`\${QueuingStrategy.name} | size1 === size2 -> \${size1 === size2}\n\`;
  12. }
  13. return str;
  14. })()
  15. `);
  16. println(result);
  17. for (const QueuingStrategy of [CountQueuingStrategy, ByteLengthQueuingStrategy]) {
  18. const size1 = (new QueuingStrategy({ highWaterMark: 5 })).size;
  19. const size2 = (new QueuingStrategy({ highWaterMark: 10 })).size;
  20. println(`${QueuingStrategy.name} | size1 === size2 -> ${size1 === size2}`);
  21. }
  22. })
  23. </script>