feat: Reinitialize frontend with SvelteKit and TypeScript

- Delete old Vite+Svelte frontend
- Initialize new SvelteKit project with TypeScript
- Configure Tailwind CSS v4 + DaisyUI
- Implement JWT authentication with auto-refresh
- Create login page with form validation (Zod)
- Add protected route guards
- Update Docker configuration for single-stage build
- Add E2E tests with Playwright (6/11 passing)
- Fix Svelte 5 reactivity with $state() runes

Known issues:
- 5 E2E tests failing (timing/async issues)
- Token refresh implementation needs debugging
- Validation error display timing
This commit is contained in:
2026-02-17 16:19:59 -05:00
parent 54df6018f5
commit de2d83092e
28274 changed files with 3816354 additions and 90 deletions

404
frontend/node_modules/happy-dom/cjs/PropertySymbol.cjs generated vendored Normal file
View File

@@ -0,0 +1,404 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registry = exports.referrer = exports.readyStateManager = exports.propagationStopped = exports.ownerElement = exports.ownerDocument = exports.mutationListeners = exports.observeMutations = exports.nextActiveElement = exports.itemsByName = exports.listeners = exports.listenerOptions = exports.isValue = exports.isInPassiveEventListener = exports.isFirstWriteAfterOpen = exports.isFirstWrite = exports.indeterminate = exports.immediatePropagationStopped = exports.height = exports.internalId = exports.formNode = exports.exceptionObserver = exports.evaluateScript = exports.evaluateCSS = exports.entries = exports.end = exports.dirtyness = exports.destroy = exports.defaultView = exports.data = exports.currentTarget = exports.currentScript = exports.cssText = exports.contentType = exports.contentLength = exports.disconnectedFromDocument = exports.connectedToDocument = exports.disconnectedFromNode = exports.connectedToNode = exports.classList = exports.children = exports.childNodes = exports.checked = exports.callbacks = exports.cachedResponse = exports.buffer = exports.bodyBuffer = exports.asyncTaskManager = exports.activeElement = exports.abort = void 0;
exports.implementation = exports.adoptedStyleSheets = exports.specified = exports.name = exports.clientTop = exports.clientLeft = exports.clientWidth = exports.clientHeight = exports.offsetTop = exports.offsetLeft = exports.offsetWidth = exports.offsetHeight = exports.accessKeyLabel = exports.accessKey = exports.namespaceURI = exports.attributesProxy = exports.attributes = exports.scrollLeft = exports.scrollTop = exports.scrollWidth = exports.scrollHeight = exports.prefix = exports.tagName = exports.nodeType = exports.parentNode = exports.isConnected = exports.popup = exports.openerWindow = exports.openerFrame = exports.mutationObservers = exports.windowResizeListener = exports.window = exports.width = exports.value = exports.url = exports.updateSelectedness = exports.reportMutation = exports.unobserveMutations = exports.textAreaNode = exports.target = exports.style = exports.start = exports.shadowRoot = exports.setupVMContext = exports.selection = exports.selectedness = exports.selectNode = exports.rootNode = exports.resetSelection = exports.relList = void 0;
exports.cloneNode = exports.sandbox = exports.localStorage = exports.sessionStorage = exports.screen = exports.navigator = exports.history = exports.location = exports.nodeStream = exports.classRegistry = exports.localName = exports.setURL = exports.host = exports.mode = exports.content = exports.options = exports.played = exports.seekable = exports.seeking = exports.textTracks = exports.networkState = exports.ended = exports.error = exports.duration = exports.buffered = exports.preservesPitch = exports.defaultMuted = exports.muted = exports.defaultPlaybackRate = exports.playbackRate = exports.currentTime = exports.paused = exports.volume = exports.sheet = exports.files = exports.defaultChecked = exports.y = exports.x = exports.loading = exports.naturalWidth = exports.naturalHeight = exports.complete = exports.length = exports.elements = exports.returnValue = exports.validity = exports.validationMessage = exports.systemId = exports.publicId = exports.readyState = void 0;
exports.rows = exports.cells = exports.assignedToSlot = exports.assignedNodes = exports.slotAssignment = exports.serializable = exports.delegatesFocus = exports.clonable = exports.elementIdMap = exports.defaultValue = exports.areas = exports.top = exports.parent = exports.self = exports.selectedIndex = exports.attributeName = exports.getTokenList = exports.setNamedItem = exports.proxy = exports.itemsByNamespaceURI = exports.getNamedItemKey = exports.getNamespaceItemKey = exports.dataset = exports.getFormControlNamedItem = exports.getFormControlItems = exports.computedStyle = exports.query = exports.affectsComputedStyleCache = exports.forms = exports.affectsCache = exports.cache = exports.elementArray = exports.nodeArray = exports.onRemoveAttribute = exports.onSetAttribute = exports.clearCache = exports.updateSheet = exports.styleNode = exports.selectedOptions = exports.items = exports.removeNamedItem = exports.clone = exports.settings = exports.capabilities = exports.constraints = exports.tracks = exports.replaceChild = exports.insertBefore = exports.removeChild = exports.appendChild = void 0;
exports.preserveAspectRatio = exports.readOnly = exports.refY = exports.refX = exports.orientAngle = exports.orientType = exports.values = exports.markerHeight = exports.markerWidth = exports.markerUnits = exports.viewBox = exports.unitType = exports.pathLength = exports.animVal = exports.baseVal = exports.transform = exports.systemLanguage = exports.requiredExtensions = exports.getItemList = exports.windowInternalId = exports.browserFrames = exports.aborted = exports.destroyed = exports.globalObject = exports.detail = exports.type = exports.timeStamp = exports.eventPhase = exports.defaultPrevented = exports.cancelable = exports.bubbles = exports.composed = exports.popoverTargetElement = exports.canvas = exports.state = exports.illegalConstructor = exports.id = exports.language = exports.label = exports.kind = exports.activeCues = exports.cues = exports.srcObject = exports.sinkId = exports.remote = exports.mediaKeys = exports.controlsList = exports.track = exports.tBodies = exports.headers = void 0;
exports.m41 = exports.m34 = exports.m33 = exports.m32 = exports.m31 = exports.m24 = exports.m23 = exports.m22 = exports.m21 = exports.m14 = exports.m13 = exports.m12 = exports.m11 = exports.angle = exports.fromArray = exports.fromString = exports.toArray = exports.w = exports.z = exports.setAttribute = exports.getAttribute = exports.lengthAdjust = exports.textLength = exports.disabled = exports.offset = exports.fy = exports.fx = exports.patternTransform = exports.patternContentUnits = exports.patternUnits = exports.spreadMethod = exports.gradientTransform = exports.gradientUnits = exports.y2 = exports.x2 = exports.y1 = exports.x1 = exports.href = exports.primitiveUnits = exports.filterUnits = exports.maskContentUnits = exports.maskUnits = exports.clipPathUnits = exports.r = exports.cy = exports.cx = exports.ry = exports.rx = exports.points = exports.animatedPoints = void 0;
exports.amplitude = exports.intercept = exports.slope = exports.tableValues = exports.stdDeviationY = exports.stdDeviationX = exports.dy = exports.dx = exports.elevation = exports.azimuth = exports.yChannelSelector = exports.xChannelSelector = exports.scale = exports.surfaceScale = exports.diffuseConstant = exports.targetY = exports.targetX = exports.preserveAlpha = exports.orderY = exports.orderX = exports.kernelUnitLengthY = exports.kernelUnitLengthX = exports.kernelMatrix = exports.edgeMode = exports.divisor = exports.bias = exports.result = exports.in2 = exports.in1 = exports.spacing = exports.method = exports.startOffset = exports.attributeValue = exports.setDOMMatrix = exports.getDOMMatrix = exports.domMatrix = exports.matrix = exports.multiplySelf = exports.skewYSelf = exports.skewXSelf = exports.scaleNonUniformSelf = exports.scale3dSelf = exports.scaleSelf = exports.rotateAxisAngleSelf = exports.rotateSelf = exports.translateSelf = exports.setMatrixValue = exports.m44 = exports.m43 = exports.m42 = void 0;
exports.propertyEventListeners = exports.reason = exports.supports = exports.dispatchError = exports.moduleImportMap = exports.blocking = exports.credentials = exports.bodyUsed = exports.signal = exports.referrerPolicy = exports.redirect = exports.body = exports.preloads = exports.modules = exports.dispatching = exports.customElementReactionStack = exports.filterNode = exports.root = exports.xmlProcessingInstruction = exports.bindMethods = exports.rotate = exports.currentScale = exports.getLength = exports.invertSelf = exports.flipYSelf = exports.flipXSelf = exports.rotateFromVectorSelf = exports.stitchTiles = exports.seed = exports.numOctaves = exports.baseFrequencyY = exports.baseFrequencyX = exports.limitingConeAngle = exports.pointsAtZ = exports.pointsAtY = exports.pointsAtX = exports.specularExponent = exports.specularConstant = exports.radiusY = exports.radiusX = exports.operator = exports.crossOrigin = exports.exponent = void 0;
exports.abort = Symbol('abort');
exports.activeElement = Symbol('activeElement');
exports.asyncTaskManager = Symbol('asyncTaskManager');
exports.bodyBuffer = Symbol('bodyBuffer');
exports.buffer = Symbol('buffer');
exports.cachedResponse = Symbol('cachedResponse');
exports.callbacks = Symbol('callbacks');
exports.checked = Symbol('checked');
exports.childNodes = Symbol('childNodes');
exports.children = Symbol('children');
exports.classList = Symbol('classList');
exports.connectedToNode = Symbol('connectedToNode');
exports.disconnectedFromNode = Symbol('disconnectedFromNode');
exports.connectedToDocument = Symbol('connectedToDocument');
exports.disconnectedFromDocument = Symbol('disconnectedFromDocument');
exports.contentLength = Symbol('contentLength');
exports.contentType = Symbol('contentType');
exports.cssText = Symbol('cssText');
exports.currentScript = Symbol('currentScript');
exports.currentTarget = Symbol('currentTarget');
exports.data = Symbol('data');
exports.defaultView = Symbol('defaultView');
exports.destroy = Symbol('destroy');
exports.dirtyness = Symbol('dirtyness');
exports.end = Symbol('end');
exports.entries = Symbol('entries');
exports.evaluateCSS = Symbol('evaluateCSS');
exports.evaluateScript = Symbol('evaluateScript');
exports.exceptionObserver = Symbol('exceptionObserver');
exports.formNode = Symbol('formNode');
exports.internalId = Symbol('internalId');
exports.height = Symbol('height');
exports.immediatePropagationStopped = Symbol('immediatePropagationStopped');
exports.indeterminate = Symbol('indeterminate');
exports.isFirstWrite = Symbol('isFirstWrite');
exports.isFirstWriteAfterOpen = Symbol('isFirstWriteAfterOpen');
exports.isInPassiveEventListener = Symbol('isInPassiveEventListener');
exports.isValue = Symbol('isValue');
exports.listenerOptions = Symbol('listenerOptions');
exports.listeners = Symbol('listeners');
exports.itemsByName = Symbol('itemsByName');
exports.nextActiveElement = Symbol('nextActiveElement');
exports.observeMutations = Symbol('observeMutations');
exports.mutationListeners = Symbol('mutationListeners');
exports.ownerDocument = Symbol('ownerDocument');
exports.ownerElement = Symbol('ownerElement');
exports.propagationStopped = Symbol('propagationStopped');
exports.readyStateManager = Symbol('readyStateManager');
exports.referrer = Symbol('referrer');
exports.registry = Symbol('registry');
exports.relList = Symbol('relList');
exports.resetSelection = Symbol('resetSelection');
exports.rootNode = Symbol('rootNode');
exports.selectNode = Symbol('selectNode');
exports.selectedness = Symbol('selectedness');
exports.selection = Symbol('selection');
exports.setupVMContext = Symbol('setupVMContext');
exports.shadowRoot = Symbol('shadowRoot');
exports.start = Symbol('start');
exports.style = Symbol('style');
exports.target = Symbol('target');
exports.textAreaNode = Symbol('textAreaNode');
exports.unobserveMutations = Symbol('unobserveMutations');
exports.reportMutation = Symbol('reportMutation');
exports.updateSelectedness = Symbol('updateSelectedness');
exports.url = Symbol('url');
exports.value = Symbol('value');
exports.width = Symbol('width');
exports.window = Symbol('window');
exports.windowResizeListener = Symbol('windowResizeListener');
exports.mutationObservers = Symbol('mutationObservers');
exports.openerFrame = Symbol('openerFrame');
exports.openerWindow = Symbol('openerWindow');
exports.popup = Symbol('popup');
exports.isConnected = Symbol('isConnected');
exports.parentNode = Symbol('parentNode');
exports.nodeType = Symbol('nodeType');
exports.tagName = Symbol('tagName');
exports.prefix = Symbol('prefix');
exports.scrollHeight = Symbol('scrollHeight');
exports.scrollWidth = Symbol('scrollWidth');
exports.scrollTop = Symbol('scrollTop');
exports.scrollLeft = Symbol('scrollLeft');
exports.attributes = Symbol('attributes');
exports.attributesProxy = Symbol('attributesProxy');
exports.namespaceURI = Symbol('namespaceURI');
exports.accessKey = Symbol('accessKey');
exports.accessKeyLabel = Symbol('accessKeyLabel');
exports.offsetHeight = Symbol('offsetHeight');
exports.offsetWidth = Symbol('offsetWidth');
exports.offsetLeft = Symbol('offsetLeft');
exports.offsetTop = Symbol('offsetTop');
exports.clientHeight = Symbol('clientHeight');
exports.clientWidth = Symbol('clientWidth');
exports.clientLeft = Symbol('clientLeft');
exports.clientTop = Symbol('clientTop');
exports.name = Symbol('name');
exports.specified = Symbol('specified');
exports.adoptedStyleSheets = Symbol('adoptedStyleSheets');
exports.implementation = Symbol('implementation');
exports.readyState = Symbol('readyState');
exports.publicId = Symbol('publicId');
exports.systemId = Symbol('systemId');
exports.validationMessage = Symbol('validationMessage');
exports.validity = Symbol('validity');
exports.returnValue = Symbol('returnValue');
exports.elements = Symbol('elements');
exports.length = Symbol('length');
exports.complete = Symbol('complete');
exports.naturalHeight = Symbol('naturalHeight');
exports.naturalWidth = Symbol('naturalWidth');
exports.loading = Symbol('loading');
exports.x = Symbol('x');
exports.y = Symbol('y');
exports.defaultChecked = Symbol('defaultChecked');
exports.files = Symbol('files');
exports.sheet = Symbol('sheet');
exports.volume = Symbol('volume');
exports.paused = Symbol('paused');
exports.currentTime = Symbol('currentTime');
exports.playbackRate = Symbol('playbackRate');
exports.defaultPlaybackRate = Symbol('defaultPlaybackRate');
exports.muted = Symbol('muted');
exports.defaultMuted = Symbol('defaultMuted');
exports.preservesPitch = Symbol('preservesPitch');
exports.buffered = Symbol('buffered');
exports.duration = Symbol('duration');
exports.error = Symbol('error');
exports.ended = Symbol('ended');
exports.networkState = Symbol('networkState');
exports.textTracks = Symbol('textTracks');
exports.seeking = Symbol('seeking');
exports.seekable = Symbol('seekable');
exports.played = Symbol('played');
exports.options = Symbol('options');
exports.content = Symbol('content');
exports.mode = Symbol('mode');
exports.host = Symbol('host');
exports.setURL = Symbol('setURL');
exports.localName = Symbol('localName');
exports.classRegistry = Symbol('classRegistry');
exports.nodeStream = Symbol('nodeStream');
exports.location = Symbol('location');
exports.history = Symbol('history');
exports.navigator = Symbol('navigator');
exports.screen = Symbol('screen');
exports.sessionStorage = Symbol('sessionStorage');
exports.localStorage = Symbol('localStorage');
exports.sandbox = Symbol('sandbox');
exports.cloneNode = Symbol('cloneNode');
exports.appendChild = Symbol('appendChild');
exports.removeChild = Symbol('removeChild');
exports.insertBefore = Symbol('insertBefore');
exports.replaceChild = Symbol('replaceChild');
exports.tracks = Symbol('tracks');
exports.constraints = Symbol('constraints');
exports.capabilities = Symbol('capabilities');
exports.settings = Symbol('settings');
exports.clone = Symbol('clone');
exports.removeNamedItem = Symbol('removeNamedItem');
exports.items = Symbol('items');
exports.selectedOptions = Symbol('selectedOptions');
exports.styleNode = Symbol('styleNode');
exports.updateSheet = Symbol('updateSheet');
exports.clearCache = Symbol('clearCache');
exports.onSetAttribute = Symbol('onSetAttribute');
exports.onRemoveAttribute = Symbol('onRemoveAttribute');
exports.nodeArray = Symbol('nodeArray');
exports.elementArray = Symbol('elementArray');
exports.cache = Symbol('cache');
exports.affectsCache = Symbol('affectsCache');
exports.forms = Symbol('forms');
exports.affectsComputedStyleCache = Symbol('affectsComputedStyleCache');
exports.query = Symbol('query');
exports.computedStyle = Symbol('computedStyle');
exports.getFormControlItems = Symbol('getFormControlItems');
exports.getFormControlNamedItem = Symbol('getFormControlNamedItem');
exports.dataset = Symbol('dataset');
exports.getNamespaceItemKey = Symbol('getNamespaceItemKey');
exports.getNamedItemKey = Symbol('getNamedItemKey');
exports.itemsByNamespaceURI = Symbol('itemsByNamespaceURI');
exports.proxy = Symbol('proxy');
exports.setNamedItem = Symbol('setNamedItem');
exports.getTokenList = Symbol('getTokenList');
exports.attributeName = Symbol('attributeName');
exports.selectedIndex = Symbol('selectedIndex');
exports.self = Symbol('self');
exports.parent = Symbol('parent');
exports.top = Symbol('top');
exports.areas = Symbol('areas');
exports.defaultValue = Symbol('defaultValue');
exports.elementIdMap = Symbol('elementIdMap');
exports.clonable = Symbol('clonable');
exports.delegatesFocus = Symbol('delegatesFocus');
exports.serializable = Symbol('serializable');
exports.slotAssignment = Symbol('slotAssignment');
exports.assignedNodes = Symbol('assignedNodes');
exports.assignedToSlot = Symbol('assignedToSlot');
exports.cells = Symbol('cells');
exports.rows = Symbol('rows');
exports.headers = Symbol('headers');
exports.tBodies = Symbol('tBodies');
exports.track = Symbol('track');
exports.controlsList = Symbol('controlsList');
exports.mediaKeys = Symbol('mediaKeys');
exports.remote = Symbol('remote');
exports.sinkId = Symbol('sinkId');
exports.srcObject = Symbol('srcObject');
exports.cues = Symbol('cues');
exports.activeCues = Symbol('activeCues');
exports.kind = Symbol('kind');
exports.label = Symbol('label');
exports.language = Symbol('language');
exports.id = Symbol('id');
exports.illegalConstructor = Symbol('illegalConstructor');
exports.state = Symbol('state');
exports.canvas = Symbol('canvas');
exports.popoverTargetElement = Symbol('popoverTargetElement');
exports.composed = Symbol('composed');
exports.bubbles = Symbol('bubbles');
exports.cancelable = Symbol('cancelable');
exports.defaultPrevented = Symbol('defaultPrevented');
exports.eventPhase = Symbol('eventPhase');
exports.timeStamp = Symbol('timeStamp');
exports.type = Symbol('type');
exports.detail = Symbol('detail');
exports.globalObject = Symbol('globalObject');
exports.destroyed = Symbol('destroyed');
exports.aborted = Symbol('aborted');
exports.browserFrames = Symbol('browserFrames');
exports.windowInternalId = Symbol('windowInternalId');
exports.getItemList = Symbol('getItemList');
exports.requiredExtensions = Symbol('requiredExtensions');
exports.systemLanguage = Symbol('systemLanguage');
exports.transform = Symbol('transform');
exports.baseVal = Symbol('baseVal');
exports.animVal = Symbol('animVal');
exports.pathLength = Symbol('pathLength');
exports.unitType = Symbol('unitType');
exports.viewBox = Symbol('viewBox');
exports.markerUnits = Symbol('markerUnits');
exports.markerWidth = Symbol('markerWidth');
exports.markerHeight = Symbol('markerHeight');
exports.values = Symbol('values');
exports.orientType = Symbol('orientType');
exports.orientAngle = Symbol('orientAngle');
exports.refX = Symbol('refX');
exports.refY = Symbol('refY');
exports.readOnly = Symbol('readOnly');
exports.preserveAspectRatio = Symbol('preserveAspectRatio');
exports.animatedPoints = Symbol('animatedPoints');
exports.points = Symbol('points');
exports.rx = Symbol('rx');
exports.ry = Symbol('ry');
exports.cx = Symbol('cx');
exports.cy = Symbol('cy');
exports.r = Symbol('r');
exports.clipPathUnits = Symbol('clipPathUnits');
exports.maskUnits = Symbol('maskUnits');
exports.maskContentUnits = Symbol('maskContentUnits');
exports.filterUnits = Symbol('filterUnits');
exports.primitiveUnits = Symbol('primitiveUnits');
exports.href = Symbol('href');
exports.x1 = Symbol('x1');
exports.y1 = Symbol('y1');
exports.x2 = Symbol('x2');
exports.y2 = Symbol('y2');
exports.gradientUnits = Symbol('gradientUnits');
exports.gradientTransform = Symbol('gradientTransform');
exports.spreadMethod = Symbol('spreadMethod');
exports.patternUnits = Symbol('patternUnits');
exports.patternContentUnits = Symbol('patternContentUnits');
exports.patternTransform = Symbol('patternTransform');
exports.fx = Symbol('fx');
exports.fy = Symbol('fy');
exports.offset = Symbol('offset');
exports.disabled = Symbol('disabled');
exports.textLength = Symbol('textLength');
exports.lengthAdjust = Symbol('lengthAdjust');
exports.getAttribute = Symbol('getAttribute');
exports.setAttribute = Symbol('setAttribute');
exports.z = Symbol('z');
exports.w = Symbol('w');
exports.toArray = Symbol('toArray');
exports.fromString = Symbol('fromString');
exports.fromArray = Symbol('fromArray');
exports.angle = Symbol('angle');
exports.m11 = Symbol('m11');
exports.m12 = Symbol('m12');
exports.m13 = Symbol('m13');
exports.m14 = Symbol('m14');
exports.m21 = Symbol('m21');
exports.m22 = Symbol('m22');
exports.m23 = Symbol('m23');
exports.m24 = Symbol('m24');
exports.m31 = Symbol('m31');
exports.m32 = Symbol('m32');
exports.m33 = Symbol('m33');
exports.m34 = Symbol('m34');
exports.m41 = Symbol('m41');
exports.m42 = Symbol('m42');
exports.m43 = Symbol('m43');
exports.m44 = Symbol('m44');
exports.setMatrixValue = Symbol('setMatrixValue');
exports.translateSelf = Symbol('translateSelf');
exports.rotateSelf = Symbol('rotateSelf');
exports.rotateAxisAngleSelf = Symbol('rotateAxisAngleSelf');
exports.scaleSelf = Symbol('scaleSelf');
exports.scale3dSelf = Symbol('scale3dSelf');
exports.scaleNonUniformSelf = Symbol('scaleNonUniformSelf');
exports.skewXSelf = Symbol('skewXSelf');
exports.skewYSelf = Symbol('skewYSelf');
exports.multiplySelf = Symbol('multiplySelf');
exports.matrix = Symbol('matrix');
exports.domMatrix = Symbol('domMatrix');
exports.getDOMMatrix = Symbol('getDOMMatrix');
exports.setDOMMatrix = Symbol('setDOMMatrix');
exports.attributeValue = Symbol('attributeValue');
exports.startOffset = Symbol('startOffset');
exports.method = Symbol('method');
exports.spacing = Symbol('spacing');
exports.in1 = Symbol('in1');
exports.in2 = Symbol('in2');
exports.result = Symbol('result');
exports.bias = Symbol('bias');
exports.divisor = Symbol('divisor');
exports.edgeMode = Symbol('edgeMode');
exports.kernelMatrix = Symbol('kernelMatrix');
exports.kernelUnitLengthX = Symbol('kernelUnitLengthX');
exports.kernelUnitLengthY = Symbol('kernelUnitLengthY');
exports.orderX = Symbol('orderX');
exports.orderY = Symbol('orderY');
exports.preserveAlpha = Symbol('preserveAlpha');
exports.targetX = Symbol('targetX');
exports.targetY = Symbol('targetY');
exports.diffuseConstant = Symbol('diffuseConstant');
exports.surfaceScale = Symbol('surfaceScale');
exports.scale = Symbol('scale');
exports.xChannelSelector = Symbol('xChannelSelector');
exports.yChannelSelector = Symbol('yChannelSelector');
exports.azimuth = Symbol('azimuth');
exports.elevation = Symbol('elevation');
exports.dx = Symbol('dx');
exports.dy = Symbol('dy');
exports.stdDeviationX = Symbol('stdDeviationX');
exports.stdDeviationY = Symbol('stdDeviationY');
exports.tableValues = Symbol('tableValues');
exports.slope = Symbol('slope');
exports.intercept = Symbol('intercept');
exports.amplitude = Symbol('amplitude');
exports.exponent = Symbol('exponent');
exports.crossOrigin = Symbol('crossOrigin');
exports.operator = Symbol('operator');
exports.radiusX = Symbol('radiusX');
exports.radiusY = Symbol('radiusY');
exports.specularConstant = Symbol('specularConstant');
exports.specularExponent = Symbol('specularExponent');
exports.pointsAtX = Symbol('pointsAtX');
exports.pointsAtY = Symbol('pointsAtY');
exports.pointsAtZ = Symbol('pointsAtZ');
exports.limitingConeAngle = Symbol('limitingConeAngle');
exports.baseFrequencyX = Symbol('baseFrequencyX');
exports.baseFrequencyY = Symbol('baseFrequencyY');
exports.numOctaves = Symbol('numOctaves');
exports.seed = Symbol('seed');
exports.stitchTiles = Symbol('stitchTiles');
exports.rotateFromVectorSelf = Symbol('rotateFromVectorSelf');
exports.flipXSelf = Symbol('flipXSelf');
exports.flipYSelf = Symbol('flipYSelf');
exports.invertSelf = Symbol('invertSelf');
exports.getLength = Symbol('getLength');
exports.currentScale = Symbol('currentScale');
exports.rotate = Symbol('rotate');
exports.bindMethods = Symbol('bindMethods');
exports.xmlProcessingInstruction = Symbol('xmlProcessingInstruction');
exports.root = Symbol('root');
exports.filterNode = Symbol('filterNode');
exports.customElementReactionStack = Symbol('customElementReactionStack');
exports.dispatching = Symbol('dispatching');
exports.modules = Symbol('modules');
exports.preloads = Symbol('preloads');
exports.body = Symbol('body');
exports.redirect = Symbol('redirect');
exports.referrerPolicy = Symbol('referrerPolicy');
exports.signal = Symbol('signal');
exports.bodyUsed = Symbol('bodyUsed');
exports.credentials = Symbol('credentials');
exports.blocking = Symbol('blocking');
exports.moduleImportMap = Symbol('moduleImportMap');
exports.dispatchError = Symbol('dispatchError');
exports.supports = Symbol('supports');
exports.reason = Symbol('reason');
exports.propertyEventListeners = Symbol('propertyEventListeners');
//# sourceMappingURL=PropertySymbol.cjs.map

