Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import hasAttributeWithValue from 'hint/dist/src/lib/utils/network/has-attribute-with-value';
import isHTMLDocument from 'hint/dist/src/lib/utils/network/is-html-document';
import {
BrowserInfo, IConnector,
IAsyncHTMLElement, ElementFound, Event, FetchEnd, FetchError, ILauncher, TraverseUp, TraverseDown,
Response, Request, NetworkData
} from 'hint/dist/src/lib/types';
import { normalizeHeaders } from '@hint/utils-connector-tools/dist/src/normalize-headers';
import { RedirectManager } from '@hint/utils-connector-tools/dist/src/redirects';
import { Requester } from '@hint/utils-connector-tools/dist/src/requester';
import { Engine } from 'hint/dist/src/lib/engine';
const debug: debug.IDebugger = d(__filename);
export class Connector implements IConnector {
/** The final set of options resulting of merging the users, and default ones. */
private _options;
/** The default headers to do any request. */
private _headers;
/** The original URL to collect. */
private _href: string;
/** The final URL after redirects (if they exist) */
private _finalHref: string;
/** The instance of hint that is using this connector. */
private _server: Engine;
/** The client to talk to the browser. */
private _client: Crdp.CrdpClient;
/** A set of requests done by the connector to retrieve initial information more easily. */
private _requests: Map;
import { Crdp } from 'chrome-remote-debug-protocol';
import { IAsyncHTMLDocument, IAsyncHTMLElement } from 'hint/dist/src/lib/types/async-html'; //eslint-disable-line
import { debug as d } from 'hint/dist/src/lib/utils/debug';
import { ProblemLocation } from 'hint/dist/src/lib/types';
const debug: debug.IDebugger = d(__filename);
/** An implementation of AsyncHTMLDocument on top of the Chrome Debugging Protocol */
export class CDPAsyncHTMLDocument implements IAsyncHTMLDocument {
/** The DOM domain of the CDP client. */
private _DOM: Crdp.DOMClient;
/** The root element of the real DOM. */
private _dom!: Crdp.DOM.Node;
/** A map with all the nodes accessible using `nodeId`. */
private _nodes: Map = new Map();
/** outerHTML of the page. */
private _outerHTML: string = '';
public constructor(DOM: Crdp.DOMClient) {
this._DOM = DOM;
}