test_weakmap_keys_preserved.xul 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
  3. <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
  4. <!--
  5. https://bugzilla.mozilla.org/show_bug.cgi?id=673468
  6. -->
  7. <window title="Mozilla Bug "
  8. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  9. <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  10. <!-- test results are displayed in the html:body -->
  11. <body xmlns="http://www.w3.org/1999/xhtml">
  12. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id="
  13. target="_blank">Mozilla Bug 673468</a>
  14. </body>
  15. <!-- test code goes here -->
  16. <script type="application/javascript">
  17. <![CDATA[
  18. /** Test for Bug 673468 **/
  19. let Cc = Components.classes;
  20. let Cu = Components.utils;
  21. let Ci = Components.interfaces;
  22. let system = Cc["@mozilla.org/systemprincipal;1"].createInstance();
  23. let sandbox = Cu.Sandbox(system);
  24. let map = new sandbox.WeakMap();
  25. let obj = {};
  26. map.set(obj, {});
  27. Cu.forceGC();
  28. ok(map.has(obj), "Weakmap still contains our wrapper!");
  29. ]]>
  30. </script>
  31. </window>