tor-browser

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

browser_inspector_reload_xul.js (1512B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 "use strict";
      5 
      6 // Tests for inspecting a node on a XUL document, spanning a tab reload.
      7 
      8 const TEST_URI = URL_ROOT_SSL + "doc_inspector_reload_xul.xhtml";
      9 
     10 add_task(async function () {
     11  const { tab, inspector, toolbox } = await openInspectorForURL(TEST_URI);
     12  await testToolboxInitialization(tab, inspector, toolbox);
     13 });
     14 
     15 async function testToolboxInitialization(tab, inspector, toolbox) {
     16  ok(true, "Inspector started, and notification received.");
     17  ok(inspector, "Inspector instance is accessible.");
     18 
     19  await selectNode("#p", inspector);
     20  await testMarkupView("#p", inspector);
     21 
     22  info("Reloading the page.");
     23  await navigateTo(TEST_URI);
     24 
     25  await selectNode("#q", inspector);
     26  await testMarkupView("#q", inspector);
     27 
     28  info("Destroying toolbox.");
     29  await toolbox.destroy();
     30 
     31  ok(true, "'destroyed' notification received.");
     32  const toolboxForTab = gDevTools.getToolboxForTab(tab);
     33  ok(!toolboxForTab, "Toolbox destroyed.");
     34 }
     35 
     36 async function testMarkupView(selector, inspector) {
     37  const nodeFront = await getNodeFront(selector, inspector);
     38  try {
     39    is(
     40      inspector.selection.nodeFront,
     41      nodeFront,
     42      "Right node is selected in the markup view"
     43    );
     44  } catch (ex) {
     45    ok(false, "Got exception while resolving selected node of markup view.");
     46    console.error(ex);
     47  }
     48 }