summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/WorkerDebuggerGlobalScope.enterEventLoop_debugger.js
blob: dcd4dbecd1cf0f760ff4b7c5097d27a0391eebdd (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
"use strict";

var frames = [];

var dbg = new Debugger(global);
dbg.onDebuggerStatement = function (frame) {
  frames.push(frame);
  postMessage("paused");
  enterEventLoop();
  frames.pop();
  postMessage("resumed");
};

this.onmessage = function (event) {
  switch (event.data) {
  case "eval":
    frames[frames.length - 1].eval("f()");
    postMessage("evalled");
    break;

  case "ping":
    postMessage("pong");
    break;

  case "resume":
    leaveEventLoop();
    break;
  };
};