summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testPropagatedFunArgs.js
blob: 19052d1fe924d7c89f5dffe8dbe7db0806750c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function testPropagatedFunArgs()
{
  var win = this;
  var res = [], q = [];
  function addEventListener(name, func, flag) {
    q.push(func);
  }

  var pageInfo, obs;
  addEventListener("load", handleLoad, true);

  var observer = {
    observe: function(win, topic, data) {
      // obs.removeObserver(observer, "page-info-dialog-loaded");
      handlePageInfo();
    }
  };

  function handleLoad() {
    pageInfo = { toString: function() { return "pageInfo"; } };
    obs = { addObserver: function (obs, topic, data) { obs.observe(win, topic, data); } };
    obs.addObserver(observer, "page-info-dialog-loaded", false);
  }

  function handlePageInfo() {
    res.push(pageInfo);
    function $(aId) { res.push(pageInfo); };
    var feedTab = $("feedTab");
  }

  q[0]();
  return res.join(',');
}
assertEq(testPropagatedFunArgs(), "pageInfo,pageInfo");