File diff suppressed because one or more lines are too long

394
frontend/node_modules/happy-dom/cjs/PropertySymbol.d.ts generated vendored Normal file
View File

@@ -0,0 +1,394 @@
export declare const abort: unique symbol;
export declare const activeElement: unique symbol;
export declare const asyncTaskManager: unique symbol;
export declare const bodyBuffer: unique symbol;
export declare const buffer: unique symbol;
export declare const cachedResponse: unique symbol;
export declare const callbacks: unique symbol;
export declare const checked: unique symbol;
export declare const childNodes: unique symbol;
export declare const children: unique symbol;
export declare const classList: unique symbol;
export declare const connectedToNode: unique symbol;
export declare const disconnectedFromNode: unique symbol;
export declare const connectedToDocument: unique symbol;
export declare const disconnectedFromDocument: unique symbol;
export declare const contentLength: unique symbol;
export declare const contentType: unique symbol;
export declare const cssText: unique symbol;
export declare const currentScript: unique symbol;
export declare const currentTarget: unique symbol;
export declare const data: unique symbol;
export declare const defaultView: unique symbol;
export declare const destroy: unique symbol;
export declare const dirtyness: unique symbol;
export declare const end: unique symbol;
export declare const entries: unique symbol;
export declare const evaluateCSS: unique symbol;
export declare const evaluateScript: unique symbol;
export declare const exceptionObserver: unique symbol;
export declare const formNode: unique symbol;
export declare const internalId: unique symbol;
export declare const height: unique symbol;
export declare const immediatePropagationStopped: unique symbol;
export declare const indeterminate: unique symbol;
export declare const isFirstWrite: unique symbol;
export declare const isFirstWriteAfterOpen: unique symbol;
export declare const isInPassiveEventListener: unique symbol;
export declare const isValue: unique symbol;
export declare const listenerOptions: unique symbol;
export declare const listeners: unique symbol;
export declare const itemsByName: unique symbol;
export declare const nextActiveElement: unique symbol;
export declare const observeMutations: unique symbol;
export declare const mutationListeners: unique symbol;
export declare const ownerDocument: unique symbol;
export declare const ownerElement: unique symbol;
export declare const propagationStopped: unique symbol;
export declare const readyStateManager: unique symbol;
export declare const referrer: unique symbol;
export declare const registry: unique symbol;
export declare const relList: unique symbol;
export declare const resetSelection: unique symbol;
export declare const rootNode: unique symbol;
export declare const selectNode: unique symbol;
export declare const selectedness: unique symbol;
export declare const selection: unique symbol;
export declare const setupVMContext: unique symbol;
export declare const shadowRoot: unique symbol;
export declare const start: unique symbol;
export declare const style: unique symbol;
export declare const target: unique symbol;
export declare const textAreaNode: unique symbol;
export declare const unobserveMutations: unique symbol;
export declare const reportMutation: unique symbol;
export declare const updateSelectedness: unique symbol;
export declare const url: unique symbol;
export declare const value: unique symbol;
export declare const width: unique symbol;
export declare const window: unique symbol;
export declare const windowResizeListener: unique symbol;
export declare const mutationObservers: unique symbol;
export declare const openerFrame: unique symbol;
export declare const openerWindow: unique symbol;
export declare const popup: unique symbol;
export declare const isConnected: unique symbol;
export declare const parentNode: unique symbol;
export declare const nodeType: unique symbol;
export declare const tagName: unique symbol;
export declare const prefix: unique symbol;
export declare const scrollHeight: unique symbol;
export declare const scrollWidth: unique symbol;
export declare const scrollTop: unique symbol;
export declare const scrollLeft: unique symbol;
export declare const attributes: unique symbol;
export declare const attributesProxy: unique symbol;
export declare const namespaceURI: unique symbol;
export declare const accessKey: unique symbol;
export declare const accessKeyLabel: unique symbol;
export declare const offsetHeight: unique symbol;
export declare const offsetWidth: unique symbol;
export declare const offsetLeft: unique symbol;
export declare const offsetTop: unique symbol;
export declare const clientHeight: unique symbol;
export declare const clientWidth: unique symbol;
export declare const clientLeft: unique symbol;
export declare const clientTop: unique symbol;
export declare const name: unique symbol;
export declare const specified: unique symbol;
export declare const adoptedStyleSheets: unique symbol;
export declare const implementation: unique symbol;
export declare const readyState: unique symbol;
export declare const publicId: unique symbol;
export declare const systemId: unique symbol;
export declare const validationMessage: unique symbol;
export declare const validity: unique symbol;
export declare const returnValue: unique symbol;
export declare const elements: unique symbol;
export declare const length: unique symbol;
export declare const complete: unique symbol;
export declare const naturalHeight: unique symbol;
export declare const naturalWidth: unique symbol;
export declare const loading: unique symbol;
export declare const x: unique symbol;
export declare const y: unique symbol;
export declare const defaultChecked: unique symbol;
export declare const files: unique symbol;
export declare const sheet: unique symbol;
export declare const volume: unique symbol;
export declare const paused: unique symbol;
export declare const currentTime: unique symbol;
export declare const playbackRate: unique symbol;
export declare const defaultPlaybackRate: unique symbol;
export declare const muted: unique symbol;
export declare const defaultMuted: unique symbol;
export declare const preservesPitch: unique symbol;
export declare const buffered: unique symbol;
export declare const duration: unique symbol;
export declare const error: unique symbol;
export declare const ended: unique symbol;
export declare const networkState: unique symbol;
export declare const textTracks: unique symbol;
export declare const seeking: unique symbol;
export declare const seekable: unique symbol;
export declare const played: unique symbol;
export declare const options: unique symbol;
export declare const content: unique symbol;
export declare const mode: unique symbol;
export declare const host: unique symbol;
export declare const setURL: unique symbol;
export declare const localName: unique symbol;
export declare const classRegistry: unique symbol;
export declare const nodeStream: unique symbol;
export declare const location: unique symbol;
export declare const history: unique symbol;
export declare const navigator: unique symbol;
export declare const screen: unique symbol;
export declare const sessionStorage: unique symbol;
export declare const localStorage: unique symbol;
export declare const sandbox: unique symbol;
export declare const cloneNode: unique symbol;
export declare const appendChild: unique symbol;
export declare const removeChild: unique symbol;
export declare const insertBefore: unique symbol;
export declare const replaceChild: unique symbol;
export declare const tracks: unique symbol;
export declare const constraints: unique symbol;
export declare const capabilities: unique symbol;
export declare const settings: unique symbol;
export declare const clone: unique symbol;
export declare const removeNamedItem: unique symbol;
export declare const items: unique symbol;
export declare const selectedOptions: unique symbol;
export declare const styleNode: unique symbol;
export declare const updateSheet: unique symbol;
export declare const clearCache: unique symbol;
export declare const onSetAttribute: unique symbol;
export declare const onRemoveAttribute: unique symbol;
export declare const nodeArray: unique symbol;
export declare const elementArray: unique symbol;
export declare const cache: unique symbol;
export declare const affectsCache: unique symbol;
export declare const forms: unique symbol;
export declare const affectsComputedStyleCache: unique symbol;
export declare const query: unique symbol;
export declare const computedStyle: unique symbol;
export declare const getFormControlItems: unique symbol;
export declare const getFormControlNamedItem: unique symbol;
export declare const dataset: unique symbol;
export declare const getNamespaceItemKey: unique symbol;
export declare const getNamedItemKey: unique symbol;
export declare const itemsByNamespaceURI: unique symbol;
export declare const proxy: unique symbol;
export declare const setNamedItem: unique symbol;
export declare const getTokenList: unique symbol;
export declare const attributeName: unique symbol;
export declare const selectedIndex: unique symbol;
export declare const self: unique symbol;
export declare const parent: unique symbol;
export declare const top: unique symbol;
export declare const areas: unique symbol;
export declare const defaultValue: unique symbol;
export declare const elementIdMap: unique symbol;
export declare const clonable: unique symbol;
export declare const delegatesFocus: unique symbol;
export declare const serializable: unique symbol;
export declare const slotAssignment: unique symbol;
export declare const assignedNodes: unique symbol;
export declare const assignedToSlot: unique symbol;
export declare const cells: unique symbol;
export declare const rows: unique symbol;
export declare const headers: unique symbol;
export declare const tBodies: unique symbol;
export declare const track: unique symbol;
export declare const controlsList: unique symbol;
export declare const mediaKeys: unique symbol;
export declare const remote: unique symbol;
export declare const sinkId: unique symbol;
export declare const srcObject: unique symbol;
export declare const cues: unique symbol;
export declare const activeCues: unique symbol;
export declare const kind: unique symbol;
export declare const label: unique symbol;
export declare const language: unique symbol;
export declare const id: unique symbol;
export declare const illegalConstructor: unique symbol;
export declare const state: unique symbol;
export declare const canvas: unique symbol;
export declare const popoverTargetElement: unique symbol;
export declare const composed: unique symbol;
export declare const bubbles: unique symbol;
export declare const cancelable: unique symbol;
export declare const defaultPrevented: unique symbol;
export declare const eventPhase: unique symbol;
export declare const timeStamp: unique symbol;
export declare const type: unique symbol;
export declare const detail: unique symbol;
export declare const globalObject: unique symbol;
export declare const destroyed: unique symbol;
export declare const aborted: unique symbol;
export declare const browserFrames: unique symbol;
export declare const windowInternalId: unique symbol;
export declare const getItemList: unique symbol;
export declare const requiredExtensions: unique symbol;
export declare const systemLanguage: unique symbol;
export declare const transform: unique symbol;
export declare const baseVal: unique symbol;
export declare const animVal: unique symbol;
export declare const pathLength: unique symbol;
export declare const unitType: unique symbol;
export declare const viewBox: unique symbol;
export declare const markerUnits: unique symbol;
export declare const markerWidth: unique symbol;
export declare const markerHeight: unique symbol;
export declare const values: unique symbol;
export declare const orientType: unique symbol;
export declare const orientAngle: unique symbol;
export declare const refX: unique symbol;
export declare const refY: unique symbol;
export declare const readOnly: unique symbol;
export declare const preserveAspectRatio: unique symbol;
export declare const animatedPoints: unique symbol;
export declare const points: unique symbol;
export declare const rx: unique symbol;
export declare const ry: unique symbol;
export declare const cx: unique symbol;
export declare const cy: unique symbol;
export declare const r: unique symbol;
export declare const clipPathUnits: unique symbol;
export declare const maskUnits: unique symbol;
export declare const maskContentUnits: unique symbol;
export declare const filterUnits: unique symbol;
export declare const primitiveUnits: unique symbol;
export declare const href: unique symbol;
export declare const x1: unique symbol;
export declare const y1: unique symbol;
export declare const x2: unique symbol;
export declare const y2: unique symbol;
export declare const gradientUnits: unique symbol;
export declare const gradientTransform: unique symbol;
export declare const spreadMethod: unique symbol;
export declare const patternUnits: unique symbol;
export declare const patternContentUnits: unique symbol;
export declare const patternTransform: unique symbol;
export declare const fx: unique symbol;
export declare const fy: unique symbol;
export declare const offset: unique symbol;
export declare const disabled: unique symbol;
export declare const textLength: unique symbol;
export declare const lengthAdjust: unique symbol;
export declare const getAttribute: unique symbol;
export declare const setAttribute: unique symbol;
export declare const z: unique symbol;
export declare const w: unique symbol;
export declare const toArray: unique symbol;
export declare const fromString: unique symbol;
export declare const fromArray: unique symbol;
export declare const angle: unique symbol;
export declare const m11: unique symbol;
export declare const m12: unique symbol;
export declare const m13: unique symbol;
export declare const m14: unique symbol;
export declare const m21: unique symbol;
export declare const m22: unique symbol;
export declare const m23: unique symbol;
export declare const m24: unique symbol;
export declare const m31: unique symbol;
export declare const m32: unique symbol;
export declare const m33: unique symbol;
export declare const m34: unique symbol;
export declare const m41: unique symbol;
export declare const m42: unique symbol;
export declare const m43: unique symbol;
export declare const m44: unique symbol;
export declare const setMatrixValue: unique symbol;
export declare const translateSelf: unique symbol;
export declare const rotateSelf: unique symbol;
export declare const rotateAxisAngleSelf: unique symbol;
export declare const scaleSelf: unique symbol;
export declare const scale3dSelf: unique symbol;
export declare const scaleNonUniformSelf: unique symbol;
export declare const skewXSelf: unique symbol;
export declare const skewYSelf: unique symbol;
export declare const multiplySelf: unique symbol;
export declare const matrix: unique symbol;
export declare const domMatrix: unique symbol;
export declare const getDOMMatrix: unique symbol;
export declare const setDOMMatrix: unique symbol;
export declare const attributeValue: unique symbol;
export declare const startOffset: unique symbol;
export declare const method: unique symbol;
export declare const spacing: unique symbol;
export declare const in1: unique symbol;
export declare const in2: unique symbol;
export declare const result: unique symbol;
export declare const bias: unique symbol;
export declare const divisor: unique symbol;
export declare const edgeMode: unique symbol;
export declare const kernelMatrix: unique symbol;
export declare const kernelUnitLengthX: unique symbol;
export declare const kernelUnitLengthY: unique symbol;
export declare const orderX: unique symbol;
export declare const orderY: unique symbol;
export declare const preserveAlpha: unique symbol;
export declare const targetX: unique symbol;
export declare const targetY: unique symbol;
export declare const diffuseConstant: unique symbol;
export declare const surfaceScale: unique symbol;
export declare const scale: unique symbol;
export declare const xChannelSelector: unique symbol;
export declare const yChannelSelector: unique symbol;
export declare const azimuth: unique symbol;
export declare const elevation: unique symbol;
export declare const dx: unique symbol;
export declare const dy: unique symbol;
export declare const stdDeviationX: unique symbol;
export declare const stdDeviationY: unique symbol;
export declare const tableValues: unique symbol;
export declare const slope: unique symbol;
export declare const intercept: unique symbol;
export declare const amplitude: unique symbol;
export declare const exponent: unique symbol;
export declare const crossOrigin: unique symbol;
export declare const operator: unique symbol;
export declare const radiusX: unique symbol;
export declare const radiusY: unique symbol;
export declare const specularConstant: unique symbol;
export declare const specularExponent: unique symbol;
export declare const pointsAtX: unique symbol;
export declare const pointsAtY: unique symbol;
export declare const pointsAtZ: unique symbol;
export declare const limitingConeAngle: unique symbol;
export declare const baseFrequencyX: unique symbol;
export declare const baseFrequencyY: unique symbol;
export declare const numOctaves: unique symbol;
export declare const seed: unique symbol;
export declare const stitchTiles: unique symbol;
export declare const rotateFromVectorSelf: unique symbol;
export declare const flipXSelf: unique symbol;
export declare const flipYSelf: unique symbol;
export declare const invertSelf: unique symbol;
export declare const getLength: unique symbol;
export declare const currentScale: unique symbol;
export declare const rotate: unique symbol;
export declare const bindMethods: unique symbol;
export declare const xmlProcessingInstruction: unique symbol;
export declare const root: unique symbol;
export declare const filterNode: unique symbol;
export declare const customElementReactionStack: unique symbol;
export declare const dispatching: unique symbol;
export declare const modules: unique symbol;
export declare const preloads: unique symbol;
export declare const body: unique symbol;
export declare const redirect: unique symbol;
export declare const referrerPolicy: unique symbol;
export declare const signal: unique symbol;
export declare const bodyUsed: unique symbol;
export declare const credentials: unique symbol;
export declare const blocking: unique symbol;
export declare const moduleImportMap: unique symbol;
export declare const dispatchError: unique symbol;
export declare const supports: unique symbol;
export declare const reason: unique symbol;
export declare const propertyEventListeners: unique symbol;
//# sourceMappingURL=PropertySymbol.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,301 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// We need to set this as a global constant, so that using fake timers in Jest and Vitest won't override this on the global object.
const TIMER = {
setTimeout: globalThis.setTimeout.bind(globalThis),
clearTimeout: globalThis.clearTimeout.bind(globalThis),
clearImmediate: globalThis.clearImmediate.bind(globalThis)
};
/**
* Handles async tasks.
*/
class AsyncTaskManager {
static taskID = 0;
runningTasks = {};
runningTaskCount = 0;
runningTimers = [];
runningImmediates = [];
debugTrace = new Map();
waitUntilCompleteTimer = null;
waitUntilCompleteResolvers = [];
aborted = false;
destroyed = false;
#browserFrame;
#debugTimeout;
/**
* Constructor.
*
* @param browserFrame Browser frame.
*/
constructor(browserFrame) {
this.#browserFrame = browserFrame;
}
/**
* Returns a promise that is resolved when async tasks are complete.
*
* @returns Promise.
*/
waitUntilComplete() {
return new Promise((resolve, reject) => {
this.waitUntilCompleteResolvers.push({ resolve, reject });
this.resolveWhenComplete();
});
}
/**
* Aborts all tasks.
*/
abort() {
if (this.aborted) {
return new Promise((resolve, reject) => {
this.waitUntilCompleteResolvers.push({ resolve, reject });
this.resolveWhenComplete();
});
}
return this.abortAll(false);
}
/**
* Destroys the manager.
*/
destroy() {
if (this.aborted) {
return new Promise((resolve, reject) => {
this.waitUntilCompleteResolvers.push({ resolve, reject });
this.resolveWhenComplete();
});
}
return this.abortAll(true);
}
/**
* Starts a timer.
*
* @param timerID Timer ID.
*/
startTimer(timerID) {
if (this.aborted) {
TIMER.clearTimeout(timerID);
return;
}
if (this.waitUntilCompleteTimer) {
TIMER.clearTimeout(this.waitUntilCompleteTimer);
this.waitUntilCompleteTimer = null;
}
this.runningTimers.push(timerID);
if (this.#browserFrame.page?.context?.browser?.settings?.debug?.traceWaitUntilComplete > 0) {
this.debugTrace.set(timerID, new Error().stack);
}
}
/**
* Ends a timer.
*
* @param timerID Timer ID.
*/
endTimer(timerID) {
if (this.aborted) {
TIMER.clearTimeout(timerID);
return;
}
const index = this.runningTimers.indexOf(timerID);
if (index !== -1) {
this.runningTimers.splice(index, 1);
this.resolveWhenComplete();
}
if (this.#browserFrame.page?.context?.browser?.settings?.debug?.traceWaitUntilComplete > 0) {
this.debugTrace.delete(timerID);
}
}
/**
* Starts an immediate.
*
* @param immediateID Immediate ID.
*/
startImmediate(immediateID) {
if (this.aborted) {
TIMER.clearImmediate(immediateID);
return;
}
if (this.waitUntilCompleteTimer) {
TIMER.clearTimeout(this.waitUntilCompleteTimer);
this.waitUntilCompleteTimer = null;
}
this.runningImmediates.push(immediateID);
if (this.#browserFrame.page?.context?.browser?.settings?.debug?.traceWaitUntilComplete > 0) {
this.debugTrace.set(immediateID, new Error().stack);
}
}
/**
* Ends an immediate.
*
* @param immediateID Immediate ID.
*/
endImmediate(immediateID) {
if (this.aborted) {
TIMER.clearImmediate(immediateID);
return;
}
const index = this.runningImmediates.indexOf(immediateID);
if (index !== -1) {
this.runningImmediates.splice(index, 1);
this.resolveWhenComplete();
}
if (this.#browserFrame.page?.context?.browser?.settings?.debug?.traceWaitUntilComplete > 0) {
this.debugTrace.delete(immediateID);
}
}
/**
* Starts an async task.
*
* @param abortHandler Abort handler.
* @returns Task ID.
*/
startTask(abortHandler) {
if (this.aborted) {
if (abortHandler) {
abortHandler(this.destroyed);
}
throw new this.#browserFrame.window.Error(`Failed to execute 'startTask()' on 'AsyncTaskManager': The asynchrounous task manager has been aborted.`);
}
if (this.waitUntilCompleteTimer) {
TIMER.clearTimeout(this.waitUntilCompleteTimer);
this.waitUntilCompleteTimer = null;
}
const taskID = this.newTaskID();
this.runningTasks[taskID] = abortHandler ? abortHandler : () => { };
this.runningTaskCount++;
if (this.#browserFrame.page?.context?.browser?.settings?.debug?.traceWaitUntilComplete > 0) {
this.debugTrace.set(taskID, new Error().stack);
}
return taskID;
}
/**
* Ends an async task.
*
* @param taskID Task ID.
*/
endTask(taskID) {
if (this.aborted) {
return;
}
if (this.runningTasks[taskID]) {
delete this.runningTasks[taskID];
this.runningTaskCount--;
this.resolveWhenComplete();
}
if (this.#browserFrame.page?.context?.browser?.settings?.debug?.traceWaitUntilComplete > 0) {
this.debugTrace.delete(taskID);
}
}
/**
* Returns the amount of running tasks.
*
* @returns Count.
*/
getTaskCount() {
return this.runningTaskCount;
}
/**
* Returns a new task ID.
*
* @returns Task ID.
*/
newTaskID() {
this.constructor.taskID++;
return this.constructor.taskID;
}
/**
* Resolves when complete.
*/
resolveWhenComplete() {
this.applyDebugging();
if (this.runningTaskCount || this.runningTimers.length || this.runningImmediates.length) {
return;
}
if (this.waitUntilCompleteTimer) {
TIMER.clearTimeout(this.waitUntilCompleteTimer);
this.waitUntilCompleteTimer = null;
}
// It is not possible to detect when all microtasks are complete (such as process.nextTick() or promises).
// To cater for this we use setTimeout() which has the lowest priority and will be executed last.
// @see https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick
this.waitUntilCompleteTimer = TIMER.setTimeout(() => {
this.waitUntilCompleteTimer = null;
if (!this.runningTaskCount && !this.runningTimers.length && !this.runningImmediates.length) {
if (this.#debugTimeout) {
TIMER.clearTimeout(this.#debugTimeout);
}
const resolvers = this.waitUntilCompleteResolvers;
this.waitUntilCompleteResolvers = [];
for (const resolver of resolvers) {
resolver.resolve();
}
this.aborted = false;
}
else {
this.applyDebugging();
}
}, 1);
}
/**
* Applies debugging.
*/
applyDebugging() {
const debug = this.#browserFrame.page?.context?.browser?.settings?.debug;
if (!debug?.traceWaitUntilComplete || debug.traceWaitUntilComplete < 1) {
return;
}
if (this.#debugTimeout) {
return;
}
this.#debugTimeout = TIMER.setTimeout(() => {
this.#debugTimeout = null;
let errorMessage = `The maximum time was reached for "waitUntilComplete()".\n\n${this.debugTrace.size} task${this.debugTrace.size === 1 ? '' : 's'} did not end in time.\n\nThe following traces were recorded:\n\n`;
for (const [key, value] of this.debugTrace.entries()) {
const type = typeof key === 'number' ? 'Task' : 'Timer';
errorMessage += `${type} #${key}\n‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾${value
.replace(/Error:/, '')
.replace(/\s+at /gm, '\n> ')}\n\n`;
}
const error = new Error(errorMessage);
for (const resolver of this.waitUntilCompleteResolvers) {
resolver.reject(error);
}
this.abortAll(true);
}, debug.traceWaitUntilComplete);
}
/**
* Aborts all tasks.
*
* @param destroy Destroy.
*/
abortAll(destroy) {
const runningTimers = this.runningTimers;
const runningImmediates = this.runningImmediates;
const runningTasks = this.runningTasks;
this.aborted = true;
this.destroyed = destroy;
this.runningTasks = {};
this.runningTaskCount = 0;
this.runningImmediates = [];
this.runningTimers = [];
this.debugTrace = new Map();
if (this.waitUntilCompleteTimer) {
TIMER.clearTimeout(this.waitUntilCompleteTimer);
this.waitUntilCompleteTimer = null;
}
for (const immediate of runningImmediates) {
TIMER.clearImmediate(immediate);
}
for (const timer of runningTimers) {
TIMER.clearTimeout(timer);
}
for (const key of Object.keys(runningTasks)) {
runningTasks[key](destroy);
}
// We need to wait for microtasks to complete before resolving.
return new Promise((resolve, reject) => {
this.waitUntilCompleteResolvers.push({ resolve, reject });
this.resolveWhenComplete();
});
}
}
exports.default = AsyncTaskManager;
//# sourceMappingURL=AsyncTaskManager.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,101 @@
import IBrowserFrame from '../browser/types/IBrowserFrame.cjs';
/**
* Handles async tasks.
*/
export default class AsyncTaskManager {
#private;
private static taskID;
private runningTasks;
private runningTaskCount;
private runningTimers;
private runningImmediates;
private debugTrace;
private waitUntilCompleteTimer;
private waitUntilCompleteResolvers;
private aborted;
private destroyed;
/**
* Constructor.
*
* @param browserFrame Browser frame.
*/
constructor(browserFrame: IBrowserFrame);
/**
* Returns a promise that is resolved when async tasks are complete.
*
* @returns Promise.
*/
waitUntilComplete(): Promise<void>;
/**
* Aborts all tasks.
*/
abort(): Promise<void>;
/**
* Destroys the manager.
*/
destroy(): Promise<void>;
/**
* Starts a timer.
*
* @param timerID Timer ID.
*/
startTimer(timerID: NodeJS.Timeout): void;
/**
* Ends a timer.
*
* @param timerID Timer ID.
*/
endTimer(timerID: NodeJS.Timeout): void;
/**
* Starts an immediate.
*
* @param immediateID Immediate ID.
*/
startImmediate(immediateID: NodeJS.Immediate): void;
/**
* Ends an immediate.
*
* @param immediateID Immediate ID.
*/
endImmediate(immediateID: NodeJS.Immediate): void;
/**
* Starts an async task.
*
* @param abortHandler Abort handler.
* @returns Task ID.
*/
startTask(abortHandler?: (destroy?: boolean) => void): number;
/**
* Ends an async task.
*
* @param taskID Task ID.
*/
endTask(taskID: number): void;
/**
* Returns the amount of running tasks.
*
* @returns Count.
*/
getTaskCount(): number;
/**
* Returns a new task ID.
*
* @returns Task ID.
*/
private newTaskID;
/**
* Resolves when complete.
*/
private resolveWhenComplete;
/**
* Applies debugging.
*/
private applyDebugging;
/**
* Aborts all tasks.
*
* @param destroy Destroy.
*/
private abortAll;
}
//# sourceMappingURL=AsyncTaskManager.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AsyncTaskManager.d.ts","sourceRoot":"","sources":["../../src/async-task-manager/AsyncTaskManager.ts"],"names":[],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AmB;IAiC3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAkCtB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;CAoChB"}

