tor-browser

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

browser_layout_simple.js (954B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Simple checks for the LayoutActor and GridActor
      7 
      8 add_task(async function () {
      9  const { target, walker, layout } = await initLayoutFrontForUrl(
     10    "data:text/html;charset=utf-8,<title>test</title><div></div>"
     11  );
     12 
     13  ok(layout, "The LayoutFront was created");
     14  ok(layout.getGrids, "The getGrids method exists");
     15 
     16  let didThrow = false;
     17  try {
     18    await layout.getGrids(null);
     19  } catch (e) {
     20    didThrow = true;
     21  }
     22  ok(didThrow, "An exception was thrown for a missing NodeActor in getGrids");
     23 
     24  const invalidNode = await walker.querySelector(walker.rootNode, "title");
     25  const grids = await layout.getGrids(invalidNode);
     26  ok(Array.isArray(grids), "An array of grids was returned");
     27  is(grids.length, 0, "0 grids have been returned for the invalid node");
     28 
     29  await target.destroy();
     30  gBrowser.removeCurrentTab();
     31 });