tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_inspector-changevalue.html (1977B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug </title>
      9 
     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">
     14 "use strict";
     15 
     16 window.onload = function() {
     17  SimpleTest.waitForExplicitFinish();
     18  runNextTest();
     19 };
     20 
     21 let gInspectee = null;
     22 let gWalker = null;
     23 
     24 addTest(async function setup() {
     25  const url = document.getElementById("inspectorContent").href;
     26  const { target, doc } = await attachURL(url);
     27  gInspectee = doc;
     28  const inspector = await target.getFront("inspector");
     29  gWalker = inspector.walker;
     30  runNextTest();
     31 });
     32 
     33 addTest(function testChangeValue() {
     34  const contentNode = gInspectee.querySelector("#a").firstChild;
     35  let nodeFront;
     36  promiseDone(gWalker.querySelector(gWalker.rootNode, "#a").then(front => {
     37    // Get the text child
     38    return gWalker.children(front, { maxNodes: 1 });
     39  }).then(children => {
     40    nodeFront = children.nodes[0];
     41    is(nodeFront.nodeType, Node.TEXT_NODE);
     42    return nodeFront.setNodeValue("newvalue");
     43  }).then(() => {
     44    // We're only going to test that the change hit the document.
     45    // There are other tests that make sure changes are propagated
     46    // to the client.
     47    is(contentNode.nodeValue, "newvalue", "Node should have a new value.");
     48  }).then(runNextTest));
     49 });
     50 
     51 addTest(function cleanup() {
     52  gWalker = null;
     53  gInspectee = null;
     54  runNextTest();
     55 });
     56  </script>
     57 </head>
     58 <body>
     59 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
     60 <a id="inspectorContent" target="_blank" href="inspector-traversal-data.html">Test Document</a>
     61 <p id="display"></p>
     62 <div id="content" style="display: none">
     63 
     64 </div>
     65 <pre id="test">
     66 </pre>
     67 </body>
     68 </html>