89
frontend/node_modules/happy-dom/cjs/base64/Base64.cjs generated vendored Normal file
View File

@@ -0,0 +1,89 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const DOMException_js_1 = __importDefault(require("../exception/DOMException.cjs"));
const DOMExceptionNameEnum_js_1 = __importDefault(require("../exception/DOMExceptionNameEnum.cjs"));
const BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
/**
* Base64 encoding and decoding.
*/
class Base64 {
/**
* Creates a Base64-encoded ASCII string from a binary string (i.e., a string in which each character in the string is treated as a byte of binary data).
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/btoa
* @param data Binay data.
* @returns Base64-encoded string.
*/
static btoa(data) {
const str = data.toString();
if (/[^\u0000-\u00ff]/.test(str)) {
throw new DOMException_js_1.default("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.", DOMExceptionNameEnum_js_1.default.invalidCharacterError);
}
let t = '';
let p = -6;
let a = 0;
let i = 0;
let v = 0;
let c;
while (i < str.length || p > -6) {
if (p < 0) {
if (i < str.length) {
c = str.charCodeAt(i++);
v += 8;
}
else {
c = 0;
}
a = ((a & 255) << 8) | (c & 255);
p += 8;
}
t += BASE64_CHARS.charAt(v > 0 ? (a >> p) & 63 : 64);
p -= 6;
v -= 6;
}
return t;
}
/**
* Decodes a string of data which has been encoded using Base64 encoding.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/atob
* @see https://infra.spec.whatwg.org/#forgiving-base64-encode.
* @see Https://html.spec.whatwg.org/multipage/webappapis.html#btoa.
* @param data Binay string.
* @returns An ASCII string containing decoded data from encodedData.
*/
static atob(data) {
const str = data.toString();
if (/[^\u0000-\u00ff]/.test(str)) {
throw new DOMException_js_1.default("Failed to execute 'atob' on 'Window': The string to be decoded contains characters outside of the Latin1 range.", DOMExceptionNameEnum_js_1.default.invalidCharacterError);
}
if (/[^A-Za-z\d+/=]/.test(str) || str.length % 4 == 1) {
throw new DOMException_js_1.default("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.", DOMExceptionNameEnum_js_1.default.invalidCharacterError);
}
let t = '';
let p = -8;
let a = 0;
let c;
let d;
for (let i = 0; i < str.length; i++) {
if ((c = BASE64_CHARS.indexOf(str.charAt(i))) < 0) {
continue;
}
a = (a << 6) | (c & 63);
if ((p += 6) >= 0) {
d = (a >> p) & 255;
if (c !== 64) {
t += String.fromCharCode(d);
}
a &= 63;
p -= 8;
}
}
return t;
}
}
exports.default = Base64;
//# sourceMappingURL=Base64.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Base64.cjs","sourceRoot":"","sources":["../../src/base64/Base64.ts"],"names":[],"mappings":";;;;;AAAA,mFAAwD;AACxD,mGAAwE;AAExE,MAAM,YAAY,GAAG,mEAAmE,CAAC;AAEzF;;GAEG;AACH,MAAqB,MAAM;IAC1B;;;;;;OAMG;IACI,MAAM,CAAC,IAAI,CAAC,IAAa;QAC/B,MAAM,GAAG,GAAY,IAAK,CAAC,QAAQ,EAAE,CAAC;QACtC,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,yBAAY,CACrB,iHAAiH,EACjH,iCAAoB,CAAC,qBAAqB,CAC1C,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,IAAI,CA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,GAAG,CAAC,CAAC,CAAC;QACX,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAI,CAAC,CAAC;QACN,IAAI,CAAC,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnD,SAAS;YACV,CAAC;YACD,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACxB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;oBACd,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC7B,CAAC;gBACD,CAAC,IAAI,EAAE,CAAC;gBACR,CAAC,IAAI,CAAC,CAAC;YACR,CAAC;QACF,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC;CACD;AAxFD,yBAwFC"}

