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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable no-shadow */
"use strict";
/**
* Ensure that the debugger resume page execution when the connection drops
* and when the target is detached.
*/
add_task(
threadFrontTest(({ threadFront, debuggee, targetFront }) => {
return new Promise(resolve => {
(async () => {
await executeOnNextTickAndWaitForPause(evalCode, threadFront);
ok(true, "The page is paused");
ok(!debuggee.foo, "foo is still false after we hit the breakpoint");
await targetFront.detach();
// Closing the connection will force the thread actor to resume page
// execution
ok(debuggee.foo, "foo is true after target's detach request");
resolve();
})();
function evalCode() {
/* eslint-disable */
Cu.evalInSandbox("var foo = false;\n", debuggee);
/* eslint-enable */
ok(!debuggee.foo, "foo is false at startup");
/* eslint-disable */
Cu.evalInSandbox("debugger;\n" + "foo = true;\n", debuggee);
/* eslint-enable */
}
});
})
);
add_task(
threadFrontTest(({ threadFront, client, debuggee }) => {
return new Promise(resolve => {
(async () => {
await executeOnNextTickAndWaitForPause(evalCode, threadFront);
ok(true, "The page is paused");
ok(!debuggee.foo, "foo is still false after we hit the breakpoint");
await client.close();
// `close` will force the destruction of the thread actor, which,
// will resume the page execution. But all of that seems to be
// synchronous and we have to spin the event loop in order to ensure
// having the content javascript to execute the resumed code.
await new Promise(executeSoon);
// Closing the connection will force the thread actor to resume page
// execution
ok(debuggee.foo, "foo is true after client close");
executeSoon(resolve);
dump("resolved\n");
})();
function evalCode() {
/* eslint-disable */
Cu.evalInSandbox("var foo = false;\n", debuggee);
/* eslint-enable */
ok(!debuggee.foo, "foo is false at startup");
/* eslint-disable */
Cu.evalInSandbox("debugger;\n" + "foo = true;\n", debuggee);
/* eslint-enable */
}
});
})
);
|