js/src/tests/js1_7/iterable/regress-341815.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_7/iterable/regress-341815.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,94 @@
     1.4 +// |reftest| skip-if(!xulRuntime.shell) -- bug xxx - fails to dismiss alert
     1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +//-----------------------------------------------------------------------------
    1.11 +var BUGNUMBER = 341815;
    1.12 +var summary = 'Close hook crash';
    1.13 +var actual = 'No Crash';
    1.14 +var expect = 'No Crash';
    1.15 +
    1.16 +var ialert = 0;
    1.17 +//-----------------------------------------------------------------------------
    1.18 +//test();
    1.19 +//-----------------------------------------------------------------------------
    1.20 +
    1.21 +function test()
    1.22 +{
    1.23 +  enterFunc ('test');
    1.24 +  printBugNumber(BUGNUMBER);
    1.25 +  printStatus (summary);
    1.26 +
    1.27 +  var globalToPokeGC = {};
    1.28 +
    1.29 +  function make_iterator()
    1.30 +  {
    1.31 +    function generator() {
    1.32 +      try {
    1.33 +        yield 0;
    1.34 +      } finally {
    1.35 +        make_iterator();
    1.36 +      }
    1.37 +    }
    1.38 +    generator().next();
    1.39 +    globalToPokeGC = {};
    1.40 +    if (typeof alert != 'undefined')
    1.41 +    {
    1.42 +      alert(++ialert);
    1.43 +    }
    1.44 +  }
    1.45 +
    1.46 +  make_iterator();
    1.47 +
    1.48 +  for (var i = 0; i != 50000; ++i) {
    1.49 +    var x = {};
    1.50 +  }
    1.51 + 
    1.52 +  print('done');
    1.53 +
    1.54 +  setTimeout('checkTest()', 10000);
    1.55 +
    1.56 +  exitFunc ('test');
    1.57 +}
    1.58 +
    1.59 +function init()
    1.60 +{
    1.61 +  // give the dialog closer time to register
    1.62 +  setTimeout('test()', 5000);
    1.63 +}
    1.64 +
    1.65 +var lastialert = 0;
    1.66 +
    1.67 +function checkTest()
    1.68 +{
    1.69 +  // this function is used to check if there
    1.70 +  // additional alerts are still being fired 
    1.71 +  // in order to prevent the test from completing
    1.72 +  // until all alerts have finished.
    1.73 +
    1.74 +  if (ialert != lastialert)
    1.75 +  {
    1.76 +    lastialert = ialert;
    1.77 +    setTimeout('checkTest()', 10000);
    1.78 +    return;
    1.79 +  }
    1.80 +
    1.81 +  reportCompare(expect, actual, summary);
    1.82 +  gDelayTestDriverEnd = false;
    1.83 +  jsTestDriverEnd();
    1.84 +}
    1.85 +
    1.86 +if (typeof window != 'undefined')
    1.87 +{
    1.88 +  // delay test driver end
    1.89 +  gDelayTestDriverEnd = true;
    1.90 +
    1.91 +  window.addEventListener("load", init, false);
    1.92 +}
    1.93 +else
    1.94 +{
    1.95 +  reportCompare(expect, actual, summary);
    1.96 +}
    1.97 +

mercurial