24
frontend/node_modules/happy-dom/cjs/base64/Base64.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
/**
* Base64 encoding and decoding.
*/
export default class Base64 {
/**
* Creates a Base64-encoded ASCII string from a binary string (i.e., a string in which each character in the string is treated as a byte of binary data).
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/btoa
* @param data Binay data.
* @returns Base64-encoded string.
*/
static btoa(data: unknown): string;
/**
* Decodes a string of data which has been encoded using Base64 encoding.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/atob
* @see https://infra.spec.whatwg.org/#forgiving-base64-encode.
* @see Https://html.spec.whatwg.org/multipage/webappapis.html#btoa.
* @param data Binay string.
* @returns An ASCII string containing decoded data from encodedData.
*/
static atob(data: unknown): string;
}
//# sourceMappingURL=Base64.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Base64.d.ts","sourceRoot":"","sources":["../../src/base64/Base64.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IAC1B;;;;;;OAMG;WACW,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAiCzC;;;;;;;;OAQG;WACW,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;CAsCzC"}

137
frontend/node_modules/happy-dom/cjs/browser/Browser.cjs generated vendored Normal file
View File

@@ -0,0 +1,137 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const BrowserContext_js_1 = __importDefault(require("./BrowserContext.cjs"));
const BrowserSettingsFactory_js_1 = __importDefault(require("./BrowserSettingsFactory.cjs"));
const BrowserExceptionObserver_js_1 = __importDefault(require("./utilities/BrowserExceptionObserver.cjs"));
const PropertySymbol = __importStar(require("../PropertySymbol.cjs"));
const BrowserErrorCaptureEnum_js_1 = __importDefault(require("./enums/BrowserErrorCaptureEnum.cjs"));
/**
* Browser.
*/
class Browser {
contexts;
settings;
console;
[PropertySymbol.exceptionObserver] = null;
/**
* Constructor.
*
* @param [options] Options.
* @param [options.settings] Browser settings.
* @param [options.console] Console.
*/
constructor(options) {
this.console = options?.console || null;
this.settings = BrowserSettingsFactory_js_1.default.createSettings(options?.settings);
if (this.settings.errorCapture === BrowserErrorCaptureEnum_js_1.default.processLevel) {
this[PropertySymbol.exceptionObserver] = new BrowserExceptionObserver_js_1.default();
}
this.contexts = [new BrowserContext_js_1.default(this)];
}
/**
* Returns the default context.
*
* @returns Default context.
*/
get defaultContext() {
if (this.contexts.length === 0) {
throw new Error('No default context. The browser has been closed.');
}
return this.contexts[0];
}
/**
* Aborts all ongoing operations and destroys the browser.
*/
async close() {
await Promise.all(this.contexts.slice().map((context) => context.close()));
this.contexts = [];
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
async waitUntilComplete() {
if (this.contexts.length === 0) {
throw new Error('No default context. The browser has been closed.');
}
await Promise.all(this.contexts.map((page) => page.waitUntilComplete()));
}
/**
* Aborts all ongoing operations.
*/
abort() {
// Using Promise instead of async/await to prevent microtask
return new Promise((resolve, reject) => {
if (!this.contexts.length) {
resolve();
return;
}
Promise.all(this.contexts.slice().map((context) => context.abort()))
.then(() => resolve())
.catch((error) => reject(error));
});
}
/**
* Creates a new incognito context.
*
* @returns Context.
*/
newIncognitoContext() {
if (this.contexts.length === 0) {
throw new Error('No default context. The browser has been closed.');
}
const context = new BrowserContext_js_1.default(this);
this.contexts.push(context);
return context;
}
/**
* Creates a new page.
*
* @returns Page.
*/
newPage() {
if (this.contexts.length === 0) {
throw new Error('No default context. The browser has been closed.');
}
return this.contexts[0].newPage();
}
}
exports.default = Browser;
//# sourceMappingURL=Browser.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Browser.cjs","sourceRoot":"","sources":["../../src/browser/Browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAiD;AAEjD,4FAAiE;AAGjE,0GAA+E;AAC/E,qEAAuD;AACvD,oGAAyE;AAEzE;;GAEG;AACH,MAAqB,OAAO;IACX,QAAQ,CAAmB;IAC3B,QAAQ,CAAmB;IAC3B,OAAO,CAAiB;IACjC,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAoC,IAAI,CAAC;IAElF;;;;;;OAMG;IACH,YAAY,OAAoE;QAC/E,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,mCAAsB,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,KAAK,oCAAuB,CAAC,YAAY,EAAE,CAAC;YACzE,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAG,IAAI,qCAAwB,EAAE,CAAC;QACzE,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,2BAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,IAAW,cAAc;QACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,KAAK;QACjB,MAA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CAAC;QACD,MAAM,OAAO,GAAG,IAAI,2BAAc,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,OAAO,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,OAAO;QACb,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;CACD;AA/FD,0BA+FC"}

View File

@@ -0,0 +1,60 @@
import IBrowserSettings from './types/IBrowserSettings.cjs';
import BrowserContext from './BrowserContext.cjs';
import IOptionalBrowserSettings from './types/IOptionalBrowserSettings.cjs';
import BrowserPage from './BrowserPage.cjs';
import IBrowser from './types/IBrowser.cjs';
import BrowserExceptionObserver from './utilities/BrowserExceptionObserver.cjs';
import * as PropertySymbol from '../PropertySymbol.cjs';
/**
* Browser.
*/
export default class Browser implements IBrowser {
readonly contexts: BrowserContext[];
readonly settings: IBrowserSettings;
readonly console: Console | null;
[PropertySymbol.exceptionObserver]: BrowserExceptionObserver | null;
/**
* Constructor.
*
* @param [options] Options.
* @param [options.settings] Browser settings.
* @param [options.console] Console.
*/
constructor(options?: {
settings?: IOptionalBrowserSettings;
console?: Console;
});
/**
* Returns the default context.
*
* @returns Default context.
*/
get defaultContext(): BrowserContext;
/**
* Aborts all ongoing operations and destroys the browser.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
waitUntilComplete(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Creates a new incognito context.
*
* @returns Context.
*/
newIncognitoContext(): BrowserContext;
/**
* Creates a new page.
*
* @returns Page.
*/
newPage(): BrowserPage;
}
//# sourceMappingURL=Browser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Browser.d.ts","sourceRoot":"","sources":["../../src/browser/Browser.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAC3D,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,wBAAwB,MAAM,qCAAqC,CAAC;AAE3E,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,wBAAwB,MAAM,yCAAyC,CAAC;AAC/E,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AAGvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,YAAW,QAAQ;IAC/C,SAAgB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3C,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAC3C,SAAgB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAQ;IAElF;;;;;;OAMG;gBACS,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,wBAAwB,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;IAShF;;;;OAIG;IACH,IAAW,cAAc,IAAI,cAAc,CAK1C;IAED;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/C;;OAEG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAa7B;;;;OAIG;IACI,mBAAmB,IAAI,cAAc;IAS5C;;;;OAIG;IACI,OAAO,IAAI,WAAW;CAM7B"}

View File

@@ -0,0 +1,85 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const CookieContainer_js_1 = __importDefault(require("../cookie/CookieContainer.cjs"));
const ResponseCache_js_1 = __importDefault(require("../fetch/cache/response/ResponseCache.cjs"));
const BrowserPage_js_1 = __importDefault(require("./BrowserPage.cjs"));
const PreflightResponseCache_js_1 = __importDefault(require("../fetch/cache/preflight/PreflightResponseCache.cjs"));
/**
* Browser context.
*/
class BrowserContext {
pages = [];
browser;
cookieContainer = new CookieContainer_js_1.default();
responseCache = new ResponseCache_js_1.default();
preflightResponseCache = new PreflightResponseCache_js_1.default();
/**
* Constructor.
*
* @param browser
*/
constructor(browser) {
this.browser = browser;
}
/**
* Aborts all ongoing operations and destroys the context.
*/
async close() {
if (!this.browser) {
return;
}
await Promise.all(this.pages.slice().map((page) => page.close()));
const browser = this.browser;
const index = browser.contexts.indexOf(this);
if (index !== -1) {
browser.contexts.splice(index, 1);
}
this.pages = [];
this.browser = null;
this.cookieContainer = null;
this.responseCache.clear();
this.preflightResponseCache.clear();
this.responseCache = null;
this.preflightResponseCache = null;
if (browser.contexts.length === 0) {
browser.close();
}
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
async waitUntilComplete() {
await Promise.all(this.pages.map((page) => page.waitUntilComplete()));
}
/**
* Aborts all ongoing operations.
*/
abort() {
return new Promise((resolve, reject) => {
if (!this.pages.length) {
resolve();
return;
}
Promise.all(this.pages.slice().map((page) => page.abort()))
.then(() => resolve())
.catch((error) => reject(error));
});
}
/**
* Creates a new page.
*
* @returns Page.
*/
newPage() {
const page = new BrowserPage_js_1.default(this);
this.pages.push(page);
return page;
}
}
exports.default = BrowserContext;
//# sourceMappingURL=BrowserContext.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserContext.cjs","sourceRoot":"","sources":["../../src/browser/BrowserContext.ts"],"names":[],"mappings":";;;;;AAAA,sFAA2D;AAG3D,gGAAqE;AAErE,sEAA2C;AAG3C,mHAAwF;AAExF;;GA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AK,EAAE,CAAC;QACjB,CAAC;IACF,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iBAAiB;QAC7B,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,KAAK;QACX,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBACxB,OAAO,EAAE,CAAC;gBACV,OAAO;YACR,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;iBACzD,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;iBACrB,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,OAAO;QACb,MAAM,IAAI,GAAG,IAAI,wBAAW,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA3ED,iCA2EC"}

View File

@@ -0,0 +1,43 @@
import ICookieContainer from '../cookie/ICookieContainer.cjs';
import IResponseCache from '../fetch/cache/response/IResponseCache.cjs';
import Browser from './Browser.cjs';
import BrowserPage from './BrowserPage.cjs';
import IBrowserContext from './types/IBrowserContext.cjs';
import IPreflightResponseCache from '../fetch/cache/preflight/IPreflightResponseCache.cjs';
/**
* Browser context.
*/
export default class BrowserContext implements IBrowserContext {
readonly pages: BrowserPage[];
readonly browser: Browser;
readonly cookieContainer: ICookieContainer;
readonly responseCache: IResponseCache;
readonly preflightResponseCache: IPreflightResponseCache;
/**
* Constructor.
*
* @param browser
*/
constructor(browser: Browser);
/**
* Aborts all ongoing operations and destroys the context.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
waitUntilComplete(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Creates a new page.
*
* @returns Page.
*/
newPage(): BrowserPage;
}
//# sourceMappingURL=BrowserContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserContext.d.ts","sourceRoot":"","sources":["../../src/browser/BrowserContext.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,cAAc,MAAM,2CAA2C,CAAC;AAEvE,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,eAAe,MAAM,4BAA4B,CAAC;AACzD,OAAO,uBAAuB,MAAM,qDAAqD,CAAC;AAG1F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,eAAe;IAC7D,SAAgB,KAAK,EAAE,WAAW,EAAE,CAAM;IAC1C,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,eAAe,EAAE,gBAAgB,CAAyB;IAC1E,SAAgB,aAAa,EAAE,cAAc,CAAuB;IACpE,SAAgB,sBAAsB,EAAE,uBAAuB,CAAgC;IAE/F;;;;OAIG;gBACS,OAAO,EAAE,OAAO;IAI5B;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBnC;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;OAEG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY7B;;;;OAIG;IACI,OAAO,IAAI,WAAW;CAK7B"}

View File

@@ -0,0 +1,234 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const PropertySymbol = __importStar(require("../PropertySymbol.cjs"));
const AsyncTaskManager_js_1 = __importDefault(require("../async-task-manager/AsyncTaskManager.cjs"));
const BrowserWindow_js_1 = __importDefault(require("../window/BrowserWindow.cjs"));
const BrowserFrameURL_js_1 = __importDefault(require("./utilities/BrowserFrameURL.cjs"));
const BrowserFrameScriptEvaluator_js_1 = __importDefault(require("./utilities/BrowserFrameScriptEvaluator.cjs"));
const BrowserFrameNavigator_js_1 = __importDefault(require("./utilities/BrowserFrameNavigator.cjs"));
const HistoryScrollRestorationEnum_js_1 = __importDefault(require("../history/HistoryScrollRestorationEnum.cjs"));
/**
* Browser frame.
*/
class BrowserFrame {
childFrames = [];
parentFrame = null;
page;
window;
[PropertySymbol.asyncTaskManager] = new AsyncTaskManager_js_1.default(this);
[PropertySymbol.listeners] = { navigation: [] };
[PropertySymbol.openerFrame] = null;
[PropertySymbol.openerWindow] = null;
[PropertySymbol.popup] = false;
[PropertySymbol.history] = [
{
title: '',
href: 'about:blank',
state: null,
scrollRestoration: HistoryScrollRestorationEnum_js_1.default.auto,
method: 'GET',
formData: null,
isCurrent: true
}
];
/**
* Constructor.
*
* @param page Page.
*/
constructor(page) {
this.page = page;
this.window = new BrowserWindow_js_1.default(this);
// Attach process level error capturing.
if (page.context.browser[PropertySymbol.exceptionObserver]) {
page.context.browser[PropertySymbol.exceptionObserver].observe(this.window);
}
}
/**
* Returns the content.
*
* @returns Content.
*/
get content() {
return this.window.document.documentElement.outerHTML;
}
/**
* Sets the content.
*
* @param content Content.
*/
set content(content) {
this.window.document[PropertySymbol.isFirstWrite] = true;
this.window.document[PropertySymbol.isFirstWriteAfterOpen] = false;
this.window.document.open();
this.window.document.write(content);
}
/**
* Returns the URL.
*
* @returns URL.
*/
get url() {
return this.window.location.href;
}
/**
* Sets the content.
*
* @param url URL.
*/
set url(url) {
this.window[PropertySymbol.location][PropertySymbol.setURL](this, BrowserFrameURL_js_1.default.getRelativeURL(this, url).href);
}
/**
* Returns document.
*
* @returns Document.
*/
get document() {
return this.window?.document ?? null;
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
async waitUntilComplete() {
await Promise.all([
this[PropertySymbol.asyncTaskManager].waitUntilComplete(),
...this.childFrames.map((frame) => frame.waitUntilComplete())
]);
}
/**
* Returns a promise that is resolved when the frame has navigated and the response HTML has been written to the document.
*/
waitForNavigation() {
return new Promise((resolve) => this[PropertySymbol.listeners].navigation.push(resolve));
}
/**
* Aborts all ongoing operations.
*/
abort() {
if (!this.childFrames.length) {
return this[PropertySymbol.asyncTaskManager].abort();
}
return new Promise((resolve, reject) => {
// Using Promise instead of async/await to prevent microtask
Promise.all(this.childFrames
.map((frame) => frame.abort())
.concat([this[PropertySymbol.asyncTaskManager].abort()]))
.then(() => resolve())
.catch(reject);
});
}
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script) {
return BrowserFrameScriptEvaluator_js_1.default.evaluate(this, script);
}
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url, options) {
return BrowserFrameNavigator_js_1.default.navigate({
windowClass: BrowserWindow_js_1.default,
frame: this,
url: url,
goToOptions: options
});
}
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options) {
return BrowserFrameNavigator_js_1.default.navigateBack({
windowClass: BrowserWindow_js_1.default,
frame: this,
goToOptions: options
});
}
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options) {
return BrowserFrameNavigator_js_1.default.navigateForward({
windowClass: BrowserWindow_js_1.default,
frame: this,
goToOptions: options
});
}
/**
* Navigates a delta in history.
*
* @param steps Steps.
* @param [options] Options.
*/
goSteps(steps, options) {
return BrowserFrameNavigator_js_1.default.navigateSteps({
windowClass: BrowserWindow_js_1.default,
frame: this,
steps: steps,
goToOptions: options
});
}
/**
* Reloads the current frame.
*
* @param [options] Options.
* @returns Response.
*/
reload(options) {
return BrowserFrameNavigator_js_1.default.reload({
windowClass: BrowserWindow_js_1.default,
frame: this,
goToOptions: options
});
}
}
exports.default = BrowserFrame;
//# sourceMappingURL=BrowserFrame.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserFrame.cjs","sourceRoot":"","sources":["../../src/browser/BrowserFrame.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qEAAuD;AACvD,oGAAyE;AAEzE,kFAAuD;AAKvD,wFAA6D;AAC7D,gHAAqF;AACrF,oGAAyE;AAIzE,iHAAsF;AAEtF;;GAEG;AACH,MAAqB,YAAY;IAChB,WAAW,GAAmB,EAAE,CAAC;IACjC,WAAW,G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SACpB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,KAAc,EAAE,OAAsB;QACpD,OAAO,kCAAqB,CAAC,aAAa,CAAC;YAC1C,WAAW,EAAE,0BAAa;YAC1B,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,OAAO;SACpB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAAwB;QACrC,OAAO,kCAAqB,CAAC,MAAM,CAAC;YACnC,WAAW,EAAE,0BAAa;YAC1B,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,OAAO;SACpB,CAAC,CAAC;IACJ,CAAC;CACD;AA5MD,+BA4MC"}

