4 https://bugzilla.mozilla.org/show_bug.cgi?id=
8 <title>Test for Bug
</title>
10 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css">
12 <script type=
"application/javascript" src=
"inspector-helpers.js"></script>
13 <script type=
"application/javascript">
16 window.onload = function() {
17 SimpleTest.waitForExplicitFinish();
21 let gInspectee = null;
23 let gResourceCommand = null;
26 addTest(async function setup() {
27 const url = document.getElementById(
"inspectorContent").href;
28 const { commands, doc } = await attachURL(url);
29 const target = commands.targetCommand.targetFront;
30 const inspector = await target.getFront(
"inspector");
32 const walker = inspector.walker;
33 gWalker = await inspector.getWalker();
34 gResourceCommand = commands.resourceCommand;
37 ok(walker === gWalker,
"getWalker() twice should return the same walker.");
41 addTest(async function testReload() {
42 const oldRootID = gWalker.rootNode.actorID;
44 info(
"Start watching for root nodes and wait for the initial root node");
46 let rootNodePromise = new Promise(r =
> (rootNodeResolve = r));
47 const onAvailable = rootNodeFront =
> rootNodeResolve(rootNodeFront);
48 await gResourceCommand.watchResources([gResourceCommand.TYPES.ROOT_NODE], {
51 await rootNodePromise;
53 info(
"Retrieve the node front for the selector `#a`");
54 const nodeFront = await gWalker.querySelector(gWalker.rootNode,
"#a");
55 ok(nodeFront.actorID,
"Node front has a valid actor ID");
57 info(
"Reload the page and wait for the newRoot mutation");
58 rootNodePromise = new Promise(r =
> (rootNodeResolve = r));
60 gInspectee.defaultView.location.reload();
61 await rootNodePromise;
62 gWalker = (await gCommands.targetCommand.targetFront.getFront(
"inspector")).walker;
64 info(
"Retrieve the (new) node front for the selector `#a`");
65 const newNodeFront = await gWalker.querySelector(gWalker.rootNode,
"#a");
66 ok(newNodeFront.actorID,
"Got a new actor ID");
67 ok(gWalker.rootNode.actorID != oldRootID,
"Root node should have changed.");
72 addTest(function cleanup() {
75 gResourceCommand = null;
81 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug
</a>
82 <a id=
"inspectorContent" target=
"_blank" href=
"inspector-traversal-data.html">Test Document
</a>
84 <div id=
"content" style=
"display: none">