js/src/tests/ecma_3/FunExpr/regress-545980.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_3/FunExpr/regress-545980.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +/*
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/licenses/publicdomain/
     1.7 + */
     1.8 +
     1.9 +var BUGNUMBER = 518103;
    1.10 +var summary = 'partial flat closures must not reach across funargs';
    1.11 +var actual = "no crash";
    1.12 +var expect = actual;
    1.13 +
    1.14 +function Timer(){}
    1.15 +Timer.prototype = { initWithCallback: function (o) {Timer.q.push(o)} };
    1.16 +Timer.q = [];
    1.17 +
    1.18 +var later;
    1.19 +var ac = {startSearch: function(q,s,n,o){later=o}};
    1.20 +
    1.21 +var bm = {insertBookmark: function(){}, getIdForItemAt: function(){}};
    1.22 +
    1.23 +function run_test() {
    1.24 +  var tagIds = [];
    1.25 +
    1.26 +  (function doSearch(query) {
    1.27 +    ac.startSearch(query, "", null, {
    1.28 +      onSearchResult: function() {
    1.29 +        var num = tagIds.length;
    1.30 +
    1.31 +        var timer = new Timer;
    1.32 +        var next = query.slice(1);
    1.33 +        timer.initWithCallback({ notify: function() doSearch(next) });
    1.34 +      }
    1.35 +    });
    1.36 +  })("title");
    1.37 +}
    1.38 +
    1.39 +run_test();
    1.40 +later.onSearchResult();
    1.41 +for (var i in Timer.q)
    1.42 +  Timer.q[i].notify();
    1.43 +
    1.44 +reportCompare(expect, actual, summary);

mercurial