tor-browser

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

browser_openLayoutDebug.js (973B)


      1 "use strict";
      2 
      3 /*
      4 When run locally this won't test whether the files are packaged and available
      5 in a distributed build unless `./mach mochitest --appname dist` is used
      6 (after `./mach package`)
      7 */
      8 
      9 function test() {
     10  waitForExplicitFinish();
     11 
     12  const windowListener = {
     13    onOpenWindow(win) {
     14      info("Observed window open");
     15 
     16      const domWindow = win.docShell.domWindow;
     17      waitForFocus(() => {
     18        is(
     19          domWindow.location.href,
     20          "chrome://layoutdebug/content/layoutdebug.xhtml",
     21          "Window location is correct"
     22        );
     23        domWindow.close();
     24      }, domWindow);
     25    },
     26 
     27    onCloseWindow() {
     28      info("Observed window closed");
     29      Services.wm.removeListener(this);
     30      finish();
     31    },
     32  };
     33  Services.wm.addListener(windowListener);
     34 
     35  const menuitem = document.getElementById("menu_layout_debugger");
     36  ok(menuitem, "Menuitem present");
     37  if (menuitem) {
     38    // open the debugger window
     39    menuitem.click();
     40  }
     41 }