View File

@@ -0,0 +1,118 @@
import BrowserPage from './BrowserPage.cjs';
import * as PropertySymbol from '../PropertySymbol.cjs';
import IBrowserFrame from './types/IBrowserFrame.cjs';
import BrowserWindow from '../window/BrowserWindow.cjs';
import CrossOriginBrowserWindow from '../window/CrossOriginBrowserWindow.cjs';
import Response from '../fetch/Response.cjs';
import IGoToOptions from './types/IGoToOptions.cjs';
import { Script } from 'vm';
import IReloadOptions from './types/IReloadOptions.cjs';
import Document from '../nodes/document/Document.cjs';
import IHistoryItem from '../history/IHistoryItem.cjs';
/**
* Browser frame.
*/
export default class BrowserFrame implements IBrowserFrame {
readonly childFrames: BrowserFrame[];
readonly parentFrame: BrowserFrame | null;
readonly page: BrowserPage;
readonly window: BrowserWindow;
[PropertySymbol.asyncTaskManager]: any;
[PropertySymbol.listeners]: {
navigation: Array<() => void>;
};
[PropertySymbol.openerFrame]: IBrowserFrame | null;
[PropertySymbol.openerWindow]: BrowserWindow | CrossOriginBrowserWindow | null;
[PropertySymbol.popup]: boolean;
[PropertySymbol.history]: IHistoryItem[];
/**
* Constructor.
*
* @param page Page.
*/
constructor(page: BrowserPage);
/**
* Returns the content.
*
* @returns Content.
*/
get content(): string;
/**
* Sets the content.
*
* @param content Content.
*/
set content(content: string);
/**
* Returns the URL.
*
* @returns URL.
*/
get url(): string;
/**
* Sets the content.
*
* @param url URL.
*/
set url(url: string);
/**
* Returns document.
*
* @returns Document.
*/
get document(): Document;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete(): Promise<void>;
/**
* Returns a promise that is resolved when the frame has navigated and the response HTML has been written to the document.
*/
waitForNavigation(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script: string | Script): any;
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url: string, options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates a delta in history.
*
* @param steps Steps.
* @param [options] Options.
*/
goSteps(steps?: number, options?: IGoToOptions): Promise<Response | null>;
/**
* Reloads the current frame.
*
* @param [options] Options.
* @returns Response.
*/
reload(options?: IReloadOptions): Promise<Response | null>;
}
//# sourceMappingURL=BrowserFrame.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserFrame.d.ts","sourceRoot":"","sources":["../../src/browser/BrowserFrame.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AAEvD,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAC7E,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAI5B,OAAO,c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IAgB7B;;;;;OAKG;IACI,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG;IAI7C;;;;;;OAMG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAS1E;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAQ/D;;;;OAIG;IACI,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAQlE;;;;;OAKG;IACI,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAShF;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAOjE"}

View File

@@ -0,0 +1,161 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const VirtualConsolePrinter_js_1 = __importDefault(require("../console/VirtualConsolePrinter.cjs"));
const BrowserFrame_js_1 = __importDefault(require("./BrowserFrame.cjs"));
const VirtualConsole_js_1 = __importDefault(require("../console/VirtualConsole.cjs"));
const BrowserPageUtility_js_1 = __importDefault(require("./utilities/BrowserPageUtility.cjs"));
const DefaultBrowserPageViewport_js_1 = __importDefault(require("./DefaultBrowserPageViewport.cjs"));
const Event_js_1 = __importDefault(require("../event/Event.cjs"));
/**
* Browser page.
*/
class BrowserPage {
virtualConsolePrinter = new VirtualConsolePrinter_js_1.default();
mainFrame;
context;
console;
viewport = Object.assign({}, DefaultBrowserPageViewport_js_1.default);
/**
* Constructor.
*
* @param context Browser context.
*/
constructor(context) {
this.context = context;
this.console = context.browser.console ?? new VirtualConsole_js_1.default(this.virtualConsolePrinter);
this.mainFrame = new BrowserFrame_js_1.default(this);
}
/**
* Returns frames.
*/
get frames() {
return BrowserPageUtility_js_1.default.getFrames(this);
}
/**
* Returns the viewport.
*/
get content() {
return this.mainFrame.content;
}
/**
* Sets the content.
*
* @param content Content.
*/
set content(content) {
this.mainFrame.content = content;
}
/**
* Returns the URL.
*
* @returns URL.
*/
get url() {
return this.mainFrame.url;
}
/**
* Sets the content.
*
* @param url URL.
*/
set url(url) {
this.mainFrame.url = url;
}
/**
* Aborts all ongoing operations and destroys the page.
*/
close() {
return BrowserPageUtility_js_1.default.closePage(this);
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete() {
return this.mainFrame.waitUntilComplete();
}
/**
* Returns a promise that is resolved when the page has navigated and the response HTML has been written to the document.
*/
waitForNavigation() {
return this.mainFrame.waitForNavigation();
}
/**
* Aborts all ongoing operations.
*/
abort() {
return this.mainFrame.abort();
}
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script) {
return this.mainFrame.evaluate(script);
}
/**
* Sets the viewport.
*
* @param viewport Viewport.
*/
setViewport(viewport) {
const previousViewport = Object.assign({}, this.viewport);
Object.assign(this.viewport, viewport);
if (previousViewport.width !== this.viewport.width ||
previousViewport.height !== this.viewport.height ||
previousViewport.devicePixelRatio !== this.viewport.devicePixelRatio) {
this.mainFrame.window.dispatchEvent(new Event_js_1.default('resize'));
}
}
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url, options) {
return this.mainFrame.goto(url, options);
}
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options) {
return this.mainFrame.goBack(options);
}
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options) {
return this.mainFrame.goForward(options);
}
/**
* Navigates a delta in history.
*
* @param delta Delta.
* @param steps
* @param [options] Options.
*/
goSteps(steps, options) {
return this.mainFrame.goSteps(steps, options);
}
/**
* Reloads the current page.
*
* @param [options] Options.
* @returns Response.
*/
reload(options) {
return this.mainFrame.reload(options);
}
}
exports.default = BrowserPage;
//# sourceMappingURL=BrowserPage.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserPage.cjs","sourceRoot":"","sources":["../../src/browser/BrowserPage.ts"],"names":[],"mappings":";;;;;AAAA,mGAAwE;AACxE,wEAA6C;AAE7C,qFAA0D;AAE1D,8FAAmE;AAOnE,oGAAyE;AACzE,iEAAsC;AAEtC;;GAEG;AACH,MAAqB,WAAW;IACf,qBAAqB,GAAG,IAAI,kCAAqB,EAAE,CAAC;IACpD,SAAS,CAAe;IACxB,OAAO,CAAiB;IACxB,OAAO,CAAU;IACjB,QAAQ,GAAyB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,uCAA0B,CAAC,CAAC;IAE/F;;;;OAIG;IACH,YAAY,OAAuB;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,2BAAc,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACzF,IAAI,CAAC,SAAS,GAAG,IAAI,yBAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QAChB,OAAuB,+BAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,IAAW,OAAO,CAAC,OAAO;QACzB,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,IAAW,GAAG;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;IAC3B,CAAC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AAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAAsB;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,OAAsB;QACtC,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,KAAc,EAAE,OAAsB;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACD;AAnKD,8BAmKC"}

View File

@@ -0,0 +1,117 @@
import VirtualConsolePrinter from '../console/VirtualConsolePrinter.cjs';
import BrowserFrame from './BrowserFrame.cjs';
import BrowserContext from './BrowserContext.cjs';
import IBrowserPage from './types/IBrowserPage.cjs';
import { Script } from 'vm';
import IGoToOptions from './types/IGoToOptions.cjs';
import Response from '../fetch/Response.cjs';
import IReloadOptions from './types/IReloadOptions.cjs';
import IBrowserPageViewport from './types/IBrowserPageViewport.cjs';
import IOptionalBrowserPageViewport from './types/IOptionalBrowserPageViewport.cjs';
/**
* Browser page.
*/
export default class BrowserPage implements IBrowserPage {
readonly virtualConsolePrinter: VirtualConsolePrinter;
readonly mainFrame: BrowserFrame;
readonly context: BrowserContext;
readonly console: Console;
readonly viewport: IBrowserPageViewport;
/**
* Constructor.
*
* @param context Browser context.
*/
constructor(context: BrowserContext);
/**
* Returns frames.
*/
get frames(): BrowserFrame[];
/**
* Returns the viewport.
*/
get content(): string;
/**
* Sets the content.
*
* @param content Content.
*/
set content(content: string);
/**
* Returns the URL.
*
* @returns URL.
*/
get url(): string;
/**
* Sets the content.
*
* @param url URL.
*/
set url(url: string);
/**
* Aborts all ongoing operations and destroys the page.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete(): Promise<void>;
/**
* Returns a promise that is resolved when the page has navigated and the response HTML has been written to the document.
*/
waitForNavigation(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script: string | Script): any;
/**
* Sets the viewport.
*
* @param viewport Viewport.
*/
setViewport(viewport: IOptionalBrowserPageViewport): void;
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url: string, options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates a delta in history.
*
* @param delta Delta.
* @param steps
* @param [options] Options.
*/
goSteps(steps?: number, options?: IGoToOptions): Promise<Response | null>;
/**
* Reloads the current page.
*
* @param [options] Options.
* @returns Response.
*/
reload(options?: IReloadOptions): Promise<Response | null>;
}
//# sourceMappingURL=BrowserPage.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserPage.d.ts","sourceRoot":"","sources":["../../src/browser/BrowserPage.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,OAAO,YAAY,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,c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O,CAAC,QAAQ,GAAG,IAAI,CAAC;IAI/D;;;;OAIG;IACI,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAIlE;;;;;;OAMG;IACI,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAIhF;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAGjE"}

View File

@@ -0,0 +1,50 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const DefaultBrowserSettings_js_1 = __importDefault(require("./DefaultBrowserSettings.cjs"));
/**
* Browser settings utility.
*/
class BrowserSettingsFactory {
/**
* Returns browser settings.
*
* @param [settings] Browser settings.
* @param [freezeObject] "true" to freeze the object.
* @returns Settings.
*/
static createSettings(settings) {
return {
...DefaultBrowserSettings_js_1.default,
...settings,
navigation: {
...DefaultBrowserSettings_js_1.default.navigation,
...settings?.navigation
},
navigator: {
...DefaultBrowserSettings_js_1.default.navigator,
...settings?.navigator
},
timer: {
...DefaultBrowserSettings_js_1.default.timer,
...settings?.timer
},
fetch: {
...DefaultBrowserSettings_js_1.default.fetch,
...settings?.fetch
},
device: {
...DefaultBrowserSettings_js_1.default.device,
...settings?.device
},
debug: {
...DefaultBrowserSettings_js_1.default.debug,
...settings?.debug
}
};
}
}
exports.default = BrowserSettingsFactory;
//# sourceMappingURL=BrowserSettingsFactory.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserSettingsFactory.cjs","sourceRoot":"","sources":["../../src/browser/BrowserSettingsFactory.ts"],"names":[],"mappings":";;;;;AAEA,4FAAiE;AAEjE;;GAEG;AACH,MAAqB,sBAAsB;IAC1C;;;;;;OAMG;IACI,MAAM,CAAC,cAAc,CAAC,QAAmC;QAC/D,OAAO;YACN,GAAG,mCAAsB;YACzB,GAAG,QAAQ;YACX,UAAU,EAAE;gBACX,GAAG,mCAAsB,CAAC,UAAU;gBACpC,GAAG,QAAQ,EAAE,UAAU;aACvB;YACD,SAAS,EAAE;gBACV,GAAG,mCAAsB,CAAC,SAAS;gBACnC,GAAG,QAAQ,EAAE,SAAS;aACtB;YACD,KAAK,EAAE;gBACN,GAAG,mCAAsB,CAAC,KAAK;gBAC/B,GAAG,QAAQ,EAAE,KAAK;aAClB;YACD,KAAK,EAAE;gBACN,GAAG,mCAAsB,CAAC,KAAK;gBAC/B,GAAG,QAAQ,EAAE,KAAK;aAClB;YACD,MAAM,EAAE;gBACP,GAAG,mCAAsB,CAAC,MAAM;gBAChC,GAAG,QAAQ,EAAE,MAAM;aACnB;YACD,KAAK,EAAE;gBACN,GAAG,mCAAsB,CAAC,KAAK;gBAC/B,GAAG,QAAQ,EAAE,KAAK;aAClB;SACD,CAAC;IACH,CAAC;CACD;AAtCD,yCAsCC"}

View File

@@ -0,0 +1,16 @@
import IBrowserSettings from './types/IBrowserSettings.cjs';
import IOptionalBrowserSettings from './types/IOptionalBrowserSettings.cjs';
/**
* Browser settings utility.
*/
export default class BrowserSettingsFactory {
/**
* Returns browser settings.
*
* @param [settings] Browser settings.
* @param [freezeObject] "true" to freeze the object.
* @returns Settings.
*/
static createSettings(settings?: IOptionalBrowserSettings): IBrowserSettings;
}
//# sourceMappingURL=BrowserSettingsFactory.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserSettingsFactory.d.ts","sourceRoot":"","sources":["../../src/browser/BrowserSettingsFactory.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAC3D,OAAO,wBAAwB,MAAM,qCAAqC,CAAC;AAG3E;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IAC1C;;;;;;OAMG;WACW,cAAc,CAAC,QAAQ,CAAC,EAAE,wBAAwB,GAAG,gBAAgB;CA8BnF"}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
width: 1024,
height: 768,
devicePixelRatio: 1
};
//# sourceMappingURL=DefaultBrowserPageViewport.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultBrowserPageViewport.cjs","sourceRoot":"","sources":["../../src/browser/DefaultBrowserPageViewport.ts"],"names":[],"mappings":";;AAEA,kBAAqC;IACpC,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,GAAG;IACX,gBAAgB,EAAE,CAAC;CACnB,CAAC"}

View File

@@ -0,0 +1,4 @@
import IBrowserPageViewport from './types/IBrowserPageViewport.cjs';
declare const _default: IBrowserPageViewport;
export default _default;
//# sourceMappingURL=DefaultBrowserPageViewport.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultBrowserPageViewport.d.ts","sourceRoot":"","sources":["../../src/browser/DefaultBrowserPageViewport.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;wBAEnD,oBAAoB;AAApC,wBAIE"}

View File

@@ -0,0 +1,51 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const version_js_1 = __importDefault(require("../version.cjs"));
const BrowserErrorCaptureEnum_js_1 = __importDefault(require("./enums/BrowserErrorCaptureEnum.cjs"));
const BrowserNavigationCrossOriginPolicyEnum_js_1 = __importDefault(require("./enums/BrowserNavigationCrossOriginPolicyEnum.cjs"));
exports.default = {
disableJavaScriptEvaluation: false,
disableJavaScriptFileLoading: false,
disableCSSFileLoading: false,
disableIframePageLoading: false,
disableComputedStyleRendering: false,
disableErrorCapturing: false,
errorCapture: BrowserErrorCaptureEnum_js_1.default.tryAndCatch,
enableFileSystemHttpRequests: false,
timer: {
maxTimeout: -1,
maxIntervalTime: -1,
maxIntervalIterations: -1,
preventTimerLoops: false
},
fetch: {
disableSameOriginPolicy: false,
disableStrictSSL: false,
interceptor: null,
virtualServers: null
},
navigation: {
disableMainFrameNavigation: false,
disableChildFrameNavigation: false,
disableChildPageNavigation: false,
disableFallbackToSetURL: false,
crossOriginPolicy: BrowserNavigationCrossOriginPolicyEnum_js_1.default.anyOrigin
},
navigator: {
userAgent: `Mozilla/5.0 (X11; ${process.platform.charAt(0).toUpperCase() + process.platform.slice(1) + ' ' + process.arch}) AppleWebKit/537.36 (KHTML, like Gecko) HappyDOM/${version_js_1.default.version}`,
maxTouchPoints: 0
},
device: {
prefersColorScheme: 'light',
prefersReducedMotion: 'no-preference',
mediaType: 'screen',
forcedColors: 'none'
},
debug: {
traceWaitUntilComplete: -1
}
};
//# sourceMappingURL=DefaultBrowserSettings.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultBrowserSettings.cjs","sourceRoot":"","sources":["../../src/browser/DefaultBrowserSettings.ts"],"names":[],"mappings":";;;;;AAAA,+DAA2C;AAC3C,oGAAyE;AACzE,kIAAuG;AAGvG,kBAAiC;IAChC,2BAA2B,EAAE,KAAK;IAClC,4BAA4B,EAAE,KAAK;IACnC,qBAAqB,EAAE,KAAK;IAC5B,wBAAwB,EAAE,KAAK;IAC/B,6BAA6B,EAAE,KAAK;IACpC,qBAAqB,EAAE,KAAK;IAC5B,YAAY,EAAE,oCAAuB,CAAC,WAAW;IACjD,4BAA4B,EAAE,KAAK;IACnC,KAAK,EAAE;QACN,UAAU,EAAE,CAAC,CAAC;QACd,eAAe,EAAE,CAAC,CAAC;QACnB,qBAAqB,EAAE,CAAC,CAAC;QACzB,iBAAiB,EAAE,KAAK;KACxB;IACD,KAAK,EAAE;QACN,uBAAuB,EAAE,KAAK;QAC9B,gBAAgB,EAAE,KAAK;QACvB,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;KACpB;IACD,UAAU,EAAE;QACX,0BAA0B,EAAE,KAAK;QACjC,2BAA2B,EAAE,KAAK;QAClC,0BAA0B,EAAE,KAAK;QACjC,uBAAuB,EAAE,KAAK;QAC9B,iBAAiB,EAAE,mDAAsC,CAAC,SAAS;KACnE;IACD,SAAS,EAAE;QACV,SAAS,EAAE,qBACV,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,IACtF,qDAAqD,oBAAc,CAAC,OAAO,EAAE;QAC7E,cAAc,EAAE,CAAC;KACjB;IACD,MAAM,EAAE;QACP,kBAAkB,EAAE,OAAO;QAC3B,oBAAoB,EAAE,eAAe;QACrC,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,MAAM;KACpB;IACD,KAAK,EAAE;QACN,sBAAsB,EAAE,CAAC,CAAC;KAC1B;CACD,CAAC"}

