dom/future/tests/test_bug883683.html
author Andrea Marchesini <amarchesini@mozilla.com>
Wed, 26 Jun 2013 09:44:21 -0400
changeset 136540 db69e91e26243e610d8cd17a0ac2b940d198dbfe
permissions -rw-r--r--
Bug 883683 - Leak with DOM promises. r=bz

<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
  <title>Future - bug 883683</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<pre id="test">
<script type="application/javascript"><!--

function runTest() {
  [{}, {}, {}, {}, {}].reduce(Future.reject);
  ok(true, "No leaks with reject?");

  [{}, {}, {}, {}, {}].reduce(Future.resolve);
  ok(true, "No leaks with resolve?");

  [{}, {}, {}, {}, {}].reduce(function(a, b, c, d) { return new Future(function(r) { throw a; }); });
  ok(true, "No leaks with exception?");

  [{}, {}, {}, {}, {}].reduce(function(a, b, c, d) { return new Future(function(r) { }); });
  ok(true, "No leaks with empty future?");

  SimpleTest.finish();
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.future.enabled", true]]}, runTest);
// -->
</script>
</pre>
</body>
</html>