tor-browser

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

AIWindowTestUtils.sys.mjs (728B)


      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 
      5 import { BrowserTestUtils } from "resource://testing-common/BrowserTestUtils.sys.mjs";
      6 
      7 export const AIWindowTestUtils = {
      8  async toggleAIWindowPref(SpecialPowers, enabled) {
      9    await SpecialPowers.pushPrefEnv({
     10      set: [["browser.aiwindow.enabled", enabled]],
     11    });
     12  },
     13 
     14  isAIWindow(win) {
     15    return win.document.documentElement.hasAttribute("ai-window");
     16  },
     17 
     18  async openAIWindow(aiWindow = true) {
     19    return BrowserTestUtils.openNewBrowserWindow({
     20      openerWindow: null,
     21      aiWindow,
     22    });
     23  },
     24 };