View File

@@ -0,0 +1,4 @@
import IBrowserSettings from './types/IBrowserSettings.cjs';
declare const _default: IBrowserSettings;
export default _default;
//# sourceMappingURL=DefaultBrowserSettings.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultBrowserSettings.d.ts","sourceRoot":"","sources":["../../src/browser/DefaultBrowserSettings.ts"],"names":[],"mappings":"AAGA,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;wBAE3C,gBAAgB;AAAhC,wBA2CE"}

View File

@@ -0,0 +1,133 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const DetachedBrowserContext_js_1 = __importDefault(require("./DetachedBrowserContext.cjs"));
const BrowserSettingsFactory_js_1 = __importDefault(require("../BrowserSettingsFactory.cjs"));
const PropertySymbol = __importStar(require("../../PropertySymbol.cjs"));
const BrowserErrorCaptureEnum_js_1 = __importDefault(require("../enums/BrowserErrorCaptureEnum.cjs"));
const BrowserExceptionObserver_js_1 = __importDefault(require("../utilities/BrowserExceptionObserver.cjs"));
/**
* Detached browser used when constructing a Window instance without a browser.
*/
class DetachedBrowser {
contexts;
settings;
console;
windowClass;
[PropertySymbol.exceptionObserver] = null;
/**
* Constructor.
*
* @param windowClass Window class.
* @param [options] Options.
* @param [options.settings] Browser settings.
* @param [options.console] Console.
*/
constructor(windowClass, options) {
this.windowClass = windowClass;
this.console = options?.console || null;
this.settings = BrowserSettingsFactory_js_1.default.createSettings(options?.settings);
if (this.settings.errorCapture === BrowserErrorCaptureEnum_js_1.default.processLevel) {
this[PropertySymbol.exceptionObserver] = new BrowserExceptionObserver_js_1.default();
}
this.contexts = [];
this.contexts.push(new DetachedBrowserContext_js_1.default(this));
}
/**
* Returns the default context.
*
* @returns Default context.
*/
get defaultContext() {
if (this.contexts.length === 0) {
throw new Error('No default context. The browser has been closed.');
}
return this.contexts[0];
}
/**
* Aborts all ongoing operations and destroys the browser.
*/
async close() {
await Promise.all(this.contexts.slice().map((context) => context.close()));
this.contexts = [];
this.console = null;
this.windowClass = null;
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
async waitUntilComplete() {
await Promise.all(this.contexts.map((page) => page.waitUntilComplete()));
}
/**
* Aborts all ongoing operations.
*/
abort() {
// Using Promise instead of async/await to prevent microtask
return new Promise((resolve, reject) => {
if (!this.contexts.length) {
resolve();
return;
}
Promise.all(this.contexts.slice().map((context) => context.abort()))
.then(() => resolve())
.catch((error) => reject(error));
});
}
/**
* Creates a new incognito context.
*/
newIncognitoContext() {
throw new Error('Not possible to create a new context on a detached browser.');
}
/**
* Creates a new page.
*
* @returns Page.
*/
newPage() {
if (this.contexts.length === 0) {
throw new Error('No default context. The browser has been closed.');
}
return this.contexts[0].newPage();
}
}
exports.default = DetachedBrowser;
//# sourceMappingURL=DetachedBrowser.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowser.cjs","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4FAAiE;AAEjE,6FAAkE;AAKlE,wEAA0D;AAC1D,qGAA0E;AAC1E,2GAAgF;AAEhF;;GAEG;AACH,MAAqB,eAAe;IACnB,QAAQ,CAA2B;IACnC,QAAQ,CAAmB;IAC3B,OAAO,CAAiB;IACxB,WAAW,CAGD;IACnB,CAAC,cAAc,CAAC,iBAAiB,CAAC,GAAoC,IAAI,CAAC;IAElF;;;;;;;OAOG;IACH,YACC,WAGkB,EAClB,OAAoE;QAEpE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,mCAAsB,CAAC,cAAc,CAA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AAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC3B,OAAO,EAAE,CAAC;gBACV,OAAO;YACR,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;iBAClE,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;iBACrB,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,mBAAmB;QACzB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAChF,CAAC;IAED;;;;OAIG;IACI,OAAO;QACb,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;CACD;AApGD,kCAoGC"}

View File

@@ -0,0 +1,70 @@
import IBrowserSettings from '../types/IBrowserSettings.cjs';
import DetachedBrowserContext from './DetachedBrowserContext.cjs';
import IOptionalBrowserSettings from '../types/IOptionalBrowserSettings.cjs';
import DetachedBrowserPage from './DetachedBrowserPage.cjs';
import IBrowser from '../types/IBrowser.cjs';
import IBrowserFrame from '../types/IBrowserFrame.cjs';
import BrowserWindow from '../../window/BrowserWindow.cjs';
import * as PropertySymbol from '../../PropertySymbol.cjs';
import BrowserExceptionObserver from '../utilities/BrowserExceptionObserver.cjs';
/**
* Detached browser used when constructing a Window instance without a browser.
*/
export default class DetachedBrowser implements IBrowser {
readonly contexts: DetachedBrowserContext[];
readonly settings: IBrowserSettings;
readonly console: Console | null;
readonly windowClass: new (browserFrame: IBrowserFrame, options?: {
url?: string;
width?: number;
height?: number;
}) => BrowserWindow | null;
[PropertySymbol.exceptionObserver]: BrowserExceptionObserver | null;
/**
* Constructor.
*
* @param windowClass Window class.
* @param [options] Options.
* @param [options.settings] Browser settings.
* @param [options.console] Console.
*/
constructor(windowClass: new (browserFrame: IBrowserFrame, options?: {
url?: string;
width?: number;
height?: number;
}) => BrowserWindow, options?: {
settings?: IOptionalBrowserSettings;
console?: Console;
});
/**
* Returns the default context.
*
* @returns Default context.
*/
get defaultContext(): DetachedBrowserContext;
/**
* Aborts all ongoing operations and destroys the browser.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
waitUntilComplete(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Creates a new incognito context.
*/
newIncognitoContext(): DetachedBrowserContext;
/**
* Creates a new page.
*
* @returns Page.
*/
newPage(): DetachedBrowserPage;
}
//# sourceMappingURL=DetachedBrowser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowser.d.ts","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAC5D,OAAO,sBAAsB,MAAM,6BAA6B,CAAC;AACjE,OAAO,wBAAwB,MAAM,sCAAsC,CAAC;AAE5E,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAE1D,OAAO,wBAAwB,MAAM,0CAA0C,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,YAAW,QAAQ;IACvD,SAAgB,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnD,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAC3C,SAAgB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxC,SAAgB,WAAW,EAAE,KAC5B,YAAY,EAAE,aAAa,EAC3B,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KACvD,aAAa,GAAG,IAAI,CAAC;IACnB,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAQ;IAElF;;;;;;;OAOG;gBAEF,WAAW,EAAE,KACZ,YAAY,EAAE,aAAa,EAC3B,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KACvD,aAAa,EAClB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,wBAAwB,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;IAYrE;;;;OAIG;IACH,IAAW,cAAc,IAAI,sBAAsB,CAKlD;IAED;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAOnC;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;OAEG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAa7B;;OAEG;IACI,mBAAmB,IAAI,sBAAsB;IAIpD;;;;OAIG;IACI,OAAO,IAAI,mBAAmB;CAMrC"}

View File

@@ -0,0 +1,88 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const DetachedBrowserPage_js_1 = __importDefault(require("./DetachedBrowserPage.cjs"));
const CookieContainer_js_1 = __importDefault(require("../../cookie/CookieContainer.cjs"));
const ResponseCache_js_1 = __importDefault(require("../../fetch/cache/response/ResponseCache.cjs"));
const PreflightResponseCache_js_1 = __importDefault(require("../../fetch/cache/preflight/PreflightResponseCache.cjs"));
/**
* Detached browser context used when constructing a Window instance without a browser.
*/
class DetachedBrowserContext {
pages;
browser;
cookieContainer = new CookieContainer_js_1.default();
responseCache = new ResponseCache_js_1.default();
preflightResponseCache = new PreflightResponseCache_js_1.default();
/**
* Constructor.
*
* @param browser Browser.
*/
constructor(browser) {
this.browser = browser;
this.pages = [];
this.pages.push(new DetachedBrowserPage_js_1.default(this));
}
/**
* Aborts all ongoing operations and destroys the context.
*/
async close() {
if (!this.browser) {
return;
}
await Promise.all(this.pages.slice().map((page) => page.close()));
const browser = this.browser;
const index = browser.contexts.indexOf(this);
if (index !== -1) {
browser.contexts.splice(index, 1);
}
this.pages = [];
this.browser = null;
this.cookieContainer = null;
this.responseCache.clear();
this.preflightResponseCache.clear();
this.responseCache = null;
this.preflightResponseCache = null;
if (browser.contexts.length === 0) {
browser.close();
}
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
async waitUntilComplete() {
await Promise.all(this.pages.map((page) => page.waitUntilComplete()));
}
/**
* Aborts all ongoing operations.
*/
abort() {
return new Promise((resolve, reject) => {
if (!this.pages.length) {
resolve();
return;
}
Promise.all(this.pages.slice().map((page) => page.abort()))
.then(() => resolve())
.catch((error) => reject(error));
});
}
/**
* Creates a new page.
*
* @param [opener] Opener.
* @returns Page.
*/
newPage() {
const page = new DetachedBrowserPage_js_1.default(this);
this.pages.push(page);
return page;
}
}
exports.default = DetachedBrowserContext;
//# sourceMappingURL=DetachedBrowserContext.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowserContext.cjs","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowserContext.ts"],"names":[],"mappings":";;;;;AACA,sFAA2D;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';
import IBrowserContext from '../types/IBrowserContext.cjs';
import ICookieContainer from '../../cookie/ICookieContainer.cjs';
import IResponseCache from '../../fetch/cache/response/IResponseCache.cjs';
import IPreflightResponseCache from '../../fetch/cache/preflight/IPreflightResponseCache.cjs';
/**
* Detached browser context used when constructing a Window instance without a browser.
*/
export default class DetachedBrowserContext implements IBrowserContext {
readonly pages: DetachedBrowserPage[];
readonly browser: DetachedBrowser;
readonly cookieContainer: ICookieContainer;
readonly responseCache: IResponseCache;
readonly preflightResponseCache: IPreflightResponseCache;
/**
* Constructor.
*
* @param browser Browser.
*/
constructor(browser: DetachedBrowser);
/**
* Aborts all ongoing operations and destroys the context.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
waitUntilComplete(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Creates a new page.
*
* @param [opener] Opener.
* @returns Page.
*/
newPage(): DetachedBrowserPage;
}
//# sourceMappingURL=DetachedBrowserContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowserContext.d.ts","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowserContext.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAGhE,OAAO,cAAc,MAAM,8CAA8C,CAAC;AAC1E,OAAO,uBAAuB,MAAM,wDAAwD,CAAC;AAG7F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,YAAW,eAAe;IACrE,SAAgB,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7C,SAAgB,OAAO,EAAE,eAAe,CAAC;IACzC,SAAgB,eAAe,EAAE,gBAAgB,CAAyB;IAC1E,SAAgB,aAAa,EAAE,cAAc,CAAuB;IACpE,SAAgB,sBAAsB,EAAE,uBAAuB,CAAgC;IAE/F;;;;OAIG;gBACS,OAAO,EAAE,eAAe;IAMpC;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBnC;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;OAEG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY7B;;;;;OAKG;IACI,OAAO,IAAI,mBAAmB;CAKrC"}

View File

@@ -0,0 +1,249 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const PropertySymbol = __importStar(require("../../PropertySymbol.cjs"));
const AsyncTaskManager_js_1 = __importDefault(require("../../async-task-manager/AsyncTaskManager.cjs"));
const BrowserFrameURL_js_1 = __importDefault(require("../utilities/BrowserFrameURL.cjs"));
const BrowserFrameScriptEvaluator_js_1 = __importDefault(require("../utilities/BrowserFrameScriptEvaluator.cjs"));
const BrowserFrameNavigator_js_1 = __importDefault(require("../utilities/BrowserFrameNavigator.cjs"));
const HistoryScrollRestorationEnum_js_1 = __importDefault(require("../../history/HistoryScrollRestorationEnum.cjs"));
/**
* Browser frame used when constructing a Window instance without a browser.
*/
class DetachedBrowserFrame {
childFrames = [];
parentFrame = null;
page;
// Needs to be injected from the outside when the browser frame is constructed.
window;
[PropertySymbol.asyncTaskManager] = new AsyncTaskManager_js_1.default(this);
[PropertySymbol.listeners] = { navigation: [] };
[PropertySymbol.openerFrame] = null;
[PropertySymbol.openerWindow] = null;
[PropertySymbol.popup] = false;
[PropertySymbol.history] = [
{
title: '',
href: 'about:blank',
state: null,
scrollRestoration: HistoryScrollRestorationEnum_js_1.default.auto,
method: 'GET',
formData: null,
isCurrent: true
}
];
/**
* Constructor.
*
* @param page Page.
* @param [window] Window.
*/
constructor(page) {
this.page = page;
if (page.context.browser.contexts[0]?.pages[0]?.mainFrame) {
this.window = new this.page.context.browser.windowClass(this);
}
// Attach process level error capturing.
if (page.context.browser[PropertySymbol.exceptionObserver]) {
page.context.browser[PropertySymbol.exceptionObserver].observe(this.window);
}
}
/**
* Returns the content.
*
* @returns Content.
*/
get content() {
if (!this.window) {
throw new Error('The frame has been destroyed, the "window" property is not set.');
}
return this.window.document.documentElement.outerHTML;
}
/**
* Sets the content.
*
* @param content Content.
*/
set content(content) {
if (!this.window) {
throw new Error('The frame has been destroyed, the "window" property is not set.');
}
this.window.document[PropertySymbol.isFirstWrite] = true;
this.window.document[PropertySymbol.isFirstWriteAfterOpen] = false;
this.window.document.open();
this.window.document.write(content);
}
/**
* Returns the URL.
*
* @returns URL.
*/
get url() {
if (!this.window) {
throw new Error('The frame has been destroyed, the "window" property is not set.');
}
return this.window.location.href;
}
/**
* Sets the content.
*
* @param url URL.
*/
set url(url) {
if (!this.window) {
throw new Error('The frame has been destroyed, the "window" property is not set.');
}
this.window[PropertySymbol.location][PropertySymbol.setURL](this, BrowserFrameURL_js_1.default.getRelativeURL(this, url).href);
}
/**
* Returns document.
*
* @returns Document.
*/
get document() {
return this.window?.document ?? null;
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
async waitUntilComplete() {
await Promise.all([
this[PropertySymbol.asyncTaskManager].waitUntilComplete(),
...this.childFrames.map((frame) => frame.waitUntilComplete())
]);
}
/**
* Returns a promise that is resolved when the frame has navigated and the response HTML has been written to the document.
*/
waitForNavigation() {
return new Promise((resolve) => this[PropertySymbol.listeners].navigation.push(resolve));
}
/**
* Aborts all ongoing operations.
*/
abort() {
if (!this.childFrames.length) {
return this[PropertySymbol.asyncTaskManager].abort();
}
return new Promise((resolve, reject) => {
// Using Promise instead of async/await to prevent microtask
Promise.all(this.childFrames
.map((frame) => frame.abort())
.concat([this[PropertySymbol.asyncTaskManager].abort()]))
.then(() => resolve())
.catch(reject);
});
}
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script) {
return BrowserFrameScriptEvaluator_js_1.default.evaluate(this, script);
}
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url, options) {
return BrowserFrameNavigator_js_1.default.navigate({
windowClass: this.page.context.browser.windowClass,
frame: this,
url: url,
goToOptions: options
});
}
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options) {
return BrowserFrameNavigator_js_1.default.navigateBack({
windowClass: this.page.context.browser.windowClass,
frame: this,
goToOptions: options
});
}
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options) {
return BrowserFrameNavigator_js_1.default.navigateForward({
windowClass: this.page.context.browser.windowClass,
frame: this,
goToOptions: options
});
}
/**
* Navigates a delta in history.
*
* @param steps Steps.
* @param [options] Options.
*/
goSteps(steps, options) {
return BrowserFrameNavigator_js_1.default.navigateSteps({
windowClass: this.page.context.browser.windowClass,
frame: this,
steps: steps,
goToOptions: options
});
}
/**
* Reloads the current frame.
*
* @param [options] Options.
* @returns Response.
*/
reload(options) {
return BrowserFrameNavigator_js_1.default.reload({
windowClass: this.page.context.browser.windowClass,
frame: this,
goToOptions: options
});
}
}
exports.default = DetachedBrowserFrame;
//# sourceMappingURL=DetachedBrowserFrame.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowserFrame.cjs","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowserFrame.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wEAA0D;AAC1D,uGAA4E;AAK5E,yFAA8D;AAC9D,iHAAsF;AACtF,qGAA0E;AAM1E,oHAAyF;AAEzF;;GAEG;AACH,MAAqB,oBAAoB;IACxB,WAAW,GAA2B,EAAE,CAAC;IACzC,WAAW,GAAgC,IAAI,CAAC;IAChD,IAAI,CAAsB;IAC1C,+EAA+E;IACxE,MAAM,CAAgB;IACtB,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAAG,IAAI,6BAAgB,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC,cAAc,CAAC,SAAS,CAAC,GAAsC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACnF,CAAC,cAAc,CAAC,WAAW,CAAC,GAAyB,IAAI,CAAC;IAC1D,CAAC,cAAc,CAAC,YAAY,CAAC,GAAoD,IAAI,CAAC;IACtF,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAC/B,CAAC,cAAc,CAAC,OAAO,CAAC,GAAmB;QACjD;YACC,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,IAAI;YACX,iBAAiB,EAAE,yCAA4B,CAAC,IAAI;YACpD,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;SACf;KACD,CAAC;IAEF;;;;;OA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C,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW;YAClD,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,OAAO;SACpB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,KAAc,EAAE,OAAsB;QACpD,OAAO,kCAAqB,CAAC,aAAa,CAAC;YAC1C,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW;YAClD,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,OAAO;SACpB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAAwB;QACrC,OAAO,kCAAqB,CAAC,MAAM,CAAC;YACnC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW;YAClD,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,OAAO;SACpB,CAAC,CAAC;IACJ,CAAC;CACD;AA5ND,uCA4NC"}

