Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1155653</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<script type="application/javascript" src="inspector-helpers.js"></script>
<script type="application/javascript">
"use strict";
window.onload = function() {
SimpleTest.waitForExplicitFinish();
runNextTest();
};
let gWalker;
addTest(async function() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
gWalker = inspector.walker;
runNextTest();
});
addTest(function() {
info("Try to get a NodeFront from an invalid actorID");
gWalker.getNodeFromActor("invalid", ["node"]).then(node => {
ok(!node, "The node returned is null");
runNextTest();
});
});
addTest(function() {
info("Try to get a NodeFront from a valid actorID but invalid path");
gWalker.getNodeFromActor(gWalker.actorID, ["invalid", "path"]).then(node => {
ok(!node, "The node returned is null");
runNextTest();
});
});
addTest(function() {
info("Try to get a NodeFront from a valid actorID and valid path");
gWalker.getNodeFromActor(gWalker.actorID, ["rootDoc"]).then(rootDocNode => {
ok(rootDocNode, "A node was returned");
is(rootDocNode, gWalker.rootNode, "The right node was returned");
runNextTest();
});
});
addTest(function() {
info("Try to get a NodeFront from a valid actorID and valid complex path");
gWalker.getNodeFromActor(gWalker.actorID,
["targetActor", "window", "document", "body"]).then(bodyNode => {
ok(bodyNode, "A node was returned");
gWalker.querySelector(gWalker.rootNode, "body").then(node => {
is(bodyNode, node, "The body node was returned");
runNextTest();
});
});
});
addTest(function() {
gWalker = null;
runNextTest();
});
</script>
</head>
<body>
<a id="inspectorContent" target="_blank" href="inspector_getImageData.html">Test Document</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>