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
|
/* 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/>. */
// Test that xrays do not interfere with examining objects in the scopes pane.
"use strict";
add_task(async function () {
const dbg = await initDebugger("doc-scopes-xrays.html");
invokeInTab("start");
await waitForPaused(dbg, "doc-scopes-xrays.html");
await toggleNode(dbg, "set");
await toggleNode(dbg, "<entries>");
await checkObjectNode(dbg, "0", "1");
await toggleNode(dbg, "set");
await toggleNode(dbg, "weakset");
await toggleNode(dbg, "<entries>");
await checkObjectNode(dbg, "0", "2");
await toggleNode(dbg, "weakset");
await toggleNode(dbg, "map");
await toggleNode(dbg, "<entries>");
await toggleNode(dbg, "0");
await checkObjectNode(dbg, "<key>", "3");
await toggleNode(dbg, "<key>");
await checkObjectNode(dbg, "<value>", "4");
await toggleNode(dbg, "map");
await toggleNode(dbg, "weakmap");
await toggleNode(dbg, "<entries>");
await toggleNode(dbg, "0");
await checkObjectNode(dbg, "<key>", "5");
await toggleNode(dbg, "<key>");
await checkObjectNode(dbg, "<value>", "6");
await toggleNode(dbg, "weakmap");
});
function findNode(dbg, text) {
for (let index = 0; ; index++) {
const elem = findElement(dbg, "scopeNode", index);
if (elem?.innerText == text) {
return elem;
}
}
}
function toggleNode(dbg, text) {
return toggleObjectInspectorNode(findNode(dbg, text));
}
function findNodeValue(dbg, text) {
for (let index = 0; ; index++) {
const elem = findElement(dbg, "scopeNode", index);
if (elem?.innerText == text) {
return getScopeNodeValue(dbg, index);
}
}
}
async function checkObjectNode(dbg, text, value) {
await toggleNode(dbg, text);
Assert.equal(findNodeValue(dbg, "a"), value, "object value");
}
|