View File

@@ -0,0 +1,119 @@
import DetachedBrowserPage from './DetachedBrowserPage.cjs';
import * as PropertySymbol from '../../PropertySymbol.cjs';
import IBrowserFrame from '../types/IBrowserFrame.cjs';
import Response from '../../fetch/Response.cjs';
import IGoToOptions from '../types/IGoToOptions.cjs';
import { Script } from 'vm';
import BrowserWindow from '../../window/BrowserWindow.cjs';
import IReloadOptions from '../types/IReloadOptions.cjs';
import Document from '../../nodes/document/Document.cjs';
import CrossOriginBrowserWindow from '../../window/CrossOriginBrowserWindow.cjs';
import IHistoryItem from '../../history/IHistoryItem.cjs';
/**
* Browser frame used when constructing a Window instance without a browser.
*/
export default class DetachedBrowserFrame implements IBrowserFrame {
readonly childFrames: DetachedBrowserFrame[];
readonly parentFrame: DetachedBrowserFrame | null;
readonly page: DetachedBrowserPage;
window: BrowserWindow;
[PropertySymbol.asyncTaskManager]: any;
[PropertySymbol.listeners]: {
navigation: Array<() => void>;
};
[PropertySymbol.openerFrame]: IBrowserFrame | null;
[PropertySymbol.openerWindow]: BrowserWindow | CrossOriginBrowserWindow | null;
[PropertySymbol.popup]: boolean;
[PropertySymbol.history]: IHistoryItem[];
/**
* Constructor.
*
* @param page Page.
* @param [window] Window.
*/
constructor(page: DetachedBrowserPage);
/**
* Returns the content.
*
* @returns Content.
*/
get content(): string;
/**
* Sets the content.
*
* @param content Content.
*/
set content(content: string);
/**
* Returns the URL.
*
* @returns URL.
*/
get url(): string;
/**
* Sets the content.
*
* @param url URL.
*/
set url(url: string);
/**
* Returns document.
*
* @returns Document.
*/
get document(): Document;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete(): Promise<void>;
/**
* Returns a promise that is resolved when the frame has navigated and the response HTML has been written to the document.
*/
waitForNavigation(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script: string | Script): any;
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url: string, options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates a delta in history.
*
* @param steps Steps.
* @param [options] Options.
*/
goSteps(steps?: number, options?: IGoToOptions): Promise<Response | null>;
/**
* Reloads the current frame.
*
* @param [options] Options.
* @returns Response.
*/
reload(options?: IReloadOptions): Promise<Response | null>;
}
//# sourceMappingURL=DetachedBrowserFrame.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowserFrame.d.ts","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowserFrame.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D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AW,GAAG,IAAI,MAAM,CAKvB;IAED;;;;OAIG;IACH,IAAW,GAAG,CAAC,GAAG,EAZA,MAYA,EAQjB;IAED;;;;OAIG;IACH,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IAED;;OAEG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/C;;OAEG;IACI,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzC;;OAEG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB7B;;;;;OAKG;IACI,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG;IAI7C;;;;;;OAMG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAS1E;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAQ/D;;;;OAIG;IACI,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAQlE;;;;;OAKG;IACI,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAShF;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAOjE"}

View File

@@ -0,0 +1,175 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const VirtualConsolePrinter_js_1 = __importDefault(require("../../console/VirtualConsolePrinter.cjs"));
const DetachedBrowserFrame_js_1 = __importDefault(require("./DetachedBrowserFrame.cjs"));
const VirtualConsole_js_1 = __importDefault(require("../../console/VirtualConsole.cjs"));
const BrowserPageUtility_js_1 = __importDefault(require("../utilities/BrowserPageUtility.cjs"));
const DefaultBrowserPageViewport_js_1 = __importDefault(require("../DefaultBrowserPageViewport.cjs"));
const Event_js_1 = __importDefault(require("../../event/Event.cjs"));
/**
* Detached browser page used when constructing a Window instance without a browser.
*/
class DetachedBrowserPage {
virtualConsolePrinter = new VirtualConsolePrinter_js_1.default();
mainFrame;
context;
console;
viewport = Object.assign({}, DefaultBrowserPageViewport_js_1.default);
/**
* Constructor.
*
* @param context Browser context.
*/
constructor(context) {
this.context = context;
this.console = context.browser.console ?? new VirtualConsole_js_1.default(this.virtualConsolePrinter);
this.mainFrame = new DetachedBrowserFrame_js_1.default(this);
}
/**
* Returns frames.
*/
get frames() {
return BrowserPageUtility_js_1.default.getFrames(this);
}
/**
* Returns the viewport.
*/
get content() {
return this.mainFrame.content;
}
/**
* Sets the content.
*
* @param content Content.
*/
set content(content) {
this.mainFrame.content = content;
}
/**
* Returns the URL.
*
* @returns URL.
*/
get url() {
return this.mainFrame.url;
}
/**
* Sets the content.
*
* @param url URL.
*/
set url(url) {
this.mainFrame.url = url;
}
/**
* Aborts all ongoing operations and destroys the page.
*/
close() {
// Using Promise instead of async/await to prevent microtask
return new Promise((resolve, reject) => {
const context = this.context;
BrowserPageUtility_js_1.default.closePage(this)
.then(() => {
// As we are in a detached page, a context or browser should not exist without a page as there are no references to them.
if (context.pages[0] === this) {
context.close().then(resolve).catch(reject);
}
else {
resolve();
}
})
.catch(reject);
});
}
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete() {
return this.mainFrame.waitUntilComplete();
}
/**
* Returns a promise that is resolved when the page has navigated and the response HTML has been written to the document.
*/
waitForNavigation() {
return this.mainFrame.waitForNavigation();
}
/**
* Aborts all ongoing operations.
*/
abort() {
return this.mainFrame.abort();
}
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script) {
return this.mainFrame.evaluate(script);
}
/**
* Sets the viewport.
*
* @param viewport Viewport.
*/
setViewport(viewport) {
const previousViewport = Object.assign({}, this.viewport);
Object.assign(this.viewport, viewport);
if (previousViewport.width !== this.viewport.width ||
previousViewport.height !== this.viewport.height ||
previousViewport.devicePixelRatio !== this.viewport.devicePixelRatio) {
this.mainFrame.window.dispatchEvent(new Event_js_1.default('resize'));
}
}
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url, options) {
return this.mainFrame.goto(url, options);
}
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options) {
return this.mainFrame.goBack(options);
}
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options) {
return this.mainFrame.goForward(options);
}
/**
* Navigates a delta in history.
*
* @param delta Delta.
* @param steps
* @param [options] Options.
*/
goSteps(steps, options) {
return this.mainFrame.goSteps(steps, options);
}
/**
* Reloads the current page.
*
* @param [options] Options.
* @returns Response.
*/
reload(options) {
return this.mainFrame.reload(options);
}
}
exports.default = DetachedBrowserPage;
//# sourceMappingURL=DetachedBrowserPage.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowserPage.cjs","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowserPage.ts"],"names":[],"mappings":";;;;;AAAA,sGAA2E;AAC3E,wFAA6D;AAE7D,wFAA6D;AAK7D,+FAAoE;AAEpE,qGAA0E;AAG1E,oEAAyC;AAEzC;;GAEG;AACH,MAAqB,mBAAmB;IACvB,qBAAqB,GAAG,IAAI,kCAAqB,EAAE,CAAC;IACpD,SAAS,CAAuB;IAChC,OAAO,CAAyB;IAChC,OAAO,CAAU;IACjB,QAAQ,GAAyB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,uCAA0B,CAAC,CAAC;IAE/F;;;;OAIG;IACH,YAAY,OAA+B;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OA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,CAAC,OAAsB;QACtC,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,KAAc,EAAE,OAAsB;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACD;AAhLD,sCAgLC"}

View File

