tor-browser

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

browser_inspector_reload-01.js (1071B)


      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 // A test to ensure reloading a page doesn't break the inspector.
      7 
      8 // Reload should reselect the currently selected markup view element.
      9 // This should work even when an element whose selector needs escaping
     10 // is selected (bug 1002280).
     11 const TEST_URI = "data:text/html,<p id='1'>p</p>";
     12 
     13 add_task(async function () {
     14  const { inspector } = await openInspectorForURL(TEST_URI);
     15  await selectNode("p", inspector);
     16 
     17  const markupLoaded = inspector.once("markuploaded");
     18 
     19  info("Reloading page.");
     20  await navigateTo(TEST_URI);
     21 
     22  info("Waiting for markupview to load after reload.");
     23  await markupLoaded;
     24 
     25  const nodeFront = await getNodeFront("p", inspector);
     26  is(inspector.selection.nodeFront, nodeFront, "<p> selected after reload.");
     27 
     28  info("Selecting a node to see that inspector still works.");
     29  await selectNode("body", inspector);
     30 });