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
81
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// Tests early event breakpoints and event breakpoints in a remote frame.
"use strict";
add_task(async function () {
const dbg = await initDebugger(
"doc-event-breakpoints-fission.html",
"event-breakpoints.js"
);
await selectSource(dbg, "event-breakpoints.js");
await waitForSelectedSource(dbg, "event-breakpoints.js");
await dbg.actions.addEventListenerBreakpoints([
"event.mouse.click",
"event.xhr.load",
"timer.timeout.set",
]);
info("Assert early timeout event breakpoint gets hit");
const waitForReload = reloadBrowser();
await waitForPaused(dbg);
assertPausedAtSourceAndLine(
dbg,
findSource(dbg, "doc-event-breakpoints-fission.html").id,
17
);
await resume(dbg);
await waitForReload;
info("Assert event breakpoints work in remote frame");
await invokeAndAssertBreakpoints(dbg);
info("reload the iframe");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () =>
content.wrappedJSObject.reloadIframe()
);
info("Assert event breakpoints work in remote frame after reload");
await invokeAndAssertBreakpoints(dbg);
});
async function invokeAndAssertBreakpoints(dbg) {
invokeInTabRemoteFrame("clickHandler");
await waitForPaused(dbg);
assertPausedAtSourceAndLine(
dbg,
findSource(dbg, "event-breakpoints.js").id,
12
);
await resume(dbg);
invokeInTabRemoteFrame("xhrHandler");
await waitForPaused(dbg);
assertPausedAtSourceAndLine(
dbg,
findSource(dbg, "event-breakpoints.js").id,
20
);
await resume(dbg);
}
async function invokeInTabRemoteFrame(fnc, ...args) {
info(`Invoking in tab remote frame: ${fnc}(${args.map(uneval).join(",")})`);
await SpecialPowers.spawn(
gBrowser.selectedBrowser,
[fnc, args],
function (_fnc, _args) {
return SpecialPowers.spawn(
content.document.querySelector("iframe"),
[_fnc, _args],
(__fnc, __args) => content.wrappedJSObject[__fnc](...__args)
);
}
);
}
|