summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/WorkerDebuggerGlobalScope.enterEventLoop_debugger.js
blob: d2a1a21e858677ac95a96d96975b7ca7d4e4912b (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;
  }
};