@@ -0,0 +1,117 @@
import VirtualConsolePrinter from '../../console/VirtualConsolePrinter.cjs';
import DetachedBrowserFrame from './DetachedBrowserFrame.cjs';
import DetachedBrowserContext from './DetachedBrowserContext.cjs';
import IBrowserPage from '../types/IBrowserPage.cjs';
import { Script } from 'vm';
import IGoToOptions from '../types/IGoToOptions.cjs';
import Response from '../../fetch/Response.cjs';
import IReloadOptions from '../types/IReloadOptions.cjs';
import IOptionalBrowserPageViewport from '../types/IOptionalBrowserPageViewport.cjs';
import IBrowserPageViewport from '../types/IBrowserPageViewport.cjs';
/**
* Detached browser page used when constructing a Window instance without a browser.
*/
export default class DetachedBrowserPage implements IBrowserPage {
readonly virtualConsolePrinter: VirtualConsolePrinter;
readonly mainFrame: DetachedBrowserFrame;
readonly context: DetachedBrowserContext;
readonly console: Console;
readonly viewport: IBrowserPageViewport;
/**
* Constructor.
*
* @param context Browser context.
*/
constructor(context: DetachedBrowserContext);
/**
* Returns frames.
*/
get frames(): DetachedBrowserFrame[];
/**
* Returns the viewport.
*/
get content(): string;
/**
* Sets the content.
*
* @param content Content.
*/
set content(content: string);
/**
* Returns the URL.
*
* @returns URL.
*/
get url(): string;
/**
* Sets the content.
*
* @param url URL.
*/
set url(url: string);
/**
* Aborts all ongoing operations and destroys the page.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete(): Promise<void>;
/**
* Returns a promise that is resolved when the page has navigated and the response HTML has been written to the document.
*/
waitForNavigation(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Evaluates code or a VM Script in the page's context.
*
* @param script Script.
* @returns Result.
*/
evaluate(script: string | Script): any;
/**
* Sets the viewport.
*
* @param viewport Viewport.
*/
setViewport(viewport: IOptionalBrowserPageViewport): void;
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
* @returns Response.
*/
goto(url: string, options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates a delta in history.
*
* @param delta Delta.
* @param steps
* @param [options] Options.
*/
goSteps(steps?: number, options?: IGoToOptions): Promise<Response | null>;
/**
* Reloads the current page.
*
* @param [options] Options.
* @returns Response.
*/
reload(options?: IReloadOptions): Promise<Response | null>;
}
//# sourceMappingURL=DetachedBrowserPage.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DetachedBrowserPage.d.ts","sourceRoot":"","sources":["../../../src/browser/detached-browser/DetachedBrowserPage.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,wCAAwC,CAAC;AAC3E,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,sBAAsB,MAAM,6BAA6B,CAAC;AAEjE,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAE/C,OAAO,cAAc,MAAM,4BAA4B,CAAC;AAExD,OAAO,4BAA4B,MAAM,0CAA0C,CAAC;AACpF,OAAO,oBAAoB,MAAM,kCAAkC,C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YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAIlE;;;;;;OAMG;IACI,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAIhF;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAGjE"}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BrowserErrorCaptureEnum;
(function (BrowserErrorCaptureEnum) {
/** Happy DOM use try and catch when evaluating code, but will not be able to catch all errors and Promise rejections. This will decrease performance as using try and catch makes the execution significally slower. This is the default setting. */
BrowserErrorCaptureEnum["tryAndCatch"] = "tryAndCatch";
/** Happy DOM will add an event listener to the Node.js process to catch all errors and Promise rejections. This will not work in Jest and Vitest as it conflicts with their error listeners. */
BrowserErrorCaptureEnum["processLevel"] = "processLevel";
/** Error capturing is disabled. Errors and Promise rejections will be thrown. */
BrowserErrorCaptureEnum["disabled"] = "disabled";
})(BrowserErrorCaptureEnum || (BrowserErrorCaptureEnum = {}));
exports.default = BrowserErrorCaptureEnum;
//# sourceMappingURL=BrowserErrorCaptureEnum.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserErrorCaptureEnum.cjs","sourceRoot":"","sources":["../../../src/browser/enums/BrowserErrorCaptureEnum.ts"],"names":[],"mappings":";;AAAA,IAAK,uBAOJ;AAPD,WAAK,uBAAuB;IAC3B,qPAAqP;IACrP,sDAA2B,CAAA;IAC3B,gMAAgM;IAChM,wDAA6B,CAAA;IAC7B,iFAAiF;IACjF,gDAAqB,CAAA;AACtB,CAAC,EAPI,uBAAuB,KAAvB,uBAAuB,QAO3B;AAED,kBAAe,uBAAuB,CAAC"}

View File

@@ -0,0 +1,10 @@
declare enum BrowserErrorCaptureEnum {
/** Happy DOM use try and catch when evaluating code, but will not be able to catch all errors and Promise rejections. This will decrease performance as using try and catch makes the execution significally slower. This is the default setting. */
tryAndCatch = "tryAndCatch",
/** Happy DOM will add an event listener to the Node.js process to catch all errors and Promise rejections. This will not work in Jest and Vitest as it conflicts with their error listeners. */
processLevel = "processLevel",
/** Error capturing is disabled. Errors and Promise rejections will be thrown. */
disabled = "disabled"
}
export default BrowserErrorCaptureEnum;
//# sourceMappingURL=BrowserErrorCaptureEnum.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserErrorCaptureEnum.d.ts","sourceRoot":"","sources":["../../../src/browser/enums/BrowserErrorCaptureEnum.ts"],"names":[],"mappings":"AAAA,aAAK,uBAAuB;IAC3B,qPAAqP;IACrP,WAAW,gBAAgB;IAC3B,gMAAgM;IAChM,YAAY,iBAAiB;IAC7B,iFAAiF;IACjF,QAAQ,aAAa;CACrB;AAED,eAAe,uBAAuB,CAAC"}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BrowserNavigationCrossOriginPolicyEnum;
(function (BrowserNavigationCrossOriginPolicyEnum) {
/** The browser can navigate to any origin. */
BrowserNavigationCrossOriginPolicyEnum["anyOrigin"] = "anyOrigin";
/** The browser can only navigate to the same origin as the current page or its parent. */
BrowserNavigationCrossOriginPolicyEnum["sameOrigin"] = "sameOrigin";
/** The browser can never navigate from a secure protocol (https) to an unsecure protocol (http), but it can always navigate to a secure (https). */
BrowserNavigationCrossOriginPolicyEnum["strictOrigin"] = "strictOrigin";
})(BrowserNavigationCrossOriginPolicyEnum || (BrowserNavigationCrossOriginPolicyEnum = {}));
exports.default = BrowserNavigationCrossOriginPolicyEnum;
//# sourceMappingURL=BrowserNavigationCrossOriginPolicyEnum.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserNavigationCrossOriginPolicyEnum.cjs","sourceRoot":"","sources":["../../../src/browser/enums/BrowserNavigationCrossOriginPolicyEnum.ts"],"names":[],"mappings":";;AAAA,IAAK,sCAOJ;AAPD,WAAK,sCAAsC;IAC1C,8CAA8C;IAC9C,iEAAuB,CAAA;IACvB,0FAA0F;IAC1F,mEAAyB,CAAA;IACzB,oJAAoJ;IACpJ,uEAA6B,CAAA;AAC9B,CAAC,EAPI,sCAAsC,KAAtC,sCAAsC,QAO1C;AAED,kBAAe,sCAAsC,CAAC"}

View File

@@ -0,0 +1,10 @@
declare enum BrowserNavigationCrossOriginPolicyEnum {
/** The browser can navigate to any origin. */
anyOrigin = "anyOrigin",
/** The browser can only navigate to the same origin as the current page or its parent. */
sameOrigin = "sameOrigin",
/** The browser can never navigate from a secure protocol (https) to an unsecure protocol (http), but it can always navigate to a secure (https). */
strictOrigin = "strictOrigin"
}
export default BrowserNavigationCrossOriginPolicyEnum;
//# sourceMappingURL=BrowserNavigationCrossOriginPolicyEnum.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BrowserNavigationCrossOriginPolicyEnum.d.ts","sourceRoot":"","sources":["../../../src/browser/enums/BrowserNavigationCrossOriginPolicyEnum.ts"],"names":[],"mappings":"AAAA,aAAK,sCAAsC;IAC1C,8CAA8C;IAC9C,SAAS,cAAc;IACvB,0FAA0F;IAC1F,UAAU,eAAe;IACzB,oJAAoJ;IACpJ,YAAY,iBAAiB;CAC7B;AAED,eAAe,sCAAsC,CAAC"}

View File

@@ -0,0 +1,37 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const PropertySymbol = __importStar(require("../../PropertySymbol.cjs"));
//# sourceMappingURL=IBrowser.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowser.cjs","sourceRoot":"","sources":["../../../src/browser/types/IBrowser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wEAA0D"}

View File

@@ -0,0 +1,44 @@
import IBrowserContext from './IBrowserContext.cjs';
import IBrowserPage from './IBrowserPage.cjs';
import IBrowserSettings from './IBrowserSettings.cjs';
import * as PropertySymbol from '../../PropertySymbol.cjs';
import BrowserExceptionObserver from '../utilities/BrowserExceptionObserver.cjs';
/**
* Browser.
*
* Much of the interface for the browser has been taken from Puppeteer and Playwright, so that the API is familiar.
*/
export default interface IBrowser {
readonly defaultContext: IBrowserContext;
readonly contexts: IBrowserContext[];
readonly settings: IBrowserSettings;
readonly console: Console | null;
readonly [PropertySymbol.exceptionObserver]: BrowserExceptionObserver | null;
/**
* Aborts all ongoing operations and destroys the browser.
*/
close(): void;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
waitUntilComplete(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): void;
/**
* Creates a new incognito context.
*
* @returns Context.
*/
newIncognitoContext(): IBrowserContext;
/**
* Creates a new page.
*
* @returns Page.
*/
newPage(): IBrowserPage;
}
//# sourceMappingURL=IBrowser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowser.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAC1D,OAAO,wBAAwB,MAAM,0CAA0C,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,QAAQ;IAChC,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAE7E;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;OAIG;IACH,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;OAIG;IACH,mBAAmB,IAAI,eAAe,CAAC;IAEvC;;;;OAIG;IACH,OAAO,IAAI,YAAY,CAAC;CACxB"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IBrowserContext.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserContext.cjs","sourceRoot":"","sources":["../../../src/browser/types/IBrowserContext.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,36 @@
import ICookieContainer from '../../cookie/ICookieContainer.cjs';
import IResponseCache from '../../fetch/cache/response/IResponseCache.cjs';
import IBrowser from './IBrowser.cjs';
import IBrowserPage from './IBrowserPage.cjs';
import IPreflightResponseCache from '../../fetch/cache/preflight/IPreflightResponseCache.cjs';
/**
* Browser context.
*/
export default interface IBrowserContext {
readonly pages: IBrowserPage[];
readonly browser: IBrowser;
readonly cookieContainer: ICookieContainer;
readonly responseCache: IResponseCache;
readonly preflightResponseCache: IPreflightResponseCache;
/**
* Aborts all ongoing operations and destroys the context.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*
* @returns Promise.
*/
waitUntilComplete(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Creates a new page.
*
* @returns Page.
*/
newPage(): IBrowserPage;
}
//# sourceMappingURL=IBrowserContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserContext.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IBrowserContext.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAChE,OAAO,cAAc,MAAM,8CAA8C,CAAC;AAC1E,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,uBAAuB,MAAM,wDAAwD,CAAC;AAE7F;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,eAAe;IACvC,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC3C,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;IACvC,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;IAEzD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;OAIG;IACH,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;OAIG;IACH,OAAO,IAAI,YAAY,CAAC;CACxB"}

View File

@@ -0,0 +1,37 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const PropertySymbol = __importStar(require("../../PropertySymbol.cjs"));
//# sourceMappingURL=IBrowserFrame.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserFrame.cjs","sourceRoot":"","sources":["../../../src/browser/types/IBrowserFrame.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wEAA0D"}

View File

@@ -0,0 +1,82 @@
import AsyncTaskManager from '../../async-task-manager/AsyncTaskManager.cjs';
import * as PropertySymbol from '../../PropertySymbol.cjs';
import BrowserWindow from '../../window/BrowserWindow.cjs';
import Document from '../../nodes/document/Document.cjs';
import IBrowserPage from './IBrowserPage.cjs';
import Response from '../../fetch/Response.cjs';
import IGoToOptions from './IGoToOptions.cjs';
import { Script } from 'vm';
import IReloadOptions from './IReloadOptions.cjs';
import CrossOriginBrowserWindow from '../../window/CrossOriginBrowserWindow.cjs';
import IHistoryItem from '../../history/IHistoryItem.cjs';
/**
* Browser frame.
*/
export default interface IBrowserFrame {
readonly childFrames: IBrowserFrame[];
readonly parentFrame: IBrowserFrame | null;
readonly page: IBrowserPage;
readonly window: BrowserWindow;
readonly document: Document;
content: string;
url: string;
[PropertySymbol.history]: IHistoryItem[];
[PropertySymbol.asyncTaskManager]: AsyncTaskManager;
[PropertySymbol.listeners]: {
navigation: Array<() => void>;
};
[PropertySymbol.openerFrame]: IBrowserFrame | null;
[PropertySymbol.openerWindow]: BrowserWindow | CrossOriginBrowserWindow | null;
[PropertySymbol.popup]: boolean;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete(): Promise<void>;
/**
* Returns a promise that is resolved when the frame has navigated and the response HTML has been written to the document.
*/
waitForNavigation(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
*
* @param script Script.
* @returns Result.
*/
evaluate(script: string | Script): any;
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
*/
goto(url: string, options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates a delta in history.
*
* @param steps Steps.
* @param [options] Options.
*/
goSteps(steps?: number, options?: IGoToOptions): Promise<Response | null>;
/**
* Reloads the current frame.
*
* @param [options] Options.
*/
reload(options: IReloadOptions): Promise<Response | null>;
}
//# sourceMappingURL=IBrowserFrame.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserFrame.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IBrowserFrame.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AA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,CAAC,IAAI,CAAC,CAAC;IAEnC;;OAEG;IACH,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAEvC;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAEpE;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAEzD;;;;OAIG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAE1E;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;CAC1D"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IBrowserPage.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserPage.cjs","sourceRoot":"","sources":["../../../src/browser/types/IBrowserPage.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,82 @@
import IBrowserPageViewport from '../types/IBrowserPageViewport.cjs';
import VirtualConsolePrinter from '../../console/VirtualConsolePrinter.cjs';
import IBrowserFrame from './IBrowserFrame.cjs';
import IBrowserContext from './IBrowserContext.cjs';
import { Script } from 'vm';
import IGoToOptions from './IGoToOptions.cjs';
import Response from '../../fetch/Response.cjs';
import IReloadOptions from './IReloadOptions.cjs';
import IOptionalBrowserPageViewport from './IOptionalBrowserPageViewport.cjs';
/**
* Browser page.
*/
export default interface IBrowserPage {
readonly virtualConsolePrinter: VirtualConsolePrinter;
readonly mainFrame: IBrowserFrame;
readonly context: IBrowserContext;
readonly console: Console;
readonly frames: IBrowserFrame[];
readonly viewport: IBrowserPageViewport;
content: string;
url: string;
/**
* Aborts all ongoing operations and destroys the page.
*/
close(): Promise<void>;
/**
* Returns a promise that is resolved when all resources has been loaded, fetch has completed, and all async tasks such as timers are complete.
*/
waitUntilComplete(): Promise<void>;
/**
* Returns a promise that is resolved when the page has navigated and the response HTML has been written to the document.
*/
waitForNavigation(): Promise<void>;
/**
* Aborts all ongoing operations.
*/
abort(): Promise<void>;
/**
* Evaluates code or a VM Script in the page's context.
*/
evaluate(script: string | Script): any;
/**
* Sets the viewport.
*
* @param viewport Viewport.
*/
setViewport(viewport: IOptionalBrowserPageViewport): void;
/**
* Go to a page.
*
* @param url URL.
* @param [options] Options.
*/
goto(url: string, options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates back in history.
*
* @param [options] Options.
*/
goBack(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates forward in history.
*
* @param [options] Options.
*/
goForward(options?: IGoToOptions): Promise<Response | null>;
/**
* Navigates a delta in history.
*
* @param steps Steps.
* @param [options] Options.
*/
goSteps(steps?: number, options?: IGoToOptions): Promise<Response | null>;
/**
* Reloads the current page.
*
* @param [options] Options.
* @returns Response.
*/
reload(options?: IReloadOptions): Promise<Response | null>;
}
//# sourceMappingURL=IBrowserPage.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserPage.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IBrowserPage.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,qBAAqB,MAAM,wCAAwC,CAAC;AAC3E,OAAO,aAAa,MAAM,oBAAoB,CA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GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAEzD;;;;OAIG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAE1E;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;CAC3D"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IBrowserPageViewport.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserPageViewport.cjs","sourceRoot":"","sources":["../../../src/browser/types/IBrowserPageViewport.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,6 @@
export default interface IBrowserPageViewport {
width: number;
height: number;
devicePixelRatio: number;
}
//# sourceMappingURL=IBrowserPageViewport.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserPageViewport.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IBrowserPageViewport.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,oBAAoB;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;CACzB"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IBrowserSettings.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserSettings.cjs","sourceRoot":"","sources":["../../../src/browser/types/IBrowserSettings.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,109 @@
import BrowserErrorCaptureEnum from '../enums/BrowserErrorCaptureEnum.cjs';
import BrowserNavigationCrossOriginPolicyEnum from '../enums/BrowserNavigationCrossOriginPolicyEnum.cjs';
import IFetchInterceptor from '../../fetch/types/IFetchInterceptor.cjs';
import IVirtualServer from '../../fetch/types/IVirtualServer.cjs';
/**
* Browser settings.
*/
export default interface IBrowserSettings {
/** Disables JavaScript evaluation. */
disableJavaScriptEvaluation: boolean;
/** Disables JavaScript file loading. */
disableJavaScriptFileLoading: boolean;
/** Disables CSS file loading. */
disableCSSFileLoading: boolean;
/** Disables computed style rendering. */
disableComputedStyleRendering: boolean;
/** Handle disabled resource loading as success */
handleDisabledFileLoadingAsSuccess: boolean;
/**
* Settings for timers
*/
timer: {
maxTimeout: number;
maxIntervalTime: number;
maxIntervalIterations: number;
preventTimerLoops: boolean;
};
/**
* Settings for fetch
*/
fetch: {
/**
* Disables same-origin policy (CORS)
*
* @see https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
*/
disableSameOriginPolicy: boolean;
/**
* Disables validation of certificates against the list of supplied CAs.
*
* Disabling this feature makes it possible to use self-signed certificates or certificates that are not signed by a trusted CA.
*/
disableStrictSSL: boolean;
/**
* Fetch interceptor.
*/
interceptor: IFetchInterceptor | null;
/**
* Virtual servers used for simulating a server that reads from the file system.
*/
virtualServers: IVirtualServer[] | null;
};
/**
* Disables error capturing.
*
* @deprecated Use errorCapture instead.
*/
disableErrorCapturing: boolean;
/**
* Error capturing policy.
*/
errorCapture: BrowserErrorCaptureEnum;
/**
* @deprecated Not something that browsers support anymore as it is not secure.
*/
enableFileSystemHttpRequests: boolean;
/**
* @deprecated Use navigation.disableChildFrameNavigation instead.
*/
disableIframePageLoading: boolean;
/**
* Settings for the browser's navigation (when following links or opening windows).
*/
navigation: {
/** Disables navigation to other pages in the main frame or a page. */
disableMainFrameNavigation: boolean;
/** Disables navigation to other pages in child frames (such as iframes). */
disableChildFrameNavigation: boolean;
/** Disables navigation to other pages in child pages (such as popup windows). */
disableChildPageNavigation: boolean;
/** Disables the fallback to setting the URL when navigating to a page is disabled or when inside a detached browser frame. */
disableFallbackToSetURL: boolean;
/** Sets the policy for cross-origin navigation. */
crossOriginPolicy: BrowserNavigationCrossOriginPolicyEnum;
};
/**
* Settings for the browser's navigator.
*/
navigator: {
userAgent: string;
maxTouchPoints: number;
};
/**
* Settings for the browser's device.
*/
device: {
prefersColorScheme: string;
prefersReducedMotion: string;
mediaType: string;
forcedColors: string;
};
/**
* Debug settings.
*/
debug: {
traceWaitUntilComplete: number;
};
}
//# sourceMappingURL=IBrowserSettings.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IBrowserSettings.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IBrowserSettings.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,sCAAsC,MAAM,oDAAoD,CAAC;AACxG,OAAO,iBAAiB,MAAM,wCAAwC,CAAC;AACvE,OAAO,cAAc,MAAM,qCAAqC,CAAC;AAEjE;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,gBAAgB;IACxC,sCAAsC;IACtC,2BAA2B,EAAE,OAAO,CAAC;IAErC,wCAAwC;IACxC,4BAA4B,EAAE,OAAO,CAAC;IAEtC,iCAAiC;IACjC,qBAAqB,EAAE,OAAO,CAAC;IAE/B,yCAAyC;IACzC,6BAA6B,EAAE,OAAO,CAAC;IAEvC,kDAAkD;IAClD,kCAAkC,EAAE,OAAO,CAAC;IAE5C;;OAEG;IACH,KAAK,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;QACxB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,iBAAiB,EAAE,OAAO,CAAC;KAC3B,CAAC;IAEF;;OAEG;IACH,KAAK,EAAE;QACN;;;;WAIG;QACH,uBAAuB,EAAE,OAAO,CAAC;QAEjC;;;;WAIG;QACH,gBAAgB,EAAE,OAAO,CAAC;QAE1B;;WAEG;QACH,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;QAEtC;;WAEG;QACH,cAAc,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;KACxC,CAAC;IAEF;;;;OAIG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,YAAY,EAAE,uBAAuB,CAAC;IAEtC;;OAEG;IACH,4BAA4B,EAAE,OAAO,CAAC;IAEtC;;OAEG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,UAAU,EAAE;QACX,sEAAsE;QACtE,0BAA0B,EAAE,OAAO,CAAC;QAEpC,4EAA4E;QAC5E,2BAA2B,EAAE,OAAO,CAAC;QAErC,iFAAiF;QACjF,0BAA0B,EAAE,OAAO,CAAC;QAEpC,8HAA8H;QAC9H,uBAAuB,EAAE,OAAO,CAAC;QAEjC,mDAAmD;QACnD,iBAAiB,EAAE,sCAAsC,CAAC;KAC1D,CAAC;IAEF;;OAEG;IACH,SAAS,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;KACvB,CAAC;IAEF;;OAEG;IACH,MAAM,EAAE;QACP,kBAAkB,EAAE,MAAM,CAAC;QAC3B,oBAAoB,EAAE,MAAM,CAAC;QAC7B,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF;;OAEG;IACH,KAAK,EAAE;QACN,sBAAsB,EAAE,MAAM,CAAC;KAC/B,CAAC;CACF"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IGoToOptions.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IGoToOptions.cjs","sourceRoot":"","sources":["../../../src/browser/types/IGoToOptions.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,16 @@
import IRequestReferrerPolicy from '../../fetch/types/IRequestReferrerPolicy.cjs';
import IReloadOptions from './IReloadOptions.cjs';
/**
* Go to options.
*/
export default interface IGoToOptions extends IReloadOptions {
/**
* Referrer.
*/
referrer?: string;
/**
* Referrer policy.
*/
referrerPolicy?: IRequestReferrerPolicy;
}
//# sourceMappingURL=IGoToOptions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IGoToOptions.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IGoToOptions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,6CAA6C,CAAC;AACjF,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,YAAa,SAAQ,cAAc;IAC3D;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACxC"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IOptionalBrowserPageViewport.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IOptionalBrowserPageViewport.cjs","sourceRoot":"","sources":["../../../src/browser/types/IOptionalBrowserPageViewport.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,6 @@
export default interface IOptionalBrowserPageViewport {
width?: number;
height?: number;
devicePixelRatio?: number;
}
//# sourceMappingURL=IOptionalBrowserPageViewport.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IOptionalBrowserPageViewport.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IOptionalBrowserPageViewport.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,4BAA4B;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IOptionalBrowserSettings.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IOptionalBrowserSettings.cjs","sourceRoot":"","sources":["../../../src/browser/types/IOptionalBrowserSettings.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,103 @@
import BrowserErrorCaptureEnum from '../enums/BrowserErrorCaptureEnum.cjs';
import BrowserNavigationCrossOriginPolicyEnum from '../enums/BrowserNavigationCrossOriginPolicyEnum.cjs';
import IFetchInterceptor from '../../fetch/types/IFetchInterceptor.cjs';
import IVirtualServer from '../../fetch/types/IVirtualServer.cjs';
export default interface IOptionalBrowserSettings {
/** Disables JavaScript evaluation. */
disableJavaScriptEvaluation?: boolean;
/** Disables JavaScript file loading. */
disableJavaScriptFileLoading?: boolean;
/** Disables CSS file loading. */
disableCSSFileLoading?: boolean;
/** Disables computed style rendering. */
disableComputedStyleRendering?: boolean;
/** Handle disabled file loading as success */
handleDisabledFileLoadingAsSuccess?: boolean;
/** Settings for timers */
timer?: {
maxTimeout?: number;
maxIntervalTime?: number;
maxIntervalIterations?: number;
};
/**
* Settings for fetch
*/
fetch?: {
/**
* Disables same-origin policy (CORS)
*
* @see https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
*/
disableSameOriginPolicy?: boolean;
/**
* Disables validation of certificates against the list of supplied CAs.
*
* Disabling this feature makes it possible to use self-signed certificates or certificates that are not signed by a trusted CA.
*/
disableStrictSSL?: boolean;
/**
* Fetch interceptor.
*/
interceptor?: IFetchInterceptor | null;
/**
* Virtual servers used for simulating a server that reads from the file system.
*/
virtualServers?: IVirtualServer[] | null;
};
/**
* Disables error capturing.
*
* @deprecated Use errorCapture instead.
*/
disableErrorCapturing?: boolean;
/**
* Error capturing policy.
*/
errorCapture?: BrowserErrorCaptureEnum;
/**
* @deprecated Not something that browsers support anymore as it is not secure.
*/
enableFileSystemHttpRequests?: boolean;
/**
* @deprecated Use navigation.disableChildFrameNavigation instead.
*/
disableIframePageLoading?: boolean;
/**
* Settings for the browser's navigation (when following links or opening windows).
*/
navigation?: {
/** Disables navigation to other pages in the main frame or a page. */
disableMainFrameNavigation?: boolean;
/** Disables navigation to other pages in child frames (such as iframes). */
disableChildFrameNavigation?: boolean;
/** Disables navigation to other pages in child pages (such as popup windows). */
disableChildPageNavigation?: boolean;
/** Disables the fallback to setting the URL when navigating to a page is disabled or when inside a detached browser frame. */
disableFallbackToSetURL?: boolean;
/** Sets the policy for cross-origin navigation. */
crossOriginPolicy?: BrowserNavigationCrossOriginPolicyEnum;
};
/**
* Settings for the browser's navigator.
*/
navigator?: {
userAgent?: string;
maxTouchPoints?: number;
};
/**
* Settings for the browser's device.
*/
device?: {
prefersColorScheme?: string;
prefersReducedMotion?: string;
mediaType?: string;
forcedColors?: string;
};
/**
* Debug settings.
*/
debug?: {
traceWaitUntilComplete?: number;
};
}
//# sourceMappingURL=IOptionalBrowserSettings.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IOptionalBrowserSettings.d.ts","sourceRoot":"","sources":["../../../src/browser/types/IOptionalBrowserSettings.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,sCAAsC,MAAM,oDAAoD,CAAC;AACxG,OAAO,iBAAiB,MAAM,wCAAwC,CAAC;AACvE,OAAO,cAAc,MAAM,qCAAqC,CAAC;AAEjE,MAAM,CAAC,OAAO,WAAW,wBAAwB;IAChD,sCAAsC;IACtC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC,wCAAwC;IACxC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IAEvC,iCAAiC;IACjC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC,yCAAyC;IACzC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAExC,8CAA8C;IAC9C,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAE7C,0BAA0B;IAC1B,KAAK,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAC/B,CAAC;IAEF;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