tor-browser

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

ConnectOptions.ts (2605B)


      1 /**
      2 * @license
      3 * Copyright 2020 Google Inc.
      4 * SPDX-License-Identifier: Apache-2.0
      5 */
      6 
      7 import type {Session} from 'chromium-bidi/lib/cjs/protocol/protocol.js';
      8 
      9 import type {
     10  IsPageTargetCallback,
     11  TargetFilterCallback,
     12 } from '../api/Browser.js';
     13 
     14 import type {ConnectionTransport} from './ConnectionTransport.js';
     15 import type {DownloadBehavior} from './DownloadBehavior.js';
     16 import type {Viewport} from './Viewport.js';
     17 
     18 /**
     19 * @public
     20 */
     21 export type ProtocolType = 'cdp' | 'webDriverBiDi';
     22 
     23 /**
     24 * @public
     25 */
     26 export type SupportedWebDriverCapability = Exclude<
     27  Session.CapabilityRequest,
     28  'unhandledPromptBehavior' | 'acceptInsecureCerts'
     29 >;
     30 
     31 /**
     32 * WebDriver BiDi capabilities that are not set by Puppeteer itself.
     33 *
     34 * @public
     35 */
     36 export interface SupportedWebDriverCapabilities {
     37  firstMatch?: SupportedWebDriverCapability[];
     38  alwaysMatch?: SupportedWebDriverCapability;
     39 }
     40 
     41 /**
     42 * Generic browser options that can be passed when launching any browser or when
     43 * connecting to an existing browser instance.
     44 * @public
     45 */
     46 export interface ConnectOptions {
     47  /**
     48   * Whether to ignore HTTPS errors during navigation.
     49   * @defaultValue `false`
     50   */
     51  acceptInsecureCerts?: boolean;
     52  /**
     53   * Sets the viewport for each page.
     54   *
     55   * @defaultValue '\{width: 800, height: 600\}'
     56   */
     57  defaultViewport?: Viewport | null;
     58  /**
     59   * Sets the download behavior for the context.
     60   */
     61  downloadBehavior?: DownloadBehavior;
     62  /**
     63   * Slows down Puppeteer operations by the specified amount of milliseconds to
     64   * aid debugging.
     65   */
     66  slowMo?: number;
     67  /**
     68   * Callback to decide if Puppeteer should connect to a given target or not.
     69   */
     70  targetFilter?: TargetFilterCallback;
     71  /**
     72   * @internal
     73   */
     74  _isPageTarget?: IsPageTargetCallback;
     75 
     76  /**
     77   * @defaultValue Determined at run time:
     78   *
     79   * - Launching Chrome - 'cdp'.
     80   *
     81   * - Launching Firefox - 'webDriverBiDi'.
     82   *
     83   * - Connecting to a browser - 'cdp'.
     84   *
     85   * @public
     86   */
     87  protocol?: ProtocolType;
     88  /**
     89   * Timeout setting for individual protocol (CDP) calls.
     90   *
     91   * @defaultValue `180_000`
     92   */
     93  protocolTimeout?: number;
     94 
     95  browserWSEndpoint?: string;
     96  browserURL?: string;
     97  transport?: ConnectionTransport;
     98  /**
     99   * Headers to use for the web socket connection.
    100   * @remarks
    101   * Only works in the Node.js environment.
    102   */
    103  headers?: Record<string, string>;
    104 
    105  /**
    106   * WebDriver BiDi capabilities passed to BiDi `session.new`.
    107   *
    108   * @remarks
    109   * Only works for `protocol="webDriverBiDi"` and {@link Puppeteer.connect}.
    110   */
    111  capabilities?: SupportedWebDriverCapabilities;
    112 }