From e881b3be921fcdfa36b400cb0e341fa68806c869 Mon Sep 17 00:00:00 2001 From: Andres Olivares Date: Sun, 25 Oct 2020 21:05:51 -0500 Subject: [PATCH 01/85] [ts] Typecheck source_frame/ImageView.js with TypeScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: chromium:1011811 Change-Id: I634abf11694ee26df9ac88e9e8d6e740d070af65 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2497147 Reviewed-by: Simon Zünd Commit-Queue: Andres Olivares --- front_end/source_frame/ImageView.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/front_end/source_frame/ImageView.js b/front_end/source_frame/ImageView.js index 2990becdc36..50028cc39cf 100644 --- a/front_end/source_frame/ImageView.js +++ b/front_end/source_frame/ImageView.js @@ -26,9 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks - import * as Common from '../common/common.js'; import * as Host from '../host/host.js'; import * as Platform from '../platform/platform.js'; @@ -67,7 +64,9 @@ export class ImageView extends UI.View.SimpleView { this._dimensionsLabel = new UI.Toolbar.ToolbarText(); this._mimeTypeLabel = new UI.Toolbar.ToolbarText(mimeType); this._container = this.element.createChild('div', 'image'); - this._imagePreviewElement = this._container.createChild('img', 'resource-image-view'); + /** @type {!HTMLImageElement} */ + this._imagePreviewElement = + /** @type {!HTMLImageElement} */ (this._container.createChild('img', 'resource-image-view')); this._imagePreviewElement.addEventListener('contextmenu', this._contextMenu.bind(this), true); } @@ -110,6 +109,7 @@ export class ImageView extends UI.View.SimpleView { } const contentEncoded = await this._contentProvider.contentEncoded(); + /** @type {?string} */ this._cachedContent = content; let imageSrc = TextUtils.ContentProvider.contentAsDataURL(content, this._mimeType, contentEncoded); if (content === null) { @@ -118,7 +118,9 @@ export class ImageView extends UI.View.SimpleView { const loadPromise = new Promise(x => { this._imagePreviewElement.onload = x; }); - this._imagePreviewElement.src = imageSrc; + if (imageSrc) { + this._imagePreviewElement.src = imageSrc; + } this._imagePreviewElement.alt = ls`Image from ${this._url}`; const size = content && !contentEncoded ? content.length : base64ToSize(content); this._sizeLabel.setText(Platform.NumberUtilities.bytesToString(size)); @@ -127,6 +129,9 @@ export class ImageView extends UI.View.SimpleView { '%d × %d', this._imagePreviewElement.naturalWidth, this._imagePreviewElement.naturalHeight)); } + /** + * @param {!Event} event + */ _contextMenu(event) { const contextMenu = new UI.ContextMenu.ContextMenu(event); if (!this._parsedURL.isDataURL()) { @@ -153,7 +158,7 @@ export class ImageView extends UI.View.SimpleView { } _saveImage() { - const link = createElement('a'); + const link = document.createElement('a'); link.download = this._parsedURL.displayName; link.href = this._url; link.click(); @@ -174,7 +179,10 @@ export class ImageView extends UI.View.SimpleView { const entry = items[0].webkitGetAsEntry(); const encoded = !entry.name.endsWith('.svg'); - entry.file(file => { + /** + * @param {!Blob} file + */ + const fileCallback = file => { const reader = new FileReader(); reader.onloadend = () => { let result; @@ -184,7 +192,7 @@ export class ImageView extends UI.View.SimpleView { result = null; console.error('Can\'t read file: ' + e); } - if (typeof result !== 'string') { + if (typeof result !== 'string' || !this._uiSourceCode) { return; } this._uiSourceCode.setContent(encoded ? btoa(result) : result, encoded); @@ -194,6 +202,7 @@ export class ImageView extends UI.View.SimpleView { } else { reader.readAsText(file); } - }); + }; + entry.file(fileCallback); } } From 1444fbc94324040fa399720ab8ce2c6fd559738b Mon Sep 17 00:00:00 2001 From: Andres Olivares Date: Sun, 25 Oct 2020 18:27:11 -0500 Subject: [PATCH 02/85] [ts] Typecheck source_frame/BinaryResourceViewFactory.js with TypeScript Bug: chromium:1011811 Change-Id: I69ae491446a1744174aff5161118ac2163410c15 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2497145 Reviewed-by: Paul Lewis Commit-Queue: Andres Olivares --- .../source_frame/BinaryResourceViewFactory.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/front_end/source_frame/BinaryResourceViewFactory.js b/front_end/source_frame/BinaryResourceViewFactory.js index ed1540cd5d2..d417cc5707f 100644 --- a/front_end/source_frame/BinaryResourceViewFactory.js +++ b/front_end/source_frame/BinaryResourceViewFactory.js @@ -2,11 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks import * as Common from '../common/common.js'; // eslint-disable-line no-unused-vars import * as TextUtils from '../text_utils/text_utils.js'; // eslint-disable-line no-unused-vars +import * as UI from '../ui/ui.js'; // eslint-disable-line no-unused-vars import {ResourceSourceFrame} from './ResourceSourceFrame.js'; @@ -22,7 +21,7 @@ export class BinaryResourceViewFactory { this._resourceType = resourceType; /** @type {?Promise} */ this._arrayPromise = null; - /** @type {?Promise} */ + /** @type {?Promise} */ this._hexPromise = null; /** @type {?Promise} */ this._utf8Promise = null; @@ -43,11 +42,9 @@ export class BinaryResourceViewFactory { */ async hex() { if (!this._hexPromise) { - this._hexPromise = new Promise(async resolve => { const content = await this._fetchContentAsArray(); const hexString = BinaryResourceViewFactory.uint8ArrayToHexString(content); - resolve({content: hexString, isEncoded: false}); - }); + return {content: hexString, isEncoded: false}; } return this._hexPromise; @@ -82,7 +79,7 @@ export class BinaryResourceViewFactory { return new ResourceSourceFrame( TextUtils.StaticContentProvider.StaticContentProvider.fromString( this._contentUrl, this._resourceType, this._base64content), - /* autoPrettyPrint */ false, {lineNumbers: false, lineWrapping: true}); + /* autoPrettyPrint */ false, /** @type {!UI.TextEditor.Options} */ ({lineNumbers: false, lineWrapping: true})); } /** @@ -97,7 +94,7 @@ export class BinaryResourceViewFactory { }); return new ResourceSourceFrame( hexViewerContentProvider, - /* autoPrettyPrint */ false, {lineNumbers: false, lineWrapping: false}); + /* autoPrettyPrint */ false, /** @type {!UI.TextEditor.Options} */ ({lineNumbers: false, lineWrapping: false})); } /** @@ -109,7 +106,7 @@ export class BinaryResourceViewFactory { new TextUtils.StaticContentProvider.StaticContentProvider(this._contentUrl, this._resourceType, utf8fn); return new ResourceSourceFrame( utf8ContentProvider, - /* autoPrettyPrint */ false, {lineNumbers: true, lineWrapping: true}); + /* autoPrettyPrint */ false, /** @type {!UI.TextEditor.Options} */ ({lineNumbers: true, lineWrapping: true})); } /** From c2d30bd803d2942dda07904a9280047e2057f48f Mon Sep 17 00:00:00 2001 From: Andres Olivares Date: Sun, 25 Oct 2020 18:35:18 -0500 Subject: [PATCH 03/85] [ts] Typecheck source_frame/ResourceSourceFrame.js with TypeScript Bug: chromium:1011811 Change-Id: I8a251207b3a6d160df2b5b06880af7b535f34fa3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2497146 Reviewed-by: Jack Franklin Commit-Queue: Andres Olivares --- front_end/source_frame/ResourceSourceFrame.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/front_end/source_frame/ResourceSourceFrame.js b/front_end/source_frame/ResourceSourceFrame.js index 37c657071f0..98f442ddfee 100644 --- a/front_end/source_frame/ResourceSourceFrame.js +++ b/front_end/source_frame/ResourceSourceFrame.js @@ -27,8 +27,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks import * as TextUtils from '../text_utils/text_utils.js'; // eslint-disable-line no-unused-vars import * as UI from '../ui/ui.js'; @@ -75,7 +73,7 @@ export class ResourceSourceFrame extends SourceFrameImpl { * @param {!UI.ContextMenu.ContextMenu} contextMenu * @param {number} lineNumber * @param {number} columnNumber - * @return {!Promise} + * @return {!Promise} */ populateTextAreaContextMenu(contextMenu, lineNumber, columnNumber) { contextMenu.appendApplicableItems(this._resource); @@ -88,7 +86,6 @@ export class SearchableContainer extends UI.Widget.VBox { * @param {!TextUtils.ContentProvider.ContentProvider} resource * @param {string} highlighterType * @param {boolean=} autoPrettyPrint - * @return {!UI.Widget.Widget} */ constructor(resource, highlighterType, autoPrettyPrint) { super(true); From f19de97d8be0e834f60d2b4cd3bb84224171fbc1 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 27 Oct 2020 14:03:33 +0000 Subject: [PATCH 04/85] Typecheck formatter/SourceFormatter.js with TypeScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R=szuend@chromium.org Bug: 1011811 Change-Id: I8d5cf38af8b7b3edac3a05dde5b4487b779178d0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2502611 Reviewed-by: Simon Zünd Commit-Queue: Tim van der Lippe --- front_end/formatter/SourceFormatter.js | 148 +++++++++++++------------ 1 file changed, 77 insertions(+), 71 deletions(-) diff --git a/front_end/formatter/SourceFormatter.js b/front_end/formatter/SourceFormatter.js index 1a53ca72e3d..2df76926b73 100644 --- a/front_end/formatter/SourceFormatter.js +++ b/front_end/formatter/SourceFormatter.js @@ -1,8 +1,6 @@ // Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks import * as Bindings from '../bindings/bindings.js'; import * as Common from '../common/common.js'; @@ -12,6 +10,9 @@ import * as Workspace from '../workspace/workspace.js'; import {FormatterInterface, FormatterSourceMapping} from './ScriptFormatter.js'; // eslint-disable-line no-unused-vars +/** @type {!WeakMap} */ +const objectToFormattingResult = new WeakMap(); + export class SourceFormatData { /** * @param {!Workspace.UISourceCode.UISourceCode} originalSourceCode @@ -33,12 +34,10 @@ export class SourceFormatData { * @return {?SourceFormatData} */ static _for(object) { - return object[SourceFormatData._formatDataSymbol]; + return objectToFormattingResult.get(object) || null; } } -SourceFormatData._formatDataSymbol = Symbol('formatData'); - /** @type {?SourceFormatter} */ let sourceFormatterInstance = null; @@ -99,7 +98,7 @@ export class SourceFormatter { * @param {!SourceFormatData} formatData */ async _discardFormatData(formatData) { - delete formatData.formattedSourceCode[SourceFormatData._formatDataSymbol]; + objectToFormattingResult.delete(formatData.formattedSourceCode); await this._scriptMapping._setSourceMappingEnabled(formatData, false); this._styleMapping._setSourceMappingEnabled(formatData, false); this._project.removeFile(formatData.formattedSourceCode.url()); @@ -118,8 +117,7 @@ export class SourceFormatter { * @return {!Workspace.UISourceCode.UISourceCode} */ getOriginalUISourceCode(uiSourceCode) { - const formatData = - /** @type {?SourceFormatData} */ (uiSourceCode[SourceFormatData._formatDataSymbol]); + const formatData = objectToFormattingResult.get(uiSourceCode); if (!formatData) { return uiSourceCode; } @@ -136,57 +134,54 @@ export class SourceFormatter { return cacheEntry.promise; } - let fulfillFormatPromise; - const resultPromise = new Promise(fulfill => { - fulfillFormatPromise = fulfill; - }); - this._formattedSourceCodes.set(uiSourceCode, {promise: resultPromise, formatData: null}); - const {content} = await uiSourceCode.requestContent(); - // ------------ ASYNC ------------ - FormatterInterface.format( - uiSourceCode.contentType(), uiSourceCode.mimeType(), content || '', formatDone.bind(this)); - return resultPromise; - /** - * @this SourceFormatter - * @param {string} formattedContent - * @param {!FormatterSourceMapping} formatterMapping + * @type {!Promise} */ - async function formatDone(formattedContent, formatterMapping) { - const cacheEntry = this._formattedSourceCodes.get(uiSourceCode); - if (!cacheEntry || cacheEntry.promise !== resultPromise) { - return; - } - let formattedURL; - let count = 0; - let suffix = ''; - do { - formattedURL = `${uiSourceCode.url()}:formatted${suffix}`; - suffix = `:${count++}`; - } while (this._project.uiSourceCodeForURL(formattedURL)); - const contentProvider = TextUtils.StaticContentProvider.StaticContentProvider.fromString( - formattedURL, uiSourceCode.contentType(), formattedContent); - const formattedUISourceCode = this._project.createUISourceCode(formattedURL, contentProvider.contentType()); - const formatData = new SourceFormatData(uiSourceCode, formattedUISourceCode, formatterMapping); - formattedUISourceCode[SourceFormatData._formatDataSymbol] = formatData; - this._project.addUISourceCodeWithProvider( - formattedUISourceCode, contentProvider, /* metadata */ null, uiSourceCode.mimeType()); - await this._scriptMapping._setSourceMappingEnabled(formatData, true); - await this._styleMapping._setSourceMappingEnabled(formatData, true); - cacheEntry.formatData = formatData; - - for (const decoration of uiSourceCode.allDecorations()) { - const range = decoration.range(); - const startLocation = formatterMapping.originalToFormatted(range.startLine, range.startColumn); - const endLocation = formatterMapping.originalToFormatted(range.endLine, range.endColumn); - - formattedUISourceCode.addDecoration( - new TextUtils.TextRange.TextRange(startLocation[0], startLocation[1], endLocation[0], endLocation[1]), - /** @type {string} */ (decoration.type()), decoration.data()); - } + const resultPromise = new Promise(async resolve => { + const {content} = await uiSourceCode.requestContent(); - fulfillFormatPromise(formatData); - } + FormatterInterface.format( + uiSourceCode.contentType(), uiSourceCode.mimeType(), content || '', + async (formattedContent, formatterMapping) => { + const cacheEntry = this._formattedSourceCodes.get(uiSourceCode); + if (!cacheEntry || cacheEntry.promise !== resultPromise) { + return; + } + let formattedURL; + let count = 0; + let suffix = ''; + do { + formattedURL = `${uiSourceCode.url()}:formatted${suffix}`; + suffix = `:${count++}`; + } while (this._project.uiSourceCodeForURL(formattedURL)); + const contentProvider = TextUtils.StaticContentProvider.StaticContentProvider.fromString( + formattedURL, uiSourceCode.contentType(), formattedContent); + const formattedUISourceCode = this._project.createUISourceCode(formattedURL, contentProvider.contentType()); + const formatData = new SourceFormatData(uiSourceCode, formattedUISourceCode, formatterMapping); + objectToFormattingResult.set(formattedUISourceCode, formatData); + this._project.addUISourceCodeWithProvider( + formattedUISourceCode, contentProvider, /* metadata */ null, uiSourceCode.mimeType()); + await this._scriptMapping._setSourceMappingEnabled(formatData, true); + await this._styleMapping._setSourceMappingEnabled(formatData, true); + cacheEntry.formatData = formatData; + + for (const decoration of uiSourceCode.allDecorations()) { + const range = decoration.range(); + const startLocation = formatterMapping.originalToFormatted(range.startLine, range.startColumn); + const endLocation = formatterMapping.originalToFormatted(range.endLine, range.endColumn); + + formattedUISourceCode.addDecoration( + new TextUtils.TextRange.TextRange(startLocation[0], startLocation[1], endLocation[0], endLocation[1]), + /** @type {string} */ (decoration.type()), decoration.data()); + } + + resolve(formatData); + }); + }); + + this._formattedSourceCodes.set(uiSourceCode, {promise: resultPromise, formatData: null}); + + return resultPromise; } } @@ -206,7 +201,7 @@ class ScriptMapping { rawLocationToUILocation(rawLocation) { const script = rawLocation.script(); const formatData = script && SourceFormatData._for(script); - if (!formatData) { + if (!formatData || !script) { return null; } if (script.isInlineScriptWithSourceURL()) { @@ -260,7 +255,8 @@ class ScriptMapping { .filter(script => script.isInlineScript() && !script.hasSourceURL); // Here we have an inline script, which was formatted together with the containing document, so we must not // translate locations as they are relative to the start of the document. - const locations = scripts.map(script => script.rawLocation(originalLine, originalColumn)).filter(l => !!l); + const locations = /** @type {!Array} */ ( + scripts.map(script => script.rawLocation(originalLine, originalColumn)).filter(l => !!l)); console.assert(locations.every(l => l && !!l.script())); return locations; } @@ -279,11 +275,11 @@ class ScriptMapping { } if (enabled) { for (const script of scripts) { - script[SourceFormatData._formatDataSymbol] = formatData; + objectToFormattingResult.set(script, formatData); } } else { for (const script of scripts) { - delete script[SourceFormatData._formatDataSymbol]; + objectToFormattingResult.delete(script); } } const updatePromises = scripts.map( @@ -306,17 +302,19 @@ class ScriptMapping { } } if (uiSourceCode.contentType().isScript()) { - console.assert( - !uiSourceCode[SourceFormatData._formatDataSymbol] || - uiSourceCode[SourceFormatData._formatDataSymbol] === uiSourceCode); + console.assert(!objectToFormattingResult.has(uiSourceCode)); const rawLocations = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance() .uiLocationToRawLocationsForUnformattedJavaScript(uiSourceCode, 0, 0); - return rawLocations.map(location => location.script()).filter(script => !!script); + return /** @type {!Array} */ ( + rawLocations.map(location => location.script()).filter(script => !!script)); } return []; } } +/** @type {!WeakMap>} */ +const sourceCodeToHeaders = new WeakMap(); + /** * @implements {Bindings.CSSWorkspaceBinding.SourceMapping} */ @@ -354,8 +352,13 @@ class StyleMapping { } const [originalLine, originalColumn] = formatData.mapping.formattedToOriginal(uiLocation.lineNumber, uiLocation.columnNumber); - const headers = formatData.originalSourceCode[this._headersSymbol].filter( - header => header.containsLocation(originalLine, originalColumn)); + const allHeaders = sourceCodeToHeaders.get(formatData.originalSourceCode); + + if (!allHeaders) { + return []; + } + + const headers = allHeaders.filter(header => header.containsLocation(originalLine, originalColumn)); return headers.map(header => new SDK.CSSModel.CSSLocation(header, originalLine, originalColumn)); } @@ -367,13 +370,15 @@ class StyleMapping { const original = formatData.originalSourceCode; const headers = this._headersForUISourceCode(original); if (enable) { - original[this._headersSymbol] = headers; + sourceCodeToHeaders.set(original, headers); headers.forEach(header => { - header[SourceFormatData._formatDataSymbol] = formatData; + objectToFormattingResult.set(header, formatData); }); } else { - original[this._headersSymbol] = null; - headers.forEach(header => delete header[SourceFormatData._formatDataSymbol]); + sourceCodeToHeaders.delete(original); + headers.forEach(header => { + objectToFormattingResult.delete(header); + }); } const updatePromises = headers.map(header => Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().updateLocations(header)); @@ -395,7 +400,8 @@ class StyleMapping { } else if (uiSourceCode.contentType().isStyleSheet()) { const rawLocations = Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().uiLocationToRawLocations( uiSourceCode.uiLocation(0, 0)); - return rawLocations.map(rawLocation => rawLocation.header()).filter(header => !!header); + return /** @type {!Array} */ ( + rawLocations.map(rawLocation => rawLocation.header()).filter(header => !!header)); } return []; } From a759e62ec6f4c64816013433b96363f6cc1004de Mon Sep 17 00:00:00 2001 From: Jan Scheffler Date: Tue, 27 Oct 2020 15:14:39 +0100 Subject: [PATCH 05/85] [Puppeteer] Update puppeteer to v.5.4.0 Change-Id: I831d23e24f840d1898959814809839a34b6b9eb7 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2502001 Commit-Queue: Jan Scheffler Reviewed-by: Mathias Bynens Reviewed-by: Paul Lewis --- all_devtools_modules.gni | 17 +- devtools_grd_files.gni | 17 +- front_end/third_party/puppeteer/BUILD.gn | 117 +- .../third_party/puppeteer/package/LICENSE | 4 +- .../third_party/puppeteer/package/README.md | 22 +- .../puppeteer/package/cjs-entry-core.js | 2 +- .../puppeteer/package/cjs-entry.js | 2 +- .../third_party/puppeteer/package/install.js | 2 +- .../lib/cjs/puppeteer/api-docs-entry.d.ts | 49 - .../lib/cjs/puppeteer/api-docs-entry.d.ts.map | 1 - .../lib/cjs/puppeteer/api-docs-entry.js | 71 - .../cjs/puppeteer/common/Accessibility.d.ts | 176 - .../puppeteer/common/Accessibility.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Accessibility.js | 360 -- .../lib/cjs/puppeteer/common/Browser.d.ts | 424 -- .../lib/cjs/puppeteer/common/Browser.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Browser.js | 519 -- .../lib/cjs/puppeteer/common/Connection.d.ts | 120 - .../cjs/puppeteer/common/Connection.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Connection.js | 271 -- .../common/ConnectionTransport.d.ts.map | 1 - .../cjs/puppeteer/common/ConsoleMessage.d.ts | 68 - .../puppeteer/common/ConsoleMessage.d.ts.map | 1 - .../cjs/puppeteer/common/ConsoleMessage.js | 58 - .../lib/cjs/puppeteer/common/Coverage.d.ts | 181 - .../cjs/puppeteer/common/Coverage.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Coverage.js | 319 -- .../lib/cjs/puppeteer/common/DOMWorld.d.ts | 136 - .../cjs/puppeteer/common/DOMWorld.d.ts.map | 1 - .../lib/cjs/puppeteer/common/DOMWorld.js | 520 -- .../lib/cjs/puppeteer/common/Debug.d.ts | 53 - .../lib/cjs/puppeteer/common/Debug.d.ts.map | 1 - .../package/lib/cjs/puppeteer/common/Debug.js | 80 - .../puppeteer/common/DeviceDescriptors.d.ts | 33 - .../common/DeviceDescriptors.d.ts.map | 1 - .../cjs/puppeteer/common/DeviceDescriptors.js | 876 ---- .../lib/cjs/puppeteer/common/Dialog.d.ts | 76 - .../lib/cjs/puppeteer/common/Dialog.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Dialog.js | 96 - .../puppeteer/common/EmulationManager.d.ts | 25 - .../common/EmulationManager.d.ts.map | 1 - .../cjs/puppeteer/common/EmulationManager.js | 37 - .../lib/cjs/puppeteer/common/Errors.d.ts | 34 - .../lib/cjs/puppeteer/common/Errors.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Errors.js | 41 - .../lib/cjs/puppeteer/common/EvalTypes.d.ts | 59 - .../cjs/puppeteer/common/EvalTypes.d.ts.map | 1 - .../cjs/puppeteer/common/EventEmitter.d.ts | 89 - .../puppeteer/common/EventEmitter.d.ts.map | 1 - .../lib/cjs/puppeteer/common/EventEmitter.js | 116 - .../lib/cjs/puppeteer/common/Events.d.ts | 82 - .../lib/cjs/puppeteer/common/Events.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Events.js | 86 - .../puppeteer/common/ExecutionContext.d.ts | 186 - .../common/ExecutionContext.d.ts.map | 1 - .../cjs/puppeteer/common/ExecutionContext.js | 317 -- .../lib/cjs/puppeteer/common/FileChooser.d.ts | 60 - .../cjs/puppeteer/common/FileChooser.d.ts.map | 1 - .../lib/cjs/puppeteer/common/FileChooser.js | 70 - .../cjs/puppeteer/common/FrameManager.d.ts | 710 --- .../puppeteer/common/FrameManager.d.ts.map | 1 - .../lib/cjs/puppeteer/common/FrameManager.js | 924 ---- .../lib/cjs/puppeteer/common/HTTPRequest.d.ts | 276 -- .../cjs/puppeteer/common/HTTPRequest.d.ts.map | 1 - .../lib/cjs/puppeteer/common/HTTPRequest.js | 421 -- .../cjs/puppeteer/common/HTTPResponse.d.ts | 128 - .../puppeteer/common/HTTPResponse.d.ts.map | 1 - .../lib/cjs/puppeteer/common/HTTPResponse.js | 154 - .../lib/cjs/puppeteer/common/Input.d.ts | 322 -- .../lib/cjs/puppeteer/common/Input.d.ts.map | 1 - .../package/lib/cjs/puppeteer/common/Input.js | 476 -- .../lib/cjs/puppeteer/common/JSHandle.d.ts | 439 -- .../cjs/puppeteer/common/JSHandle.d.ts.map | 1 - .../lib/cjs/puppeteer/common/JSHandle.js | 746 --- .../puppeteer/common/LifecycleWatcher.d.ts | 62 - .../common/LifecycleWatcher.d.ts.map | 1 - .../cjs/puppeteer/common/LifecycleWatcher.js | 148 - .../cjs/puppeteer/common/NetworkManager.d.ts | 80 - .../puppeteer/common/NetworkManager.d.ts.map | 1 - .../cjs/puppeteer/common/NetworkManager.js | 265 -- .../lib/cjs/puppeteer/common/PDFOptions.d.ts | 152 - .../cjs/puppeteer/common/PDFOptions.d.ts.map | 1 - .../lib/cjs/puppeteer/common/PDFOptions.js | 34 - .../lib/cjs/puppeteer/common/Page.d.ts | 815 ---- .../lib/cjs/puppeteer/common/Page.d.ts.map | 1 - .../package/lib/cjs/puppeteer/common/Page.js | 1275 ----- .../cjs/puppeteer/common/Puppeteer.d.ts.map | 1 - .../puppeteer/common/PuppeteerViewport.d.ts | 24 - .../common/PuppeteerViewport.d.ts.map | 1 - .../cjs/puppeteer/common/PuppeteerViewport.js | 2 - .../cjs/puppeteer/common/QueryHandler.d.ts | 31 - .../puppeteer/common/QueryHandler.d.ts.map | 1 - .../lib/cjs/puppeteer/common/QueryHandler.js | 63 - .../cjs/puppeteer/common/SecurityDetails.d.ts | 61 - .../puppeteer/common/SecurityDetails.d.ts.map | 1 - .../cjs/puppeteer/common/SecurityDetails.js | 76 - .../lib/cjs/puppeteer/common/Target.d.ts | 98 - .../lib/cjs/puppeteer/common/Target.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Target.js | 141 - .../cjs/puppeteer/common/TimeoutSettings.d.ts | 28 - .../puppeteer/common/TimeoutSettings.d.ts.map | 1 - .../cjs/puppeteer/common/TimeoutSettings.js | 47 - .../lib/cjs/puppeteer/common/Tracing.d.ts | 47 - .../lib/cjs/puppeteer/common/Tracing.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Tracing.js | 94 - .../puppeteer/common/USKeyboardLayout.d.ts | 40 - .../common/USKeyboardLayout.d.ts.map | 1 - .../cjs/puppeteer/common/USKeyboardLayout.js | 406 -- .../common/WebSocketTransport.d.ts.map | 1 - .../lib/cjs/puppeteer/common/WebWorker.d.ts | 102 - .../cjs/puppeteer/common/WebWorker.d.ts.map | 1 - .../lib/cjs/puppeteer/common/WebWorker.js | 112 - .../lib/cjs/puppeteer/common/assert.d.ts | 22 - .../lib/cjs/puppeteer/common/assert.d.ts.map | 1 - .../lib/cjs/puppeteer/common/assert.js | 27 - .../lib/cjs/puppeteer/common/helper.d.ts | 42 - .../lib/cjs/puppeteer/common/helper.d.ts.map | 1 - .../lib/cjs/puppeteer/common/helper.js | 206 - .../lib/cjs/puppeteer/environment.d.ts.map | 1 - .../package/lib/cjs/puppeteer/environment.js | 21 - .../lib/cjs/puppeteer/index-core.d.ts.map | 1 - .../package/lib/cjs/puppeteer/index-core.js | 20 - .../package/lib/cjs/puppeteer/index.d.ts.map | 1 - .../lib/cjs/puppeteer/initialize.d.ts.map | 1 - .../package/lib/cjs/puppeteer/initialize.js | 38 - .../lib/cjs/puppeteer/install.d.ts.map | 1 - .../package/lib/cjs/puppeteer/install.js | 152 - .../cjs/puppeteer/node/BrowserFetcher.d.ts | 136 - .../puppeteer/node/BrowserFetcher.d.ts.map | 1 - .../lib/cjs/puppeteer/node/BrowserFetcher.js | 492 -- .../lib/cjs/puppeteer/node/BrowserRunner.d.ts | 40 - .../cjs/puppeteer/node/BrowserRunner.d.ts.map | 1 - .../lib/cjs/puppeteer/node/BrowserRunner.js | 220 - .../cjs/puppeteer/node/LaunchOptions.d.ts.map | 1 - .../lib/cjs/puppeteer/node/Launcher.d.ts | 16 - .../lib/cjs/puppeteer/node/Launcher.d.ts.map | 1 - .../lib/cjs/puppeteer/node/Launcher.js | 563 --- .../lib/cjs/puppeteer/node/PipeTransport.d.ts | 31 - .../cjs/puppeteer/node/PipeTransport.d.ts.map | 1 - .../lib/cjs/puppeteer/node/PipeTransport.js | 64 - .../package/lib/cjs/puppeteer/revisions.d.ts | 22 - .../lib/cjs/puppeteer/revisions.d.ts.map | 1 - .../cjs/puppeteer/tsconfig.cjs.tsbuildinfo | 4214 ----------------- .../lib/cjs/vendor/mitt/src/index.d.ts | 20 - .../lib/cjs/vendor/mitt/src/index.d.ts.map | 1 - .../package/lib/cjs/vendor/mitt/src/index.js | 52 - .../lib/cjs/vendor/tsconfig.cjs.tsbuildinfo | 2901 ------------ .../lib/esm/puppeteer/api-docs-entry.d.ts | 6 +- .../lib/esm/puppeteer/api-docs-entry.d.ts.map | 2 +- .../lib/esm/puppeteer/api-docs-entry.js | 11 +- .../esm/puppeteer/common/Accessibility.d.ts | 4 +- .../lib/esm/puppeteer/common/Accessibility.js | 14 +- .../puppeteer/common/AriaQueryHandler.d.ts | 21 + .../common/AriaQueryHandler.d.ts.map | 1 + .../esm/puppeteer/common/AriaQueryHandler.js | 81 + .../lib/esm/puppeteer/common/Browser.d.ts | 5 +- .../lib/esm/puppeteer/common/Browser.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Browser.js | 7 +- .../puppeteer/common/BrowserConnector.d.ts} | 43 +- .../common/BrowserConnector.d.ts.map | 1 + .../esm/puppeteer/common/BrowserConnector.js | 76 + ...rt.d.ts => BrowserWebSocketTransport.d.ts} | 17 +- .../common/BrowserWebSocketTransport.d.ts.map | 1 + .../common/BrowserWebSocketTransport.js} | 17 +- .../lib/esm/puppeteer/common/Connection.d.ts | 4 +- .../esm/puppeteer/common/Connection.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Connection.js | 6 +- .../esm/puppeteer/common/ConsoleMessage.d.ts | 8 +- .../puppeteer/common/ConsoleMessage.d.ts.map | 2 +- .../esm/puppeteer/common/ConsoleMessage.js | 12 +- .../lib/esm/puppeteer/common/DOMWorld.d.ts | 27 +- .../esm/puppeteer/common/DOMWorld.d.ts.map | 2 +- .../lib/esm/puppeteer/common/DOMWorld.js | 248 +- .../lib/esm/puppeteer/common/Errors.d.ts | 2 +- .../lib/esm/puppeteer/common/Errors.js | 2 +- .../puppeteer/common/ExecutionContext.d.ts | 5 +- .../common/ExecutionContext.d.ts.map | 2 +- .../esm/puppeteer/common/FrameManager.d.ts | 27 +- .../puppeteer/common/FrameManager.d.ts.map | 2 +- .../lib/esm/puppeteer/common/FrameManager.js | 44 +- .../esm/puppeteer/common/HTTPRequest.d.ts.map | 2 +- .../lib/esm/puppeteer/common/HTTPRequest.js | 5 +- .../lib/esm/puppeteer/common/JSHandle.d.ts | 2 +- .../esm/puppeteer/common/JSHandle.d.ts.map | 2 +- .../lib/esm/puppeteer/common/JSHandle.js | 50 +- .../lib/esm/puppeteer/common/Page.d.ts | 99 +- .../lib/esm/puppeteer/common/Page.d.ts.map | 2 +- .../package/lib/esm/puppeteer/common/Page.js | 201 +- .../puppeteer/common/Product.d.ts} | 8 +- .../lib/esm/puppeteer/common/Product.d.ts.map | 1 + .../puppeteer/common/Product.js} | 2 - .../lib/esm/puppeteer/common/Puppeteer.d.ts | 183 +- .../esm/puppeteer/common/Puppeteer.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Puppeteer.js | 186 +- .../esm/puppeteer/common/QueryHandler.d.ts | 47 +- .../puppeteer/common/QueryHandler.d.ts.map | 2 +- .../lib/esm/puppeteer/common/QueryHandler.js | 132 +- .../lib/esm/puppeteer/common/Tracing.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Tracing.js | 8 +- .../common/WebSocketTransport.d.ts.map | 1 - .../puppeteer/common/fetch.d.ts} | 4 +- .../lib/esm/puppeteer/common/fetch.d.ts.map | 1 + .../puppeteer/common/fetch.js} | 10 +- .../lib/esm/puppeteer/common/helper.d.ts | 10 + .../lib/esm/puppeteer/common/helper.d.ts.map | 2 +- .../lib/esm/puppeteer/common/helper.js | 101 +- .../lib/esm/puppeteer/index-core.d.ts.map | 1 - .../package/lib/esm/puppeteer/index-core.js | 18 - .../package/lib/esm/puppeteer/index.d.ts | 18 - .../package/lib/esm/puppeteer/index.d.ts.map | 1 - .../package/lib/esm/puppeteer/index.js | 18 - .../lib/esm/puppeteer/initialize-node.d.ts | 18 + .../esm/puppeteer/initialize-node.d.ts.map | 1 + .../{initialize.js => initialize-node.js} | 15 +- .../puppeteer/initialize-web.d.ts} | 4 +- .../lib/esm/puppeteer/initialize-web.d.ts.map | 1 + .../{initialize.d.ts => initialize-web.js} | 8 +- .../lib/esm/puppeteer/initialize.d.ts.map | 1 - .../package/lib/esm/puppeteer/install.d.ts | 18 - .../lib/esm/puppeteer/install.d.ts.map | 1 - .../puppeteer/node-puppeteer-core.d.ts} | 4 +- .../puppeteer/node-puppeteer-core.d.ts.map | 1 + ...index-core.d.ts => node-puppeteer-core.js} | 9 +- .../index.d.ts => esm/puppeteer/node.d.ts} | 6 +- .../package/lib/esm/puppeteer/node.d.ts.map | 1 + .../index.js => esm/puppeteer/node.js} | 12 +- .../esm/puppeteer/node/BrowserFetcher.d.ts | 6 +- .../puppeteer/node/BrowserFetcher.d.ts.map | 2 +- .../lib/esm/puppeteer/node/BrowserRunner.js | 2 +- .../lib/esm/puppeteer/node/LaunchOptions.d.ts | 10 - .../esm/puppeteer/node/LaunchOptions.d.ts.map | 2 +- .../lib/esm/puppeteer/node/LaunchOptions.js | 15 - .../lib/esm/puppeteer/node/Launcher.d.ts | 4 +- .../lib/esm/puppeteer/node/Launcher.d.ts.map | 2 +- .../lib/esm/puppeteer/node/Launcher.js | 107 +- .../node/NodeWebSocketTransport.d.ts} | 12 +- .../node/NodeWebSocketTransport.d.ts.map | 1 + .../NodeWebSocketTransport.js} | 4 +- .../puppeteer/node}/Puppeteer.d.ts | 156 +- .../lib/esm/puppeteer/node/Puppeteer.d.ts.map | 1 + .../puppeteer/node}/Puppeteer.js | 181 +- .../puppeteer/node}/install.d.ts | 0 .../lib/esm/puppeteer/node/install.d.ts.map | 1 + .../lib/esm/puppeteer/{ => node}/install.js | 19 +- .../package/lib/esm/puppeteer/revisions.js | 2 +- .../esm/puppeteer/tsconfig.esm.tsbuildinfo | 3954 ++++------------ .../EvalTypes.js => esm/puppeteer/web.d.ts} | 5 +- .../package/lib/esm/puppeteer/web.d.ts.map | 1 + .../puppeteer/web.js} | 12 +- .../lib/esm/vendor/mitt/src/index.d.ts | 14 +- .../lib/esm/vendor/mitt/src/index.d.ts.map | 2 +- .../package/lib/esm/vendor/mitt/src/index.js | 12 +- .../lib/esm/vendor/tsconfig.esm.tsbuildinfo | 2496 ++-------- .../puppeteer/package/package.json | 62 +- scripts/deps/roll-puppeteer-into-frontend.py | 114 + 255 files changed, 3105 insertions(+), 30039 deletions(-) delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebSocketTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index-core.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index-core.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/install.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/install.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/tsconfig.cjs.tsbuildinfo delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/tsconfig.cjs.tsbuildinfo create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/node/LaunchOptions.d.ts => esm/puppeteer/common/BrowserConnector.d.ts} (54%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/{WebSocketTransport.d.ts => BrowserWebSocketTransport.d.ts} (66%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/WebSocketTransport.js => esm/puppeteer/common/BrowserWebSocketTransport.js} (56%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/environment.d.ts => esm/puppeteer/common/Product.d.ts} (82%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/node/LaunchOptions.js => esm/puppeteer/common/Product.js} (88%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/ConnectionTransport.js => esm/puppeteer/common/fetch.d.ts} (86%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/revisions.js => esm/puppeteer/common/fetch.js} (72%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.js delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.js create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{initialize.js => initialize-node.js} (75%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/initialize.d.ts => esm/puppeteer/initialize-web.d.ts} (84%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{initialize.d.ts => initialize-web.js} (78%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/install.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/install.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/index-core.d.ts => esm/puppeteer/node-puppeteer-core.d.ts} (92%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{index-core.d.ts => node-puppeteer-core.js} (71%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/index.d.ts => esm/puppeteer/node.d.ts} (82%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/index.js => esm/puppeteer/node.js} (70%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/WebSocketTransport.d.ts => esm/puppeteer/node/NodeWebSocketTransport.d.ts} (71%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{common/WebSocketTransport.js => node/NodeWebSocketTransport.js} (88%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common => esm/puppeteer/node}/Puppeteer.d.ts (56%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common => esm/puppeteer/node}/Puppeteer.js (57%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer => esm/puppeteer/node}/install.d.ts (100%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{ => node}/install.js (90%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/EvalTypes.js => esm/puppeteer/web.d.ts} (83%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/ConnectionTransport.d.ts => esm/puppeteer/web.js} (71%) create mode 100755 scripts/deps/roll-puppeteer-into-frontend.py diff --git a/all_devtools_modules.gni b/all_devtools_modules.gni index 8b3274dbca2..90d918f9ea1 100644 --- a/all_devtools_modules.gni +++ b/all_devtools_modules.gni @@ -589,7 +589,10 @@ all_typescript_module_sources = [ "third_party/marked/package/lib/marked.esm.js", "third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js", @@ -614,6 +617,7 @@ all_typescript_module_sources = [ "third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js", @@ -622,20 +626,25 @@ all_typescript_module_sources = [ "third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js", - "third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js", "third_party/puppeteer/package/lib/esm/puppeteer/environment.js", - "third_party/puppeteer/package/lib/esm/puppeteer/index-core.js", - "third_party/puppeteer/package/lib/esm/puppeteer/index.js", - "third_party/puppeteer/package/lib/esm/puppeteer/initialize.js", + "third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js", + "third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node/install.js", "third_party/puppeteer/package/lib/esm/puppeteer/revisions.js", + "third_party/puppeteer/package/lib/esm/puppeteer/web.js", "third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js", "third_party/wasmparser/package/dist/esm/WasmDis.js", "third_party/wasmparser/package/dist/esm/WasmParser.js", diff --git a/devtools_grd_files.gni b/devtools_grd_files.gni index 10b79ec26a4..98bebf4b347 100644 --- a/devtools_grd_files.gni +++ b/devtools_grd_files.gni @@ -942,7 +942,10 @@ grd_files_debug_sources = [ "front_end/third_party/marked/package/lib/marked.esm.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js", @@ -967,6 +970,7 @@ grd_files_debug_sources = [ "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js", @@ -975,20 +979,25 @@ grd_files_debug_sources = [ "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js", "front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js", "front_end/third_party/wasmparser/package/dist/esm/WasmDis.js", "front_end/third_party/wasmparser/package/dist/esm/WasmParser.js", diff --git a/front_end/third_party/puppeteer/BUILD.gn b/front_end/third_party/puppeteer/BUILD.gn index d62e1dd413c..7b644fa7d20 100644 --- a/front_end/third_party/puppeteer/BUILD.gn +++ b/front_end/third_party/puppeteer/BUILD.gn @@ -7,155 +7,64 @@ import("../../../scripts/build/ninja/devtools_pre_built.gni") devtools_pre_built("puppeteer") { sources = [ - "package/lib/esm/puppeteer/api-docs-entry.d.ts", - "package/lib/esm/puppeteer/api-docs-entry.d.ts.map", "package/lib/esm/puppeteer/api-docs-entry.js", - "package/lib/esm/puppeteer/common/Accessibility.d.ts", - "package/lib/esm/puppeteer/common/Accessibility.d.ts.map", "package/lib/esm/puppeteer/common/Accessibility.js", - "package/lib/esm/puppeteer/common/Browser.d.ts", - "package/lib/esm/puppeteer/common/Browser.d.ts.map", + "package/lib/esm/puppeteer/common/AriaQueryHandler.js", "package/lib/esm/puppeteer/common/Browser.js", - "package/lib/esm/puppeteer/common/Connection.d.ts", - "package/lib/esm/puppeteer/common/Connection.d.ts.map", + "package/lib/esm/puppeteer/common/BrowserConnector.js", + "package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "package/lib/esm/puppeteer/common/Connection.js", - "package/lib/esm/puppeteer/common/ConnectionTransport.d.ts", - "package/lib/esm/puppeteer/common/ConnectionTransport.d.ts.map", "package/lib/esm/puppeteer/common/ConnectionTransport.js", - "package/lib/esm/puppeteer/common/ConsoleMessage.d.ts", - "package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map", "package/lib/esm/puppeteer/common/ConsoleMessage.js", - "package/lib/esm/puppeteer/common/Coverage.d.ts", - "package/lib/esm/puppeteer/common/Coverage.d.ts.map", "package/lib/esm/puppeteer/common/Coverage.js", - "package/lib/esm/puppeteer/common/DOMWorld.d.ts", - "package/lib/esm/puppeteer/common/DOMWorld.d.ts.map", "package/lib/esm/puppeteer/common/DOMWorld.js", - "package/lib/esm/puppeteer/common/Debug.d.ts", - "package/lib/esm/puppeteer/common/Debug.d.ts.map", "package/lib/esm/puppeteer/common/Debug.js", - "package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts", - "package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map", "package/lib/esm/puppeteer/common/DeviceDescriptors.js", - "package/lib/esm/puppeteer/common/Dialog.d.ts", - "package/lib/esm/puppeteer/common/Dialog.d.ts.map", "package/lib/esm/puppeteer/common/Dialog.js", - "package/lib/esm/puppeteer/common/EmulationManager.d.ts", - "package/lib/esm/puppeteer/common/EmulationManager.d.ts.map", "package/lib/esm/puppeteer/common/EmulationManager.js", - "package/lib/esm/puppeteer/common/Errors.d.ts", - "package/lib/esm/puppeteer/common/Errors.d.ts.map", "package/lib/esm/puppeteer/common/Errors.js", - "package/lib/esm/puppeteer/common/EvalTypes.d.ts", - "package/lib/esm/puppeteer/common/EvalTypes.d.ts.map", "package/lib/esm/puppeteer/common/EvalTypes.js", - "package/lib/esm/puppeteer/common/EventEmitter.d.ts", - "package/lib/esm/puppeteer/common/EventEmitter.d.ts.map", "package/lib/esm/puppeteer/common/EventEmitter.js", - "package/lib/esm/puppeteer/common/Events.d.ts", - "package/lib/esm/puppeteer/common/Events.d.ts.map", "package/lib/esm/puppeteer/common/Events.js", - "package/lib/esm/puppeteer/common/ExecutionContext.d.ts", - "package/lib/esm/puppeteer/common/ExecutionContext.d.ts.map", "package/lib/esm/puppeteer/common/ExecutionContext.js", - "package/lib/esm/puppeteer/common/FileChooser.d.ts", - "package/lib/esm/puppeteer/common/FileChooser.d.ts.map", "package/lib/esm/puppeteer/common/FileChooser.js", - "package/lib/esm/puppeteer/common/FrameManager.d.ts", - "package/lib/esm/puppeteer/common/FrameManager.d.ts.map", "package/lib/esm/puppeteer/common/FrameManager.js", - "package/lib/esm/puppeteer/common/HTTPRequest.d.ts", - "package/lib/esm/puppeteer/common/HTTPRequest.d.ts.map", "package/lib/esm/puppeteer/common/HTTPRequest.js", - "package/lib/esm/puppeteer/common/HTTPResponse.d.ts", - "package/lib/esm/puppeteer/common/HTTPResponse.d.ts.map", "package/lib/esm/puppeteer/common/HTTPResponse.js", - "package/lib/esm/puppeteer/common/Input.d.ts", - "package/lib/esm/puppeteer/common/Input.d.ts.map", "package/lib/esm/puppeteer/common/Input.js", - "package/lib/esm/puppeteer/common/JSHandle.d.ts", - "package/lib/esm/puppeteer/common/JSHandle.d.ts.map", "package/lib/esm/puppeteer/common/JSHandle.js", - "package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts", - "package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map", "package/lib/esm/puppeteer/common/LifecycleWatcher.js", - "package/lib/esm/puppeteer/common/NetworkManager.d.ts", - "package/lib/esm/puppeteer/common/NetworkManager.d.ts.map", "package/lib/esm/puppeteer/common/NetworkManager.js", - "package/lib/esm/puppeteer/common/PDFOptions.d.ts", - "package/lib/esm/puppeteer/common/PDFOptions.d.ts.map", "package/lib/esm/puppeteer/common/PDFOptions.js", - "package/lib/esm/puppeteer/common/Page.d.ts", - "package/lib/esm/puppeteer/common/Page.d.ts.map", "package/lib/esm/puppeteer/common/Page.js", - "package/lib/esm/puppeteer/common/Puppeteer.d.ts", - "package/lib/esm/puppeteer/common/Puppeteer.d.ts.map", + "package/lib/esm/puppeteer/common/Product.js", "package/lib/esm/puppeteer/common/Puppeteer.js", - "package/lib/esm/puppeteer/common/PuppeteerViewport.d.ts", - "package/lib/esm/puppeteer/common/PuppeteerViewport.d.ts.map", "package/lib/esm/puppeteer/common/PuppeteerViewport.js", - "package/lib/esm/puppeteer/common/QueryHandler.d.ts", - "package/lib/esm/puppeteer/common/QueryHandler.d.ts.map", "package/lib/esm/puppeteer/common/QueryHandler.js", - "package/lib/esm/puppeteer/common/SecurityDetails.d.ts", - "package/lib/esm/puppeteer/common/SecurityDetails.d.ts.map", "package/lib/esm/puppeteer/common/SecurityDetails.js", - "package/lib/esm/puppeteer/common/Target.d.ts", - "package/lib/esm/puppeteer/common/Target.d.ts.map", "package/lib/esm/puppeteer/common/Target.js", - "package/lib/esm/puppeteer/common/TimeoutSettings.d.ts", - "package/lib/esm/puppeteer/common/TimeoutSettings.d.ts.map", "package/lib/esm/puppeteer/common/TimeoutSettings.js", - "package/lib/esm/puppeteer/common/Tracing.d.ts", - "package/lib/esm/puppeteer/common/Tracing.d.ts.map", "package/lib/esm/puppeteer/common/Tracing.js", - "package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts", - "package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map", "package/lib/esm/puppeteer/common/USKeyboardLayout.js", - "package/lib/esm/puppeteer/common/WebSocketTransport.d.ts", - "package/lib/esm/puppeteer/common/WebSocketTransport.d.ts.map", - "package/lib/esm/puppeteer/common/WebSocketTransport.js", - "package/lib/esm/puppeteer/common/WebWorker.d.ts", - "package/lib/esm/puppeteer/common/WebWorker.d.ts.map", "package/lib/esm/puppeteer/common/WebWorker.js", - "package/lib/esm/puppeteer/common/assert.d.ts", - "package/lib/esm/puppeteer/common/assert.d.ts.map", "package/lib/esm/puppeteer/common/assert.js", - "package/lib/esm/puppeteer/common/helper.d.ts", - "package/lib/esm/puppeteer/common/helper.d.ts.map", + "package/lib/esm/puppeteer/common/fetch.js", "package/lib/esm/puppeteer/common/helper.js", - "package/lib/esm/puppeteer/environment.d.ts", - "package/lib/esm/puppeteer/environment.d.ts.map", "package/lib/esm/puppeteer/environment.js", - "package/lib/esm/puppeteer/index-core.d.ts", - "package/lib/esm/puppeteer/index-core.d.ts.map", - "package/lib/esm/puppeteer/index-core.js", - "package/lib/esm/puppeteer/index.d.ts", - "package/lib/esm/puppeteer/index.d.ts.map", - "package/lib/esm/puppeteer/index.js", - "package/lib/esm/puppeteer/initialize.d.ts", - "package/lib/esm/puppeteer/initialize.d.ts.map", - "package/lib/esm/puppeteer/initialize.js", - "package/lib/esm/puppeteer/node/BrowserFetcher.d.ts", - "package/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map", + "package/lib/esm/puppeteer/initialize-node.js", + "package/lib/esm/puppeteer/initialize-web.js", + "package/lib/esm/puppeteer/node-puppeteer-core.js", + "package/lib/esm/puppeteer/node.js", "package/lib/esm/puppeteer/node/BrowserFetcher.js", - "package/lib/esm/puppeteer/node/BrowserRunner.d.ts", - "package/lib/esm/puppeteer/node/BrowserRunner.d.ts.map", "package/lib/esm/puppeteer/node/BrowserRunner.js", - "package/lib/esm/puppeteer/node/LaunchOptions.d.ts", - "package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map", "package/lib/esm/puppeteer/node/LaunchOptions.js", - "package/lib/esm/puppeteer/node/Launcher.d.ts", - "package/lib/esm/puppeteer/node/Launcher.d.ts.map", "package/lib/esm/puppeteer/node/Launcher.js", - "package/lib/esm/puppeteer/node/PipeTransport.d.ts", - "package/lib/esm/puppeteer/node/PipeTransport.d.ts.map", + "package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "package/lib/esm/puppeteer/node/PipeTransport.js", - "package/lib/esm/puppeteer/revisions.d.ts", - "package/lib/esm/puppeteer/revisions.d.ts.map", + "package/lib/esm/puppeteer/node/Puppeteer.js", + "package/lib/esm/puppeteer/node/install.js", "package/lib/esm/puppeteer/revisions.js", - "package/lib/esm/vendor/mitt/src/index.d.ts", - "package/lib/esm/vendor/mitt/src/index.d.ts.map", + "package/lib/esm/puppeteer/web.js", "package/lib/esm/vendor/mitt/src/index.js", "puppeteer-tsconfig.json", ] diff --git a/front_end/third_party/puppeteer/package/LICENSE b/front_end/third_party/puppeteer/package/LICENSE index afdfe50e72e..d2c171df74e 100644 --- a/front_end/third_party/puppeteer/package/LICENSE +++ b/front_end/third_party/puppeteer/package/LICENSE @@ -1,7 +1,7 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -193,7 +193,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/front_end/third_party/puppeteer/package/README.md b/front_end/third_party/puppeteer/package/README.md index a7e87358942..5a851876881 100644 --- a/front_end/third_party/puppeteer/package/README.md +++ b/front_end/third_party/puppeteer/package/README.md @@ -6,7 +6,7 @@ -###### [API](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) +###### [API](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) > Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium. @@ -37,7 +37,7 @@ npm i puppeteer # or "yarn add puppeteer" ``` -Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#environment-variables). +Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#environment-variables). ### puppeteer-core @@ -63,7 +63,7 @@ Note: Prior to v1.18.1, Puppeteer required at least Node v6.4.0. Versions from v Node 8.9.0+. Starting from v3.0.0 Puppeteer starts to rely on Node 10.18.1+. All examples below use async/await which is only supported in Node v7.6.0 or greater. Puppeteer will be familiar to people using other browser testing frameworks. You create an instance -of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#). +of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#). **Example** - navigating to https://example.com and saving a screenshot as *example.png*: @@ -88,7 +88,7 @@ Execute script on the command line node example.js ``` -Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pagesetviewportviewport). +Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pagesetviewportviewport). **Example** - create a PDF. @@ -113,7 +113,7 @@ Execute script on the command line node hn.js ``` -See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pagepdfoptions) for more information about creating pdfs. +See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pagepdfoptions) for more information about creating pdfs. **Example** - evaluate script in the context of the page @@ -148,7 +148,7 @@ Execute script on the command line node get-dimensions.js ``` -See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. +See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. @@ -157,7 +157,7 @@ See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/ **1. Uses Headless mode** -Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) when launching a browser: +Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) when launching a browser: ```js const browser = await puppeteer.launch({headless: false}); // default is true @@ -173,7 +173,7 @@ pass in the executable's path when creating a `Browser` instance: const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'}); ``` -You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) for more information. +You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) for more information. See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. @@ -185,7 +185,7 @@ Puppeteer creates its own browser user profile which it **cleans up on every run ## Resources -- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md) +- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md) - [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples/) - [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer) @@ -328,7 +328,7 @@ See [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING Official Firefox support is currently experimental. The ongoing collaboration with Mozilla aims to support common end-to-end testing use cases, for which developers expect cross-browser coverage. The Puppeteer team needs input from users to stabilize Firefox support and to bring missing APIs to our attention. -From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. +From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. We will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari. This effort includes exploration of a standard for executing cross-browser commands (instead of relying on the non-standard DevTools Protocol used by Chrome). @@ -424,7 +424,7 @@ await page.evaluate(() => { You may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/puppeteer/puppeteer/issues/291).) There are two reasons for this: -* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) +* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) * Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming). #### Q: I am having trouble installing / running Puppeteer in my test environment. Where should I look for help? diff --git a/front_end/third_party/puppeteer/package/cjs-entry-core.js b/front_end/third_party/puppeteer/package/cjs-entry-core.js index 70e9b88040f..446726fafa3 100644 --- a/front_end/third_party/puppeteer/package/cjs-entry-core.js +++ b/front_end/third_party/puppeteer/package/cjs-entry-core.js @@ -25,5 +25,5 @@ * This means that we can publish to CJS and ESM whilst maintaining the expected * import behaviour for CJS and ESM users. */ -const puppeteerExport = require('./lib/cjs/puppeteer/index-core'); +const puppeteerExport = require('./lib/cjs/puppeteer/node-puppeteer-core'); module.exports = puppeteerExport.default; diff --git a/front_end/third_party/puppeteer/package/cjs-entry.js b/front_end/third_party/puppeteer/package/cjs-entry.js index 1bcec7d85af..d1840a9bea1 100644 --- a/front_end/third_party/puppeteer/package/cjs-entry.js +++ b/front_end/third_party/puppeteer/package/cjs-entry.js @@ -25,5 +25,5 @@ * This means that we can publish to CJS and ESM whilst maintaining the expected * import behaviour for CJS and ESM users. */ -const puppeteerExport = require('./lib/cjs/puppeteer/index'); +const puppeteerExport = require('./lib/cjs/puppeteer/node'); module.exports = puppeteerExport.default; diff --git a/front_end/third_party/puppeteer/package/install.js b/front_end/third_party/puppeteer/package/install.js index 5fe1314e4a6..11518a595f5 100644 --- a/front_end/third_party/puppeteer/package/install.js +++ b/front_end/third_party/puppeteer/package/install.js @@ -32,7 +32,7 @@ async function download() { const { downloadBrowser, logPolitely, - } = require('./lib/cjs/puppeteer/install'); + } = require('./lib/cjs/puppeteer/node/install'); if (process.env.PUPPETEER_SKIP_DOWNLOAD) { logPolitely( diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts deleted file mode 100644 index 4fca5db7228..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './common/Accessibility.js'; -export * from './common/Browser.js'; -export * from './node/BrowserFetcher.js'; -export * from './common/Connection.js'; -export * from './common/ConsoleMessage.js'; -export * from './common/Coverage.js'; -export * from './common/DeviceDescriptors.js'; -export * from './common/Dialog.js'; -export * from './common/DOMWorld.js'; -export * from './common/JSHandle.js'; -export * from './common/ExecutionContext.js'; -export * from './common/EventEmitter.js'; -export * from './common/FileChooser.js'; -export * from './common/FrameManager.js'; -export * from './common/Input.js'; -export * from './common/Page.js'; -export * from './common/Puppeteer.js'; -export * from './node/LaunchOptions.js'; -export * from './node/Launcher.js'; -export * from './common/HTTPRequest.js'; -export * from './common/HTTPResponse.js'; -export * from './common/SecurityDetails.js'; -export * from './common/Target.js'; -export * from './common/Errors.js'; -export * from './common/Tracing.js'; -export * from './common/NetworkManager.js'; -export * from './common/WebWorker.js'; -export * from './common/USKeyboardLayout.js'; -export * from './common/EvalTypes.js'; -export * from './common/PDFOptions.js'; -export * from './common/TimeoutSettings.js'; -export * from './common/LifecycleWatcher.js'; -export * from 'devtools-protocol/types/protocol'; -//# sourceMappingURL=api-docs-entry.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map deleted file mode 100644 index 1e462ec6c80..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api-docs-entry.d.ts","sourceRoot":"","sources":["../../../src/api-docs-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAaH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js deleted file mode 100644 index c98190a29e7..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -/* - * This file re-exports any APIs that we want to have documentation generated - * for. It is used by API Extractor to determine what parts of the system to - * document. - * - * We also have src/api.ts. This is used in `index.js` and by the legacy DocLint - * system. src/api-docs-entry.ts is ONLY used by API Extractor. - * - * Once we have migrated to API Extractor and removed DocLint we can remove the - * duplication and use this file. - */ -__exportStar(require("./common/Accessibility.js"), exports); -__exportStar(require("./common/Browser.js"), exports); -__exportStar(require("./node/BrowserFetcher.js"), exports); -__exportStar(require("./common/Connection.js"), exports); -__exportStar(require("./common/ConsoleMessage.js"), exports); -__exportStar(require("./common/Coverage.js"), exports); -__exportStar(require("./common/DeviceDescriptors.js"), exports); -__exportStar(require("./common/Dialog.js"), exports); -__exportStar(require("./common/DOMWorld.js"), exports); -__exportStar(require("./common/JSHandle.js"), exports); -__exportStar(require("./common/ExecutionContext.js"), exports); -__exportStar(require("./common/EventEmitter.js"), exports); -__exportStar(require("./common/FileChooser.js"), exports); -__exportStar(require("./common/FrameManager.js"), exports); -__exportStar(require("./common/Input.js"), exports); -__exportStar(require("./common/Page.js"), exports); -__exportStar(require("./common/Puppeteer.js"), exports); -__exportStar(require("./node/LaunchOptions.js"), exports); -__exportStar(require("./node/Launcher.js"), exports); -__exportStar(require("./common/HTTPRequest.js"), exports); -__exportStar(require("./common/HTTPResponse.js"), exports); -__exportStar(require("./common/SecurityDetails.js"), exports); -__exportStar(require("./common/Target.js"), exports); -__exportStar(require("./common/Errors.js"), exports); -__exportStar(require("./common/Tracing.js"), exports); -__exportStar(require("./common/NetworkManager.js"), exports); -__exportStar(require("./common/WebWorker.js"), exports); -__exportStar(require("./common/USKeyboardLayout.js"), exports); -__exportStar(require("./common/EvalTypes.js"), exports); -__exportStar(require("./common/PDFOptions.js"), exports); -__exportStar(require("./common/TimeoutSettings.js"), exports); -__exportStar(require("./common/LifecycleWatcher.js"), exports); -__exportStar(require("devtools-protocol/types/protocol"), exports); diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts deleted file mode 100644 index 736b3b54394..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts +++ /dev/null @@ -1,176 +0,0 @@ -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { CDPSession } from './Connection.js'; -import { ElementHandle } from './JSHandle.js'; -/** - * Represents a Node and the properties of it that are relevant to Accessibility. - * @public - */ -export interface SerializedAXNode { - /** - * The {@link https://www.w3.org/TR/wai-aria/#usage_intro | role} of the node. - */ - role: string; - /** - * A human readable name for the node. - */ - name?: string; - /** - * The current value of the node. - */ - value?: string | number; - /** - * An additional human readable description of the node. - */ - description?: string; - /** - * Any keyboard shortcuts associated with this node. - */ - keyshortcuts?: string; - /** - * A human readable alternative to the role. - */ - roledescription?: string; - /** - * A description of the current value. - */ - valuetext?: string; - disabled?: boolean; - expanded?: boolean; - focused?: boolean; - modal?: boolean; - multiline?: boolean; - /** - * Whether more than one child can be selected. - */ - multiselectable?: boolean; - readonly?: boolean; - required?: boolean; - selected?: boolean; - /** - * Whether the checkbox is checked, or in a - * {@link https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html | mixed state}. - */ - checked?: boolean | 'mixed'; - /** - * Whether the node is checked or in a mixed state. - */ - pressed?: boolean | 'mixed'; - /** - * The level of a heading. - */ - level?: number; - valuemin?: number; - valuemax?: number; - autocomplete?: string; - haspopup?: string; - /** - * Whether and in what way this node's value is invalid. - */ - invalid?: string; - orientation?: string; - /** - * Children of this node, if there are any. - */ - children?: SerializedAXNode[]; -} -/** - * @public - */ -export interface SnapshotOptions { - /** - * Prune unintersting nodes from the tree. - * @defaultValue true - */ - interestingOnly?: boolean; - /** - * Prune unintersting nodes from the tree. - * @defaultValue The root node of the entire page. - */ - root?: ElementHandle; -} -/** - * The Accessibility class provides methods for inspecting Chromium's - * accessibility tree. The accessibility tree is used by assistive technology - * such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or - * {@link https://en.wikipedia.org/wiki/Switch_access | switches}. - * - * @remarks - * - * Accessibility is a very platform-specific thing. On different platforms, - * there are different screen readers that might have wildly different output. - * - * Blink - Chrome's rendering engine - has a concept of "accessibility tree", - * which is then translated into different platform-specific APIs. Accessibility - * namespace gives users access to the Blink Accessibility Tree. - * - * Most of the accessibility tree gets filtered out when converting from Blink - * AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. - * By default, Puppeteer tries to approximate this filtering, exposing only - * the "interesting" nodes of the tree. - * - * @public - */ -export declare class Accessibility { - private _client; - /** - * @internal - */ - constructor(client: CDPSession); - /** - * Captures the current state of the accessibility tree. - * The returned object represents the root accessible node of the page. - * - * @remarks - * - * **NOTE** The Chromium accessibility tree contains nodes that go unused on - * most platforms and by most screen readers. Puppeteer will discard them as - * well for an easier to process tree, unless `interestingOnly` is set to - * `false`. - * - * @example - * An example of dumping the entire accessibility tree: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * console.log(snapshot); - * ``` - * - * @example - * An example of logging the focused node's name: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * const node = findFocusedNode(snapshot); - * console.log(node && node.name); - * - * function findFocusedNode(node) { - * if (node.focused) - * return node; - * for (const child of node.children || []) { - * const foundNode = findFocusedNode(child); - * return foundNode; - * } - * return null; - * } - * ``` - * - * @returns An AXNode object representing the snapshot. - * - */ - snapshot(options?: SnapshotOptions): Promise; - private serializeTree; - private collectInterestingNodes; -} -//# sourceMappingURL=Accessibility.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map deleted file mode 100644 index 09e4537815d..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Accessibility.d.ts","sourceRoot":"","sources":["../../../../src/common/Accessibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAa;IAE5B;;OAEG;gBACS,MAAM,EAAE,UAAU;IAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACU,QAAQ,CACnB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC;IA0B5B,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,uBAAuB;CAWhC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js deleted file mode 100644 index 03dff902668..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js +++ /dev/null @@ -1,360 +0,0 @@ -"use strict"; -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Accessibility = void 0; -/** - * The Accessibility class provides methods for inspecting Chromium's - * accessibility tree. The accessibility tree is used by assistive technology - * such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or - * {@link https://en.wikipedia.org/wiki/Switch_access | switches}. - * - * @remarks - * - * Accessibility is a very platform-specific thing. On different platforms, - * there are different screen readers that might have wildly different output. - * - * Blink - Chrome's rendering engine - has a concept of "accessibility tree", - * which is then translated into different platform-specific APIs. Accessibility - * namespace gives users access to the Blink Accessibility Tree. - * - * Most of the accessibility tree gets filtered out when converting from Blink - * AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. - * By default, Puppeteer tries to approximate this filtering, exposing only - * the "interesting" nodes of the tree. - * - * @public - */ -class Accessibility { - /** - * @internal - */ - constructor(client) { - this._client = client; - } - /** - * Captures the current state of the accessibility tree. - * The returned object represents the root accessible node of the page. - * - * @remarks - * - * **NOTE** The Chromium accessibility tree contains nodes that go unused on - * most platforms and by most screen readers. Puppeteer will discard them as - * well for an easier to process tree, unless `interestingOnly` is set to - * `false`. - * - * @example - * An example of dumping the entire accessibility tree: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * console.log(snapshot); - * ``` - * - * @example - * An example of logging the focused node's name: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * const node = findFocusedNode(snapshot); - * console.log(node && node.name); - * - * function findFocusedNode(node) { - * if (node.focused) - * return node; - * for (const child of node.children || []) { - * const foundNode = findFocusedNode(child); - * return foundNode; - * } - * return null; - * } - * ``` - * - * @returns An AXNode object representing the snapshot. - * - */ - async snapshot(options = {}) { - const { interestingOnly = true, root = null } = options; - const { nodes } = await this._client.send('Accessibility.getFullAXTree'); - let backendNodeId = null; - if (root) { - const { node } = await this._client.send('DOM.describeNode', { - objectId: root._remoteObject.objectId, - }); - backendNodeId = node.backendNodeId; - } - const defaultRoot = AXNode.createTree(nodes); - let needle = defaultRoot; - if (backendNodeId) { - needle = defaultRoot.find((node) => node.payload.backendDOMNodeId === backendNodeId); - if (!needle) - return null; - } - if (!interestingOnly) - return this.serializeTree(needle)[0]; - const interestingNodes = new Set(); - this.collectInterestingNodes(interestingNodes, defaultRoot, false); - if (!interestingNodes.has(needle)) - return null; - return this.serializeTree(needle, interestingNodes)[0]; - } - serializeTree(node, whitelistedNodes) { - const children = []; - for (const child of node.children) - children.push(...this.serializeTree(child, whitelistedNodes)); - if (whitelistedNodes && !whitelistedNodes.has(node)) - return children; - const serializedNode = node.serialize(); - if (children.length) - serializedNode.children = children; - return [serializedNode]; - } - collectInterestingNodes(collection, node, insideControl) { - if (node.isInteresting(insideControl)) - collection.add(node); - if (node.isLeafNode()) - return; - insideControl = insideControl || node.isControl(); - for (const child of node.children) - this.collectInterestingNodes(collection, child, insideControl); - } -} -exports.Accessibility = Accessibility; -class AXNode { - constructor(payload) { - this.children = []; - this._richlyEditable = false; - this._editable = false; - this._focusable = false; - this._hidden = false; - this.payload = payload; - this._name = this.payload.name ? this.payload.name.value : ''; - this._role = this.payload.role ? this.payload.role.value : 'Unknown'; - for (const property of this.payload.properties || []) { - if (property.name === 'editable') { - this._richlyEditable = property.value.value === 'richtext'; - this._editable = true; - } - if (property.name === 'focusable') - this._focusable = property.value.value; - if (property.name === 'hidden') - this._hidden = property.value.value; - } - } - _isPlainTextField() { - if (this._richlyEditable) - return false; - if (this._editable) - return true; - return (this._role === 'textbox' || - this._role === 'ComboBox' || - this._role === 'searchbox'); - } - _isTextOnlyObject() { - const role = this._role; - return role === 'LineBreak' || role === 'text' || role === 'InlineTextBox'; - } - _hasFocusableChild() { - if (this._cachedHasFocusableChild === undefined) { - this._cachedHasFocusableChild = false; - for (const child of this.children) { - if (child._focusable || child._hasFocusableChild()) { - this._cachedHasFocusableChild = true; - break; - } - } - } - return this._cachedHasFocusableChild; - } - find(predicate) { - if (predicate(this)) - return this; - for (const child of this.children) { - const result = child.find(predicate); - if (result) - return result; - } - return null; - } - isLeafNode() { - if (!this.children.length) - return true; - // These types of objects may have children that we use as internal - // implementation details, but we want to expose them as leaves to platform - // accessibility APIs because screen readers might be confused if they find - // any children. - if (this._isPlainTextField() || this._isTextOnlyObject()) - return true; - // Roles whose children are only presentational according to the ARIA and - // HTML5 Specs should be hidden from screen readers. - // (Note that whilst ARIA buttons can have only presentational children, HTML5 - // buttons are allowed to have content.) - switch (this._role) { - case 'doc-cover': - case 'graphics-symbol': - case 'img': - case 'Meter': - case 'scrollbar': - case 'slider': - case 'separator': - case 'progressbar': - return true; - default: - break; - } - // Here and below: Android heuristics - if (this._hasFocusableChild()) - return false; - if (this._focusable && this._name) - return true; - if (this._role === 'heading' && this._name) - return true; - return false; - } - isControl() { - switch (this._role) { - case 'button': - case 'checkbox': - case 'ColorWell': - case 'combobox': - case 'DisclosureTriangle': - case 'listbox': - case 'menu': - case 'menubar': - case 'menuitem': - case 'menuitemcheckbox': - case 'menuitemradio': - case 'radio': - case 'scrollbar': - case 'searchbox': - case 'slider': - case 'spinbutton': - case 'switch': - case 'tab': - case 'textbox': - case 'tree': - return true; - default: - return false; - } - } - isInteresting(insideControl) { - const role = this._role; - if (role === 'Ignored' || this._hidden) - return false; - if (this._focusable || this._richlyEditable) - return true; - // If it's not focusable but has a control role, then it's interesting. - if (this.isControl()) - return true; - // A non focusable child of a control is not interesting - if (insideControl) - return false; - return this.isLeafNode() && !!this._name; - } - serialize() { - const properties = new Map(); - for (const property of this.payload.properties || []) - properties.set(property.name.toLowerCase(), property.value.value); - if (this.payload.name) - properties.set('name', this.payload.name.value); - if (this.payload.value) - properties.set('value', this.payload.value.value); - if (this.payload.description) - properties.set('description', this.payload.description.value); - const node = { - role: this._role, - }; - const userStringProperties = [ - 'name', - 'value', - 'description', - 'keyshortcuts', - 'roledescription', - 'valuetext', - ]; - const getUserStringPropertyValue = (key) => properties.get(key); - for (const userStringProperty of userStringProperties) { - if (!properties.has(userStringProperty)) - continue; - node[userStringProperty] = getUserStringPropertyValue(userStringProperty); - } - const booleanProperties = [ - 'disabled', - 'expanded', - 'focused', - 'modal', - 'multiline', - 'multiselectable', - 'readonly', - 'required', - 'selected', - ]; - const getBooleanPropertyValue = (key) => properties.get(key); - for (const booleanProperty of booleanProperties) { - // WebArea's treat focus differently than other nodes. They report whether - // their frame has focus, not whether focus is specifically on the root - // node. - if (booleanProperty === 'focused' && this._role === 'WebArea') - continue; - const value = getBooleanPropertyValue(booleanProperty); - if (!value) - continue; - node[booleanProperty] = getBooleanPropertyValue(booleanProperty); - } - const tristateProperties = ['checked', 'pressed']; - for (const tristateProperty of tristateProperties) { - if (!properties.has(tristateProperty)) - continue; - const value = properties.get(tristateProperty); - node[tristateProperty] = - value === 'mixed' ? 'mixed' : value === 'true' ? true : false; - } - const numericalProperties = [ - 'level', - 'valuemax', - 'valuemin', - ]; - const getNumericalPropertyValue = (key) => properties.get(key); - for (const numericalProperty of numericalProperties) { - if (!properties.has(numericalProperty)) - continue; - node[numericalProperty] = getNumericalPropertyValue(numericalProperty); - } - const tokenProperties = [ - 'autocomplete', - 'haspopup', - 'invalid', - 'orientation', - ]; - const getTokenPropertyValue = (key) => properties.get(key); - for (const tokenProperty of tokenProperties) { - const value = getTokenPropertyValue(tokenProperty); - if (!value || value === 'false') - continue; - node[tokenProperty] = getTokenPropertyValue(tokenProperty); - } - return node; - } - static createTree(payloads) { - const nodeById = new Map(); - for (const payload of payloads) - nodeById.set(payload.nodeId, new AXNode(payload)); - for (const node of nodeById.values()) { - for (const childId of node.payload.childIds || []) - node.children.push(nodeById.get(childId)); - } - return nodeById.values().next().value; - } -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts deleted file mode 100644 index 43df72baf69..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts +++ /dev/null @@ -1,424 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/// -import { ChildProcess } from 'child_process'; -import { Protocol } from 'devtools-protocol'; - -import { Connection } from './Connection.js'; -import { EventEmitter } from './EventEmitter.js'; -import { Page } from './Page.js'; -import { Viewport } from './PuppeteerViewport.js'; -import { Target } from './Target.js'; - -declare type BrowserCloseCallback = () => Promise | void; -/** - * @public - */ -export interface WaitForTargetOptions { - /** - * Maximum wait time in milliseconds. Pass `0` to disable the timeout. - * @defaultValue 30 seconds. - */ - timeout?: number; -} -/** - * All the events a {@link Browser | browser instance} may emit. - * - * @public - */ -export declare const enum BrowserEmittedEvents { - /** - * Emitted when Puppeteer gets disconnected from the Chromium instance. This - * might happen because of one of the following: - * - * - Chromium is closed or crashed - * - * - The {@link Browser.disconnect | browser.disconnect } method was called. - */ - Disconnected = "disconnected", - /** - * Emitted when the url of a target changes. Contains a {@link Target} instance. - * - * @remarks - * - * Note that this includes target changes in incognito browser contexts. - */ - TargetChanged = "targetchanged", - /** - * Emitted when a target is created, for example when a new page is opened by - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/open | window.open} - * or by {@link Browser.newPage | browser.newPage} - * - * Contains a {@link Target} instance. - * - * @remarks - * - * Note that this includes target creations in incognito browser contexts. - */ - TargetCreated = "targetcreated", - /** - * Emitted when a target is destroyed, for example when a page is closed. - * Contains a {@link Target} instance. - * - * @remarks - * - * Note that this includes target destructions in incognito browser contexts. - */ - TargetDestroyed = "targetdestroyed" -} -/** - * A Browser is created when Puppeteer connects to a Chromium instance, either through - * {@link Puppeteer.launch} or {@link Puppeteer.connect}. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and will - * emit various events which are documented in the {@link BrowserEmittedEvents} enum. - * - * @example - * - * An example of using a {@link Browser} to create a {@link Page}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * await page.goto('https://example.com'); - * await browser.close(); - * })(); - * ``` - * - * @example - * - * An example of disconnecting from and reconnecting to a {@link Browser}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * // Store the endpoint to be able to reconnect to Chromium - * const browserWSEndpoint = browser.wsEndpoint(); - * // Disconnect puppeteer from Chromium - * browser.disconnect(); - * - * // Use the endpoint to reestablish a connection - * const browser2 = await puppeteer.connect({browserWSEndpoint}); - * // Close Chromium - * await browser2.close(); - * })(); - * ``` - * - * @public - */ -export declare class Browser extends EventEmitter { - /** - * @internal - */ - static create(connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport, process?: ChildProcess, closeCallback?: BrowserCloseCallback): Promise; - private _ignoreHTTPSErrors; - private _defaultViewport?; - private _process?; - private _connection; - private _closeCallback; - private _defaultContext; - private _contexts; - /** - * @internal - * Used in Target.ts directly so cannot be marked private. - */ - _targets: Map; - /** - * @internal - */ - constructor(connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport, process?: ChildProcess, closeCallback?: BrowserCloseCallback); - /** - * The spawned browser process. Returns `null` if the browser instance was created with - * {@link Puppeteer.connect}. - */ - process(): ChildProcess | null; - /** - * Creates a new incognito browser context. This won't share cookies/cache with other - * browser contexts. - * - * @example - * ```js - * (async () => { - * const browser = await puppeteer.launch(); - * // Create a new incognito browser context. - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page in a pristine context. - * const page = await context.newPage(); - * // Do stuff - * await page.goto('https://example.com'); - * })(); - * ``` - */ - createIncognitoBrowserContext(): Promise; - /** - * Returns an array of all open browser contexts. In a newly created browser, this will - * return a single instance of {@link BrowserContext}. - */ - browserContexts(): BrowserContext[]; - /** - * Returns the default browser context. The default browser context cannot be closed. - */ - defaultBrowserContext(): BrowserContext; - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - _disposeContext(contextId?: string): Promise; - private _targetCreated; - private _targetDestroyed; - private _targetInfoChanged; - /** - * The browser websocket endpoint which can be used as an argument to - * {@link Puppeteer.connect}. - * - * @returns The Browser websocket url. - * - * @remarks - * - * The format is `ws://${host}:${port}/devtools/browser/`. - * - * You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. - * Learn more about the - * {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and - * the {@link - * https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target - * | browser endpoint}. - */ - wsEndpoint(): string; - /** - * Creates a {@link Page} in the default browser context. - */ - newPage(): Promise; - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - _createPageInContext(contextId?: string): Promise; - /** - * All active targets inside the Browser. In case of multiple browser contexts, returns - * an array with all the targets in all browser contexts. - */ - targets(): Target[]; - /** - * The target associated with the browser. - */ - target(): Target; - /** - * Searches for a target in all browser contexts. - * - * @param predicate - A function to be run for every target. - * @returns The first target found that matches the `predicate` function. - * - * @example - * - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - */ - waitForTarget(predicate: (x: Target) => boolean, options?: WaitForTargetOptions): Promise; - /** - * An array of all open pages inside the Browser. - * - * @remarks - * - * In case of multiple browser contexts, returns an array with all the pages in all - * browser contexts. Non-visible pages, such as `"background_page"`, will not be listed - * here. You can find them using {@link Target.page}. - */ - pages(): Promise; - /** - * A string representing the browser name and version. - * - * @remarks - * - * For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For - * non-headless, this is similar to `Chrome/61.0.3153.0`. - * - * The format of browser.version() might change with future releases of Chromium. - */ - version(): Promise; - /** - * The browser's original user agent. Pages can override the browser user agent with - * {@link Page.setUserAgent}. - */ - userAgent(): Promise; - /** - * Closes Chromium and all of its pages (if any were opened). The {@link Browser} object - * itself is considered to be disposed and cannot be used anymore. - */ - close(): Promise; - /** - * Disconnects Puppeteer from the browser, but leaves the Chromium process running. - * After calling `disconnect`, the {@link Browser} object is considered disposed and - * cannot be used anymore. - */ - disconnect(): void; - /** - * Indicates that the browser is connected. - */ - isConnected(): boolean; - private _getVersion; -} -export declare const enum BrowserContextEmittedEvents { - /** - * Emitted when the url of a target inside the browser context changes. - * Contains a {@link Target} instance. - */ - TargetChanged = "targetchanged", - /** - * Emitted when a target is created within the browser context, for example - * when a new page is opened by - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/open | window.open} - * or by {@link BrowserContext.newPage | browserContext.newPage} - * - * Contains a {@link Target} instance. - */ - TargetCreated = "targetcreated", - /** - * Emitted when a target is destroyed within the browser context, for example - * when a page is closed. Contains a {@link Target} instance. - */ - TargetDestroyed = "targetdestroyed" -} -/** - * BrowserContexts provide a way to operate multiple independent browser - * sessions. When a browser is launched, it has a single BrowserContext used by - * default. The method {@link Browser.newPage | Browser.newPage} creates a page - * in the default browser context. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and - * will emit various events which are documented in the - * {@link BrowserContextEmittedEvents} enum. - * - * If a page opens another page, e.g. with a `window.open` call, the popup will - * belong to the parent page's browser context. - * - * Puppeteer allows creation of "incognito" browser contexts with - * {@link Browser.createIncognitoBrowserContext | Browser.createIncognitoBrowserContext} - * method. "Incognito" browser contexts don't write any browsing data to disk. - * - * @example - * ```js - * // Create a new incognito browser context - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page inside context. - * const page = await context.newPage(); - * // ... do stuff with page ... - * await page.goto('https://example.com'); - * // Dispose context once it's no longer needed. - * await context.close(); - * ``` - */ -export declare class BrowserContext extends EventEmitter { - private _connection; - private _browser; - private _id?; - /** - * @internal - */ - constructor(connection: Connection, browser: Browser, contextId?: string); - /** - * An array of all active targets inside the browser context. - */ - targets(): Target[]; - /** - * This searches for a target in this specific browser context. - * - * @example - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - * - * @param predicate - A function to be run for every target - * @param options - An object of options. Accepts a timout, - * which is the maximum wait time in milliseconds. - * Pass `0` to disable the timeout. Defaults to 30 seconds. - * @returns Promise which resolves to the first target found - * that matches the `predicate` function. - */ - waitForTarget(predicate: (x: Target) => boolean, options?: { - timeout?: number; - }): Promise; - /** - * An array of all pages inside the browser context. - * - * @returns Promise which resolves to an array of all open pages. - * Non visible pages, such as `"background_page"`, will not be listed here. - * You can find them using {@link Target.page | the target page}. - */ - pages(): Promise; - /** - * Returns whether BrowserContext is incognito. - * The default browser context is the only non-incognito browser context. - * - * @remarks - * The default browser context cannot be closed. - */ - isIncognito(): boolean; - /** - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * await context.overridePermissions('https://html5demos.com', ['geolocation']); - * ``` - * - * @param origin - The origin to grant permissions to, e.g. "https://example.com". - * @param permissions - An array of permissions to grant. - * All permissions that are not listed here will be automatically denied. - */ - overridePermissions(origin: string, permissions: Protocol.Browser.PermissionType[]): Promise; - /** - * Clears all permission overrides for the browser context. - * - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * context.overridePermissions('https://example.com', ['clipboard-read']); - * // do stuff .. - * context.clearPermissionOverrides(); - * ``` - */ - clearPermissionOverrides(): Promise; - /** - * Creates a new page in the browser context. - */ - newPage(): Promise; - /** - * The browser this browser context belongs to. - */ - browser(): Browser; - /** - * Closes the browser context. All the targets that belong to the browser context - * will be closed. - * - * @remarks - * Only incognito browser contexts can be closed. - */ - close(): Promise; -} -export {}; -//# sourceMappingURL=Browser.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map deleted file mode 100644 index 2e1d5273b1e..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Browser.d.ts","sourceRoot":"","sources":["../../../../src/common/Browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAA2B,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,aAAK,oBAAoB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,0BAAkB,oBAAoB;IACpC;;;;;;;OAOG;IACH,YAAY,iBAAiB;IAE7B;;;;;;OAMG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;;;;OAUG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;OAOG;IACH,eAAe,oBAAoB;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBAAa,OAAQ,SAAQ,YAAY;IACvC;;OAEG;WACU,MAAM,CACjB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,OAAO,EAC1B,eAAe,CAAC,EAAE,QAAQ,EAC1B,OAAO,CAAC,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,oBAAoB,GACnC,OAAO,CAAC,OAAO,CAAC;IAYnB,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,gBAAgB,CAAC,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,SAAS,CAA8B;IAC/C;;;OAGG;IACH,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B;;OAEG;gBAED,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,OAAO,EAC1B,eAAe,CAAC,EAAE,QAAQ,EAC1B,OAAO,CAAC,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,oBAAoB;IAgCtC;;;OAGG;IACH,OAAO,IAAI,YAAY,GAAG,IAAI;IAI9B;;;;;;;;;;;;;;;;OAgBG;IACG,6BAA6B,IAAI,OAAO,CAAC,cAAc,CAAC;IAa9D;;;OAGG;IACH,eAAe,IAAI,cAAc,EAAE;IAInC;;OAEG;IACH,qBAAqB,IAAI,cAAc;IAIvC;;;OAGG;IACG,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAO1C,cAAc;YA6Bd,gBAAgB;IAa9B,OAAO,CAAC,kBAAkB;IAgB1B;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7D;;;OAGG;IACH,OAAO,IAAI,MAAM,EAAE;IAMnB;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;;;;;;;;;;OAaG;IACG,aAAa,CACjB,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,EACjC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,MAAM,CAAC;IAyBlB;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAQ9B;;;;;;;;;OASG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAKlC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB,OAAO,CAAC,WAAW;CAGpB;AAED,0BAAkB,2BAA2B;IAC3C;;;OAGG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;OAOG;IACH,aAAa,kBAAkB;IAC/B;;;OAGG;IACH,eAAe,oBAAoB;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAS;IAErB;;OAEG;gBACS,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM;IAOxE;;OAEG;IACH,OAAO,IAAI,MAAM,EAAE;IAMnB;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CACX,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,EACjC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GACjC,OAAO,CAAC,MAAM,CAAC;IAOlB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAS9B;;;;;;OAMG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;;;;;;OAUG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,GAC7C,OAAO,CAAC,IAAI,CAAC;IAqChB;;;;;;;;;;OAUG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAM/C;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js deleted file mode 100644 index 31d98a7e675..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js +++ /dev/null @@ -1,519 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BrowserContext = exports.Browser = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const Target_js_1 = require("./Target.js"); -const EventEmitter_js_1 = require("./EventEmitter.js"); -const Connection_js_1 = require("./Connection.js"); -/** - * A Browser is created when Puppeteer connects to a Chromium instance, either through - * {@link Puppeteer.launch} or {@link Puppeteer.connect}. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and will - * emit various events which are documented in the {@link BrowserEmittedEvents} enum. - * - * @example - * - * An example of using a {@link Browser} to create a {@link Page}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * await page.goto('https://example.com'); - * await browser.close(); - * })(); - * ``` - * - * @example - * - * An example of disconnecting from and reconnecting to a {@link Browser}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * // Store the endpoint to be able to reconnect to Chromium - * const browserWSEndpoint = browser.wsEndpoint(); - * // Disconnect puppeteer from Chromium - * browser.disconnect(); - * - * // Use the endpoint to reestablish a connection - * const browser2 = await puppeteer.connect({browserWSEndpoint}); - * // Close Chromium - * await browser2.close(); - * })(); - * ``` - * - * @public - */ -class Browser extends EventEmitter_js_1.EventEmitter { - /** - * @internal - */ - constructor(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) { - super(); - this._ignoreHTTPSErrors = ignoreHTTPSErrors; - this._defaultViewport = defaultViewport; - this._process = process; - this._connection = connection; - this._closeCallback = closeCallback || function () { }; - this._defaultContext = new BrowserContext(this._connection, this, null); - this._contexts = new Map(); - for (const contextId of contextIds) - this._contexts.set(contextId, new BrowserContext(this._connection, this, contextId)); - this._targets = new Map(); - this._connection.on(Connection_js_1.ConnectionEmittedEvents.Disconnected, () => this.emit("disconnected" /* Disconnected */)); - this._connection.on('Target.targetCreated', this._targetCreated.bind(this)); - this._connection.on('Target.targetDestroyed', this._targetDestroyed.bind(this)); - this._connection.on('Target.targetInfoChanged', this._targetInfoChanged.bind(this)); - } - /** - * @internal - */ - static async create(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) { - const browser = new Browser(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback); - await connection.send('Target.setDiscoverTargets', { discover: true }); - return browser; - } - /** - * The spawned browser process. Returns `null` if the browser instance was created with - * {@link Puppeteer.connect}. - */ - process() { - return this._process; - } - /** - * Creates a new incognito browser context. This won't share cookies/cache with other - * browser contexts. - * - * @example - * ```js - * (async () => { - * const browser = await puppeteer.launch(); - * // Create a new incognito browser context. - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page in a pristine context. - * const page = await context.newPage(); - * // Do stuff - * await page.goto('https://example.com'); - * })(); - * ``` - */ - async createIncognitoBrowserContext() { - const { browserContextId } = await this._connection.send('Target.createBrowserContext'); - const context = new BrowserContext(this._connection, this, browserContextId); - this._contexts.set(browserContextId, context); - return context; - } - /** - * Returns an array of all open browser contexts. In a newly created browser, this will - * return a single instance of {@link BrowserContext}. - */ - browserContexts() { - return [this._defaultContext, ...Array.from(this._contexts.values())]; - } - /** - * Returns the default browser context. The default browser context cannot be closed. - */ - defaultBrowserContext() { - return this._defaultContext; - } - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - async _disposeContext(contextId) { - await this._connection.send('Target.disposeBrowserContext', { - browserContextId: contextId || undefined, - }); - this._contexts.delete(contextId); - } - async _targetCreated(event) { - const targetInfo = event.targetInfo; - const { browserContextId } = targetInfo; - const context = browserContextId && this._contexts.has(browserContextId) - ? this._contexts.get(browserContextId) - : this._defaultContext; - const target = new Target_js_1.Target(targetInfo, context, () => this._connection.createSession(targetInfo), this._ignoreHTTPSErrors, this._defaultViewport); - assert_js_1.assert(!this._targets.has(event.targetInfo.targetId), 'Target should not exist before targetCreated'); - this._targets.set(event.targetInfo.targetId, target); - if (await target._initializedPromise) { - this.emit("targetcreated" /* TargetCreated */, target); - context.emit("targetcreated" /* TargetCreated */, target); - } - } - async _targetDestroyed(event) { - const target = this._targets.get(event.targetId); - target._initializedCallback(false); - this._targets.delete(event.targetId); - target._closedCallback(); - if (await target._initializedPromise) { - this.emit("targetdestroyed" /* TargetDestroyed */, target); - target - .browserContext() - .emit("targetdestroyed" /* TargetDestroyed */, target); - } - } - _targetInfoChanged(event) { - const target = this._targets.get(event.targetInfo.targetId); - assert_js_1.assert(target, 'target should exist before targetInfoChanged'); - const previousURL = target.url(); - const wasInitialized = target._isInitialized; - target._targetInfoChanged(event.targetInfo); - if (wasInitialized && previousURL !== target.url()) { - this.emit("targetchanged" /* TargetChanged */, target); - target - .browserContext() - .emit("targetchanged" /* TargetChanged */, target); - } - } - /** - * The browser websocket endpoint which can be used as an argument to - * {@link Puppeteer.connect}. - * - * @returns The Browser websocket url. - * - * @remarks - * - * The format is `ws://${host}:${port}/devtools/browser/`. - * - * You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. - * Learn more about the - * {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and - * the {@link - * https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target - * | browser endpoint}. - */ - wsEndpoint() { - return this._connection.url(); - } - /** - * Creates a {@link Page} in the default browser context. - */ - async newPage() { - return this._defaultContext.newPage(); - } - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - async _createPageInContext(contextId) { - const { targetId } = await this._connection.send('Target.createTarget', { - url: 'about:blank', - browserContextId: contextId || undefined, - }); - const target = await this._targets.get(targetId); - assert_js_1.assert(await target._initializedPromise, 'Failed to create target for page'); - const page = await target.page(); - return page; - } - /** - * All active targets inside the Browser. In case of multiple browser contexts, returns - * an array with all the targets in all browser contexts. - */ - targets() { - return Array.from(this._targets.values()).filter((target) => target._isInitialized); - } - /** - * The target associated with the browser. - */ - target() { - return this.targets().find((target) => target.type() === 'browser'); - } - /** - * Searches for a target in all browser contexts. - * - * @param predicate - A function to be run for every target. - * @returns The first target found that matches the `predicate` function. - * - * @example - * - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - */ - async waitForTarget(predicate, options = {}) { - const { timeout = 30000 } = options; - const existingTarget = this.targets().find(predicate); - if (existingTarget) - return existingTarget; - let resolve; - const targetPromise = new Promise((x) => (resolve = x)); - this.on("targetcreated" /* TargetCreated */, check); - this.on("targetchanged" /* TargetChanged */, check); - try { - if (!timeout) - return await targetPromise; - return await helper_js_1.helper.waitWithTimeout(targetPromise, 'target', timeout); - } - finally { - this.removeListener("targetcreated" /* TargetCreated */, check); - this.removeListener("targetchanged" /* TargetChanged */, check); - } - function check(target) { - if (predicate(target)) - resolve(target); - } - } - /** - * An array of all open pages inside the Browser. - * - * @remarks - * - * In case of multiple browser contexts, returns an array with all the pages in all - * browser contexts. Non-visible pages, such as `"background_page"`, will not be listed - * here. You can find them using {@link Target.page}. - */ - async pages() { - const contextPages = await Promise.all(this.browserContexts().map((context) => context.pages())); - // Flatten array. - return contextPages.reduce((acc, x) => acc.concat(x), []); - } - /** - * A string representing the browser name and version. - * - * @remarks - * - * For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For - * non-headless, this is similar to `Chrome/61.0.3153.0`. - * - * The format of browser.version() might change with future releases of Chromium. - */ - async version() { - const version = await this._getVersion(); - return version.product; - } - /** - * The browser's original user agent. Pages can override the browser user agent with - * {@link Page.setUserAgent}. - */ - async userAgent() { - const version = await this._getVersion(); - return version.userAgent; - } - /** - * Closes Chromium and all of its pages (if any were opened). The {@link Browser} object - * itself is considered to be disposed and cannot be used anymore. - */ - async close() { - await this._closeCallback.call(null); - this.disconnect(); - } - /** - * Disconnects Puppeteer from the browser, but leaves the Chromium process running. - * After calling `disconnect`, the {@link Browser} object is considered disposed and - * cannot be used anymore. - */ - disconnect() { - this._connection.dispose(); - } - /** - * Indicates that the browser is connected. - */ - isConnected() { - return !this._connection._closed; - } - _getVersion() { - return this._connection.send('Browser.getVersion'); - } -} -exports.Browser = Browser; -/** - * BrowserContexts provide a way to operate multiple independent browser - * sessions. When a browser is launched, it has a single BrowserContext used by - * default. The method {@link Browser.newPage | Browser.newPage} creates a page - * in the default browser context. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and - * will emit various events which are documented in the - * {@link BrowserContextEmittedEvents} enum. - * - * If a page opens another page, e.g. with a `window.open` call, the popup will - * belong to the parent page's browser context. - * - * Puppeteer allows creation of "incognito" browser contexts with - * {@link Browser.createIncognitoBrowserContext | Browser.createIncognitoBrowserContext} - * method. "Incognito" browser contexts don't write any browsing data to disk. - * - * @example - * ```js - * // Create a new incognito browser context - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page inside context. - * const page = await context.newPage(); - * // ... do stuff with page ... - * await page.goto('https://example.com'); - * // Dispose context once it's no longer needed. - * await context.close(); - * ``` - */ -class BrowserContext extends EventEmitter_js_1.EventEmitter { - /** - * @internal - */ - constructor(connection, browser, contextId) { - super(); - this._connection = connection; - this._browser = browser; - this._id = contextId; - } - /** - * An array of all active targets inside the browser context. - */ - targets() { - return this._browser - .targets() - .filter((target) => target.browserContext() === this); - } - /** - * This searches for a target in this specific browser context. - * - * @example - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - * - * @param predicate - A function to be run for every target - * @param options - An object of options. Accepts a timout, - * which is the maximum wait time in milliseconds. - * Pass `0` to disable the timeout. Defaults to 30 seconds. - * @returns Promise which resolves to the first target found - * that matches the `predicate` function. - */ - waitForTarget(predicate, options = {}) { - return this._browser.waitForTarget((target) => target.browserContext() === this && predicate(target), options); - } - /** - * An array of all pages inside the browser context. - * - * @returns Promise which resolves to an array of all open pages. - * Non visible pages, such as `"background_page"`, will not be listed here. - * You can find them using {@link Target.page | the target page}. - */ - async pages() { - const pages = await Promise.all(this.targets() - .filter((target) => target.type() === 'page') - .map((target) => target.page())); - return pages.filter((page) => !!page); - } - /** - * Returns whether BrowserContext is incognito. - * The default browser context is the only non-incognito browser context. - * - * @remarks - * The default browser context cannot be closed. - */ - isIncognito() { - return !!this._id; - } - /** - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * await context.overridePermissions('https://html5demos.com', ['geolocation']); - * ``` - * - * @param origin - The origin to grant permissions to, e.g. "https://example.com". - * @param permissions - An array of permissions to grant. - * All permissions that are not listed here will be automatically denied. - */ - async overridePermissions(origin, permissions) { - const webPermissionToProtocol = new Map([ - ['geolocation', 'geolocation'], - ['midi', 'midi'], - ['notifications', 'notifications'], - // TODO: push isn't a valid type? - // ['push', 'push'], - ['camera', 'videoCapture'], - ['microphone', 'audioCapture'], - ['background-sync', 'backgroundSync'], - ['ambient-light-sensor', 'sensors'], - ['accelerometer', 'sensors'], - ['gyroscope', 'sensors'], - ['magnetometer', 'sensors'], - ['accessibility-events', 'accessibilityEvents'], - ['clipboard-read', 'clipboardReadWrite'], - ['clipboard-write', 'clipboardReadWrite'], - ['payment-handler', 'paymentHandler'], - // chrome-specific permissions we have. - ['midi-sysex', 'midiSysex'], - ]); - permissions = permissions.map((permission) => { - const protocolPermission = webPermissionToProtocol.get(permission); - if (!protocolPermission) - throw new Error('Unknown permission: ' + permission); - return protocolPermission; - }); - await this._connection.send('Browser.grantPermissions', { - origin, - browserContextId: this._id || undefined, - permissions, - }); - } - /** - * Clears all permission overrides for the browser context. - * - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * context.overridePermissions('https://example.com', ['clipboard-read']); - * // do stuff .. - * context.clearPermissionOverrides(); - * ``` - */ - async clearPermissionOverrides() { - await this._connection.send('Browser.resetPermissions', { - browserContextId: this._id || undefined, - }); - } - /** - * Creates a new page in the browser context. - */ - newPage() { - return this._browser._createPageInContext(this._id); - } - /** - * The browser this browser context belongs to. - */ - browser() { - return this._browser; - } - /** - * Closes the browser context. All the targets that belong to the browser context - * will be closed. - * - * @remarks - * Only incognito browser contexts can be closed. - */ - async close() { - assert_js_1.assert(this._id, 'Non-incognito profiles cannot be closed!'); - await this._browser._disposeContext(this._id); - } -} -exports.BrowserContext = BrowserContext; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts deleted file mode 100644 index 0756d87f1b7..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Protocol } from 'devtools-protocol'; -import { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js'; -import { ConnectionTransport } from './ConnectionTransport.js'; -import { EventEmitter } from './EventEmitter.js'; -interface ConnectionCallback { - resolve: Function; - reject: Function; - error: Error; - method: string; -} -/** - * Internal events that the Connection class emits. - * - * @internal - */ -export declare const ConnectionEmittedEvents: { - readonly Disconnected: symbol; -}; -/** - * @internal - */ -export declare class Connection extends EventEmitter { - _url: string; - _transport: ConnectionTransport; - _delay: number; - _lastId: number; - _sessions: Map; - _closed: boolean; - _callbacks: Map; - constructor(url: string, transport: ConnectionTransport, delay?: number); - static fromSession(session: CDPSession): Connection; - /** - * @param {string} sessionId - * @returns {?CDPSession} - */ - session(sessionId: string): CDPSession | null; - url(): string; - send(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise; - _rawSend(message: {}): number; - _onMessage(message: string): Promise; - _onClose(): void; - dispose(): void; - /** - * @param {Protocol.Target.TargetInfo} targetInfo - * @returns {!Promise} - */ - createSession(targetInfo: Protocol.Target.TargetInfo): Promise; -} -interface CDPSessionOnMessageObject { - id?: number; - method: string; - params: {}; - error: { - message: string; - data: any; - }; - result?: any; -} -/** - * Internal events that the CDPSession class emits. - * - * @internal - */ -export declare const CDPSessionEmittedEvents: { - readonly Disconnected: symbol; -}; -/** - * The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. - * - * @remarks - * - * Protocol methods can be called with {@link CDPSession.send} method and protocol - * events can be subscribed to with `CDPSession.on` method. - * - * Useful links: {@link https://chromedevtools.github.io/devtools-protocol/ | DevTools Protocol Viewer} - * and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md | Getting Started with DevTools Protocol}. - * - * @example - * ```js - * const client = await page.target().createCDPSession(); - * await client.send('Animation.enable'); - * client.on('Animation.animationCreated', () => console.log('Animation created!')); - * const response = await client.send('Animation.getPlaybackRate'); - * console.log('playback rate is ' + response.playbackRate); - * await client.send('Animation.setPlaybackRate', { - * playbackRate: response.playbackRate / 2 - * }); - * ``` - * - * @public - */ -export declare class CDPSession extends EventEmitter { - /** - * @internal - */ - _connection: Connection; - private _sessionId; - private _targetType; - private _callbacks; - /** - * @internal - */ - constructor(connection: Connection, targetType: string, sessionId: string); - send(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise; - /** - * @internal - */ - _onMessage(object: CDPSessionOnMessageObject): void; - /** - * Detaches the cdpSession from the target. Once detached, the cdpSession object - * won't emit any events and can't be used to send messages. - */ - detach(): Promise; - /** - * @internal - */ - _onClosed(): void; -} -export {}; -//# sourceMappingURL=Connection.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map deleted file mode 100644 index dff726e837a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../../../src/common/Connection.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX;;GAEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,SAAK;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;IAC/C,OAAO,UAAS;IAEhB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAa;gBAE5C,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,KAAK,SAAI;IAUlE,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU;IAInD;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAI7C,GAAG,IAAI,MAAM;IAIb,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,EACT,GAAG,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GACtD,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAcrD,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM;IAQvB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsChD,QAAQ,IAAI,IAAI;IAkBhB,OAAO,IAAI,IAAI;IAKf;;;OAGG;IACG,aAAa,CACjB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,GACrC,OAAO,CAAC,UAAU,CAAC;CAOvB;AAED,UAAU,yBAAyB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,EAAE,CAAC;IACX,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC;IACtC,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAA8C;IAEhE;;OAEG;gBACS,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAOzE,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,EACT,GAAG,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GACtD,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IA0BrD;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI;IAenD;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B;;OAEG;IACH,SAAS,IAAI,IAAI;CAYlB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js deleted file mode 100644 index 8ca18019a1f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js +++ /dev/null @@ -1,271 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CDPSession = exports.CDPSessionEmittedEvents = exports.Connection = exports.ConnectionEmittedEvents = void 0; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const assert_js_1 = require("./assert.js"); -const Debug_js_1 = require("./Debug.js"); -const debugProtocolSend = Debug_js_1.debug('puppeteer:protocol:SEND ►'); -const debugProtocolReceive = Debug_js_1.debug('puppeteer:protocol:RECV ◀'); -const EventEmitter_js_1 = require("./EventEmitter.js"); -/** - * Internal events that the Connection class emits. - * - * @internal - */ -exports.ConnectionEmittedEvents = { - Disconnected: Symbol('Connection.Disconnected'), -}; -/** - * @internal - */ -class Connection extends EventEmitter_js_1.EventEmitter { - constructor(url, transport, delay = 0) { - super(); - this._lastId = 0; - this._sessions = new Map(); - this._closed = false; - this._callbacks = new Map(); - this._url = url; - this._delay = delay; - this._transport = transport; - this._transport.onmessage = this._onMessage.bind(this); - this._transport.onclose = this._onClose.bind(this); - } - static fromSession(session) { - return session._connection; - } - /** - * @param {string} sessionId - * @returns {?CDPSession} - */ - session(sessionId) { - return this._sessions.get(sessionId) || null; - } - url() { - return this._url; - } - send(method, ...paramArgs) { - // There is only ever 1 param arg passed, but the Protocol defines it as an - // array of 0 or 1 items See this comment: - // https://github.com/ChromeDevTools/devtools-protocol/pull/113#issuecomment-412603285 - // which explains why the protocol defines the params this way for better - // type-inference. - // So now we check if there are any params or not and deal with them accordingly. - const params = paramArgs.length ? paramArgs[0] : undefined; - const id = this._rawSend({ method, params }); - return new Promise((resolve, reject) => { - this._callbacks.set(id, { resolve, reject, error: new Error(), method }); - }); - } - _rawSend(message) { - const id = ++this._lastId; - message = JSON.stringify(Object.assign({}, message, { id })); - debugProtocolSend(message); - this._transport.send(message); - return id; - } - async _onMessage(message) { - if (this._delay) - await new Promise((f) => setTimeout(f, this._delay)); - debugProtocolReceive(message); - const object = JSON.parse(message); - if (object.method === 'Target.attachedToTarget') { - const sessionId = object.params.sessionId; - const session = new CDPSession(this, object.params.targetInfo.type, sessionId); - this._sessions.set(sessionId, session); - } - else if (object.method === 'Target.detachedFromTarget') { - const session = this._sessions.get(object.params.sessionId); - if (session) { - session._onClosed(); - this._sessions.delete(object.params.sessionId); - } - } - if (object.sessionId) { - const session = this._sessions.get(object.sessionId); - if (session) - session._onMessage(object); - } - else if (object.id) { - const callback = this._callbacks.get(object.id); - // Callbacks could be all rejected if someone has called `.dispose()`. - if (callback) { - this._callbacks.delete(object.id); - if (object.error) - callback.reject(createProtocolError(callback.error, callback.method, object)); - else - callback.resolve(object.result); - } - } - else { - this.emit(object.method, object.params); - } - } - _onClose() { - if (this._closed) - return; - this._closed = true; - this._transport.onmessage = null; - this._transport.onclose = null; - for (const callback of this._callbacks.values()) - callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`)); - this._callbacks.clear(); - for (const session of this._sessions.values()) - session._onClosed(); - this._sessions.clear(); - this.emit(exports.ConnectionEmittedEvents.Disconnected); - } - dispose() { - this._onClose(); - this._transport.close(); - } - /** - * @param {Protocol.Target.TargetInfo} targetInfo - * @returns {!Promise} - */ - async createSession(targetInfo) { - const { sessionId } = await this.send('Target.attachToTarget', { - targetId: targetInfo.targetId, - flatten: true, - }); - return this._sessions.get(sessionId); - } -} -exports.Connection = Connection; -/** - * Internal events that the CDPSession class emits. - * - * @internal - */ -exports.CDPSessionEmittedEvents = { - Disconnected: Symbol('CDPSession.Disconnected'), -}; -/** - * The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. - * - * @remarks - * - * Protocol methods can be called with {@link CDPSession.send} method and protocol - * events can be subscribed to with `CDPSession.on` method. - * - * Useful links: {@link https://chromedevtools.github.io/devtools-protocol/ | DevTools Protocol Viewer} - * and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md | Getting Started with DevTools Protocol}. - * - * @example - * ```js - * const client = await page.target().createCDPSession(); - * await client.send('Animation.enable'); - * client.on('Animation.animationCreated', () => console.log('Animation created!')); - * const response = await client.send('Animation.getPlaybackRate'); - * console.log('playback rate is ' + response.playbackRate); - * await client.send('Animation.setPlaybackRate', { - * playbackRate: response.playbackRate / 2 - * }); - * ``` - * - * @public - */ -class CDPSession extends EventEmitter_js_1.EventEmitter { - /** - * @internal - */ - constructor(connection, targetType, sessionId) { - super(); - this._callbacks = new Map(); - this._connection = connection; - this._targetType = targetType; - this._sessionId = sessionId; - } - send(method, ...paramArgs) { - if (!this._connection) - return Promise.reject(new Error(`Protocol error (${method}): Session closed. Most likely the ${this._targetType} has been closed.`)); - // See the comment in Connection#send explaining why we do this. - const params = paramArgs.length ? paramArgs[0] : undefined; - const id = this._connection._rawSend({ - sessionId: this._sessionId, - method, - /* TODO(jacktfranklin@): once this Firefox bug is solved - * we no longer need the `|| {}` check - * https://bugzilla.mozilla.org/show_bug.cgi?id=1631570 - */ - params: params || {}, - }); - return new Promise((resolve, reject) => { - this._callbacks.set(id, { resolve, reject, error: new Error(), method }); - }); - } - /** - * @internal - */ - _onMessage(object) { - if (object.id && this._callbacks.has(object.id)) { - const callback = this._callbacks.get(object.id); - this._callbacks.delete(object.id); - if (object.error) - callback.reject(createProtocolError(callback.error, callback.method, object)); - else - callback.resolve(object.result); - } - else { - assert_js_1.assert(!object.id); - this.emit(object.method, object.params); - } - } - /** - * Detaches the cdpSession from the target. Once detached, the cdpSession object - * won't emit any events and can't be used to send messages. - */ - async detach() { - if (!this._connection) - throw new Error(`Session already detached. Most likely the ${this._targetType} has been closed.`); - await this._connection.send('Target.detachFromTarget', { - sessionId: this._sessionId, - }); - } - /** - * @internal - */ - _onClosed() { - for (const callback of this._callbacks.values()) - callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`)); - this._callbacks.clear(); - this._connection = null; - this.emit(exports.CDPSessionEmittedEvents.Disconnected); - } -} -exports.CDPSession = CDPSession; -/** - * @param {!Error} error - * @param {string} method - * @param {{error: {message: string, data: any}}} object - * @returns {!Error} - */ -function createProtocolError(error, method, object) { - let message = `Protocol error (${method}): ${object.error.message}`; - if ('data' in object.error) - message += ` ${object.error.data}`; - return rewriteError(error, message); -} -/** - * @param {!Error} error - * @param {string} message - * @returns {!Error} - */ -function rewriteError(error, message) { - error.message = message; - return error; -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map deleted file mode 100644 index 7b55f821811..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ConnectionTransport.d.ts","sourceRoot":"","sources":["../../../../src/common/ConnectionTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,MAAM,KAAA,OAAE;IACb,KAAK,QAAG;IACR,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts deleted file mode 100644 index 0ca5f94dd3f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { JSHandle } from './JSHandle.js'; -/** - * @public - */ -export interface ConsoleMessageLocation { - /** - * URL of the resource if known or `undefined` otherwise. - */ - url?: string; - /** - * 0-based line number in the resource if known or `undefined` otherwise. - */ - lineNumber?: number; - /** - * 0-based column number in the resource if known or `undefined` otherwise. - */ - columnNumber?: number; -} -/** - * The supported types for console messages. - */ -export declare type ConsoleMessageType = 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd' | 'verbose'; -/** - * ConsoleMessage objects are dispatched by page via the 'console' event. - * @public - */ -export declare class ConsoleMessage { - private _type; - private _text; - private _args; - private _location; - /** - * @public - */ - constructor(type: ConsoleMessageType, text: string, args: JSHandle[], location?: ConsoleMessageLocation); - /** - * @returns The type of the console message. - */ - type(): ConsoleMessageType; - /** - * @returns The text of the console message. - */ - text(): string; - /** - * @returns An array of arguments passed to the console. - */ - args(): JSHandle[]; - /** - * @returns The location of the console message. - */ - location(): ConsoleMessageLocation; -} -//# sourceMappingURL=ConsoleMessage.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map deleted file mode 100644 index b241d856c42..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ConsoleMessage.d.ts","sourceRoot":"","sources":["../../../../src/common/ConsoleMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,kBAAkB,GAC1B,KAAK,GACL,OAAO,GACP,MAAM,GACN,OAAO,GACP,SAAS,GACT,KAAK,GACL,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,YAAY,GACZ,qBAAqB,GACrB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,OAAO,GACP,SAAS,GACT,SAAS,CAAC;AAEd;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAyB;IAE1C;;OAEG;gBAED,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,EAAE,EAChB,QAAQ,GAAE,sBAA2B;IAQvC;;OAEG;IACH,IAAI,IAAI,kBAAkB;IAI1B;;OAEG;IACH,IAAI,IAAI,MAAM;IAId;;OAEG;IACH,IAAI,IAAI,QAAQ,EAAE;IAIlB;;OAEG;IACH,QAAQ,IAAI,sBAAsB;CAGnC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js deleted file mode 100644 index 7f2edb39cf0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConsoleMessage = void 0; -/** - * ConsoleMessage objects are dispatched by page via the 'console' event. - * @public - */ -class ConsoleMessage { - /** - * @public - */ - constructor(type, text, args, location = {}) { - this._type = type; - this._text = text; - this._args = args; - this._location = location; - } - /** - * @returns The type of the console message. - */ - type() { - return this._type; - } - /** - * @returns The text of the console message. - */ - text() { - return this._text; - } - /** - * @returns An array of arguments passed to the console. - */ - args() { - return this._args; - } - /** - * @returns The location of the console message. - */ - location() { - return this._location; - } -} -exports.ConsoleMessage = ConsoleMessage; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts deleted file mode 100644 index 0233eaac1fc..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; -import { PuppeteerEventListener } from './helper.js'; - -/** - * The CoverageEntry class represents one entry of the coverage report. - * @public - */ -export interface CoverageEntry { - /** - * The URL of the style sheet or script. - */ - url: string; - /** - * The content of the style sheet or script. - */ - text: string; - /** - * The covered range as start and end positions. - */ - ranges: Array<{ - start: number; - end: number; - }>; -} -/** - * Set of configurable options for JS coverage. - * @public - */ -export interface JSCoverageOptions { - /** - * Whether to reset coverage on every navigation. - */ - resetOnNavigation?: boolean; - /** - * Whether anonymous scripts generated by the page should be reported. - */ - reportAnonymousScripts?: boolean; -} -/** - * Set of configurable options for CSS coverage. - * @public - */ -export interface CSSCoverageOptions { - /** - * Whether to reset coverage on every navigation. - */ - resetOnNavigation?: boolean; -} -/** - * The Coverage class provides methods to gathers information about parts of - * JavaScript and CSS that were used by the page. - * - * @remarks - * To output coverage in a form consumable by {@link https://github.com/istanbuljs | Istanbul}, - * see {@link https://github.com/istanbuljs/puppeteer-to-istanbul | puppeteer-to-istanbul}. - * - * @example - * An example of using JavaScript and CSS coverage to get percentage of initially - * executed code: - * ```js - * // Enable both JavaScript and CSS coverage - * await Promise.all([ - * page.coverage.startJSCoverage(), - * page.coverage.startCSSCoverage() - * ]); - * // Navigate to page - * await page.goto('https://example.com'); - * // Disable both JavaScript and CSS coverage - * const [jsCoverage, cssCoverage] = await Promise.all([ - * page.coverage.stopJSCoverage(), - * page.coverage.stopCSSCoverage(), - * ]); - * let totalBytes = 0; - * let usedBytes = 0; - * const coverage = [...jsCoverage, ...cssCoverage]; - * for (const entry of coverage) { - * totalBytes += entry.text.length; - * for (const range of entry.ranges) - * usedBytes += range.end - range.start - 1; - * } - * console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`); - * ``` - * @public - */ -export declare class Coverage { - /** - * @internal - */ - _jsCoverage: JSCoverage; - /** - * @internal - */ - _cssCoverage: CSSCoverage; - constructor(client: CDPSession); - /** - * @param options - defaults to - * `{ resetOnNavigation : true, reportAnonymousScripts : false }` - * @returns Promise that resolves when coverage is started. - * - * @remarks - * Anonymous scripts are ones that don't have an associated url. These are - * scripts that are dynamically created on the page using `eval` or - * `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous - * scripts will have `__puppeteer_evaluation_script__` as their URL. - */ - startJSCoverage(options?: JSCoverageOptions): Promise; - /** - * @returns Promise that resolves to the array of coverage reports for - * all scripts. - * - * @remarks - * JavaScript Coverage doesn't include anonymous scripts by default. - * However, scripts with sourceURLs are reported. - */ - stopJSCoverage(): Promise; - /** - * @param options - defaults to `{ resetOnNavigation : true }` - * @returns Promise that resolves when coverage is started. - */ - startCSSCoverage(options?: CSSCoverageOptions): Promise; - /** - * @returns Promise that resolves to the array of coverage reports - * for all stylesheets. - * @remarks - * CSS Coverage doesn't include dynamically injected style tags - * without sourceURLs. - */ - stopCSSCoverage(): Promise; -} -declare class JSCoverage { - _client: CDPSession; - _enabled: boolean; - _scriptURLs: Map; - _scriptSources: Map; - _eventListeners: PuppeteerEventListener[]; - _resetOnNavigation: boolean; - _reportAnonymousScripts: boolean; - constructor(client: CDPSession); - start(options?: { - resetOnNavigation?: boolean; - reportAnonymousScripts?: boolean; - }): Promise; - _onExecutionContextsCleared(): void; - _onScriptParsed(event: Protocol.Debugger.ScriptParsedEvent): Promise; - stop(): Promise; -} -declare class CSSCoverage { - _client: CDPSession; - _enabled: boolean; - _stylesheetURLs: Map; - _stylesheetSources: Map; - _eventListeners: PuppeteerEventListener[]; - _resetOnNavigation: boolean; - _reportAnonymousScripts: boolean; - constructor(client: CDPSession); - start(options?: { - resetOnNavigation?: boolean; - }): Promise; - _onExecutionContextsCleared(): void; - _onStyleSheet(event: Protocol.CSS.StyleSheetAddedEvent): Promise; - stop(): Promise; -} -export {}; -//# sourceMappingURL=Coverage.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map deleted file mode 100644 index cb4f25d4194..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Coverage.d.ts","sourceRoot":"","sources":["../../../../src/common/Coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAsB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,QAAQ;IACnB;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,YAAY,EAAE,WAAW,CAAC;gBAEd,MAAM,EAAE,UAAU;IAK9B;;;;;;;;;;OAUG;IACG,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;;;;;OAOG;IACG,cAAc,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAIhD;;;OAGG;IACG,gBAAgB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE;;;;;;OAMG;IACG,eAAe,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAGlD;AAED,cAAM,UAAU;IACd,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,UAAS;IACjB,WAAW,sBAA6B;IACxC,cAAc,sBAA6B;IAC3C,eAAe,EAAE,sBAAsB,EAAE,CAAM;IAC/C,kBAAkB,UAAS;IAC3B,uBAAuB,UAAS;gBAEpB,MAAM,EAAE,UAAU;IAIxB,KAAK,CACT,OAAO,GAAE;QACP,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAC7B,GACL,OAAO,CAAC,IAAI,CAAC;IAkChB,2BAA2B,IAAI,IAAI;IAM7B,eAAe,CACnB,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,GACzC,OAAO,CAAC,IAAI,CAAC;IAiBV,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAkCvC;AAED,cAAM,WAAW;IACf,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,UAAS;IACjB,eAAe,sBAA6B;IAC5C,kBAAkB,sBAA6B;IAC/C,eAAe,EAAE,sBAAsB,EAAE,CAAM;IAC/C,kBAAkB,UAAS;IAC3B,uBAAuB,UAAS;gBAEpB,MAAM,EAAE,UAAU;IAIxB,KAAK,CAAC,OAAO,GAAE;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BzE,2BAA2B,IAAI,IAAI;IAM7B,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBtE,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAuCvC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js deleted file mode 100644 index 9bb4d3ed7e0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js +++ /dev/null @@ -1,319 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Coverage = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const ExecutionContext_js_1 = require("./ExecutionContext.js"); -/** - * The Coverage class provides methods to gathers information about parts of - * JavaScript and CSS that were used by the page. - * - * @remarks - * To output coverage in a form consumable by {@link https://github.com/istanbuljs | Istanbul}, - * see {@link https://github.com/istanbuljs/puppeteer-to-istanbul | puppeteer-to-istanbul}. - * - * @example - * An example of using JavaScript and CSS coverage to get percentage of initially - * executed code: - * ```js - * // Enable both JavaScript and CSS coverage - * await Promise.all([ - * page.coverage.startJSCoverage(), - * page.coverage.startCSSCoverage() - * ]); - * // Navigate to page - * await page.goto('https://example.com'); - * // Disable both JavaScript and CSS coverage - * const [jsCoverage, cssCoverage] = await Promise.all([ - * page.coverage.stopJSCoverage(), - * page.coverage.stopCSSCoverage(), - * ]); - * let totalBytes = 0; - * let usedBytes = 0; - * const coverage = [...jsCoverage, ...cssCoverage]; - * for (const entry of coverage) { - * totalBytes += entry.text.length; - * for (const range of entry.ranges) - * usedBytes += range.end - range.start - 1; - * } - * console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`); - * ``` - * @public - */ -class Coverage { - constructor(client) { - this._jsCoverage = new JSCoverage(client); - this._cssCoverage = new CSSCoverage(client); - } - /** - * @param options - defaults to - * `{ resetOnNavigation : true, reportAnonymousScripts : false }` - * @returns Promise that resolves when coverage is started. - * - * @remarks - * Anonymous scripts are ones that don't have an associated url. These are - * scripts that are dynamically created on the page using `eval` or - * `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous - * scripts will have `__puppeteer_evaluation_script__` as their URL. - */ - async startJSCoverage(options = {}) { - return await this._jsCoverage.start(options); - } - /** - * @returns Promise that resolves to the array of coverage reports for - * all scripts. - * - * @remarks - * JavaScript Coverage doesn't include anonymous scripts by default. - * However, scripts with sourceURLs are reported. - */ - async stopJSCoverage() { - return await this._jsCoverage.stop(); - } - /** - * @param options - defaults to `{ resetOnNavigation : true }` - * @returns Promise that resolves when coverage is started. - */ - async startCSSCoverage(options = {}) { - return await this._cssCoverage.start(options); - } - /** - * @returns Promise that resolves to the array of coverage reports - * for all stylesheets. - * @remarks - * CSS Coverage doesn't include dynamically injected style tags - * without sourceURLs. - */ - async stopCSSCoverage() { - return await this._cssCoverage.stop(); - } -} -exports.Coverage = Coverage; -class JSCoverage { - constructor(client) { - this._enabled = false; - this._scriptURLs = new Map(); - this._scriptSources = new Map(); - this._eventListeners = []; - this._resetOnNavigation = false; - this._reportAnonymousScripts = false; - this._client = client; - } - async start(options = {}) { - assert_js_1.assert(!this._enabled, 'JSCoverage is already enabled'); - const { resetOnNavigation = true, reportAnonymousScripts = false, } = options; - this._resetOnNavigation = resetOnNavigation; - this._reportAnonymousScripts = reportAnonymousScripts; - this._enabled = true; - this._scriptURLs.clear(); - this._scriptSources.clear(); - this._eventListeners = [ - helper_js_1.helper.addEventListener(this._client, 'Debugger.scriptParsed', this._onScriptParsed.bind(this)), - helper_js_1.helper.addEventListener(this._client, 'Runtime.executionContextsCleared', this._onExecutionContextsCleared.bind(this)), - ]; - await Promise.all([ - this._client.send('Profiler.enable'), - this._client.send('Profiler.startPreciseCoverage', { - callCount: false, - detailed: true, - }), - this._client.send('Debugger.enable'), - this._client.send('Debugger.setSkipAllPauses', { skip: true }), - ]); - } - _onExecutionContextsCleared() { - if (!this._resetOnNavigation) - return; - this._scriptURLs.clear(); - this._scriptSources.clear(); - } - async _onScriptParsed(event) { - // Ignore puppeteer-injected scripts - if (event.url === ExecutionContext_js_1.EVALUATION_SCRIPT_URL) - return; - // Ignore other anonymous scripts unless the reportAnonymousScripts option is true. - if (!event.url && !this._reportAnonymousScripts) - return; - try { - const response = await this._client.send('Debugger.getScriptSource', { - scriptId: event.scriptId, - }); - this._scriptURLs.set(event.scriptId, event.url); - this._scriptSources.set(event.scriptId, response.scriptSource); - } - catch (error) { - // This might happen if the page has already navigated away. - helper_js_1.debugError(error); - } - } - async stop() { - assert_js_1.assert(this._enabled, 'JSCoverage is not enabled'); - this._enabled = false; - const result = await Promise.all([ - this._client.send('Profiler.takePreciseCoverage'), - this._client.send('Profiler.stopPreciseCoverage'), - this._client.send('Profiler.disable'), - this._client.send('Debugger.disable'), - ]); - helper_js_1.helper.removeEventListeners(this._eventListeners); - const coverage = []; - const profileResponse = result[0]; - for (const entry of profileResponse.result) { - let url = this._scriptURLs.get(entry.scriptId); - if (!url && this._reportAnonymousScripts) - url = 'debugger://VM' + entry.scriptId; - const text = this._scriptSources.get(entry.scriptId); - if (text === undefined || url === undefined) - continue; - const flattenRanges = []; - for (const func of entry.functions) - flattenRanges.push(...func.ranges); - const ranges = convertToDisjointRanges(flattenRanges); - coverage.push({ url, ranges, text }); - } - return coverage; - } -} -class CSSCoverage { - constructor(client) { - this._enabled = false; - this._stylesheetURLs = new Map(); - this._stylesheetSources = new Map(); - this._eventListeners = []; - this._resetOnNavigation = false; - this._reportAnonymousScripts = false; - this._client = client; - } - async start(options = {}) { - assert_js_1.assert(!this._enabled, 'CSSCoverage is already enabled'); - const { resetOnNavigation = true } = options; - this._resetOnNavigation = resetOnNavigation; - this._enabled = true; - this._stylesheetURLs.clear(); - this._stylesheetSources.clear(); - this._eventListeners = [ - helper_js_1.helper.addEventListener(this._client, 'CSS.styleSheetAdded', this._onStyleSheet.bind(this)), - helper_js_1.helper.addEventListener(this._client, 'Runtime.executionContextsCleared', this._onExecutionContextsCleared.bind(this)), - ]; - await Promise.all([ - this._client.send('DOM.enable'), - this._client.send('CSS.enable'), - this._client.send('CSS.startRuleUsageTracking'), - ]); - } - _onExecutionContextsCleared() { - if (!this._resetOnNavigation) - return; - this._stylesheetURLs.clear(); - this._stylesheetSources.clear(); - } - async _onStyleSheet(event) { - const header = event.header; - // Ignore anonymous scripts - if (!header.sourceURL) - return; - try { - const response = await this._client.send('CSS.getStyleSheetText', { - styleSheetId: header.styleSheetId, - }); - this._stylesheetURLs.set(header.styleSheetId, header.sourceURL); - this._stylesheetSources.set(header.styleSheetId, response.text); - } - catch (error) { - // This might happen if the page has already navigated away. - helper_js_1.debugError(error); - } - } - async stop() { - assert_js_1.assert(this._enabled, 'CSSCoverage is not enabled'); - this._enabled = false; - const ruleTrackingResponse = await this._client.send('CSS.stopRuleUsageTracking'); - await Promise.all([ - this._client.send('CSS.disable'), - this._client.send('DOM.disable'), - ]); - helper_js_1.helper.removeEventListeners(this._eventListeners); - // aggregate by styleSheetId - const styleSheetIdToCoverage = new Map(); - for (const entry of ruleTrackingResponse.ruleUsage) { - let ranges = styleSheetIdToCoverage.get(entry.styleSheetId); - if (!ranges) { - ranges = []; - styleSheetIdToCoverage.set(entry.styleSheetId, ranges); - } - ranges.push({ - startOffset: entry.startOffset, - endOffset: entry.endOffset, - count: entry.used ? 1 : 0, - }); - } - const coverage = []; - for (const styleSheetId of this._stylesheetURLs.keys()) { - const url = this._stylesheetURLs.get(styleSheetId); - const text = this._stylesheetSources.get(styleSheetId); - const ranges = convertToDisjointRanges(styleSheetIdToCoverage.get(styleSheetId) || []); - coverage.push({ url, ranges, text }); - } - return coverage; - } -} -function convertToDisjointRanges(nestedRanges) { - const points = []; - for (const range of nestedRanges) { - points.push({ offset: range.startOffset, type: 0, range }); - points.push({ offset: range.endOffset, type: 1, range }); - } - // Sort points to form a valid parenthesis sequence. - points.sort((a, b) => { - // Sort with increasing offsets. - if (a.offset !== b.offset) - return a.offset - b.offset; - // All "end" points should go before "start" points. - if (a.type !== b.type) - return b.type - a.type; - const aLength = a.range.endOffset - a.range.startOffset; - const bLength = b.range.endOffset - b.range.startOffset; - // For two "start" points, the one with longer range goes first. - if (a.type === 0) - return bLength - aLength; - // For two "end" points, the one with shorter range goes first. - return aLength - bLength; - }); - const hitCountStack = []; - const results = []; - let lastOffset = 0; - // Run scanning line to intersect all ranges. - for (const point of points) { - if (hitCountStack.length && - lastOffset < point.offset && - hitCountStack[hitCountStack.length - 1] > 0) { - const lastResult = results.length ? results[results.length - 1] : null; - if (lastResult && lastResult.end === lastOffset) - lastResult.end = point.offset; - else - results.push({ start: lastOffset, end: point.offset }); - } - lastOffset = point.offset; - if (point.type === 0) - hitCountStack.push(point.range.count); - else - hitCountStack.pop(); - } - // Filter out empty ranges. - return results.filter((range) => range.end - range.start > 1); -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts deleted file mode 100644 index a2276edb037..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/// -import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike , WrapElementHandle} from './EvalTypes.js'; -import { ExecutionContext } from './ExecutionContext.js'; -import { Frame , FrameManager} from './FrameManager.js'; -import { MouseButton } from './Input.js'; -import { ElementHandle , JSHandle} from './JSHandle.js'; -import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js'; -import { TimeoutSettings } from './TimeoutSettings.js'; - -/** - * @public - */ -export interface WaitForSelectorOptions { - visible?: boolean; - hidden?: boolean; - timeout?: number; -} -/** - * @internal - */ -export declare class DOMWorld { - private _frameManager; - private _frame; - private _timeoutSettings; - private _documentPromise?; - private _contextPromise?; - private _contextResolveCallback?; - private _detached; - /** - * internal - */ - _waitTasks: Set; - constructor(frameManager: FrameManager, frame: Frame, timeoutSettings: TimeoutSettings); - frame(): Frame; - _setContext(context?: ExecutionContext): void; - _hasContext(): boolean; - _detach(): void; - executionContext(): Promise; - evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; - evaluate(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise>>; - $(selector: string): Promise; - _document(): Promise; - $x(expression: string): Promise; - $eval(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - $$eval(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - $$(selector: string): Promise; - content(): Promise; - setContent(html: string, options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * Adds a script tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - */ - addScriptTag(options: { - url?: string; - path?: string; - content?: string; - type?: string; - }): Promise; - /** - * Adds a style tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - * - */ - addStyleTag(options: { - url?: string; - path?: string; - content?: string; - }): Promise; - click(selector: string, options: { - delay?: number; - button?: MouseButton; - clickCount?: number; - }): Promise; - focus(selector: string): Promise; - hover(selector: string): Promise; - select(selector: string, ...values: string[]): Promise; - tap(selector: string): Promise; - type(selector: string, text: string, options?: { - delay: number; - }): Promise; - waitForSelector(selector: string, options: WaitForSelectorOptions): Promise; - waitForXPath(xpath: string, options: WaitForSelectorOptions): Promise; - waitForFunction(pageFunction: Function | string, options?: { - polling?: string | number; - timeout?: number; - }, ...args: SerializableOrJSHandle[]): Promise; - title(): Promise; - private _waitForSelectorOrXPath; -} -declare class WaitTask { - _domWorld: DOMWorld; - _polling: string | number; - _timeout: number; - _predicateBody: string; - _args: SerializableOrJSHandle[]; - _runCount: number; - promise: Promise; - _resolve: (x: JSHandle) => void; - _reject: (x: Error) => void; - _timeoutTimer?: NodeJS.Timeout; - _terminated: boolean; - constructor(domWorld: DOMWorld, predicateBody: Function | string, predicateQueryHandlerBody: Function | string | undefined, title: string, polling: string | number, timeout: number, ...args: SerializableOrJSHandle[]); - terminate(error: Error): void; - rerun(): Promise; - _cleanup(): void; -} -export {}; -//# sourceMappingURL=DOMWorld.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map deleted file mode 100644 index cc6a070e792..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DOMWorld.d.ts","sourceRoot":"","sources":["../../../../src/common/DOMWorld.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAIH,OAAO,EAEL,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAUxB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,gBAAgB,CAAC,CAAgC;IACzD,OAAO,CAAC,eAAe,CAAC,CAAmC;IAE3D,OAAO,CAAC,uBAAuB,CAAC,CAAwC;IAExE,OAAO,CAAC,SAAS,CAAS;IAC1B;;OAEG;IACH,UAAU,gBAAuB;gBAG/B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe;IAQlC,KAAK,IAAI,KAAK;IAId,WAAW,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAa7C,WAAW,IAAI,OAAO;IAItB,OAAO,IAAI,IAAI;IAQf,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAQvC,cAAc,CAAC,WAAW,SAAS,QAAQ,GAAG,QAAQ,EAC1D,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,WAAW,CAAC;IAKjB,QAAQ,CAAC,CAAC,SAAS,UAAU,EACjC,YAAY,EAAE,CAAC,EACf,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAQhD,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAMlD,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC;IASnC,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAMhD,KAAK,CAAC,UAAU,EACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CACZ,OAAO,EAAE,OAAO,EAChB,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,EACrC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAKnC,MAAM,CAAC,UAAU,EACrB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,EACrC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAUnC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAM9C,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAW1B,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,CAAC;KAC5D,GACL,OAAO,CAAC,IAAI,CAAC;IA0BhB;;;;;;;;OAQG;IACG,YAAY,CAAC,OAAO,EAAE;QAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,aAAa,CAAC;IA0E1B;;;;;;;;;OASG;IACG,WAAW,CAAC,OAAO,EAAE;QACzB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoEpB,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACrE,OAAO,CAAC,IAAI,CAAC;IAOV,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQhE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOpC,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;IAOhB,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIhC,YAAY,CACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIhC,eAAe,CACb,YAAY,EAAE,QAAQ,GAAG,MAAM,EAC/B,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,EAC7D,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,QAAQ,CAAC;IAgBd,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;YAIhB,uBAAuB;CAyEtC;AAED,cAAM,QAAQ;IACZ,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,SAAS,SAAK;IACd,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IAC/B,WAAW,UAAS;gBAGlB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,QAAQ,GAAG,MAAM,EAChC,yBAAyB,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,EACxD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,GAAG,IAAI,EAAE,sBAAsB,EAAE;IAsDnC,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAMvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoD5B,QAAQ,IAAI,IAAI;CAIjB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js deleted file mode 100644 index d0a17eae3c0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +++ /dev/null @@ -1,520 +0,0 @@ -"use strict"; -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DOMWorld = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const LifecycleWatcher_js_1 = require("./LifecycleWatcher.js"); -const Errors_js_1 = require("./Errors.js"); -const QueryHandler_js_1 = require("./QueryHandler.js"); -const environment_js_1 = require("../environment.js"); -/** - * @internal - */ -class DOMWorld { - constructor(frameManager, frame, timeoutSettings) { - this._documentPromise = null; - this._contextPromise = null; - this._contextResolveCallback = null; - this._detached = false; - /** - * internal - */ - this._waitTasks = new Set(); - this._frameManager = frameManager; - this._frame = frame; - this._timeoutSettings = timeoutSettings; - this._setContext(null); - } - frame() { - return this._frame; - } - _setContext(context) { - if (context) { - this._contextResolveCallback.call(null, context); - this._contextResolveCallback = null; - for (const waitTask of this._waitTasks) - waitTask.rerun(); - } - else { - this._documentPromise = null; - this._contextPromise = new Promise((fulfill) => { - this._contextResolveCallback = fulfill; - }); - } - } - _hasContext() { - return !this._contextResolveCallback; - } - _detach() { - this._detached = true; - for (const waitTask of this._waitTasks) - waitTask.terminate(new Error('waitForFunction failed: frame got detached.')); - } - executionContext() { - if (this._detached) - throw new Error(`Execution Context is not available in detached frame "${this._frame.url()}" (are you trying to evaluate?)`); - return this._contextPromise; - } - async evaluateHandle(pageFunction, ...args) { - const context = await this.executionContext(); - return context.evaluateHandle(pageFunction, ...args); - } - async evaluate(pageFunction, ...args) { - const context = await this.executionContext(); - return context.evaluate(pageFunction, ...args); - } - async $(selector) { - const document = await this._document(); - const value = await document.$(selector); - return value; - } - async _document() { - if (this._documentPromise) - return this._documentPromise; - this._documentPromise = this.executionContext().then(async (context) => { - const document = await context.evaluateHandle('document'); - return document.asElement(); - }); - return this._documentPromise; - } - async $x(expression) { - const document = await this._document(); - const value = await document.$x(expression); - return value; - } - async $eval(selector, pageFunction, ...args) { - const document = await this._document(); - return document.$eval(selector, pageFunction, ...args); - } - async $$eval(selector, pageFunction, ...args) { - const document = await this._document(); - const value = await document.$$eval(selector, pageFunction, ...args); - return value; - } - async $$(selector) { - const document = await this._document(); - const value = await document.$$(selector); - return value; - } - async content() { - return await this.evaluate(() => { - let retVal = ''; - if (document.doctype) - retVal = new XMLSerializer().serializeToString(document.doctype); - if (document.documentElement) - retVal += document.documentElement.outerHTML; - return retVal; - }); - } - async setContent(html, options = {}) { - const { waitUntil = ['load'], timeout = this._timeoutSettings.navigationTimeout(), } = options; - // We rely upon the fact that document.open() will reset frame lifecycle with "init" - // lifecycle event. @see https://crrev.com/608658 - await this.evaluate((html) => { - document.open(); - document.write(html); - document.close(); - }, html); - const watcher = new LifecycleWatcher_js_1.LifecycleWatcher(this._frameManager, this._frame, waitUntil, timeout); - const error = await Promise.race([ - watcher.timeoutOrTerminationPromise(), - watcher.lifecyclePromise(), - ]); - watcher.dispose(); - if (error) - throw error; - } - /** - * Adds a script tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - */ - async addScriptTag(options) { - const { url = null, path = null, content = null, type = '' } = options; - if (url !== null) { - try { - const context = await this.executionContext(); - return (await context.evaluateHandle(addScriptUrl, url, type)).asElement(); - } - catch (error) { - throw new Error(`Loading script from ${url} failed`); - } - } - if (path !== null) { - if (!environment_js_1.isNode) { - throw new Error('Cannot pass a filepath to addScriptTag in the browser environment.'); - } - // eslint-disable-next-line @typescript-eslint/no-var-requires - const fs = require('fs'); - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { promisify } = require('util'); - const readFileAsync = promisify(fs.readFile); - let contents = await readFileAsync(path, 'utf8'); - contents += '//# sourceURL=' + path.replace(/\n/g, ''); - const context = await this.executionContext(); - return (await context.evaluateHandle(addScriptContent, contents, type)).asElement(); - } - if (content !== null) { - const context = await this.executionContext(); - return (await context.evaluateHandle(addScriptContent, content, type)).asElement(); - } - throw new Error('Provide an object with a `url`, `path` or `content` property'); - async function addScriptUrl(url, type) { - const script = document.createElement('script'); - script.src = url; - if (type) - script.type = type; - const promise = new Promise((res, rej) => { - script.onload = res; - script.onerror = rej; - }); - document.head.appendChild(script); - await promise; - return script; - } - function addScriptContent(content, type = 'text/javascript') { - const script = document.createElement('script'); - script.type = type; - script.text = content; - let error = null; - script.onerror = (e) => (error = e); - document.head.appendChild(script); - if (error) - throw error; - return script; - } - } - /** - * Adds a style tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - * - */ - async addStyleTag(options) { - const { url = null, path = null, content = null } = options; - if (url !== null) { - try { - const context = await this.executionContext(); - return (await context.evaluateHandle(addStyleUrl, url)).asElement(); - } - catch (error) { - throw new Error(`Loading style from ${url} failed`); - } - } - if (path !== null) { - if (!environment_js_1.isNode) { - throw new Error('Cannot pass a filepath to addStyleTag in the browser environment.'); - } - // eslint-disable-next-line @typescript-eslint/no-var-requires - const fs = require('fs'); - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { promisify } = require('util'); - const readFileAsync = promisify(fs.readFile); - let contents = await readFileAsync(path, 'utf8'); - contents += '/*# sourceURL=' + path.replace(/\n/g, '') + '*/'; - const context = await this.executionContext(); - return (await context.evaluateHandle(addStyleContent, contents)).asElement(); - } - if (content !== null) { - const context = await this.executionContext(); - return (await context.evaluateHandle(addStyleContent, content)).asElement(); - } - throw new Error('Provide an object with a `url`, `path` or `content` property'); - async function addStyleUrl(url) { - const link = document.createElement('link'); - link.rel = 'stylesheet'; - link.href = url; - const promise = new Promise((res, rej) => { - link.onload = res; - link.onerror = rej; - }); - document.head.appendChild(link); - await promise; - return link; - } - async function addStyleContent(content) { - const style = document.createElement('style'); - style.type = 'text/css'; - style.appendChild(document.createTextNode(content)); - const promise = new Promise((res, rej) => { - style.onload = res; - style.onerror = rej; - }); - document.head.appendChild(style); - await promise; - return style; - } - } - async click(selector, options) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.click(options); - await handle.dispose(); - } - async focus(selector) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.focus(); - await handle.dispose(); - } - async hover(selector) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.hover(); - await handle.dispose(); - } - async select(selector, ...values) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - const result = await handle.select(...values); - await handle.dispose(); - return result; - } - async tap(selector) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.tap(); - await handle.dispose(); - } - async type(selector, text, options) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.type(text, options); - await handle.dispose(); - } - waitForSelector(selector, options) { - return this._waitForSelectorOrXPath(selector, false, options); - } - waitForXPath(xpath, options) { - return this._waitForSelectorOrXPath(xpath, true, options); - } - waitForFunction(pageFunction, options = {}, ...args) { - const { polling = 'raf', timeout = this._timeoutSettings.timeout(), } = options; - return new WaitTask(this, pageFunction, undefined, 'function', polling, timeout, ...args).promise; - } - async title() { - return this.evaluate(() => document.title); - } - async _waitForSelectorOrXPath(selectorOrXPath, isXPath, options = {}) { - const { visible: waitForVisible = false, hidden: waitForHidden = false, timeout = this._timeoutSettings.timeout(), } = options; - const polling = waitForVisible || waitForHidden ? 'raf' : 'mutation'; - const title = `${isXPath ? 'XPath' : 'selector'} "${selectorOrXPath}"${waitForHidden ? ' to be hidden' : ''}`; - const { updatedSelector, queryHandler } = QueryHandler_js_1.getQueryHandlerAndSelector(selectorOrXPath); - const waitTask = new WaitTask(this, predicate, queryHandler.queryOne, title, polling, timeout, updatedSelector, isXPath, waitForVisible, waitForHidden); - const handle = await waitTask.promise; - if (!handle.asElement()) { - await handle.dispose(); - return null; - } - return handle.asElement(); - function predicate(selectorOrXPath, isXPath, waitForVisible, waitForHidden) { - const node = isXPath - ? document.evaluate(selectorOrXPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue - : predicateQueryHandler - ? predicateQueryHandler(document, selectorOrXPath) - : document.querySelector(selectorOrXPath); - if (!node) - return waitForHidden; - if (!waitForVisible && !waitForHidden) - return node; - const element = node.nodeType === Node.TEXT_NODE - ? node.parentElement - : node; - const style = window.getComputedStyle(element); - const isVisible = style && style.visibility !== 'hidden' && hasVisibleBoundingBox(); - const success = waitForVisible === isVisible || waitForHidden === !isVisible; - return success ? node : null; - function hasVisibleBoundingBox() { - const rect = element.getBoundingClientRect(); - return !!(rect.top || rect.bottom || rect.width || rect.height); - } - } - } -} -exports.DOMWorld = DOMWorld; -class WaitTask { - constructor(domWorld, predicateBody, predicateQueryHandlerBody, title, polling, timeout, ...args) { - this._runCount = 0; - this._terminated = false; - if (helper_js_1.helper.isString(polling)) - assert_js_1.assert(polling === 'raf' || polling === 'mutation', 'Unknown polling option: ' + polling); - else if (helper_js_1.helper.isNumber(polling)) - assert_js_1.assert(polling > 0, 'Cannot poll with non-positive interval: ' + polling); - else - throw new Error('Unknown polling options: ' + polling); - function getPredicateBody(predicateBody, predicateQueryHandlerBody) { - if (helper_js_1.helper.isString(predicateBody)) - return `return (${predicateBody});`; - if (predicateQueryHandlerBody) { - return ` - return (function wrapper(args) { - const predicateQueryHandler = ${predicateQueryHandlerBody}; - return (${predicateBody})(...args); - })(args);`; - } - return `return (${predicateBody})(...args);`; - } - this._domWorld = domWorld; - this._polling = polling; - this._timeout = timeout; - this._predicateBody = getPredicateBody(predicateBody, predicateQueryHandlerBody); - this._args = args; - this._runCount = 0; - domWorld._waitTasks.add(this); - this.promise = new Promise((resolve, reject) => { - this._resolve = resolve; - this._reject = reject; - }); - // Since page navigation requires us to re-install the pageScript, we should track - // timeout on our end. - if (timeout) { - const timeoutError = new Errors_js_1.TimeoutError(`waiting for ${title} failed: timeout ${timeout}ms exceeded`); - this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), timeout); - } - this.rerun(); - } - terminate(error) { - this._terminated = true; - this._reject(error); - this._cleanup(); - } - async rerun() { - const runCount = ++this._runCount; - /** @type {?JSHandle} */ - let success = null; - let error = null; - try { - success = await (await this._domWorld.executionContext()).evaluateHandle(waitForPredicatePageFunction, this._predicateBody, this._polling, this._timeout, ...this._args); - } - catch (error_) { - error = error_; - } - if (this._terminated || runCount !== this._runCount) { - if (success) - await success.dispose(); - return; - } - // Ignore timeouts in pageScript - we track timeouts ourselves. - // If the frame's execution context has already changed, `frame.evaluate` will - // throw an error - ignore this predicate run altogether. - if (!error && - (await this._domWorld.evaluate((s) => !s, success).catch(() => true))) { - await success.dispose(); - return; - } - // When the page is navigated, the promise is rejected. - // We will try again in the new execution context. - if (error && error.message.includes('Execution context was destroyed')) - return; - // We could have tried to evaluate in a context which was already - // destroyed. - if (error && - error.message.includes('Cannot find context with specified id')) - return; - if (error) - this._reject(error); - else - this._resolve(success); - this._cleanup(); - } - _cleanup() { - clearTimeout(this._timeoutTimer); - this._domWorld._waitTasks.delete(this); - } -} -async function waitForPredicatePageFunction(predicateBody, polling, timeout, ...args) { - const predicate = new Function('...args', predicateBody); - let timedOut = false; - if (timeout) - setTimeout(() => (timedOut = true), timeout); - if (polling === 'raf') - return await pollRaf(); - if (polling === 'mutation') - return await pollMutation(); - if (typeof polling === 'number') - return await pollInterval(polling); - /** - * @returns {!Promise<*>} - */ - async function pollMutation() { - const success = await predicate(...args); - if (success) - return Promise.resolve(success); - let fulfill; - const result = new Promise((x) => (fulfill = x)); - const observer = new MutationObserver(async () => { - if (timedOut) { - observer.disconnect(); - fulfill(); - } - const success = await predicate(...args); - if (success) { - observer.disconnect(); - fulfill(success); - } - }); - observer.observe(document, { - childList: true, - subtree: true, - attributes: true, - }); - return result; - } - async function pollRaf() { - let fulfill; - const result = new Promise((x) => (fulfill = x)); - await onRaf(); - return result; - async function onRaf() { - if (timedOut) { - fulfill(); - return; - } - const success = await predicate(...args); - if (success) - fulfill(success); - else - requestAnimationFrame(onRaf); - } - } - async function pollInterval(pollInterval) { - let fulfill; - const result = new Promise((x) => (fulfill = x)); - await onTimeout(); - return result; - async function onTimeout() { - if (timedOut) { - fulfill(); - return; - } - const success = await predicate(...args); - if (success) - fulfill(success); - else - setTimeout(onTimeout, pollInterval); - } - } -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts deleted file mode 100644 index 77b2e5bcd6f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * A debug function that can be used in any environment. - * - * @remarks - * - * If used in Node, it falls back to the - * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it - * uses `console.log`. - * - * @param prefix - this will be prefixed to each log. - * @returns a function that can be called to log to that debug channel. - * - * In Node, use the `DEBUG` environment variable to control logging: - * - * ``` - * DEBUG=* // logs all channels - * DEBUG=foo // logs the `foo` channel - * DEBUG=foo* // logs any channels starting with `foo` - * ``` - * - * In the browser, set `window.__PUPPETEER_DEBUG` to a string: - * - * ``` - * window.__PUPPETEER_DEBUG='*'; // logs all channels - * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel - * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` - * ``` - * - * @example - * ``` - * const log = debug('Page'); - * - * log('new page created') - * // logs "Page: new page created" - * ``` - */ -export declare const debug: (prefix: string) => (...args: unknown[]) => void; -//# sourceMappingURL=Debug.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map deleted file mode 100644 index 2f3bd79bec9..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Debug.d.ts","sourceRoot":"","sources":["../../../../src/common/Debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,KAAK,WAAY,MAAM,eAAc,OAAO,EAAE,KAAK,IA4B/D,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js deleted file mode 100644 index 6a01693c17d..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.debug = void 0; -const environment_js_1 = require("../environment.js"); -/** - * A debug function that can be used in any environment. - * - * @remarks - * - * If used in Node, it falls back to the - * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it - * uses `console.log`. - * - * @param prefix - this will be prefixed to each log. - * @returns a function that can be called to log to that debug channel. - * - * In Node, use the `DEBUG` environment variable to control logging: - * - * ``` - * DEBUG=* // logs all channels - * DEBUG=foo // logs the `foo` channel - * DEBUG=foo* // logs any channels starting with `foo` - * ``` - * - * In the browser, set `window.__PUPPETEER_DEBUG` to a string: - * - * ``` - * window.__PUPPETEER_DEBUG='*'; // logs all channels - * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel - * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` - * ``` - * - * @example - * ``` - * const log = debug('Page'); - * - * log('new page created') - * // logs "Page: new page created" - * ``` - */ -exports.debug = (prefix) => { - if (environment_js_1.isNode) { - // eslint-disable-next-line @typescript-eslint/no-var-requires - return require('debug')(prefix); - } - return (...logArgs) => { - const debugLevel = globalThis.__PUPPETEER_DEBUG; - if (!debugLevel) - return; - const everythingShouldBeLogged = debugLevel === '*'; - const prefixMatchesDebugLevel = everythingShouldBeLogged || - /** - * If the debug level is `foo*`, that means we match any prefix that - * starts with `foo`. If the level is `foo`, we match only the prefix - * `foo`. - */ - (debugLevel.endsWith('*') - ? prefix.startsWith(debugLevel) - : prefix === debugLevel); - if (!prefixMatchesDebugLevel) - return; - // eslint-disable-next-line no-console - console.log(`${prefix}:`, ...logArgs); - }; -}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts deleted file mode 100644 index f74e0171162..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -interface Device { - name: string; - userAgent: string; - viewport: { - width: number; - height: number; - deviceScaleFactor: number; - isMobile: boolean; - hasTouch: boolean; - isLandscape: boolean; - }; -} -export declare type DevicesMap = { - [name: string]: Device; -}; -declare const devicesMap: DevicesMap; -export { devicesMap }; -//# sourceMappingURL=DeviceDescriptors.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map deleted file mode 100644 index 6215766fb6e..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DeviceDescriptors.d.ts","sourceRoot":"","sources":["../../../../src/common/DeviceDescriptors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,EAAE,MAAM,CAAC;QAC1B,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;CACH;AAg6BD,oBAAY,UAAU,GAAG;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,UAAe,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js deleted file mode 100644 index 60e7af7c142..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js +++ /dev/null @@ -1,876 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.devicesMap = void 0; -const devices = [ - { - name: 'Blackberry PlayBook', - userAgent: 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+', - viewport: { - width: 600, - height: 1024, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Blackberry PlayBook landscape', - userAgent: 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+', - viewport: { - width: 1024, - height: 600, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'BlackBerry Z30', - userAgent: 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'BlackBerry Z30 landscape', - userAgent: 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy Note 3', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy Note 3 landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy Note II', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy Note II landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy S III', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy S III landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy S5', - userAgent: 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy S5 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPad', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 768, - height: 1024, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPad landscape', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1024, - height: 768, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPad Mini', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 768, - height: 1024, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPad Mini landscape', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1024, - height: 768, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPad Pro', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1024, - height: 1366, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPad Pro landscape', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1366, - height: 1024, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 4', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53', - viewport: { - width: 320, - height: 480, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 4 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53', - viewport: { - width: 480, - height: 320, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 5', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 320, - height: 568, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 5 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 568, - height: 320, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 6', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 667, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 6 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 667, - height: 375, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 6 Plus', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 414, - height: 736, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 6 Plus landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 736, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 7', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 667, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 7 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 667, - height: 375, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 7 Plus', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 414, - height: 736, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 7 Plus landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 736, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 8', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 667, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 8 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 667, - height: 375, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 8 Plus', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 414, - height: 736, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 8 Plus landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 736, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone SE', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 320, - height: 568, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone SE landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 568, - height: 320, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone X', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 812, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone X landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 812, - height: 375, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone XR', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1', - viewport: { - width: 414, - height: 896, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone XR landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1', - viewport: { - width: 896, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'JioPhone 2', - userAgent: 'Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5', - viewport: { - width: 240, - height: 320, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'JioPhone 2 landscape', - userAgent: 'Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5', - viewport: { - width: 320, - height: 240, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Kindle Fire HDX', - userAgent: 'Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true', - viewport: { - width: 800, - height: 1280, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Kindle Fire HDX landscape', - userAgent: 'Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true', - viewport: { - width: 1280, - height: 800, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'LG Optimus L70', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 384, - height: 640, - deviceScaleFactor: 1.25, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'LG Optimus L70 landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 384, - deviceScaleFactor: 1.25, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Microsoft Lumia 550', - userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Microsoft Lumia 950', - userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 4, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Microsoft Lumia 950 landscape', - userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 4, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 10', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 800, - height: 1280, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 10 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 1280, - height: 800, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 4', - userAgent: 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 384, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 4 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 384, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 5', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 5 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 5X', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 412, - height: 732, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 5X landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 732, - height: 412, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 6', - userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 412, - height: 732, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 6 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 732, - height: 412, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 6P', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 412, - height: 732, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 6P landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 732, - height: 412, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 7', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 600, - height: 960, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 7 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 960, - height: 600, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nokia Lumia 520', - userAgent: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)', - viewport: { - width: 320, - height: 533, - deviceScaleFactor: 1.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nokia Lumia 520 landscape', - userAgent: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)', - viewport: { - width: 533, - height: 320, - deviceScaleFactor: 1.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nokia N9', - userAgent: 'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13', - viewport: { - width: 480, - height: 854, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nokia N9 landscape', - userAgent: 'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13', - viewport: { - width: 854, - height: 480, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Pixel 2', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 411, - height: 731, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Pixel 2 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 731, - height: 411, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Pixel 2 XL', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 411, - height: 823, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Pixel 2 XL landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 823, - height: 411, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, -]; -const devicesMap = {}; -exports.devicesMap = devicesMap; -for (const device of devices) - devicesMap[device.name] = device; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts deleted file mode 100644 index 660e1d946b8..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; - -/** - * Dialog instances are dispatched by the {@link Page} via the `dialog` event. - * - * @remarks - * - * @example - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * page.on('dialog', async dialog => { - * console.log(dialog.message()); - * await dialog.dismiss(); - * await browser.close(); - * }); - * page.evaluate(() => alert('1')); - * })(); - * ``` - */ -export declare class Dialog { - private _client; - private _type; - private _message; - private _defaultValue; - private _handled; - /** - * @internal - */ - constructor(client: CDPSession, type: Protocol.Page.DialogType, message: string, defaultValue?: string); - /** - * @returns The type of the dialog. - */ - type(): Protocol.Page.DialogType; - /** - * @returns The message displayed in the dialog. - */ - message(): string; - /** - * @returns The default value of the prompt, or an empty string if the dialog - * is not a `prompt`. - */ - defaultValue(): string; - /** - * @param promptText - optional text that will be entered in the dialog - * prompt. Has no effect if the dialog's type is not `prompt`. - * - * @returns A promise that resolves when the dialog has been accepted. - */ - accept(promptText?: string): Promise; - /** - * @returns A promise which will resolve once the dialog has been dismissed - */ - dismiss(): Promise; -} -//# sourceMappingURL=Dialog.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map deleted file mode 100644 index d2fee6a7328..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/common/Dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBAED,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAC9B,OAAO,EAAE,MAAM,EACf,YAAY,SAAK;IAQnB;;OAEG;IACH,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU;IAIhC;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;OAKG;IACG,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js deleted file mode 100644 index 0013a0d1016..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Dialog = void 0; -const assert_js_1 = require("./assert.js"); -/** - * Dialog instances are dispatched by the {@link Page} via the `dialog` event. - * - * @remarks - * - * @example - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * page.on('dialog', async dialog => { - * console.log(dialog.message()); - * await dialog.dismiss(); - * await browser.close(); - * }); - * page.evaluate(() => alert('1')); - * })(); - * ``` - */ -class Dialog { - /** - * @internal - */ - constructor(client, type, message, defaultValue = '') { - this._handled = false; - this._client = client; - this._type = type; - this._message = message; - this._defaultValue = defaultValue; - } - /** - * @returns The type of the dialog. - */ - type() { - return this._type; - } - /** - * @returns The message displayed in the dialog. - */ - message() { - return this._message; - } - /** - * @returns The default value of the prompt, or an empty string if the dialog - * is not a `prompt`. - */ - defaultValue() { - return this._defaultValue; - } - /** - * @param promptText - optional text that will be entered in the dialog - * prompt. Has no effect if the dialog's type is not `prompt`. - * - * @returns A promise that resolves when the dialog has been accepted. - */ - async accept(promptText) { - assert_js_1.assert(!this._handled, 'Cannot accept dialog which is already handled!'); - this._handled = true; - await this._client.send('Page.handleJavaScriptDialog', { - accept: true, - promptText: promptText, - }); - } - /** - * @returns A promise which will resolve once the dialog has been dismissed - */ - async dismiss() { - assert_js_1.assert(!this._handled, 'Cannot dismiss dialog which is already handled!'); - this._handled = true; - await this._client.send('Page.handleJavaScriptDialog', { - accept: false, - }); - } -} -exports.Dialog = Dialog; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts deleted file mode 100644 index c9abdc158a4..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { CDPSession } from './Connection.js'; -import { Viewport } from './PuppeteerViewport.js'; -export declare class EmulationManager { - _client: CDPSession; - _emulatingMobile: boolean; - _hasTouch: boolean; - constructor(client: CDPSession); - emulateViewport(viewport: Viewport): Promise; -} -//# sourceMappingURL=EmulationManager.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map deleted file mode 100644 index 0cfbf8e6a60..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"EmulationManager.d.ts","sourceRoot":"","sources":["../../../../src/common/EmulationManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,qBAAa,gBAAgB;IAC3B,OAAO,EAAE,UAAU,CAAC;IACpB,gBAAgB,UAAS;IACzB,SAAS,UAAS;gBAEN,MAAM,EAAE,UAAU;IAIxB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CA6B5D"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js deleted file mode 100644 index c0914dbea0c..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EmulationManager = void 0; -class EmulationManager { - constructor(client) { - this._emulatingMobile = false; - this._hasTouch = false; - this._client = client; - } - async emulateViewport(viewport) { - const mobile = viewport.isMobile || false; - const width = viewport.width; - const height = viewport.height; - const deviceScaleFactor = viewport.deviceScaleFactor || 1; - const screenOrientation = viewport.isLandscape - ? { angle: 90, type: 'landscapePrimary' } - : { angle: 0, type: 'portraitPrimary' }; - const hasTouch = viewport.hasTouch || false; - await Promise.all([ - this._client.send('Emulation.setDeviceMetricsOverride', { - mobile, - width, - height, - deviceScaleFactor, - screenOrientation, - }), - this._client.send('Emulation.setTouchEmulationEnabled', { - enabled: hasTouch, - }), - ]); - const reloadNeeded = this._emulatingMobile !== mobile || this._hasTouch !== hasTouch; - this._emulatingMobile = mobile; - this._hasTouch = hasTouch; - return reloadNeeded; - } -} -exports.EmulationManager = EmulationManager; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts deleted file mode 100644 index a0b094b522a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -declare class CustomError extends Error { - constructor(message: string); -} -/** - * TimeoutError is emitted whenever certain operations are terminated due to timeout. - * - * @remarks - * - * Example operations are {@link Page.waitForSelector | page.waitForSelector} - * or {@link Puppeteer.launch | puppeteer.launch}. - * - * @public - */ -export declare class TimeoutError extends CustomError { -} -export declare type PuppeteerErrors = Record; -export declare const puppeteerErrors: PuppeteerErrors; -export {}; -//# sourceMappingURL=Errors.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map deleted file mode 100644 index 442a102c159..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../../../../src/common/Errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,EAAE,MAAM;CAK5B;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAa,SAAQ,WAAW;CAAG;AAEhD,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,WAAW,CAAC,CAAC;AAEjE,eAAO,MAAM,eAAe,EAAE,eAE7B,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js deleted file mode 100644 index 1ce3eb058e4..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.puppeteerErrors = exports.TimeoutError = void 0; -class CustomError extends Error { - constructor(message) { - super(message); - this.name = this.constructor.name; - Error.captureStackTrace(this, this.constructor); - } -} -/** - * TimeoutError is emitted whenever certain operations are terminated due to timeout. - * - * @remarks - * - * Example operations are {@link Page.waitForSelector | page.waitForSelector} - * or {@link Puppeteer.launch | puppeteer.launch}. - * - * @public - */ -class TimeoutError extends CustomError { -} -exports.TimeoutError = TimeoutError; -exports.puppeteerErrors = { - TimeoutError, -}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts deleted file mode 100644 index 46fbd894f6e..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ElementHandle , JSHandle} from './JSHandle.js'; - -/** - * @public - */ -export declare type EvaluateFn = string | ((arg1: T, ...args: unknown[]) => unknown); -export declare type UnwrapPromiseLike = T extends PromiseLike ? U : T; -/** - * @public - */ -export declare type EvaluateFnReturnType = T extends (...args: unknown[]) => infer R ? R : unknown; -/** - * @public - */ -export declare type EvaluateHandleFn = string | ((...args: unknown[]) => unknown); -/** - * @public - */ -export declare type Serializable = number | string | boolean | null | BigInt | JSONArray | JSONObject; -/** - * @public - */ -export declare type JSONArray = Serializable[]; -/** - * @public - */ -export interface JSONObject { - [key: string]: Serializable; -} -/** - * @public - */ -export declare type SerializableOrJSHandle = Serializable | JSHandle; -/** - * Wraps a DOM element into an ElementHandle instance - * @public - **/ -export declare type WrapElementHandle = X extends Element ? ElementHandle : X; -/** - * Unwraps a DOM element out of an ElementHandle instance - * @public - **/ -export declare type UnwrapElementHandle = X extends ElementHandle ? E : X; -//# sourceMappingURL=EvalTypes.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map deleted file mode 100644 index cb2b74fe21d..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"EvalTypes.d.ts","sourceRoot":"","sources":["../../../../src/common/EvalTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExD;;GAEG;AACH,oBAAY,UAAU,CAAC,CAAC,GAAG,OAAO,IAC9B,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;AAE/C,oBAAY,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE1E;;GAEG;AACH,oBAAY,oBAAoB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,SAAS,CACjE,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,MAAM,CAAC,GACR,CAAC,GACD,OAAO,CAAC;AAEZ;;GAEG;AACH,oBAAY,gBAAgB,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;AAE1E;;GAEG;AACH,oBAAY,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,SAAS,GACT,UAAU,CAAC;AAEf;;GAEG;AACH,oBAAY,SAAS,GAAG,YAAY,EAAE,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B;AAED;;GAEG;AACH,oBAAY,sBAAsB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE7D;;;IAGI;AACJ,oBAAY,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAE5E;;;IAGI;AACJ,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts deleted file mode 100644 index fa24ddd3818..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { EventType, Handler } from '../../vendor/mitt/src/index.js'; -/** - * @internal - */ -export interface CommonEventEmitter { - on(event: EventType, handler: Handler): CommonEventEmitter; - off(event: EventType, handler: Handler): CommonEventEmitter; - addListener(event: EventType, handler: Handler): CommonEventEmitter; - removeListener(event: EventType, handler: Handler): CommonEventEmitter; - emit(event: EventType, eventData?: any): boolean; - once(event: EventType, handler: Handler): CommonEventEmitter; - listenerCount(event: string): number; - removeAllListeners(event?: EventType): CommonEventEmitter; -} -/** - * The EventEmitter class that many Puppeteer classes extend. - * - * @remarks - * - * This allows you to listen to events that Puppeteer classes fire and act - * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and - * {@link EventEmitter.off | off} to bind - * and unbind to event listeners. - * - * @public - */ -export declare class EventEmitter implements CommonEventEmitter { - private emitter; - private eventsMap; - /** - * @internal - */ - constructor(); - /** - * Bind an event listener to fire when an event occurs. - * @param event - the event type you'd like to listen to. Can be a string or symbol. - * @param handler - the function to be called when the event occurs. - * @returns `this` to enable you to chain calls. - */ - on(event: EventType, handler: Handler): EventEmitter; - /** - * Remove an event listener from firing. - * @param event - the event type you'd like to stop listening to. - * @param handler - the function that should be removed. - * @returns `this` to enable you to chain calls. - */ - off(event: EventType, handler: Handler): EventEmitter; - /** - * Remove an event listener. - * @deprecated please use `off` instead. - */ - removeListener(event: EventType, handler: Handler): EventEmitter; - /** - * Add an event listener. - * @deprecated please use `on` instead. - */ - addListener(event: EventType, handler: Handler): EventEmitter; - /** - * Emit an event and call any associated listeners. - * - * @param event - the event you'd like to emit - * @param eventData - any data you'd like to emit with the event - * @returns `true` if there are any listeners, `false` if there are not. - */ - emit(event: EventType, eventData?: any): boolean; - /** - * Like `on` but the listener will only be fired once and then it will be removed. - * @param event - the event you'd like to listen to - * @param handler - the handler function to run when the event occurs - * @returns `this` to enable you to chain calls. - */ - once(event: EventType, handler: Handler): EventEmitter; - /** - * Gets the number of listeners for a given event. - * - * @param event - the event to get the listener count for - * @returns the number of listeners bound to the given event - */ - listenerCount(event: EventType): number; - /** - * Removes all listeners. If given an event argument, it will remove only - * listeners for that event. - * @param event - the event to remove listeners for. - * @returns `this` to enable you to chain calls. - */ - removeAllListeners(event?: EventType): EventEmitter; - private eventListenersCount; -} -//# sourceMappingURL=EventEmitter.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map deleted file mode 100644 index fa7686c64c2..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/common/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAa,EAEX,SAAS,EACT,OAAO,EACR,MAAM,gCAAgC,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC3D,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAK5D,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACpE,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACvE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC7D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAErC,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,kBAAkB,CAAC;CAC3D;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,YAAW,kBAAkB;IACrD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,SAAS,CAAmC;IAEpD;;OAEG;;IAKH;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKpD;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKrD;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKhE;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAK7D;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO;IAKhD;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAStD;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAIvC;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY;IASnD,OAAO,CAAC,mBAAmB;CAG5B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js deleted file mode 100644 index 1e6d5345d5f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EventEmitter = void 0; -const index_js_1 = __importDefault(require("../../vendor/mitt/src/index.js")); -/** - * The EventEmitter class that many Puppeteer classes extend. - * - * @remarks - * - * This allows you to listen to events that Puppeteer classes fire and act - * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and - * {@link EventEmitter.off | off} to bind - * and unbind to event listeners. - * - * @public - */ -class EventEmitter { - /** - * @internal - */ - constructor() { - this.eventsMap = new Map(); - this.emitter = index_js_1.default(this.eventsMap); - } - /** - * Bind an event listener to fire when an event occurs. - * @param event - the event type you'd like to listen to. Can be a string or symbol. - * @param handler - the function to be called when the event occurs. - * @returns `this` to enable you to chain calls. - */ - on(event, handler) { - this.emitter.on(event, handler); - return this; - } - /** - * Remove an event listener from firing. - * @param event - the event type you'd like to stop listening to. - * @param handler - the function that should be removed. - * @returns `this` to enable you to chain calls. - */ - off(event, handler) { - this.emitter.off(event, handler); - return this; - } - /** - * Remove an event listener. - * @deprecated please use `off` instead. - */ - removeListener(event, handler) { - this.off(event, handler); - return this; - } - /** - * Add an event listener. - * @deprecated please use `on` instead. - */ - addListener(event, handler) { - this.on(event, handler); - return this; - } - /** - * Emit an event and call any associated listeners. - * - * @param event - the event you'd like to emit - * @param eventData - any data you'd like to emit with the event - * @returns `true` if there are any listeners, `false` if there are not. - */ - emit(event, eventData) { - this.emitter.emit(event, eventData); - return this.eventListenersCount(event) > 0; - } - /** - * Like `on` but the listener will only be fired once and then it will be removed. - * @param event - the event you'd like to listen to - * @param handler - the handler function to run when the event occurs - * @returns `this` to enable you to chain calls. - */ - once(event, handler) { - const onceHandler = (eventData) => { - handler(eventData); - this.off(event, onceHandler); - }; - return this.on(event, onceHandler); - } - /** - * Gets the number of listeners for a given event. - * - * @param event - the event to get the listener count for - * @returns the number of listeners bound to the given event - */ - listenerCount(event) { - return this.eventListenersCount(event); - } - /** - * Removes all listeners. If given an event argument, it will remove only - * listeners for that event. - * @param event - the event to remove listeners for. - * @returns `this` to enable you to chain calls. - */ - removeAllListeners(event) { - if (event) { - this.eventsMap.delete(event); - } - else { - this.eventsMap.clear(); - } - return this; - } - eventListenersCount(event) { - return this.eventsMap.has(event) ? this.eventsMap.get(event).length : 0; - } -} -exports.EventEmitter = EventEmitter; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts deleted file mode 100644 index d717c7464f9..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * IMPORTANT: we are mid-way through migrating away from this Events.ts file - * in favour of defining events next to the class that emits them. - * - * However we need to maintain this file for now because the legacy DocLint - * system relies on them. Be aware in the mean time if you make a change here - * you probably need to replicate it in the relevant class. For example if you - * add a new Page event, you should update the PageEmittedEvents enum in - * src/common/Page.ts. - * - * Chat to @jackfranklin if you're unsure. - */ -export declare const Events: { - readonly Page: { - readonly Close: "close"; - readonly Console: "console"; - readonly Dialog: "dialog"; - readonly DOMContentLoaded: "domcontentloaded"; - readonly Error: "error"; - readonly PageError: "pageerror"; - readonly Request: "request"; - readonly Response: "response"; - readonly RequestFailed: "requestfailed"; - readonly RequestFinished: "requestfinished"; - readonly FrameAttached: "frameattached"; - readonly FrameDetached: "framedetached"; - readonly FrameNavigated: "framenavigated"; - readonly Load: "load"; - readonly Metrics: "metrics"; - readonly Popup: "popup"; - readonly WorkerCreated: "workercreated"; - readonly WorkerDestroyed: "workerdestroyed"; - }; - readonly Browser: { - readonly TargetCreated: "targetcreated"; - readonly TargetDestroyed: "targetdestroyed"; - readonly TargetChanged: "targetchanged"; - readonly Disconnected: "disconnected"; - }; - readonly BrowserContext: { - readonly TargetCreated: "targetcreated"; - readonly TargetDestroyed: "targetdestroyed"; - readonly TargetChanged: "targetchanged"; - }; - readonly NetworkManager: { - readonly Request: symbol; - readonly Response: symbol; - readonly RequestFailed: symbol; - readonly RequestFinished: symbol; - }; - readonly FrameManager: { - readonly FrameAttached: symbol; - readonly FrameNavigated: symbol; - readonly FrameDetached: symbol; - readonly LifecycleEvent: symbol; - readonly FrameNavigatedWithinDocument: symbol; - readonly ExecutionContextCreated: symbol; - readonly ExecutionContextDestroyed: symbol; - }; - readonly Connection: { - readonly Disconnected: symbol; - }; - readonly CDPSession: { - readonly Disconnected: symbol; - }; -}; -//# sourceMappingURL=Events.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map deleted file mode 100644 index 0ef025a148a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Events.d.ts","sourceRoot":"","sources":["../../../../src/common/Events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmET,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js deleted file mode 100644 index 106a3d5609a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Events = void 0; -/** - * IMPORTANT: we are mid-way through migrating away from this Events.ts file - * in favour of defining events next to the class that emits them. - * - * However we need to maintain this file for now because the legacy DocLint - * system relies on them. Be aware in the mean time if you make a change here - * you probably need to replicate it in the relevant class. For example if you - * add a new Page event, you should update the PageEmittedEvents enum in - * src/common/Page.ts. - * - * Chat to @jackfranklin if you're unsure. - */ -exports.Events = { - Page: { - Close: 'close', - Console: 'console', - Dialog: 'dialog', - DOMContentLoaded: 'domcontentloaded', - Error: 'error', - // Can't use just 'error' due to node.js special treatment of error events. - // @see https://nodejs.org/api/events.html#events_error_events - PageError: 'pageerror', - Request: 'request', - Response: 'response', - RequestFailed: 'requestfailed', - RequestFinished: 'requestfinished', - FrameAttached: 'frameattached', - FrameDetached: 'framedetached', - FrameNavigated: 'framenavigated', - Load: 'load', - Metrics: 'metrics', - Popup: 'popup', - WorkerCreated: 'workercreated', - WorkerDestroyed: 'workerdestroyed', - }, - Browser: { - TargetCreated: 'targetcreated', - TargetDestroyed: 'targetdestroyed', - TargetChanged: 'targetchanged', - Disconnected: 'disconnected', - }, - BrowserContext: { - TargetCreated: 'targetcreated', - TargetDestroyed: 'targetdestroyed', - TargetChanged: 'targetchanged', - }, - NetworkManager: { - Request: Symbol('Events.NetworkManager.Request'), - Response: Symbol('Events.NetworkManager.Response'), - RequestFailed: Symbol('Events.NetworkManager.RequestFailed'), - RequestFinished: Symbol('Events.NetworkManager.RequestFinished'), - }, - FrameManager: { - FrameAttached: Symbol('Events.FrameManager.FrameAttached'), - FrameNavigated: Symbol('Events.FrameManager.FrameNavigated'), - FrameDetached: Symbol('Events.FrameManager.FrameDetached'), - LifecycleEvent: Symbol('Events.FrameManager.LifecycleEvent'), - FrameNavigatedWithinDocument: Symbol('Events.FrameManager.FrameNavigatedWithinDocument'), - ExecutionContextCreated: Symbol('Events.FrameManager.ExecutionContextCreated'), - ExecutionContextDestroyed: Symbol('Events.FrameManager.ExecutionContextDestroyed'), - }, - Connection: { - Disconnected: Symbol('Events.Connection.Disconnected'), - }, - CDPSession: { - Disconnected: Symbol('Events.CDPSession.Disconnected'), - }, -}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts deleted file mode 100644 index fa4e0be9562..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; -import { DOMWorld } from './DOMWorld.js'; -import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js'; -import { Frame } from './FrameManager.js'; -import { ElementHandle , JSHandle} from './JSHandle.js'; - -export declare const EVALUATION_SCRIPT_URL = "__puppeteer_evaluation_script__"; -/** - * This class represents a context for JavaScript execution. A [Page] might have - * many execution contexts: - * - each - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe | - * frame } has "default" execution context that is always created after frame is - * attached to DOM. This context is returned by the - * {@link frame.executionContext()} method. - * - {@link https://developer.chrome.com/extensions | Extension}'s content scripts - * create additional execution contexts. - * - * Besides pages, execution contexts can be found in - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | - * workers }. - * - * @public - */ -export declare class ExecutionContext { - /** - * @internal - */ - _client: CDPSession; - /** - * @internal - */ - _world: DOMWorld; - private _contextId; - /** - * @internal - */ - constructor(client: CDPSession, contextPayload: Protocol.Runtime.ExecutionContextDescription, world: DOMWorld); - /** - * @remarks - * - * Not every execution context is associated with a frame. For - * example, workers and extensions have execution contexts that are not - * associated with frames. - * - * @returns The frame associated with this execution context. - */ - frame(): Frame | null; - /** - * @remarks - * If the function passed to the `executionContext.evaluate` returns a - * Promise, then `executionContext.evaluate` would wait for the promise to - * resolve and return its value. If the function passed to the - * `executionContext.evaluate` returns a non-serializable value, then - * `executionContext.evaluate` resolves to `undefined`. DevTools Protocol also - * supports transferring some additional values that are not serializable by - * `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals. - * - * - * @example - * ```js - * const executionContext = await page.mainFrame().executionContext(); - * const result = await executionContext.evaluate(() => Promise.resolve(8 * 7))* ; - * console.log(result); // prints "56" - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * console.log(await executionContext.evaluate('1 + 2')); // prints "3" - * ``` - * - * @example - * {@link JSHandle} instances can be passed as arguments to the - * `executionContext.* evaluate`: - * ```js - * const oneHandle = await executionContext.evaluateHandle(() => 1); - * const twoHandle = await executionContext.evaluateHandle(() => 2); - * const result = await executionContext.evaluate( - * (a, b) => a + b, oneHandle, * twoHandle - * ); - * await oneHandle.dispose(); - * await twoHandle.dispose(); - * console.log(result); // prints '3'. - * ``` - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function. - */ - evaluate(pageFunction: Function | string, ...args: unknown[]): Promise; - /** - * @remarks - * The only difference between `executionContext.evaluate` and - * `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` - * returns an in-page object (a {@link JSHandle}). - * If the function passed to the `executionContext.evaluateHandle` returns a - * Promise, then `executionContext.evaluateHandle` would wait for the - * promise to resolve and return its value. - * - * @example - * ```js - * const context = await page.mainFrame().executionContext(); - * const aHandle = await context.evaluateHandle(() => Promise.resolve(self)); - * aHandle; // Handle for the global object. - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * // Handle for the '3' * object. - * const aHandle = await context.evaluateHandle('1 + 2'); - * ``` - * - * @example - * JSHandle instances can be passed as arguments - * to the `executionContext.* evaluateHandle`: - * - * ```js - * const aHandle = await context.evaluateHandle(() => document.body); - * const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle); - * console.log(await resultHandle.jsonValue()); // prints body's innerHTML - * await aHandle.dispose(); - * await resultHandle.dispose(); - * ``` - * - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function - * as an in-page object (a {@link JSHandle}). - */ - evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; - private _evaluateInternal; - /** - * This method iterates the JavaScript heap and finds all the objects with the - * given prototype. - * @remarks - * @example - * ```js - * // Create a Map object - * await page.evaluate(() => window.map = new Map()); - * // Get a handle to the Map object prototype - * const mapPrototype = await page.evaluateHandle(() => Map.prototype); - * // Query all map instances into an array - * const mapInstances = await page.queryObjects(mapPrototype); - * // Count amount of map objects in heap - * const count = await page.evaluate(maps => maps.length, mapInstances); - * await mapInstances.dispose(); - * await mapPrototype.dispose(); - * ``` - * - * @param prototypeHandle a handle to the object prototype - * - * @returns A handle to an array of objects with the given prototype. - */ - queryObjects(prototypeHandle: JSHandle): Promise; - /** - * @internal - */ - _adoptBackendNodeId(backendNodeId: Protocol.DOM.BackendNodeId): Promise; - /** - * @internal - */ - _adoptElementHandle(elementHandle: ElementHandle): Promise; -} -//# sourceMappingURL=ExecutionContext.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map deleted file mode 100644 index e53af2b64ec..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ExecutionContext.d.ts","sourceRoot":"","sources":["../../../../src/common/ExecutionContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAkB,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AAGvE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,OAAO,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,UAAU,CAAS;IAE3B;;OAEG;gBAED,MAAM,EAAE,UAAU,EAClB,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,2BAA2B,EAC5D,KAAK,EAAE,QAAQ;IAOjB;;;;;;;;OAQG;IACH,KAAK,IAAI,KAAK,GAAG,IAAI;IAIrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACG,QAAQ,CAAC,UAAU,SAAS,GAAG,EACnC,YAAY,EAAE,QAAQ,GAAG,MAAM,EAC/B,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,OAAO,CAAC,UAAU,CAAC;IAQtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACG,cAAc,CAAC,UAAU,SAAS,QAAQ,GAAG,aAAa,GAAG,QAAQ,EACzE,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,UAAU,CAAC;YAIR,iBAAiB;IAuI/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,YAAY,CAAC,eAAe,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAYhE;;OAEG;IACG,mBAAmB,CACvB,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,GACxC,OAAO,CAAC,aAAa,CAAC;IAQzB;;OAEG;IACG,mBAAmB,CACvB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,aAAa,CAAC;CAW1B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js deleted file mode 100644 index d8195474667..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js +++ /dev/null @@ -1,317 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ExecutionContext = exports.EVALUATION_SCRIPT_URL = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const JSHandle_js_1 = require("./JSHandle.js"); -exports.EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__'; -const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m; -/** - * This class represents a context for JavaScript execution. A [Page] might have - * many execution contexts: - * - each - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe | - * frame } has "default" execution context that is always created after frame is - * attached to DOM. This context is returned by the - * {@link frame.executionContext()} method. - * - {@link https://developer.chrome.com/extensions | Extension}'s content scripts - * create additional execution contexts. - * - * Besides pages, execution contexts can be found in - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | - * workers }. - * - * @public - */ -class ExecutionContext { - /** - * @internal - */ - constructor(client, contextPayload, world) { - this._client = client; - this._world = world; - this._contextId = contextPayload.id; - } - /** - * @remarks - * - * Not every execution context is associated with a frame. For - * example, workers and extensions have execution contexts that are not - * associated with frames. - * - * @returns The frame associated with this execution context. - */ - frame() { - return this._world ? this._world.frame() : null; - } - /** - * @remarks - * If the function passed to the `executionContext.evaluate` returns a - * Promise, then `executionContext.evaluate` would wait for the promise to - * resolve and return its value. If the function passed to the - * `executionContext.evaluate` returns a non-serializable value, then - * `executionContext.evaluate` resolves to `undefined`. DevTools Protocol also - * supports transferring some additional values that are not serializable by - * `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals. - * - * - * @example - * ```js - * const executionContext = await page.mainFrame().executionContext(); - * const result = await executionContext.evaluate(() => Promise.resolve(8 * 7))* ; - * console.log(result); // prints "56" - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * console.log(await executionContext.evaluate('1 + 2')); // prints "3" - * ``` - * - * @example - * {@link JSHandle} instances can be passed as arguments to the - * `executionContext.* evaluate`: - * ```js - * const oneHandle = await executionContext.evaluateHandle(() => 1); - * const twoHandle = await executionContext.evaluateHandle(() => 2); - * const result = await executionContext.evaluate( - * (a, b) => a + b, oneHandle, * twoHandle - * ); - * await oneHandle.dispose(); - * await twoHandle.dispose(); - * console.log(result); // prints '3'. - * ``` - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function. - */ - async evaluate(pageFunction, ...args) { - return await this._evaluateInternal(true, pageFunction, ...args); - } - /** - * @remarks - * The only difference between `executionContext.evaluate` and - * `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` - * returns an in-page object (a {@link JSHandle}). - * If the function passed to the `executionContext.evaluateHandle` returns a - * Promise, then `executionContext.evaluateHandle` would wait for the - * promise to resolve and return its value. - * - * @example - * ```js - * const context = await page.mainFrame().executionContext(); - * const aHandle = await context.evaluateHandle(() => Promise.resolve(self)); - * aHandle; // Handle for the global object. - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * // Handle for the '3' * object. - * const aHandle = await context.evaluateHandle('1 + 2'); - * ``` - * - * @example - * JSHandle instances can be passed as arguments - * to the `executionContext.* evaluateHandle`: - * - * ```js - * const aHandle = await context.evaluateHandle(() => document.body); - * const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle); - * console.log(await resultHandle.jsonValue()); // prints body's innerHTML - * await aHandle.dispose(); - * await resultHandle.dispose(); - * ``` - * - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function - * as an in-page object (a {@link JSHandle}). - */ - async evaluateHandle(pageFunction, ...args) { - return this._evaluateInternal(false, pageFunction, ...args); - } - async _evaluateInternal(returnByValue, pageFunction, ...args) { - const suffix = `//# sourceURL=${exports.EVALUATION_SCRIPT_URL}`; - if (helper_js_1.helper.isString(pageFunction)) { - const contextId = this._contextId; - const expression = pageFunction; - const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) - ? expression - : expression + '\n' + suffix; - const { exceptionDetails, result: remoteObject } = await this._client - .send('Runtime.evaluate', { - expression: expressionWithSourceUrl, - contextId, - returnByValue, - awaitPromise: true, - userGesture: true, - }) - .catch(rewriteError); - if (exceptionDetails) - throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); - return returnByValue - ? helper_js_1.helper.valueFromRemoteObject(remoteObject) - : JSHandle_js_1.createJSHandle(this, remoteObject); - } - if (typeof pageFunction !== 'function') - throw new Error(`Expected to get |string| or |function| as the first argument, but got "${pageFunction}" instead.`); - let functionText = pageFunction.toString(); - try { - new Function('(' + functionText + ')'); - } - catch (error) { - // This means we might have a function shorthand. Try another - // time prefixing 'function '. - if (functionText.startsWith('async ')) - functionText = - 'async function ' + functionText.substring('async '.length); - else - functionText = 'function ' + functionText; - try { - new Function('(' + functionText + ')'); - } - catch (error) { - // We tried hard to serialize, but there's a weird beast here. - throw new Error('Passed function is not well-serializable!'); - } - } - let callFunctionOnPromise; - try { - callFunctionOnPromise = this._client.send('Runtime.callFunctionOn', { - functionDeclaration: functionText + '\n' + suffix + '\n', - executionContextId: this._contextId, - arguments: args.map(convertArgument.bind(this)), - returnByValue, - awaitPromise: true, - userGesture: true, - }); - } - catch (error) { - if (error instanceof TypeError && - error.message.startsWith('Converting circular structure to JSON')) - error.message += ' Are you passing a nested JSHandle?'; - throw error; - } - const { exceptionDetails, result: remoteObject, } = await callFunctionOnPromise.catch(rewriteError); - if (exceptionDetails) - throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); - return returnByValue - ? helper_js_1.helper.valueFromRemoteObject(remoteObject) - : JSHandle_js_1.createJSHandle(this, remoteObject); - /** - * @param {*} arg - * @returns {*} - * @this {ExecutionContext} - */ - function convertArgument(arg) { - if (typeof arg === 'bigint') - // eslint-disable-line valid-typeof - return { unserializableValue: `${arg.toString()}n` }; - if (Object.is(arg, -0)) - return { unserializableValue: '-0' }; - if (Object.is(arg, Infinity)) - return { unserializableValue: 'Infinity' }; - if (Object.is(arg, -Infinity)) - return { unserializableValue: '-Infinity' }; - if (Object.is(arg, NaN)) - return { unserializableValue: 'NaN' }; - const objectHandle = arg && arg instanceof JSHandle_js_1.JSHandle ? arg : null; - if (objectHandle) { - if (objectHandle._context !== this) - throw new Error('JSHandles can be evaluated only in the context they were created!'); - if (objectHandle._disposed) - throw new Error('JSHandle is disposed!'); - if (objectHandle._remoteObject.unserializableValue) - return { - unserializableValue: objectHandle._remoteObject.unserializableValue, - }; - if (!objectHandle._remoteObject.objectId) - return { value: objectHandle._remoteObject.value }; - return { objectId: objectHandle._remoteObject.objectId }; - } - return { value: arg }; - } - function rewriteError(error) { - if (error.message.includes('Object reference chain is too long')) - return { result: { type: 'undefined' } }; - if (error.message.includes("Object couldn't be returned by value")) - return { result: { type: 'undefined' } }; - if (error.message.endsWith('Cannot find context with specified id') || - error.message.endsWith('Inspected target navigated or closed')) - throw new Error('Execution context was destroyed, most likely because of a navigation.'); - throw error; - } - } - /** - * This method iterates the JavaScript heap and finds all the objects with the - * given prototype. - * @remarks - * @example - * ```js - * // Create a Map object - * await page.evaluate(() => window.map = new Map()); - * // Get a handle to the Map object prototype - * const mapPrototype = await page.evaluateHandle(() => Map.prototype); - * // Query all map instances into an array - * const mapInstances = await page.queryObjects(mapPrototype); - * // Count amount of map objects in heap - * const count = await page.evaluate(maps => maps.length, mapInstances); - * await mapInstances.dispose(); - * await mapPrototype.dispose(); - * ``` - * - * @param prototypeHandle a handle to the object prototype - * - * @returns A handle to an array of objects with the given prototype. - */ - async queryObjects(prototypeHandle) { - assert_js_1.assert(!prototypeHandle._disposed, 'Prototype JSHandle is disposed!'); - assert_js_1.assert(prototypeHandle._remoteObject.objectId, 'Prototype JSHandle must not be referencing primitive value'); - const response = await this._client.send('Runtime.queryObjects', { - prototypeObjectId: prototypeHandle._remoteObject.objectId, - }); - return JSHandle_js_1.createJSHandle(this, response.objects); - } - /** - * @internal - */ - async _adoptBackendNodeId(backendNodeId) { - const { object } = await this._client.send('DOM.resolveNode', { - backendNodeId: backendNodeId, - executionContextId: this._contextId, - }); - return JSHandle_js_1.createJSHandle(this, object); - } - /** - * @internal - */ - async _adoptElementHandle(elementHandle) { - assert_js_1.assert(elementHandle.executionContext() !== this, 'Cannot adopt handle that already belongs to this execution context'); - assert_js_1.assert(this._world, 'Cannot adopt handle without DOMWorld'); - const nodeInfo = await this._client.send('DOM.describeNode', { - objectId: elementHandle._remoteObject.objectId, - }); - return this._adoptBackendNodeId(nodeInfo.node.backendNodeId); - } -} -exports.ExecutionContext = ExecutionContext; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts deleted file mode 100644 index 1f9fd3b13d8..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { ElementHandle } from './JSHandle.js'; - -/** - * File choosers let you react to the page requesting for a file. - * @remarks - * `FileChooser` objects are returned via the `page.waitForFileChooser` method. - * @example - * An example of using `FileChooser`: - * ```js - * const [fileChooser] = await Promise.all([ - * page.waitForFileChooser(), - * page.click('#upload-file-button'), // some button that triggers file selection - * ]); - * await fileChooser.accept(['/tmp/myfile.pdf']); - * ``` - * **NOTE** In browsers, only one file chooser can be opened at a time. - * All file choosers must be accepted or canceled. Not doing so will prevent - * subsequent file choosers from appearing. - */ -export declare class FileChooser { - private _element; - private _multiple; - private _handled; - /** - * @internal - */ - constructor(element: ElementHandle, event: Protocol.Page.FileChooserOpenedEvent); - /** - * Whether file chooser allow for {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} file selection. - */ - isMultiple(): boolean; - /** - * Accept the file chooser request with given paths. - * @param filePaths - If some of the `filePaths` are relative paths, - * then they are resolved relative to the {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. - */ - accept(filePaths: string[]): Promise; - /** - * Closes the file chooser without selecting any files. - */ - cancel(): Promise; -} -//# sourceMappingURL=FileChooser.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map deleted file mode 100644 index 3305117b8d2..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"FileChooser.d.ts","sourceRoot":"","sources":["../../../../src/common/FileChooser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBAED,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,sBAAsB;IAM7C;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;OAIG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAO9B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js deleted file mode 100644 index 50b913f09c0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FileChooser = void 0; -const assert_js_1 = require("./assert.js"); -/** - * File choosers let you react to the page requesting for a file. - * @remarks - * `FileChooser` objects are returned via the `page.waitForFileChooser` method. - * @example - * An example of using `FileChooser`: - * ```js - * const [fileChooser] = await Promise.all([ - * page.waitForFileChooser(), - * page.click('#upload-file-button'), // some button that triggers file selection - * ]); - * await fileChooser.accept(['/tmp/myfile.pdf']); - * ``` - * **NOTE** In browsers, only one file chooser can be opened at a time. - * All file choosers must be accepted or canceled. Not doing so will prevent - * subsequent file choosers from appearing. - */ -class FileChooser { - /** - * @internal - */ - constructor(element, event) { - this._handled = false; - this._element = element; - this._multiple = event.mode !== 'selectSingle'; - } - /** - * Whether file chooser allow for {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} file selection. - */ - isMultiple() { - return this._multiple; - } - /** - * Accept the file chooser request with given paths. - * @param filePaths - If some of the `filePaths` are relative paths, - * then they are resolved relative to the {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. - */ - async accept(filePaths) { - assert_js_1.assert(!this._handled, 'Cannot accept FileChooser which is already handled!'); - this._handled = true; - await this._element.uploadFile(...filePaths); - } - /** - * Closes the file chooser without selecting any files. - */ - async cancel() { - assert_js_1.assert(!this._handled, 'Cannot cancel FileChooser which is already handled!'); - this._handled = true; - } -} -exports.FileChooser = FileChooser; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts deleted file mode 100644 index c108ae26d0a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; -import { DOMWorld, WaitForSelectorOptions } from './DOMWorld.js'; -import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike , WrapElementHandle} from './EvalTypes.js'; -import { EventEmitter } from './EventEmitter.js'; -import { ExecutionContext } from './ExecutionContext.js'; -import { HTTPResponse } from './HTTPResponse.js'; -import { MouseButton } from './Input.js'; -import { ElementHandle , JSHandle} from './JSHandle.js'; -import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js'; -import { NetworkManager } from './NetworkManager.js'; -import { Page } from './Page.js'; -import { TimeoutSettings } from './TimeoutSettings.js'; - -/** - * We use symbols to prevent external parties listening to these events. - * They are internal to Puppeteer. - * - * @internal - */ -export declare const FrameManagerEmittedEvents: { - FrameAttached: symbol; - FrameNavigated: symbol; - FrameDetached: symbol; - LifecycleEvent: symbol; - FrameNavigatedWithinDocument: symbol; - ExecutionContextCreated: symbol; - ExecutionContextDestroyed: symbol; -}; -/** - * @internal - */ -export declare class FrameManager extends EventEmitter { - _client: CDPSession; - private _page; - private _networkManager; - _timeoutSettings: TimeoutSettings; - private _frames; - private _contextIdToContext; - private _isolatedWorlds; - private _mainFrame; - constructor(client: CDPSession, page: Page, ignoreHTTPSErrors: boolean, timeoutSettings: TimeoutSettings); - initialize(): Promise; - networkManager(): NetworkManager; - navigateFrame(frame: Frame, url: string, options?: { - referer?: string; - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - waitForFrameNavigation(frame: Frame, options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - _onLifecycleEvent(event: Protocol.Page.LifecycleEventEvent): void; - _onFrameStoppedLoading(frameId: string): void; - _handleFrameTree(frameTree: Protocol.Page.FrameTree): void; - page(): Page; - mainFrame(): Frame; - frames(): Frame[]; - frame(frameId: string): Frame | null; - _onFrameAttached(frameId: string, parentFrameId?: string): void; - _onFrameNavigated(framePayload: Protocol.Page.Frame): void; - _ensureIsolatedWorld(name: string): Promise; - _onFrameNavigatedWithinDocument(frameId: string, url: string): void; - _onFrameDetached(frameId: string): void; - _onExecutionContextCreated(contextPayload: Protocol.Runtime.ExecutionContextDescription): void; - private _onExecutionContextDestroyed; - private _onExecutionContextsCleared; - executionContextById(contextId: number): ExecutionContext; - private _removeFramesRecursively; -} -/** - * @public - */ -export interface FrameWaitForFunctionOptions { - /** - * An interval at which the `pageFunction` is executed, defaults to `raf`. If - * `polling` is a number, then it is treated as an interval in milliseconds at - * which the function would be executed. If `polling` is a string, then it can - * be one of the following values: - * - * - `raf` - to constantly execute `pageFunction` in `requestAnimationFrame` - * callback. This is the tightest polling mode which is suitable to observe - * styling changes. - * - * - `mutation` - to execute `pageFunction` on every DOM mutation. - */ - polling?: string | number; - /** - * Maximum time to wait in milliseconds. Defaults to `30000` (30 seconds). - * Pass `0` to disable the timeout. Puppeteer's default timeout can be changed - * using {@link Page.setDefaultTimeout}. - */ - timeout?: number; -} -/** - * @public - */ -export interface FrameAddScriptTagOptions { - /** - * the URL of the script to be added. - */ - url?: string; - /** - * The path to a JavaScript file to be injected into the frame. - * @remarks - * If `path` is a relative path, it is resolved relative to the current - * working directory (`process.cwd()` in Node.js). - */ - path?: string; - /** - * Raw JavaScript content to be injected into the frame. - */ - content?: string; - /** - * Set the script's `type`. Use `module` in order to load an ES2015 module. - */ - type?: string; -} -/** - * @public - */ -export interface FrameAddStyleTagOptions { - /** - * the URL of the CSS file to be added. - */ - url?: string; - /** - * The path to a CSS file to be injected into the frame. - * @remarks - * If `path` is a relative path, it is resolved relative to the current - * working directory (`process.cwd()` in Node.js). - */ - path?: string; - /** - * Raw CSS content to be injected into the frame. - */ - content?: string; -} -/** - * At every point of time, page exposes its current frame tree via the - * {@link Page.mainFrame | page.mainFrame} and - * {@link Frame.childFrames | frame.childFrames} methods. - * - * @remarks - * - * `Frame` object lifecycles are controlled by three events that are all - * dispatched on the page object: - * - * - {@link PageEmittedEvents.FrameAttached} - * - * - {@link PageEmittedEvents.FrameNavigated} - * - * - {@link PageEmittedEvents.FrameDetached} - * - * @Example - * An example of dumping frame tree: - * - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * await page.goto('https://www.google.com/chrome/browser/canary.html'); - * dumpFrameTree(page.mainFrame(), ''); - * await browser.close(); - * - * function dumpFrameTree(frame, indent) { - * console.log(indent + frame.url()); - * for (const child of frame.childFrames()) { - * dumpFrameTree(child, indent + ' '); - * } - * } - * })(); - * ``` - * - * @Example - * An example of getting text from an iframe element: - * - * ```js - * const frame = page.frames().find(frame => frame.name() === 'myframe'); - * const text = await frame.$eval('.selector', element => element.textContent); - * console.log(text); - * ``` - * - * @public - */ -export declare class Frame { - /** - * @internal - */ - _frameManager: FrameManager; - private _parentFrame?; - /** - * @internal - */ - _id: string; - private _url; - private _detached; - /** - * @internal - */ - _loaderId: string; - /** - * @internal - */ - _name?: string; - /** - * @internal - */ - _lifecycleEvents: Set; - /** - * @internal - */ - _mainWorld: DOMWorld; - /** - * @internal - */ - _secondaryWorld: DOMWorld; - /** - * @internal - */ - _childFrames: Set; - /** - * @internal - */ - constructor(frameManager: FrameManager, parentFrame: Frame | null, frameId: string); - /** - * @remarks - * - * `frame.goto` will throw an error if: - * - there's an SSL error (e.g. in case of self-signed certificates). - * - * - target URL is invalid. - * - * - the `timeout` is exceeded during navigation. - * - * - the remote server does not respond or is unreachable. - * - * - the main resource failed to load. - * - * `frame.goto` will not throw an error when any valid HTTP status code is - * returned by the remote server, including 404 "Not Found" and 500 "Internal - * Server Error". The status code for such responses can be retrieved by - * calling {@link HTTPResponse.status}. - * - * NOTE: `frame.goto` either throws an error or returns a main resource - * response. The only exceptions are navigation to `about:blank` or - * navigation to the same URL with a different hash, which would succeed and - * return `null`. - * - * NOTE: Headless mode doesn't support navigation to a PDF document. See - * the {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295 | upstream - * issue}. - * - * @param url - the URL to navigate the frame to. This should include the - * scheme, e.g. `https://`. - * @param options - navigation options. `waitUntil` is useful to define when - * the navigation should be considered successful - see the docs for - * {@link PuppeteerLifeCycleEvent} for more details. - * - * @returns A promise which resolves to the main resource response. In case of - * multiple redirects, the navigation will resolve with the response of the - * last redirect. - */ - goto(url: string, options?: { - referer?: string; - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * @remarks - * - * This resolves when the frame navigates to a new URL. It is useful for when - * you run code which will indirectly cause the frame to navigate. Consider - * this example: - * - * ```js - * const [response] = await Promise.all([ - * // The navigation promise resolves after navigation has finished - * frame.waitForNavigation(), - * // Clicking the link will indirectly cause a navigation - * frame.click('a.my-link'), - * ]); - * ``` - * - * Usage of the {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API} to change the URL is considered a navigation. - * - * @param options - options to configure when the navigation is consided finished. - * @returns a promise that resolves when the frame navigates to a new URL. - */ - waitForNavigation(options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * @returns a promise that resolves to the frame's default execution context. - */ - executionContext(): Promise; - /** - * @remarks - * - * The only difference between {@link Frame.evaluate} and - * `frame.evaluateHandle` is that `evaluateHandle` will return the value - * wrapped in an in-page object. - * - * This method behaves identically to {@link Page.evaluateHandle} except it's - * run within the context of the `frame`, rather than the entire page. - * - * @param pageFunction - a function that is run within the frame - * @param args - arguments to be passed to the pageFunction - */ - evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; - /** - * @remarks - * - * This method behaves identically to {@link Page.evaluate} except it's run - * within the context of the `frame`, rather than the entire page. - * - * @param pageFunction - a function that is run within the frame - * @param args - arguments to be passed to the pageFunction - */ - evaluate(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise>>; - /** - * This method queries the frame for the given selector. - * - * @param selector - a selector to query for. - * @returns A promise which resolves to an `ElementHandle` pointing at the - * element, or `null` if it was not found. - */ - $(selector: string): Promise; - /** - * This method evaluates the given XPath expression and returns the results. - * - * @param expression - the XPath expression to evaluate. - */ - $x(expression: string): Promise; - /** - * @remarks - * - * This method runs `document.querySelector` within - * the frame and passes it as the first argument to `pageFunction`. - * - * If `pageFunction` returns a Promise, then `frame.$eval` would wait for - * the promise to resolve and return its value. - * - * @example - * - * ```js - * const searchValue = await frame.$eval('#search', el => el.value); - * ``` - * - * @param selector - the selector to query for - * @param pageFunction - the function to be evaluated in the frame's context - * @param args - additional arguments to pass to `pageFuncton` - */ - $eval(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - /** - * @remarks - * - * This method runs `Array.from(document.querySelectorAll(selector))` within - * the frame and passes it as the first argument to `pageFunction`. - * - * If `pageFunction` returns a Promise, then `frame.$$eval` would wait for - * the promise to resolve and return its value. - * - * @example - * - * ```js - * const divsCounts = await frame.$$eval('div', divs => divs.length); - * ``` - * - * @param selector - the selector to query for - * @param pageFunction - the function to be evaluated in the frame's context - * @param args - additional arguments to pass to `pageFuncton` - */ - $$eval(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - /** - * This runs `document.querySelectorAll` in the frame and returns the result. - * - * @param selector - a selector to search for - * @returns An array of element handles pointing to the found frame elements. - */ - $$(selector: string): Promise; - /** - * @returns the full HTML contents of the frame, including the doctype. - */ - content(): Promise; - /** - * Set the content of the frame. - * - * @param html - HTML markup to assign to the page. - * @param options - options to configure how long before timing out and at - * what point to consider the content setting successful. - */ - setContent(html: string, options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * @remarks - * - * If the name is empty, it returns the `id` attribute instead. - * - * Note: This value is calculated once when the frame is created, and will not - * update if the attribute is changed later. - * - * @returns the frame's `name` attribute as specified in the tag. - */ - name(): string; - /** - * @returns the frame's URL. - */ - url(): string; - /** - * @returns the parent `Frame`, if any. Detached and main frames return `null`. - */ - parentFrame(): Frame | null; - /** - * @returns an array of child frames. - */ - childFrames(): Frame[]; - /** - * @returns `true` if the frame has been detached, or `false` otherwise. - */ - isDetached(): boolean; - /** - * Adds a ` diff --git a/test/e2e/resources/application/service-worker.js b/test/e2e/resources/application/service-worker.js new file mode 100644 index 00000000000..1ee35a4b8f3 --- /dev/null +++ b/test/e2e/resources/application/service-worker.js @@ -0,0 +1,26 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// @ts-nocheck +const CACHE_NAME = 'cache-v1'; + +const urlsToCache = [ + '/test/e2e/resources/application/main.css', +]; + + +self.addEventListener('install', (event) => { + event.waitUntil(caches.open(CACHE_NAME).then(function(cache) { + return cache.addAll(urlsToCache); + })); +}); + +self.addEventListener('fetch', (event) => { + event.respondWith(caches.match(event.request).then(function(response) { + if (response) { + return response; + } + return fetch(event.request); + })); +}); From a877f3cb4def91d2f4fbf88fade9a2588f431c04 Mon Sep 17 00:00:00 2001 From: Jan Scheffler Date: Tue, 27 Oct 2020 15:18:32 +0100 Subject: [PATCH 09/85] [Puppeteer] Add unit test to make sure puppeteer runs in the browser Change-Id: Ibd77f941d2a1a04d9676a91b080dc6ace4133211 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2501302 Commit-Queue: Jan Scheffler Reviewed-by: Mathias Bynens Reviewed-by: Yang Guo Reviewed-by: Jack Franklin Reviewed-by: Paul Lewis --- front_end/third_party/puppeteer/puppeteer.ts | 4 +- test/e2e/BUILD.gn | 1 + test/e2e/puppeteer/BUILD.gn | 17 +++++ test/e2e/puppeteer/puppeteer_test.ts | 76 ++++++++++++++++++++ 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 test/e2e/puppeteer/BUILD.gn create mode 100644 test/e2e/puppeteer/puppeteer_test.ts diff --git a/front_end/third_party/puppeteer/puppeteer.ts b/front_end/third_party/puppeteer/puppeteer.ts index 1d21de0e24f..189c407b526 100644 --- a/front_end/third_party/puppeteer/puppeteer.ts +++ b/front_end/third_party/puppeteer/puppeteer.ts @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {Browser} from './package/lib/esm/puppeteer/common/Browser.js'; import {Connection} from './package/lib/esm/puppeteer/common/Connection.js'; export { - Connection + Browser, + Connection, }; diff --git a/test/e2e/BUILD.gn b/test/e2e/BUILD.gn index 9f6a815e7d4..adb90a7c391 100644 --- a/test/e2e/BUILD.gn +++ b/test/e2e/BUILD.gn @@ -33,6 +33,7 @@ node_ts_library("tests") { "network", "performance", "profiler", + "puppeteer", "rendering", "search", "security", diff --git a/test/e2e/puppeteer/BUILD.gn b/test/e2e/puppeteer/BUILD.gn new file mode 100644 index 00000000000..bb42a43052f --- /dev/null +++ b/test/e2e/puppeteer/BUILD.gn @@ -0,0 +1,17 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("../../../third_party/typescript/typescript.gni") + +node_ts_library("puppeteer") { + sources = [ "puppeteer_test.ts" ] + + deps = [ + "../../../front_end/protocol_client:bundle", + "../../../front_end/sdk:bundle", + "../../../front_end/third_party/puppeteer:bundle", + "../../shared", + "../helpers", + ] +} diff --git a/test/e2e/puppeteer/puppeteer_test.ts b/test/e2e/puppeteer/puppeteer_test.ts new file mode 100644 index 00000000000..69db29d4bad --- /dev/null +++ b/test/e2e/puppeteer/puppeteer_test.ts @@ -0,0 +1,76 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {assert} from 'chai'; +import {getBrowserAndPages} from '../../shared/helper.js'; + + +describe('Puppeteer', () => { + it('should connect to the browser via DevTools own connection', async () => { + const {frontend, browser} = getBrowserAndPages(); + + const version = await browser.version(); + const result = await frontend.evaluate(`(async () => { + const puppeteer = await import('./third_party/puppeteer/puppeteer.js'); + const SDK = await import('./sdk/sdk.js'); + + class Transport { + + /** + * + * @param {ProtocolClient.InspectorBackend.Connection} connection + */ + constructor(connection) { + this._connection = connection; + } + /** + * + * @param {*} string + */ + send(string) { + this._connection.sendRawMessage(string); + } + + close() { + this._connection.disconnect(); + } + + /** + * @param {function(string): void} cb + */ + set onmessage(cb) { + this._connection.setOnMessage((data) => { + if (data.sessionId === this._connection._sessionId) { + delete data.sessionId; + } + cb(typeof data === 'string' ? data : JSON.stringify(data)); + }); + } + + /** + * @param {() => void} cb + */ + set onclose(cb) { + this._connection.setOnDisconnect(() => { + cb() + }); + } + } + + const childTargetManager = + SDK.SDKModel.TargetManager.instance().mainTarget().model(SDK.ChildTargetManager.ChildTargetManager); + const rawConnection = await childTargetManager.createParallelConnection(); + + const transport = new Transport(rawConnection); + + // url is an empty string in this case parallel to: + // https://github.com/puppeteer/puppeteer/blob/f63a123ecef86693e6457b07437a96f108f3e3c5/src/common/BrowserConnector.ts#L72 + const connection = new puppeteer.Connection('', transport); + const browser = await puppeteer.Browser.create(connection, [], false); + return browser.version(); + })()`); + + assert.deepEqual(version, result); + }); +}); From 5c22d72264b2c55b0f0df3886824a5d677da2135 Mon Sep 17 00:00:00 2001 From: Philip Pfaffe Date: Tue, 27 Oct 2020 17:53:29 +0100 Subject: [PATCH 10/85] Implement support for recursive JS formatters Recursive formatters for wasm debugging can insert anchors in their returned representation which hand control over formatting back to the frontend. Formatters identify anchor objects by their class name and a symbol property containing an EvalBase. This CL adds a hook into the RemoteObject property traversal to check for hooks in RemoteObjects created for wasm debugging. Bug: chromium:1127915 Change-Id: Ic288af36f2809992ea2c6fdfa7b049813a506794 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2489865 Auto-Submit: Philip Pfaffe Commit-Queue: Benedikt Meurer Reviewed-by: Eric Leese Reviewed-by: Benedikt Meurer --- front_end/bindings/DebuggerLanguagePlugins.js | 175 ++++++++++++++++-- front_end/sdk/RemoteObject.js | 24 ++- .../sources/debugger-language-plugins_test.ts | 60 +++++- 3 files changed, 237 insertions(+), 22 deletions(-) diff --git a/front_end/bindings/DebuggerLanguagePlugins.js b/front_end/bindings/DebuggerLanguagePlugins.js index c7d23312547..a341dec3027 100644 --- a/front_end/bindings/DebuggerLanguagePlugins.js +++ b/front_end/bindings/DebuggerLanguagePlugins.js @@ -17,12 +17,12 @@ class SourceType { /** * @param {!TypeInfo} typeInfo * @param {!Array} members + * @param {!Map<*, !SourceType>} typeMap */ - constructor(typeInfo, members) { - /** @type {!TypeInfo} */ + constructor(typeInfo, members, typeMap) { this.typeInfo = typeInfo; - /** @type {!Array} */ this.members = members; + this.typeMap = typeMap; } /** Create a type graph @@ -36,7 +36,7 @@ class SourceType { /** @type Map<*, !SourceType> */ const typeMap = new Map(); for (const typeInfo of typeInfos) { - typeMap.set(typeInfo.typeId, new SourceType(typeInfo, [])); + typeMap.set(typeInfo.typeId, new SourceType(typeInfo, [], typeMap)); } for (const sourceType of typeMap.values()) { @@ -66,15 +66,134 @@ function getRawLocation(callFrame) { }; } +/** + * @param {!SDK.DebuggerModel.CallFrame} callFrame + * @param {!SDK.RemoteObject.RemoteObject} object + * @return {!Promise<*>} + */ +async function resolveRemoteObject(callFrame, object) { + if (typeof object.value !== 'undefined') { + return object.value; + } + + const response = await callFrame.debuggerModel.target().runtimeAgent().invoke_callFunctionOn( + {functionDeclaration: 'function() { return this; }', objectId: object.objectId, returnByValue: true}); + const {result} = response; + if (!result) { + return undefined; + } + return result.value; +} + +class EvalNodeBase extends SDK.RemoteObject.RemoteObjectImpl { + /** + * @param {!SDK.DebuggerModel.CallFrame} callFrame + * @param {!DebuggerLanguagePlugin} plugin + * @param {!SourceType} sourceType + * @param {!Protocol.Runtime.RemoteObject} object + * @param {?{className: string, symbol: string }} formatterTag + */ + constructor(callFrame, sourceType, plugin, object, formatterTag) { + super( + callFrame.debuggerModel.runtimeModel(), object.objectId, object.type, object.subtype, object.value, + object.unserializableValue, object.description, object.preview, object.customPreview, object.className); + + this._plugin = plugin; + this._sourceType = sourceType; + this._callFrame = callFrame; + + /** @type {?{className: string, symbol: string }} */ + this.formatterTag = formatterTag; + } + + /** + * @param {...string} properties + * @return {!Promise>} + */ + async findProperties(...properties) { + /** @type {!Object} */ + const result = {}; + for (const prop of (await this.getOwnProperties(false)).properties || []) { + if (properties.indexOf(prop.name) >= 0) { + if (prop.value) { + result[prop.name] = /** @type {!EvalNodeBase|undefined} */ (prop.value); + } + } + } + return result; + } + + /** + * @override + * @param {!Protocol.Runtime.RemoteObject} newObject + */ + async _createRemoteObject(newObject) { + const base = await this._getEvalBaseFromObject(newObject); + if (!base) { + return new EvalNodeBase(this._callFrame, this._sourceType, this._plugin, newObject, this.formatterTag); + } + const newSourceType = this._sourceType.typeMap.get(base.rootType.typeId); + if (!newSourceType) { + throw new Error('Unknown typeId in eval base'); + } + if (base.rootType.hasValue && !base.rootType.canExpand && base) { + return EvalNode.evaluate(this._callFrame, this._plugin, newSourceType, base, []); + } + + return new EvalNode(this._callFrame, this._plugin, newSourceType, base, []); + } + + /** + * @param {!Protocol.Runtime.RemoteObject} object + */ + async _getEvalBaseFromObject(object) { + const {objectId} = object; + if (!object || !this.formatterTag) { + return null; + } + + const {className, symbol} = this.formatterTag; + if (className !== object.className) { + return null; + } + + const response = await this.debuggerModel().target().runtimeAgent().invoke_callFunctionOn( + {functionDeclaration: 'function(sym) { return this[sym]; }', objectId, arguments: [{objectId: symbol}]}); + const {result} = response; + if (!result || result.type === 'undefined') { + return null; + } + + const baseObject = new EvalNodeBase(this._callFrame, this._sourceType, this._plugin, result, null); + const {payload, rootType} = await baseObject.findProperties('payload', 'rootType'); + if (typeof payload === 'undefined' || typeof rootType === 'undefined') { + return null; + } + const value = await resolveRemoteObject(this._callFrame, payload); + const {typeId} = await rootType.findProperties('typeId', 'rootType'); + if (typeof value === 'undefined' || typeof typeId === 'undefined') { + return null; + } + + const newSourceType = this._sourceType.typeMap.get(typeId.value); + if (!newSourceType) { + return null; + } + + return {payload: value, rootType: newSourceType.typeInfo}; + } +} + class EvalNode extends SDK.RemoteObject.RemoteObjectImpl { /** * @param {!SDK.DebuggerModel.CallFrame} callFrame * @param {!DebuggerLanguagePlugin} plugin + * @param {!SourceType} sourceType * @param {!EvalBase} base * @param {!Array} field * @return {!Promise} */ - static async evaluate(callFrame, plugin, base, field) { + static async evaluate(callFrame, plugin, sourceType, base, field) { const location = getRawLocation(callFrame); let evalCode = await plugin.getFormatter({base, field}, location); @@ -84,14 +203,46 @@ class EvalNode extends SDK.RemoteObject.RemoteObjectImpl { const response = await callFrame.debuggerModel.target().debuggerAgent().invoke_evaluateOnCallFrame({ callFrameId: callFrame.id, expression: evalCode.js, - generatePreview: true, + generatePreview: false, includeCommandLineAPI: true, objectGroup: 'console', returnByValue: false, silent: false }); - return callFrame.debuggerModel.runtimeModel().createRemoteObject(response.result); + + const {result} = response; + const object = new EvalNodeBase(callFrame, sourceType, plugin, result, null); + const unpackedResultObject = await unpackResultObject(object); + const node = unpackedResultObject || object; + + if (typeof node.value === 'undefined') { + node.description = sourceType.typeInfo.typeNames[0]; + } + + return node; + + /** + * @param {!EvalNodeBase} object + * @return {!Promise} + */ + async function unpackResultObject(object) { + const {tag, value} = await object.findProperties('tag', 'value'); + if (!tag || !value) { + return null; + } + const {className, symbol} = await tag.findProperties('className', 'symbol'); + if (!className || !symbol) { + return null; + } + const resolvedClassName = className.value; + if (typeof resolvedClassName !== 'string' || typeof symbol.objectId === 'undefined') { + return null; + } + + value.formatterTag = {symbol: symbol.objectId, className: resolvedClassName}; + return value; + } } /** @@ -113,7 +264,7 @@ class EvalNode extends SDK.RemoteObject.RemoteObjectImpl { return new SDK.RemoteObject.LocalJSONObject(undefined); } if (sourceType.typeInfo.hasValue && !sourceType.typeInfo.canExpand && base) { - return EvalNode.evaluate(callFrame, plugin, base, []); + return EvalNode.evaluate(callFrame, plugin, sourceType, base, []); } return new EvalNode(callFrame, plugin, sourceType, base, []); @@ -130,10 +281,11 @@ class EvalNode extends SDK.RemoteObject.RemoteObjectImpl { const typeName = sourceType.typeInfo.typeNames[0] || ''; const variableType = 'object'; super( - callFrame.debuggerModel.runtimeModel(), /* objectId=*/ undefined, + callFrame.debuggerModel.runtimeModel(), + /* objectId=*/ undefined, /* type=*/ variableType, /* subtype=*/ undefined, /* value=*/ null, /* unserializableValue=*/ undefined, - /* description=*/ typeName); + /* description=*/ typeName, /* preview=*/ undefined, /* customPreview=*/ undefined, /* className=*/ typeName); this._variableType = variableType; this._callFrame = callFrame; this._plugin = plugin; @@ -159,7 +311,8 @@ class EvalNode extends SDK.RemoteObject.RemoteObjectImpl { */ async _expandMember(sourceType, fieldInfo) { if (sourceType.typeInfo.hasValue && !sourceType.typeInfo.canExpand && this._base) { - return EvalNode.evaluate(this._callFrame, this._plugin, this._base, this._fieldChain.concat(fieldInfo)); + return EvalNode.evaluate( + this._callFrame, this._plugin, sourceType, this._base, this._fieldChain.concat(fieldInfo)); } return new EvalNode(this._callFrame, this._plugin, sourceType, this._base, this._fieldChain.concat(fieldInfo)); } diff --git a/front_end/sdk/RemoteObject.js b/front_end/sdk/RemoteObject.js index 8e1c176e894..4980d3d7818 100644 --- a/front_end/sdk/RemoteObject.js +++ b/front_end/sdk/RemoteObject.js @@ -29,7 +29,7 @@ */ import {DebuggerModel, FunctionDetails} from './DebuggerModel.js'; // eslint-disable-line no-unused-vars -import {RuntimeModel} from './RuntimeModel.js'; // eslint-disable-line no-unused-vars +import {RuntimeModel} from './RuntimeModel.js'; // eslint-disable-line no-unused-vars export class RemoteObject { /** @@ -232,6 +232,11 @@ export class RemoteObject { throw 'Not implemented'; } + /** @param {string|undefined} description*/ + set description(description) { + throw 'Not implemented'; + } + /** @return {boolean} */ get hasChildren() { throw 'Not implemented'; @@ -452,6 +457,14 @@ export class RemoteObjectImpl extends RemoteObject { return this._description; } + /** + * @override + * @param {string|undefined} description + */ + set description(description) { + this._description = description; + } + /** * @override * @return {boolean} @@ -495,6 +508,13 @@ export class RemoteObjectImpl extends RemoteObject { return this.doGetProperties(false, accessorPropertiesOnly, generatePreview); } + /** + * @param {!Protocol.Runtime.RemoteObject} object + */ + _createRemoteObject(object) { + return Promise.resolve(this._runtimeModel.createRemoteObject(object)); + } + /** * @param {boolean} ownProperties * @param {boolean} accessorPropertiesOnly @@ -518,7 +538,7 @@ export class RemoteObjectImpl extends RemoteObject { const {result: properties = [], internalProperties = [], privateProperties = []} = response; const result = []; for (const property of properties) { - const propertyValue = property.value ? this._runtimeModel.createRemoteObject(property.value) : null; + const propertyValue = property.value ? await this._createRemoteObject(property.value) : null; const propertySymbol = property.symbol ? this._runtimeModel.createRemoteObject(property.symbol) : null; const remoteProperty = new RemoteObjectProperty( property.name, propertyValue, !!property.enumerable, !!property.writable, !!property.isOwn, diff --git a/test/e2e/sources/debugger-language-plugins_test.ts b/test/e2e/sources/debugger-language-plugins_test.ts index 482db513a18..1bffb6821e1 100644 --- a/test/e2e/sources/debugger-language-plugins_test.ts +++ b/test/e2e/sources/debugger-language-plugins_test.ts @@ -578,6 +578,16 @@ describe('The Debugger Language Plugins', async () => { canExpand: false, hasValue: true, }, + { + typeNames: ['int'], + typeId: 'int', + members: [], + alignment: 0, + arraySize: 0, + size: 4, + canExpand: false, + hasValue: true, + }, ]; const base = {rootType: typeInfos[0], payload: 28}; @@ -589,18 +599,44 @@ describe('The Debugger Language Plugins', async () => { // eslint-disable-next-line @typescript-eslint/no-unused-vars async getFormatter(expressionOrField: string|{base: EvalBase, field: FieldInfo[]}, context: RawLocation): Promise<{js: string}|null> { + function format() { + const sym = Symbol('sym'); + + class $tag { + [sym]: EvalBase; + constructor() { + const rootType = { + typeNames: ['int'], + typeId: 'int', + members: [], + alignment: 0, + arraySize: 0, + size: 4, + canExpand: false, + hasValue: true, + }; + this[sym] = {payload: {value: 19}, rootType}; + } + } + + const value = {value: 26, recurse: new $tag()}; + return {tag: {className: '$tag', symbol: sym}, value}; + } + if (typeof expressionOrField === 'string') { return null; } const {base, field} = expressionOrField; - if (typeof base.payload !== 'number' || base.payload !== 28 || field.length !== 2 || - field[0].name !== 'member' || field[0].offset !== 1 || field[0].typeId !== 'TestTypeMember' || - field[1].name !== 'member2' || field[1].offset !== 1 || field[1].typeId !== 'TestTypeMember2') { - return null; + if (base.payload === 28 && field.length === 2 && field[0].name === 'member' && field[0].offset === 1 && + field[0].typeId === 'TestTypeMember' && field[1].name === 'member2' && field[1].offset === 1 && + field[1].typeId === 'TestTypeMember2') { + return {js: `${format.toString()} format()`}; } - - return {js: '26'}; + if ((base.payload as {value: number}).value === 19 && field.length === 0) { + return {js: '27'}; + } + return null; } } @@ -615,9 +651,15 @@ describe('The Debugger Language Plugins', async () => { await goToResource('sources/wasm/unreachable.html'); await waitFor(RESUME_BUTTON); - - const locals = await getValuesForScope('LOCAL', 2, 3); - assert.deepEqual(locals, ['local: TestType', 'member: TestTypeMember', 'member2: 26']); + const locals = await getValuesForScope('LOCAL', 3, 5); + assert.deepEqual(locals, [ + 'local: TestType', + 'member: TestTypeMember', + 'member2: TestTypeMember2', + 'recurse: 27', + 'value: 26', + '__proto__: Object', + ]); }); it('shows variable value in popover', async () => { From 202a67eebb92f9c2b2eb219f168620433d8f55f1 Mon Sep 17 00:00:00 2001 From: Brian Cui Date: Mon, 26 Oct 2020 16:55:38 -0700 Subject: [PATCH 11/85] Update Console Error/Warnings Counters CSS for consistency This CL is a follow up to the minor refresh work on the main toolbar Errors, Warnings, and Issues counters [1]. The CSS has been updated to prefer class selectors instead of element selectors to match the style of other module CSS (e.g. consoleView.css and elementsPanel.css prefer class specificity). This will help avoid rule conflicts with common shared CSS and make it easier for third party themes to override. The errorWarningCounter.css file has been renamed to warningErrorCounter.css to match the name of the module and follow file naming conventions of other modules (e.g. ElementsPanel.js and elementsPanel.css). It's unclear why there was a naming difference here but it has been present for several years. [1] https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2436646 Bug: 1133060 Change-Id: Ic08f47ecff2414dd4d3efb70fbce98e5e6bf6b82 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2500743 Reviewed-by: Kalon Hinds Reviewed-by: Mathias Bynens Commit-Queue: Brian Cui --- all_devtools_files.gni | 2 +- front_end/component_helpers/get-stylesheet.ts | 2 +- front_end/console_counters/BUILD.gn | 2 +- front_end/console_counters/WarningErrorCounter.js | 9 +++++---- front_end/console_counters/module.json | 2 +- ...errorWarningCounter.css => warningErrorCounter.css} | 10 +++++----- 6 files changed, 14 insertions(+), 13 deletions(-) rename front_end/console_counters/{errorWarningCounter.css => warningErrorCounter.css} (71%) diff --git a/all_devtools_files.gni b/all_devtools_files.gni index ad26cf34b7b..2d234f12ed6 100644 --- a/all_devtools_files.gni +++ b/all_devtools_files.gni @@ -63,7 +63,7 @@ all_devtools_files = [ "front_end/components/imagePreview.css", "front_end/components/jsUtils.css", "front_end/components/module.json", - "front_end/console_counters/errorWarningCounter.css", + "front_end/console_counters/warningErrorCounter.css", "front_end/console_counters/module.json", "front_end/console_test_runner/console_test_runner.js", "front_end/console_test_runner/module.json", diff --git a/front_end/component_helpers/get-stylesheet.ts b/front_end/component_helpers/get-stylesheet.ts index 8c41b59d4e2..467fc019b5b 100644 --- a/front_end/component_helpers/get-stylesheet.ts +++ b/front_end/component_helpers/get-stylesheet.ts @@ -98,7 +98,7 @@ export const CSS_RESOURCES_TO_LOAD_INTO_RUNTIME = [ 'components/jsUtils.css', 'persistence/editFileSystemView.css', 'persistence/workspaceSettingsTab.css', - 'console_counters/errorWarningCounter.css', + 'console_counters/warningErrorCounter.css', 'mobile_throttling/throttlingSettingsTab.css', 'emulation/deviceModeToolbar.css', 'emulation/deviceModeView.css', diff --git a/front_end/console_counters/BUILD.gn b/front_end/console_counters/BUILD.gn index b697f978482..bbde1e0e0f2 100644 --- a/front_end/console_counters/BUILD.gn +++ b/front_end/console_counters/BUILD.gn @@ -18,7 +18,7 @@ devtools_module("console_counters") { } copy_to_gen("legacy_css") { - sources = [ "errorWarningCounter.css" ] + sources = [ "warningErrorCounter.css" ] } devtools_entrypoint("bundle") { diff --git a/front_end/console_counters/WarningErrorCounter.js b/front_end/console_counters/WarningErrorCounter.js index b84a746e407..3b845d4bde0 100644 --- a/front_end/console_counters/WarningErrorCounter.js +++ b/front_end/console_counters/WarningErrorCounter.js @@ -28,9 +28,10 @@ export class WarningErrorCounter { */ function createCounter(parent, delegate) { const container = parent.createChild('div'); - const shadowRoot = UI.Utils.createShadowRootWithCoreStyles(container, 'console_counters/errorWarningCounter.css'); + container.classList.add('main-toolbar-counter'); + const shadowRoot = UI.Utils.createShadowRootWithCoreStyles(container, 'console_counters/warningErrorCounter.css'); const button = shadowRoot.createChild('button'); - button.classList.add('hidden'); + button.classList.add('toolbar-counter-button', 'hidden'); button.addEventListener('click', delegate, false); return button; } @@ -90,7 +91,7 @@ export class WarningErrorCounter { */ _createItem(shadowRoot, iconType) { const item = document.createElement('span'); - item.classList.add('counter-item'); + item.classList.add('toolbar-counter-item'); UI.ARIAUtils.markAsHidden(item); const icon = /** @type {!UI.UIUtils.DevToolsIconLabel} */ (item.createChild('span', '', 'dt-icon-label')); icon.type = iconType; @@ -106,7 +107,7 @@ export class WarningErrorCounter { */ _updateItem(item, count, first) { item.item.classList.toggle('hidden', !count); - item.item.classList.toggle('counter-item-first', first); + item.item.classList.toggle('toolbar-counter-item-first', first); item.text.textContent = String(count); } diff --git a/front_end/console_counters/module.json b/front_end/console_counters/module.json index 3db530552f3..c7d2506f00d 100644 --- a/front_end/console_counters/module.json +++ b/front_end/console_counters/module.json @@ -20,6 +20,6 @@ "WarningErrorCounter.js" ], "resources": [ - "errorWarningCounter.css" + "warningErrorCounter.css" ] } diff --git a/front_end/console_counters/errorWarningCounter.css b/front_end/console_counters/warningErrorCounter.css similarity index 71% rename from front_end/console_counters/errorWarningCounter.css rename to front_end/console_counters/warningErrorCounter.css index 6ae03d5f463..dc4e9982134 100644 --- a/front_end/console_counters/errorWarningCounter.css +++ b/front_end/console_counters/warningErrorCounter.css @@ -8,7 +8,7 @@ margin-left: 6px; } -button { +.toolbar-counter-button { cursor: pointer; background-color: #f3f3f3; border: 1px solid #d0d0d0; @@ -17,15 +17,15 @@ button { margin-right: 2px; } -button:hover, -button:focus-visible { +.toolbar-counter-button:hover, +.toolbar-counter-button:focus-visible { background-color: #eaeaea; } -.counter-item { +.toolbar-counter-item { margin-left: 6px; } -.counter-item.counter-item-first { +.toolbar-counter-item.toolbar-counter-item-first { margin-left: 0; } From 01e7f120925bb3ee6476e0831b4e5b5c35fab161 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 27 Oct 2020 16:02:55 +0000 Subject: [PATCH 12/85] Typecheck formatter/FormatterWorkerPool.js with TypeScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R=szuend@chromium.org Bug: 1011811 Change-Id: Ie94ccfa1f0713cc64eea8088052be0adfe8fb450 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2502614 Auto-Submit: Tim van der Lippe Commit-Queue: Simon Zünd Reviewed-by: Simon Zünd --- front_end/formatter/FormatterWorkerPool.js | 93 ++++++++++++---------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/front_end/formatter/FormatterWorkerPool.js b/front_end/formatter/FormatterWorkerPool.js index e7d07e362ad..44fc308256d 100644 --- a/front_end/formatter/FormatterWorkerPool.js +++ b/front_end/formatter/FormatterWorkerPool.js @@ -1,23 +1,36 @@ // Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks import * as Common from '../common/common.js'; const MaxWorkers = 2; +/** @type {!FormatterWorkerPool} */ +let formatterWorkerPoolInstance; + /** * @unrestricted */ export class FormatterWorkerPool { constructor() { + /** @type {!Array} */ this._taskQueue = []; /** @type {!Map} */ this._workerTasks = new Map(); } + /** + * @return {!FormatterWorkerPool} + */ + static instance() { + if (!formatterWorkerPoolInstance) { + formatterWorkerPoolInstance = new FormatterWorkerPool(); + } + + return formatterWorkerPoolInstance; + } + /** * @return {!Common.Worker.WorkerWrapper} */ @@ -42,8 +55,10 @@ export class FormatterWorkerPool { } const task = this._taskQueue.shift(); - this._workerTasks.set(freeWorker, task); - freeWorker.postMessage({method: task.method, params: task.params}); + if (task) { + this._workerTasks.set(freeWorker, task); + freeWorker.postMessage({method: task.method, params: task.params}); + } } /** @@ -52,6 +67,9 @@ export class FormatterWorkerPool { */ _onWorkerMessage(worker, event) { const task = this._workerTasks.get(worker); + if (!task) { + return; + } if (task.isChunked && event.data && !event.data['isLastChunk']) { task.callback(event.data); return; @@ -75,13 +93,15 @@ export class FormatterWorkerPool { const newWorker = this._createWorker(); this._workerTasks.set(newWorker, null); this._processNextTask(); - task.callback(null); + if (task) { + task.callback(null); + } } /** * @param {string} methodName * @param {!Object} params - * @param {function(boolean, *)} callback + * @param {function(boolean, *):void} callback */ _runChunkedTask(methodName, params, callback) { const task = new Task(methodName, params, onData, true); @@ -96,8 +116,8 @@ export class FormatterWorkerPool { callback(true, null); return; } - const isLastChunk = !!data['isLastChunk']; - const chunk = data['chunk']; + const isLastChunk = 'isLastChunk' in data && !!data['isLastChunk']; + const chunk = 'chunk' in data && data['chunk']; callback(isLastChunk, chunk); } } @@ -108,14 +128,11 @@ export class FormatterWorkerPool { * @return {!Promise<*>} */ _runTask(methodName, params) { - let callback; - const promise = new Promise(fulfill => { - callback = fulfill; + return new Promise(resolve => { + const task = new Task(methodName, params, resolve, false); + this._taskQueue.push(task); + this._processNextTask(); }); - const task = new Task(methodName, params, callback, false); - this._taskQueue.push(task); - this._processNextTask(); - return promise; } /** @@ -147,7 +164,7 @@ export class FormatterWorkerPool { /** * @param {string} content - * @param {function(boolean, !Array)} callback + * @param {function(boolean, !Array):void} callback */ parseCSS(content, callback) { this._runChunkedTask('parseCSS', {content: content}, onDataChunk); @@ -164,7 +181,7 @@ export class FormatterWorkerPool { /** * @param {string} content - * @param {function(boolean, !Array)} callback + * @param {function(boolean, !Array):void} callback */ javaScriptOutline(content, callback) { this._runChunkedTask('javaScriptOutline', {content: content}, onDataChunk); @@ -182,7 +199,7 @@ export class FormatterWorkerPool { /** * @param {string} content * @param {string} mimeType - * @param {function(boolean, !Array)} callback + * @param {function(boolean, !Array):void} callback * @return {boolean} */ outlineForMimetype(content, mimeType, callback) { @@ -212,10 +229,10 @@ export class FormatterWorkerPool { * @param {!Array} rules */ function cssCallback(isLastChunk, rules) { - callback( - isLastChunk, - rules.map( - rule => ({line: rule.lineNumber, column: rule.columnNumber, title: rule.selectorText || rule.atRule}))); + callback(isLastChunk, rules.map(rule => { + const title = 'selectorText' in rule ? rule.selectorText : rule.atRule; + return {line: rule.lineNumber, subtitle: undefined, column: rule.columnNumber, title}; + })); } } @@ -252,7 +269,7 @@ class Task { /** * @param {string} method * @param {!Object} params - * @param {function(?MessageEvent)} callback + * @param {function(?MessageEvent):void} callback * @param {boolean=} isChunked */ constructor(method, params, callback, isChunked) { @@ -304,22 +321,6 @@ class CSSProperty { } } -// eslint-disable-next-line no-unused-vars -class CSSStyleRule { - constructor() { - /** @type {string} */ - this.selectorText; - /** @type {!TextRange} */ - this.styleRange; - /** @type {number} */ - this.lineNumber; - /** @type {number} */ - this.columnNumber; - /** @type {!Array.} */ - this.properties; - } -} - // eslint-disable-next-line no-unused-vars class SCSSProperty { constructor() { @@ -350,29 +351,35 @@ class SCSSRule { * @return {!FormatterWorkerPool} */ export function formatterWorkerPool() { - if (!Formatter._formatterWorkerPool) { - Formatter._formatterWorkerPool = new FormatterWorkerPool(); - } - return Formatter._formatterWorkerPool; + return FormatterWorkerPool.instance(); } /** @typedef {{line: number, column: number, title: string, subtitle: (string|undefined) }} */ +// @ts-ignore typedef export let OutlineItem; /** @typedef {{original: !Array, formatted: !Array}} */ +// @ts-ignore typedef export let FormatMapping; +/** @typedef {{selectorText: string, styleRange: !TextRange, lineNumber: number, columnNumber: number, properties: !Array}} */ +// @ts-ignore typedef +export let CSSStyleRule; + /** * @typedef {{atRule: string, lineNumber: number, columnNumber: number}} */ +// @ts-ignore typedef export let CSSAtRule; /** * @typedef {(CSSStyleRule|CSSAtRule)} */ +// @ts-ignore typedef export let CSSRule; /** * @typedef {{startLine: number, startColumn: number, endLine: number, endColumn: number}} */ +// @ts-ignore typedef export let TextRange; From 89a6d325b7e6b20e0c41f24b95a7ad7c30193e3f Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Wed, 28 Oct 2020 07:24:05 +0000 Subject: [PATCH 13/85] Revert "[Puppeteer] Update puppeteer to v.5.4.0" This reverts commit a759e62ec6f4c64816013433b96363f6cc1004de. Reason for revert: breaks CQ Original change's description: > [Puppeteer] Update puppeteer to v.5.4.0 > > Change-Id: I831d23e24f840d1898959814809839a34b6b9eb7 > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2502001 > Commit-Queue: Jan Scheffler > Reviewed-by: Mathias Bynens > Reviewed-by: Paul Lewis TBR=aerotwist@chromium.org,mathias@chromium.org,janscheffler@chromium.org,jacktfranklin@chromium.org Change-Id: Idc901e648ddaba20697c4b4b5d1580f6e07087e6 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2503514 Reviewed-by: Mathias Bynens Commit-Queue: Mathias Bynens --- all_devtools_modules.gni | 17 +- devtools_grd_files.gni | 17 +- front_end/third_party/puppeteer/BUILD.gn | 117 +- .../third_party/puppeteer/package/LICENSE | 4 +- .../third_party/puppeteer/package/README.md | 22 +- .../puppeteer/package/cjs-entry-core.js | 2 +- .../puppeteer/package/cjs-entry.js | 2 +- .../third_party/puppeteer/package/install.js | 2 +- .../lib/cjs/puppeteer/api-docs-entry.d.ts | 49 + .../lib/cjs/puppeteer/api-docs-entry.d.ts.map | 1 + .../lib/cjs/puppeteer/api-docs-entry.js | 71 + .../cjs/puppeteer/common/Accessibility.d.ts | 176 + .../puppeteer/common/Accessibility.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Accessibility.js | 360 ++ .../lib/cjs/puppeteer/common/Browser.d.ts | 424 ++ .../lib/cjs/puppeteer/common/Browser.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Browser.js | 519 ++ .../lib/cjs/puppeteer/common/Connection.d.ts | 120 + .../cjs/puppeteer/common/Connection.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Connection.js | 271 ++ .../puppeteer/common/ConnectionTransport.d.ts | 22 + .../common/ConnectionTransport.d.ts.map | 1 + .../puppeteer/common/ConnectionTransport.js} | 2 + .../cjs/puppeteer/common/ConsoleMessage.d.ts | 68 + .../puppeteer/common/ConsoleMessage.d.ts.map | 1 + .../cjs/puppeteer/common/ConsoleMessage.js | 58 + .../lib/cjs/puppeteer/common/Coverage.d.ts | 181 + .../cjs/puppeteer/common/Coverage.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Coverage.js | 319 ++ .../lib/cjs/puppeteer/common/DOMWorld.d.ts | 136 + .../cjs/puppeteer/common/DOMWorld.d.ts.map | 1 + .../lib/cjs/puppeteer/common/DOMWorld.js | 520 ++ .../lib/cjs/puppeteer/common/Debug.d.ts | 53 + .../lib/cjs/puppeteer/common/Debug.d.ts.map | 1 + .../package/lib/cjs/puppeteer/common/Debug.js | 80 + .../puppeteer/common/DeviceDescriptors.d.ts | 33 + .../common/DeviceDescriptors.d.ts.map | 1 + .../cjs/puppeteer/common/DeviceDescriptors.js | 876 ++++ .../lib/cjs/puppeteer/common/Dialog.d.ts | 76 + .../lib/cjs/puppeteer/common/Dialog.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Dialog.js | 96 + .../puppeteer/common/EmulationManager.d.ts | 25 + .../common/EmulationManager.d.ts.map | 1 + .../cjs/puppeteer/common/EmulationManager.js | 37 + .../lib/cjs/puppeteer/common/Errors.d.ts | 34 + .../lib/cjs/puppeteer/common/Errors.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Errors.js | 41 + .../lib/cjs/puppeteer/common/EvalTypes.d.ts | 59 + .../cjs/puppeteer/common/EvalTypes.d.ts.map | 1 + .../puppeteer/common/EvalTypes.js} | 4 +- .../cjs/puppeteer/common/EventEmitter.d.ts | 89 + .../puppeteer/common/EventEmitter.d.ts.map | 1 + .../lib/cjs/puppeteer/common/EventEmitter.js | 116 + .../lib/cjs/puppeteer/common/Events.d.ts | 82 + .../lib/cjs/puppeteer/common/Events.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Events.js | 86 + .../puppeteer/common/ExecutionContext.d.ts | 186 + .../common/ExecutionContext.d.ts.map | 1 + .../cjs/puppeteer/common/ExecutionContext.js | 317 ++ .../lib/cjs/puppeteer/common/FileChooser.d.ts | 60 + .../cjs/puppeteer/common/FileChooser.d.ts.map | 1 + .../lib/cjs/puppeteer/common/FileChooser.js | 70 + .../cjs/puppeteer/common/FrameManager.d.ts | 710 +++ .../puppeteer/common/FrameManager.d.ts.map | 1 + .../lib/cjs/puppeteer/common/FrameManager.js | 924 ++++ .../lib/cjs/puppeteer/common/HTTPRequest.d.ts | 276 ++ .../cjs/puppeteer/common/HTTPRequest.d.ts.map | 1 + .../lib/cjs/puppeteer/common/HTTPRequest.js | 421 ++ .../cjs/puppeteer/common/HTTPResponse.d.ts | 128 + .../puppeteer/common/HTTPResponse.d.ts.map | 1 + .../lib/cjs/puppeteer/common/HTTPResponse.js | 154 + .../lib/cjs/puppeteer/common/Input.d.ts | 322 ++ .../lib/cjs/puppeteer/common/Input.d.ts.map | 1 + .../package/lib/cjs/puppeteer/common/Input.js | 476 ++ .../lib/cjs/puppeteer/common/JSHandle.d.ts | 439 ++ .../cjs/puppeteer/common/JSHandle.d.ts.map | 1 + .../lib/cjs/puppeteer/common/JSHandle.js | 746 +++ .../puppeteer/common/LifecycleWatcher.d.ts | 62 + .../common/LifecycleWatcher.d.ts.map | 1 + .../cjs/puppeteer/common/LifecycleWatcher.js | 148 + .../cjs/puppeteer/common/NetworkManager.d.ts | 80 + .../puppeteer/common/NetworkManager.d.ts.map | 1 + .../cjs/puppeteer/common/NetworkManager.js | 265 ++ .../lib/cjs/puppeteer/common/PDFOptions.d.ts | 152 + .../cjs/puppeteer/common/PDFOptions.d.ts.map | 1 + .../lib/cjs/puppeteer/common/PDFOptions.js | 34 + .../lib/cjs/puppeteer/common/Page.d.ts | 815 ++++ .../lib/cjs/puppeteer/common/Page.d.ts.map | 1 + .../package/lib/cjs/puppeteer/common/Page.js | 1275 +++++ .../puppeteer/common}/Puppeteer.d.ts | 156 +- .../cjs/puppeteer/common/Puppeteer.d.ts.map | 1 + .../puppeteer/common}/Puppeteer.js | 181 +- .../puppeteer/common/PuppeteerViewport.d.ts | 24 + .../common/PuppeteerViewport.d.ts.map | 1 + .../cjs/puppeteer/common/PuppeteerViewport.js | 2 + .../cjs/puppeteer/common/QueryHandler.d.ts | 31 + .../puppeteer/common/QueryHandler.d.ts.map | 1 + .../lib/cjs/puppeteer/common/QueryHandler.js | 63 + .../cjs/puppeteer/common/SecurityDetails.d.ts | 61 + .../puppeteer/common/SecurityDetails.d.ts.map | 1 + .../cjs/puppeteer/common/SecurityDetails.js | 76 + .../lib/cjs/puppeteer/common/Target.d.ts | 98 + .../lib/cjs/puppeteer/common/Target.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Target.js | 141 + .../cjs/puppeteer/common/TimeoutSettings.d.ts | 28 + .../puppeteer/common/TimeoutSettings.d.ts.map | 1 + .../cjs/puppeteer/common/TimeoutSettings.js | 47 + .../lib/cjs/puppeteer/common/Tracing.d.ts | 47 + .../lib/cjs/puppeteer/common/Tracing.d.ts.map | 1 + .../lib/cjs/puppeteer/common/Tracing.js | 94 + .../puppeteer/common/USKeyboardLayout.d.ts | 40 + .../common/USKeyboardLayout.d.ts.map | 1 + .../cjs/puppeteer/common/USKeyboardLayout.js | 406 ++ .../puppeteer/common/WebSocketTransport.d.ts} | 12 +- .../common/WebSocketTransport.d.ts.map | 1 + .../puppeteer/common/WebSocketTransport.js} | 17 +- .../lib/cjs/puppeteer/common/WebWorker.d.ts | 102 + .../cjs/puppeteer/common/WebWorker.d.ts.map | 1 + .../lib/cjs/puppeteer/common/WebWorker.js | 112 + .../lib/cjs/puppeteer/common/assert.d.ts | 22 + .../lib/cjs/puppeteer/common/assert.d.ts.map | 1 + .../puppeteer/common/assert.js} | 15 +- .../lib/cjs/puppeteer/common/helper.d.ts | 42 + .../lib/cjs/puppeteer/common/helper.d.ts.map | 1 + .../lib/cjs/puppeteer/common/helper.js | 206 + .../puppeteer/environment.d.ts} | 5 +- .../lib/cjs/puppeteer/environment.d.ts.map | 1 + .../package/lib/cjs/puppeteer/environment.js | 21 + .../puppeteer/index-core.d.ts} | 4 +- .../lib/cjs/puppeteer/index-core.d.ts.map | 1 + .../node.js => cjs/puppeteer/index-core.js} | 12 +- .../node.d.ts => cjs/puppeteer/index.d.ts} | 6 +- .../package/lib/cjs/puppeteer/index.d.ts.map | 1 + .../puppeteer/index.js} | 13 +- .../puppeteer/initialize.d.ts} | 4 +- .../lib/cjs/puppeteer/initialize.d.ts.map | 1 + .../package/lib/cjs/puppeteer/initialize.js | 38 + .../node => cjs/puppeteer}/install.d.ts | 0 .../lib/cjs/puppeteer/install.d.ts.map | 1 + .../package/lib/cjs/puppeteer/install.js | 152 + .../cjs/puppeteer/node/BrowserFetcher.d.ts | 136 + .../puppeteer/node/BrowserFetcher.d.ts.map | 1 + .../lib/cjs/puppeteer/node/BrowserFetcher.js | 492 ++ .../lib/cjs/puppeteer/node/BrowserRunner.d.ts | 40 + .../cjs/puppeteer/node/BrowserRunner.d.ts.map | 1 + .../lib/cjs/puppeteer/node/BrowserRunner.js | 220 + .../puppeteer/node/LaunchOptions.d.ts} | 43 +- .../cjs/puppeteer/node/LaunchOptions.d.ts.map | 1 + .../puppeteer/node/LaunchOptions.js} | 8 +- .../lib/cjs/puppeteer/node/Launcher.d.ts | 16 + .../lib/cjs/puppeteer/node/Launcher.d.ts.map | 1 + .../lib/cjs/puppeteer/node/Launcher.js | 563 +++ .../lib/cjs/puppeteer/node/PipeTransport.d.ts | 31 + .../cjs/puppeteer/node/PipeTransport.d.ts.map | 1 + .../lib/cjs/puppeteer/node/PipeTransport.js | 64 + .../package/lib/cjs/puppeteer/revisions.d.ts | 22 + .../lib/cjs/puppeteer/revisions.d.ts.map | 1 + .../puppeteer/revisions.js} | 13 +- .../cjs/puppeteer/tsconfig.cjs.tsbuildinfo | 4214 +++++++++++++++++ .../lib/cjs/vendor/mitt/src/index.d.ts | 20 + .../lib/cjs/vendor/mitt/src/index.d.ts.map | 1 + .../package/lib/cjs/vendor/mitt/src/index.js | 52 + .../lib/cjs/vendor/tsconfig.cjs.tsbuildinfo | 2901 ++++++++++++ .../lib/esm/puppeteer/api-docs-entry.d.ts | 6 +- .../lib/esm/puppeteer/api-docs-entry.d.ts.map | 2 +- .../lib/esm/puppeteer/api-docs-entry.js | 11 +- .../esm/puppeteer/common/Accessibility.d.ts | 4 +- .../lib/esm/puppeteer/common/Accessibility.js | 14 +- .../common/AriaQueryHandler.d.ts.map | 1 - .../esm/puppeteer/common/AriaQueryHandler.js | 81 - .../lib/esm/puppeteer/common/Browser.d.ts | 5 +- .../lib/esm/puppeteer/common/Browser.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Browser.js | 7 +- .../common/BrowserConnector.d.ts.map | 1 - .../esm/puppeteer/common/BrowserConnector.js | 76 - .../common/BrowserWebSocketTransport.d.ts.map | 1 - .../lib/esm/puppeteer/common/Connection.d.ts | 4 +- .../esm/puppeteer/common/Connection.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Connection.js | 6 +- .../esm/puppeteer/common/ConsoleMessage.d.ts | 8 +- .../puppeteer/common/ConsoleMessage.d.ts.map | 2 +- .../esm/puppeteer/common/ConsoleMessage.js | 12 +- .../lib/esm/puppeteer/common/DOMWorld.d.ts | 27 +- .../esm/puppeteer/common/DOMWorld.d.ts.map | 2 +- .../lib/esm/puppeteer/common/DOMWorld.js | 248 +- .../lib/esm/puppeteer/common/Errors.d.ts | 2 +- .../lib/esm/puppeteer/common/Errors.js | 2 +- .../puppeteer/common/ExecutionContext.d.ts | 5 +- .../common/ExecutionContext.d.ts.map | 2 +- .../esm/puppeteer/common/FrameManager.d.ts | 27 +- .../puppeteer/common/FrameManager.d.ts.map | 2 +- .../lib/esm/puppeteer/common/FrameManager.js | 44 +- .../esm/puppeteer/common/HTTPRequest.d.ts.map | 2 +- .../lib/esm/puppeteer/common/HTTPRequest.js | 5 +- .../lib/esm/puppeteer/common/JSHandle.d.ts | 2 +- .../esm/puppeteer/common/JSHandle.d.ts.map | 2 +- .../lib/esm/puppeteer/common/JSHandle.js | 50 +- .../lib/esm/puppeteer/common/Page.d.ts | 99 +- .../lib/esm/puppeteer/common/Page.d.ts.map | 2 +- .../package/lib/esm/puppeteer/common/Page.js | 201 +- .../lib/esm/puppeteer/common/Product.d.ts.map | 1 - .../lib/esm/puppeteer/common/Puppeteer.d.ts | 183 +- .../esm/puppeteer/common/Puppeteer.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Puppeteer.js | 186 +- .../esm/puppeteer/common/QueryHandler.d.ts | 47 +- .../puppeteer/common/QueryHandler.d.ts.map | 2 +- .../lib/esm/puppeteer/common/QueryHandler.js | 132 +- .../lib/esm/puppeteer/common/Tracing.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Tracing.js | 8 +- ...Transport.d.ts => WebSocketTransport.d.ts} | 17 +- .../common/WebSocketTransport.d.ts.map | 1 + .../WebSocketTransport.js} | 4 +- .../lib/esm/puppeteer/common/fetch.d.ts.map | 1 - .../lib/esm/puppeteer/common/helper.d.ts | 10 - .../lib/esm/puppeteer/common/helper.d.ts.map | 2 +- .../lib/esm/puppeteer/common/helper.js | 101 +- .../package/lib/esm/puppeteer/index-core.d.ts | 18 + .../lib/esm/puppeteer/index-core.d.ts.map | 1 + .../package/lib/esm/puppeteer/index-core.js | 18 + .../package/lib/esm/puppeteer/index.d.ts | 18 + .../package/lib/esm/puppeteer/index.d.ts.map | 1 + .../package/lib/esm/puppeteer/index.js | 18 + .../lib/esm/puppeteer/initialize-node.d.ts | 18 - .../esm/puppeteer/initialize-node.d.ts.map | 1 - .../lib/esm/puppeteer/initialize-web.d.ts.map | 1 - .../{initialize-web.js => initialize.d.ts} | 8 +- .../lib/esm/puppeteer/initialize.d.ts.map | 1 + .../{initialize-node.js => initialize.js} | 15 +- .../package/lib/esm/puppeteer/install.d.ts | 18 + .../lib/esm/puppeteer/install.d.ts.map | 1 + .../lib/esm/puppeteer/{node => }/install.js | 19 +- .../puppeteer/node-puppeteer-core.d.ts.map | 1 - .../package/lib/esm/puppeteer/node.d.ts.map | 1 - .../esm/puppeteer/node/BrowserFetcher.d.ts | 6 +- .../puppeteer/node/BrowserFetcher.d.ts.map | 2 +- .../lib/esm/puppeteer/node/BrowserRunner.js | 2 +- .../lib/esm/puppeteer/node/LaunchOptions.d.ts | 10 + .../esm/puppeteer/node/LaunchOptions.d.ts.map | 2 +- .../lib/esm/puppeteer/node/LaunchOptions.js | 15 + .../lib/esm/puppeteer/node/Launcher.d.ts | 4 +- .../lib/esm/puppeteer/node/Launcher.d.ts.map | 2 +- .../lib/esm/puppeteer/node/Launcher.js | 107 +- .../node/NodeWebSocketTransport.d.ts.map | 1 - .../lib/esm/puppeteer/node/Puppeteer.d.ts.map | 1 - .../lib/esm/puppeteer/node/install.d.ts.map | 1 - .../package/lib/esm/puppeteer/revisions.js | 2 +- .../esm/puppeteer/tsconfig.esm.tsbuildinfo | 3964 ++++++++++++---- .../package/lib/esm/puppeteer/web.d.ts.map | 1 - .../package/lib/esm/puppeteer/web.js | 22 - .../lib/esm/vendor/mitt/src/index.d.ts | 14 +- .../lib/esm/vendor/mitt/src/index.d.ts.map | 2 +- .../package/lib/esm/vendor/mitt/src/index.js | 12 +- .../lib/esm/vendor/tsconfig.esm.tsbuildinfo | 2502 ++++++++-- .../puppeteer/package/package.json | 62 +- scripts/deps/roll-puppeteer-into-frontend.py | 114 - 255 files changed, 30049 insertions(+), 3115 deletions(-) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/common/Product.js => cjs/puppeteer/common/ConnectionTransport.js} (88%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/common/fetch.d.ts => cjs/puppeteer/common/EvalTypes.js} (86%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node => cjs/puppeteer/common}/Puppeteer.d.ts (56%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node => cjs/puppeteer/common}/Puppeteer.js (57%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.js rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node/NodeWebSocketTransport.d.ts => cjs/puppeteer/common/WebSocketTransport.d.ts} (71%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/common/BrowserWebSocketTransport.js => cjs/puppeteer/common/WebSocketTransport.js} (56%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/common/fetch.js => cjs/puppeteer/common/assert.js} (65%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/web.d.ts => cjs/puppeteer/environment.d.ts} (83%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node-puppeteer-core.d.ts => cjs/puppeteer/index-core.d.ts} (92%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index-core.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node.js => cjs/puppeteer/index-core.js} (70%) rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node.d.ts => cjs/puppeteer/index.d.ts} (82%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node-puppeteer-core.js => cjs/puppeteer/index.js} (68%) rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/initialize-web.d.ts => cjs/puppeteer/initialize.d.ts} (84%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize.js rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/node => cjs/puppeteer}/install.d.ts (100%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/install.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/install.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/common/BrowserConnector.d.ts => cjs/puppeteer/node/LaunchOptions.d.ts} (54%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/common/Product.d.ts => cjs/puppeteer/node/LaunchOptions.js} (82%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts.map rename front_end/third_party/puppeteer/package/lib/{esm/puppeteer/common/AriaQueryHandler.d.ts => cjs/puppeteer/revisions.js} (75%) create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/tsconfig.cjs.tsbuildinfo create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.js create mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/tsconfig.cjs.tsbuildinfo delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/{BrowserWebSocketTransport.d.ts => WebSocketTransport.d.ts} (66%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{node/NodeWebSocketTransport.js => common/WebSocketTransport.js} (88%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.js create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.js delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{initialize-web.js => initialize.d.ts} (78%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{initialize-node.js => initialize.js} (75%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/install.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/install.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{node => }/install.js (90%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js delete mode 100755 scripts/deps/roll-puppeteer-into-frontend.py diff --git a/all_devtools_modules.gni b/all_devtools_modules.gni index 90d918f9ea1..8b3274dbca2 100644 --- a/all_devtools_modules.gni +++ b/all_devtools_modules.gni @@ -589,10 +589,7 @@ all_typescript_module_sources = [ "third_party/marked/package/lib/marked.esm.js", "third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js", - "third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js", - "third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js", - "third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js", @@ -617,7 +614,6 @@ all_typescript_module_sources = [ "third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js", - "third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js", @@ -626,25 +622,20 @@ all_typescript_module_sources = [ "third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js", - "third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js", "third_party/puppeteer/package/lib/esm/puppeteer/environment.js", - "third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js", - "third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js", - "third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js", - "third_party/puppeteer/package/lib/esm/puppeteer/node.js", + "third_party/puppeteer/package/lib/esm/puppeteer/index-core.js", + "third_party/puppeteer/package/lib/esm/puppeteer/index.js", + "third_party/puppeteer/package/lib/esm/puppeteer/initialize.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js", - "third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js", - "third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js", - "third_party/puppeteer/package/lib/esm/puppeteer/node/install.js", "third_party/puppeteer/package/lib/esm/puppeteer/revisions.js", - "third_party/puppeteer/package/lib/esm/puppeteer/web.js", "third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js", "third_party/wasmparser/package/dist/esm/WasmDis.js", "third_party/wasmparser/package/dist/esm/WasmParser.js", diff --git a/devtools_grd_files.gni b/devtools_grd_files.gni index 98bebf4b347..10b79ec26a4 100644 --- a/devtools_grd_files.gni +++ b/devtools_grd_files.gni @@ -942,10 +942,7 @@ grd_files_debug_sources = [ "front_end/third_party/marked/package/lib/marked.esm.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js", @@ -970,7 +967,6 @@ grd_files_debug_sources = [ "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js", @@ -979,25 +975,20 @@ grd_files_debug_sources = [ "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js", "front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js", "front_end/third_party/wasmparser/package/dist/esm/WasmDis.js", "front_end/third_party/wasmparser/package/dist/esm/WasmParser.js", diff --git a/front_end/third_party/puppeteer/BUILD.gn b/front_end/third_party/puppeteer/BUILD.gn index 7b644fa7d20..d62e1dd413c 100644 --- a/front_end/third_party/puppeteer/BUILD.gn +++ b/front_end/third_party/puppeteer/BUILD.gn @@ -7,64 +7,155 @@ import("../../../scripts/build/ninja/devtools_pre_built.gni") devtools_pre_built("puppeteer") { sources = [ + "package/lib/esm/puppeteer/api-docs-entry.d.ts", + "package/lib/esm/puppeteer/api-docs-entry.d.ts.map", "package/lib/esm/puppeteer/api-docs-entry.js", + "package/lib/esm/puppeteer/common/Accessibility.d.ts", + "package/lib/esm/puppeteer/common/Accessibility.d.ts.map", "package/lib/esm/puppeteer/common/Accessibility.js", - "package/lib/esm/puppeteer/common/AriaQueryHandler.js", + "package/lib/esm/puppeteer/common/Browser.d.ts", + "package/lib/esm/puppeteer/common/Browser.d.ts.map", "package/lib/esm/puppeteer/common/Browser.js", - "package/lib/esm/puppeteer/common/BrowserConnector.js", - "package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", + "package/lib/esm/puppeteer/common/Connection.d.ts", + "package/lib/esm/puppeteer/common/Connection.d.ts.map", "package/lib/esm/puppeteer/common/Connection.js", + "package/lib/esm/puppeteer/common/ConnectionTransport.d.ts", + "package/lib/esm/puppeteer/common/ConnectionTransport.d.ts.map", "package/lib/esm/puppeteer/common/ConnectionTransport.js", + "package/lib/esm/puppeteer/common/ConsoleMessage.d.ts", + "package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map", "package/lib/esm/puppeteer/common/ConsoleMessage.js", + "package/lib/esm/puppeteer/common/Coverage.d.ts", + "package/lib/esm/puppeteer/common/Coverage.d.ts.map", "package/lib/esm/puppeteer/common/Coverage.js", + "package/lib/esm/puppeteer/common/DOMWorld.d.ts", + "package/lib/esm/puppeteer/common/DOMWorld.d.ts.map", "package/lib/esm/puppeteer/common/DOMWorld.js", + "package/lib/esm/puppeteer/common/Debug.d.ts", + "package/lib/esm/puppeteer/common/Debug.d.ts.map", "package/lib/esm/puppeteer/common/Debug.js", + "package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts", + "package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map", "package/lib/esm/puppeteer/common/DeviceDescriptors.js", + "package/lib/esm/puppeteer/common/Dialog.d.ts", + "package/lib/esm/puppeteer/common/Dialog.d.ts.map", "package/lib/esm/puppeteer/common/Dialog.js", + "package/lib/esm/puppeteer/common/EmulationManager.d.ts", + "package/lib/esm/puppeteer/common/EmulationManager.d.ts.map", "package/lib/esm/puppeteer/common/EmulationManager.js", + "package/lib/esm/puppeteer/common/Errors.d.ts", + "package/lib/esm/puppeteer/common/Errors.d.ts.map", "package/lib/esm/puppeteer/common/Errors.js", + "package/lib/esm/puppeteer/common/EvalTypes.d.ts", + "package/lib/esm/puppeteer/common/EvalTypes.d.ts.map", "package/lib/esm/puppeteer/common/EvalTypes.js", + "package/lib/esm/puppeteer/common/EventEmitter.d.ts", + "package/lib/esm/puppeteer/common/EventEmitter.d.ts.map", "package/lib/esm/puppeteer/common/EventEmitter.js", + "package/lib/esm/puppeteer/common/Events.d.ts", + "package/lib/esm/puppeteer/common/Events.d.ts.map", "package/lib/esm/puppeteer/common/Events.js", + "package/lib/esm/puppeteer/common/ExecutionContext.d.ts", + "package/lib/esm/puppeteer/common/ExecutionContext.d.ts.map", "package/lib/esm/puppeteer/common/ExecutionContext.js", + "package/lib/esm/puppeteer/common/FileChooser.d.ts", + "package/lib/esm/puppeteer/common/FileChooser.d.ts.map", "package/lib/esm/puppeteer/common/FileChooser.js", + "package/lib/esm/puppeteer/common/FrameManager.d.ts", + "package/lib/esm/puppeteer/common/FrameManager.d.ts.map", "package/lib/esm/puppeteer/common/FrameManager.js", + "package/lib/esm/puppeteer/common/HTTPRequest.d.ts", + "package/lib/esm/puppeteer/common/HTTPRequest.d.ts.map", "package/lib/esm/puppeteer/common/HTTPRequest.js", + "package/lib/esm/puppeteer/common/HTTPResponse.d.ts", + "package/lib/esm/puppeteer/common/HTTPResponse.d.ts.map", "package/lib/esm/puppeteer/common/HTTPResponse.js", + "package/lib/esm/puppeteer/common/Input.d.ts", + "package/lib/esm/puppeteer/common/Input.d.ts.map", "package/lib/esm/puppeteer/common/Input.js", + "package/lib/esm/puppeteer/common/JSHandle.d.ts", + "package/lib/esm/puppeteer/common/JSHandle.d.ts.map", "package/lib/esm/puppeteer/common/JSHandle.js", + "package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts", + "package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map", "package/lib/esm/puppeteer/common/LifecycleWatcher.js", + "package/lib/esm/puppeteer/common/NetworkManager.d.ts", + "package/lib/esm/puppeteer/common/NetworkManager.d.ts.map", "package/lib/esm/puppeteer/common/NetworkManager.js", + "package/lib/esm/puppeteer/common/PDFOptions.d.ts", + "package/lib/esm/puppeteer/common/PDFOptions.d.ts.map", "package/lib/esm/puppeteer/common/PDFOptions.js", + "package/lib/esm/puppeteer/common/Page.d.ts", + "package/lib/esm/puppeteer/common/Page.d.ts.map", "package/lib/esm/puppeteer/common/Page.js", - "package/lib/esm/puppeteer/common/Product.js", + "package/lib/esm/puppeteer/common/Puppeteer.d.ts", + "package/lib/esm/puppeteer/common/Puppeteer.d.ts.map", "package/lib/esm/puppeteer/common/Puppeteer.js", + "package/lib/esm/puppeteer/common/PuppeteerViewport.d.ts", + "package/lib/esm/puppeteer/common/PuppeteerViewport.d.ts.map", "package/lib/esm/puppeteer/common/PuppeteerViewport.js", + "package/lib/esm/puppeteer/common/QueryHandler.d.ts", + "package/lib/esm/puppeteer/common/QueryHandler.d.ts.map", "package/lib/esm/puppeteer/common/QueryHandler.js", + "package/lib/esm/puppeteer/common/SecurityDetails.d.ts", + "package/lib/esm/puppeteer/common/SecurityDetails.d.ts.map", "package/lib/esm/puppeteer/common/SecurityDetails.js", + "package/lib/esm/puppeteer/common/Target.d.ts", + "package/lib/esm/puppeteer/common/Target.d.ts.map", "package/lib/esm/puppeteer/common/Target.js", + "package/lib/esm/puppeteer/common/TimeoutSettings.d.ts", + "package/lib/esm/puppeteer/common/TimeoutSettings.d.ts.map", "package/lib/esm/puppeteer/common/TimeoutSettings.js", + "package/lib/esm/puppeteer/common/Tracing.d.ts", + "package/lib/esm/puppeteer/common/Tracing.d.ts.map", "package/lib/esm/puppeteer/common/Tracing.js", + "package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts", + "package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map", "package/lib/esm/puppeteer/common/USKeyboardLayout.js", + "package/lib/esm/puppeteer/common/WebSocketTransport.d.ts", + "package/lib/esm/puppeteer/common/WebSocketTransport.d.ts.map", + "package/lib/esm/puppeteer/common/WebSocketTransport.js", + "package/lib/esm/puppeteer/common/WebWorker.d.ts", + "package/lib/esm/puppeteer/common/WebWorker.d.ts.map", "package/lib/esm/puppeteer/common/WebWorker.js", + "package/lib/esm/puppeteer/common/assert.d.ts", + "package/lib/esm/puppeteer/common/assert.d.ts.map", "package/lib/esm/puppeteer/common/assert.js", - "package/lib/esm/puppeteer/common/fetch.js", + "package/lib/esm/puppeteer/common/helper.d.ts", + "package/lib/esm/puppeteer/common/helper.d.ts.map", "package/lib/esm/puppeteer/common/helper.js", + "package/lib/esm/puppeteer/environment.d.ts", + "package/lib/esm/puppeteer/environment.d.ts.map", "package/lib/esm/puppeteer/environment.js", - "package/lib/esm/puppeteer/initialize-node.js", - "package/lib/esm/puppeteer/initialize-web.js", - "package/lib/esm/puppeteer/node-puppeteer-core.js", - "package/lib/esm/puppeteer/node.js", + "package/lib/esm/puppeteer/index-core.d.ts", + "package/lib/esm/puppeteer/index-core.d.ts.map", + "package/lib/esm/puppeteer/index-core.js", + "package/lib/esm/puppeteer/index.d.ts", + "package/lib/esm/puppeteer/index.d.ts.map", + "package/lib/esm/puppeteer/index.js", + "package/lib/esm/puppeteer/initialize.d.ts", + "package/lib/esm/puppeteer/initialize.d.ts.map", + "package/lib/esm/puppeteer/initialize.js", + "package/lib/esm/puppeteer/node/BrowserFetcher.d.ts", + "package/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map", "package/lib/esm/puppeteer/node/BrowserFetcher.js", + "package/lib/esm/puppeteer/node/BrowserRunner.d.ts", + "package/lib/esm/puppeteer/node/BrowserRunner.d.ts.map", "package/lib/esm/puppeteer/node/BrowserRunner.js", + "package/lib/esm/puppeteer/node/LaunchOptions.d.ts", + "package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map", "package/lib/esm/puppeteer/node/LaunchOptions.js", + "package/lib/esm/puppeteer/node/Launcher.d.ts", + "package/lib/esm/puppeteer/node/Launcher.d.ts.map", "package/lib/esm/puppeteer/node/Launcher.js", - "package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", + "package/lib/esm/puppeteer/node/PipeTransport.d.ts", + "package/lib/esm/puppeteer/node/PipeTransport.d.ts.map", "package/lib/esm/puppeteer/node/PipeTransport.js", - "package/lib/esm/puppeteer/node/Puppeteer.js", - "package/lib/esm/puppeteer/node/install.js", + "package/lib/esm/puppeteer/revisions.d.ts", + "package/lib/esm/puppeteer/revisions.d.ts.map", "package/lib/esm/puppeteer/revisions.js", - "package/lib/esm/puppeteer/web.js", + "package/lib/esm/vendor/mitt/src/index.d.ts", + "package/lib/esm/vendor/mitt/src/index.d.ts.map", "package/lib/esm/vendor/mitt/src/index.js", "puppeteer-tsconfig.json", ] diff --git a/front_end/third_party/puppeteer/package/LICENSE b/front_end/third_party/puppeteer/package/LICENSE index d2c171df74e..afdfe50e72e 100644 --- a/front_end/third_party/puppeteer/package/LICENSE +++ b/front_end/third_party/puppeteer/package/LICENSE @@ -1,7 +1,7 @@ Apache License Version 2.0, January 2004 - https://www.apache.org/licenses/ + http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -193,7 +193,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/front_end/third_party/puppeteer/package/README.md b/front_end/third_party/puppeteer/package/README.md index 5a851876881..a7e87358942 100644 --- a/front_end/third_party/puppeteer/package/README.md +++ b/front_end/third_party/puppeteer/package/README.md @@ -6,7 +6,7 @@ -###### [API](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) +###### [API](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) > Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium. @@ -37,7 +37,7 @@ npm i puppeteer # or "yarn add puppeteer" ``` -Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#environment-variables). +Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#environment-variables). ### puppeteer-core @@ -63,7 +63,7 @@ Note: Prior to v1.18.1, Puppeteer required at least Node v6.4.0. Versions from v Node 8.9.0+. Starting from v3.0.0 Puppeteer starts to rely on Node 10.18.1+. All examples below use async/await which is only supported in Node v7.6.0 or greater. Puppeteer will be familiar to people using other browser testing frameworks. You create an instance -of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#). +of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#). **Example** - navigating to https://example.com and saving a screenshot as *example.png*: @@ -88,7 +88,7 @@ Execute script on the command line node example.js ``` -Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pagesetviewportviewport). +Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pagesetviewportviewport). **Example** - create a PDF. @@ -113,7 +113,7 @@ Execute script on the command line node hn.js ``` -See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pagepdfoptions) for more information about creating pdfs. +See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pagepdfoptions) for more information about creating pdfs. **Example** - evaluate script in the context of the page @@ -148,7 +148,7 @@ Execute script on the command line node get-dimensions.js ``` -See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. +See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. @@ -157,7 +157,7 @@ See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/ **1. Uses Headless mode** -Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) when launching a browser: +Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) when launching a browser: ```js const browser = await puppeteer.launch({headless: false}); // default is true @@ -173,7 +173,7 @@ pass in the executable's path when creating a `Browser` instance: const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'}); ``` -You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) for more information. +You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) for more information. See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. @@ -185,7 +185,7 @@ Puppeteer creates its own browser user profile which it **cleans up on every run ## Resources -- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md) +- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md) - [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples/) - [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer) @@ -328,7 +328,7 @@ See [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING Official Firefox support is currently experimental. The ongoing collaboration with Mozilla aims to support common end-to-end testing use cases, for which developers expect cross-browser coverage. The Puppeteer team needs input from users to stabilize Firefox support and to bring missing APIs to our attention. -From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. +From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. We will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari. This effort includes exploration of a standard for executing cross-browser commands (instead of relying on the non-standard DevTools Protocol used by Chrome). @@ -424,7 +424,7 @@ await page.evaluate(() => { You may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/puppeteer/puppeteer/issues/291).) There are two reasons for this: -* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.4.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) +* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) * Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming). #### Q: I am having trouble installing / running Puppeteer in my test environment. Where should I look for help? diff --git a/front_end/third_party/puppeteer/package/cjs-entry-core.js b/front_end/third_party/puppeteer/package/cjs-entry-core.js index 446726fafa3..70e9b88040f 100644 --- a/front_end/third_party/puppeteer/package/cjs-entry-core.js +++ b/front_end/third_party/puppeteer/package/cjs-entry-core.js @@ -25,5 +25,5 @@ * This means that we can publish to CJS and ESM whilst maintaining the expected * import behaviour for CJS and ESM users. */ -const puppeteerExport = require('./lib/cjs/puppeteer/node-puppeteer-core'); +const puppeteerExport = require('./lib/cjs/puppeteer/index-core'); module.exports = puppeteerExport.default; diff --git a/front_end/third_party/puppeteer/package/cjs-entry.js b/front_end/third_party/puppeteer/package/cjs-entry.js index d1840a9bea1..1bcec7d85af 100644 --- a/front_end/third_party/puppeteer/package/cjs-entry.js +++ b/front_end/third_party/puppeteer/package/cjs-entry.js @@ -25,5 +25,5 @@ * This means that we can publish to CJS and ESM whilst maintaining the expected * import behaviour for CJS and ESM users. */ -const puppeteerExport = require('./lib/cjs/puppeteer/node'); +const puppeteerExport = require('./lib/cjs/puppeteer/index'); module.exports = puppeteerExport.default; diff --git a/front_end/third_party/puppeteer/package/install.js b/front_end/third_party/puppeteer/package/install.js index 11518a595f5..5fe1314e4a6 100644 --- a/front_end/third_party/puppeteer/package/install.js +++ b/front_end/third_party/puppeteer/package/install.js @@ -32,7 +32,7 @@ async function download() { const { downloadBrowser, logPolitely, - } = require('./lib/cjs/puppeteer/node/install'); + } = require('./lib/cjs/puppeteer/install'); if (process.env.PUPPETEER_SKIP_DOWNLOAD) { logPolitely( diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts new file mode 100644 index 00000000000..4fca5db7228 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts @@ -0,0 +1,49 @@ +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './common/Accessibility.js'; +export * from './common/Browser.js'; +export * from './node/BrowserFetcher.js'; +export * from './common/Connection.js'; +export * from './common/ConsoleMessage.js'; +export * from './common/Coverage.js'; +export * from './common/DeviceDescriptors.js'; +export * from './common/Dialog.js'; +export * from './common/DOMWorld.js'; +export * from './common/JSHandle.js'; +export * from './common/ExecutionContext.js'; +export * from './common/EventEmitter.js'; +export * from './common/FileChooser.js'; +export * from './common/FrameManager.js'; +export * from './common/Input.js'; +export * from './common/Page.js'; +export * from './common/Puppeteer.js'; +export * from './node/LaunchOptions.js'; +export * from './node/Launcher.js'; +export * from './common/HTTPRequest.js'; +export * from './common/HTTPResponse.js'; +export * from './common/SecurityDetails.js'; +export * from './common/Target.js'; +export * from './common/Errors.js'; +export * from './common/Tracing.js'; +export * from './common/NetworkManager.js'; +export * from './common/WebWorker.js'; +export * from './common/USKeyboardLayout.js'; +export * from './common/EvalTypes.js'; +export * from './common/PDFOptions.js'; +export * from './common/TimeoutSettings.js'; +export * from './common/LifecycleWatcher.js'; +export * from 'devtools-protocol/types/protocol'; +//# sourceMappingURL=api-docs-entry.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map new file mode 100644 index 00000000000..1e462ec6c80 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-docs-entry.d.ts","sourceRoot":"","sources":["../../../src/api-docs-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAaH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js new file mode 100644 index 00000000000..c98190a29e7 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js @@ -0,0 +1,71 @@ +"use strict"; +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +/* + * This file re-exports any APIs that we want to have documentation generated + * for. It is used by API Extractor to determine what parts of the system to + * document. + * + * We also have src/api.ts. This is used in `index.js` and by the legacy DocLint + * system. src/api-docs-entry.ts is ONLY used by API Extractor. + * + * Once we have migrated to API Extractor and removed DocLint we can remove the + * duplication and use this file. + */ +__exportStar(require("./common/Accessibility.js"), exports); +__exportStar(require("./common/Browser.js"), exports); +__exportStar(require("./node/BrowserFetcher.js"), exports); +__exportStar(require("./common/Connection.js"), exports); +__exportStar(require("./common/ConsoleMessage.js"), exports); +__exportStar(require("./common/Coverage.js"), exports); +__exportStar(require("./common/DeviceDescriptors.js"), exports); +__exportStar(require("./common/Dialog.js"), exports); +__exportStar(require("./common/DOMWorld.js"), exports); +__exportStar(require("./common/JSHandle.js"), exports); +__exportStar(require("./common/ExecutionContext.js"), exports); +__exportStar(require("./common/EventEmitter.js"), exports); +__exportStar(require("./common/FileChooser.js"), exports); +__exportStar(require("./common/FrameManager.js"), exports); +__exportStar(require("./common/Input.js"), exports); +__exportStar(require("./common/Page.js"), exports); +__exportStar(require("./common/Puppeteer.js"), exports); +__exportStar(require("./node/LaunchOptions.js"), exports); +__exportStar(require("./node/Launcher.js"), exports); +__exportStar(require("./common/HTTPRequest.js"), exports); +__exportStar(require("./common/HTTPResponse.js"), exports); +__exportStar(require("./common/SecurityDetails.js"), exports); +__exportStar(require("./common/Target.js"), exports); +__exportStar(require("./common/Errors.js"), exports); +__exportStar(require("./common/Tracing.js"), exports); +__exportStar(require("./common/NetworkManager.js"), exports); +__exportStar(require("./common/WebWorker.js"), exports); +__exportStar(require("./common/USKeyboardLayout.js"), exports); +__exportStar(require("./common/EvalTypes.js"), exports); +__exportStar(require("./common/PDFOptions.js"), exports); +__exportStar(require("./common/TimeoutSettings.js"), exports); +__exportStar(require("./common/LifecycleWatcher.js"), exports); +__exportStar(require("devtools-protocol/types/protocol"), exports); diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts new file mode 100644 index 00000000000..736b3b54394 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts @@ -0,0 +1,176 @@ +/** + * Copyright 2018 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { CDPSession } from './Connection.js'; +import { ElementHandle } from './JSHandle.js'; +/** + * Represents a Node and the properties of it that are relevant to Accessibility. + * @public + */ +export interface SerializedAXNode { + /** + * The {@link https://www.w3.org/TR/wai-aria/#usage_intro | role} of the node. + */ + role: string; + /** + * A human readable name for the node. + */ + name?: string; + /** + * The current value of the node. + */ + value?: string | number; + /** + * An additional human readable description of the node. + */ + description?: string; + /** + * Any keyboard shortcuts associated with this node. + */ + keyshortcuts?: string; + /** + * A human readable alternative to the role. + */ + roledescription?: string; + /** + * A description of the current value. + */ + valuetext?: string; + disabled?: boolean; + expanded?: boolean; + focused?: boolean; + modal?: boolean; + multiline?: boolean; + /** + * Whether more than one child can be selected. + */ + multiselectable?: boolean; + readonly?: boolean; + required?: boolean; + selected?: boolean; + /** + * Whether the checkbox is checked, or in a + * {@link https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html | mixed state}. + */ + checked?: boolean | 'mixed'; + /** + * Whether the node is checked or in a mixed state. + */ + pressed?: boolean | 'mixed'; + /** + * The level of a heading. + */ + level?: number; + valuemin?: number; + valuemax?: number; + autocomplete?: string; + haspopup?: string; + /** + * Whether and in what way this node's value is invalid. + */ + invalid?: string; + orientation?: string; + /** + * Children of this node, if there are any. + */ + children?: SerializedAXNode[]; +} +/** + * @public + */ +export interface SnapshotOptions { + /** + * Prune unintersting nodes from the tree. + * @defaultValue true + */ + interestingOnly?: boolean; + /** + * Prune unintersting nodes from the tree. + * @defaultValue The root node of the entire page. + */ + root?: ElementHandle; +} +/** + * The Accessibility class provides methods for inspecting Chromium's + * accessibility tree. The accessibility tree is used by assistive technology + * such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or + * {@link https://en.wikipedia.org/wiki/Switch_access | switches}. + * + * @remarks + * + * Accessibility is a very platform-specific thing. On different platforms, + * there are different screen readers that might have wildly different output. + * + * Blink - Chrome's rendering engine - has a concept of "accessibility tree", + * which is then translated into different platform-specific APIs. Accessibility + * namespace gives users access to the Blink Accessibility Tree. + * + * Most of the accessibility tree gets filtered out when converting from Blink + * AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. + * By default, Puppeteer tries to approximate this filtering, exposing only + * the "interesting" nodes of the tree. + * + * @public + */ +export declare class Accessibility { + private _client; + /** + * @internal + */ + constructor(client: CDPSession); + /** + * Captures the current state of the accessibility tree. + * The returned object represents the root accessible node of the page. + * + * @remarks + * + * **NOTE** The Chromium accessibility tree contains nodes that go unused on + * most platforms and by most screen readers. Puppeteer will discard them as + * well for an easier to process tree, unless `interestingOnly` is set to + * `false`. + * + * @example + * An example of dumping the entire accessibility tree: + * ```js + * const snapshot = await page.accessibility.snapshot(); + * console.log(snapshot); + * ``` + * + * @example + * An example of logging the focused node's name: + * ```js + * const snapshot = await page.accessibility.snapshot(); + * const node = findFocusedNode(snapshot); + * console.log(node && node.name); + * + * function findFocusedNode(node) { + * if (node.focused) + * return node; + * for (const child of node.children || []) { + * const foundNode = findFocusedNode(child); + * return foundNode; + * } + * return null; + * } + * ``` + * + * @returns An AXNode object representing the snapshot. + * + */ + snapshot(options?: SnapshotOptions): Promise; + private serializeTree; + private collectInterestingNodes; +} +//# sourceMappingURL=Accessibility.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map new file mode 100644 index 00000000000..09e4537815d --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Accessibility.d.ts","sourceRoot":"","sources":["../../../../src/common/Accessibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAa;IAE5B;;OAEG;gBACS,MAAM,EAAE,UAAU;IAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACU,QAAQ,CACnB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC;IA0B5B,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,uBAAuB;CAWhC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js new file mode 100644 index 00000000000..03dff902668 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js @@ -0,0 +1,360 @@ +"use strict"; +/** + * Copyright 2018 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Accessibility = void 0; +/** + * The Accessibility class provides methods for inspecting Chromium's + * accessibility tree. The accessibility tree is used by assistive technology + * such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or + * {@link https://en.wikipedia.org/wiki/Switch_access | switches}. + * + * @remarks + * + * Accessibility is a very platform-specific thing. On different platforms, + * there are different screen readers that might have wildly different output. + * + * Blink - Chrome's rendering engine - has a concept of "accessibility tree", + * which is then translated into different platform-specific APIs. Accessibility + * namespace gives users access to the Blink Accessibility Tree. + * + * Most of the accessibility tree gets filtered out when converting from Blink + * AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. + * By default, Puppeteer tries to approximate this filtering, exposing only + * the "interesting" nodes of the tree. + * + * @public + */ +class Accessibility { + /** + * @internal + */ + constructor(client) { + this._client = client; + } + /** + * Captures the current state of the accessibility tree. + * The returned object represents the root accessible node of the page. + * + * @remarks + * + * **NOTE** The Chromium accessibility tree contains nodes that go unused on + * most platforms and by most screen readers. Puppeteer will discard them as + * well for an easier to process tree, unless `interestingOnly` is set to + * `false`. + * + * @example + * An example of dumping the entire accessibility tree: + * ```js + * const snapshot = await page.accessibility.snapshot(); + * console.log(snapshot); + * ``` + * + * @example + * An example of logging the focused node's name: + * ```js + * const snapshot = await page.accessibility.snapshot(); + * const node = findFocusedNode(snapshot); + * console.log(node && node.name); + * + * function findFocusedNode(node) { + * if (node.focused) + * return node; + * for (const child of node.children || []) { + * const foundNode = findFocusedNode(child); + * return foundNode; + * } + * return null; + * } + * ``` + * + * @returns An AXNode object representing the snapshot. + * + */ + async snapshot(options = {}) { + const { interestingOnly = true, root = null } = options; + const { nodes } = await this._client.send('Accessibility.getFullAXTree'); + let backendNodeId = null; + if (root) { + const { node } = await this._client.send('DOM.describeNode', { + objectId: root._remoteObject.objectId, + }); + backendNodeId = node.backendNodeId; + } + const defaultRoot = AXNode.createTree(nodes); + let needle = defaultRoot; + if (backendNodeId) { + needle = defaultRoot.find((node) => node.payload.backendDOMNodeId === backendNodeId); + if (!needle) + return null; + } + if (!interestingOnly) + return this.serializeTree(needle)[0]; + const interestingNodes = new Set(); + this.collectInterestingNodes(interestingNodes, defaultRoot, false); + if (!interestingNodes.has(needle)) + return null; + return this.serializeTree(needle, interestingNodes)[0]; + } + serializeTree(node, whitelistedNodes) { + const children = []; + for (const child of node.children) + children.push(...this.serializeTree(child, whitelistedNodes)); + if (whitelistedNodes && !whitelistedNodes.has(node)) + return children; + const serializedNode = node.serialize(); + if (children.length) + serializedNode.children = children; + return [serializedNode]; + } + collectInterestingNodes(collection, node, insideControl) { + if (node.isInteresting(insideControl)) + collection.add(node); + if (node.isLeafNode()) + return; + insideControl = insideControl || node.isControl(); + for (const child of node.children) + this.collectInterestingNodes(collection, child, insideControl); + } +} +exports.Accessibility = Accessibility; +class AXNode { + constructor(payload) { + this.children = []; + this._richlyEditable = false; + this._editable = false; + this._focusable = false; + this._hidden = false; + this.payload = payload; + this._name = this.payload.name ? this.payload.name.value : ''; + this._role = this.payload.role ? this.payload.role.value : 'Unknown'; + for (const property of this.payload.properties || []) { + if (property.name === 'editable') { + this._richlyEditable = property.value.value === 'richtext'; + this._editable = true; + } + if (property.name === 'focusable') + this._focusable = property.value.value; + if (property.name === 'hidden') + this._hidden = property.value.value; + } + } + _isPlainTextField() { + if (this._richlyEditable) + return false; + if (this._editable) + return true; + return (this._role === 'textbox' || + this._role === 'ComboBox' || + this._role === 'searchbox'); + } + _isTextOnlyObject() { + const role = this._role; + return role === 'LineBreak' || role === 'text' || role === 'InlineTextBox'; + } + _hasFocusableChild() { + if (this._cachedHasFocusableChild === undefined) { + this._cachedHasFocusableChild = false; + for (const child of this.children) { + if (child._focusable || child._hasFocusableChild()) { + this._cachedHasFocusableChild = true; + break; + } + } + } + return this._cachedHasFocusableChild; + } + find(predicate) { + if (predicate(this)) + return this; + for (const child of this.children) { + const result = child.find(predicate); + if (result) + return result; + } + return null; + } + isLeafNode() { + if (!this.children.length) + return true; + // These types of objects may have children that we use as internal + // implementation details, but we want to expose them as leaves to platform + // accessibility APIs because screen readers might be confused if they find + // any children. + if (this._isPlainTextField() || this._isTextOnlyObject()) + return true; + // Roles whose children are only presentational according to the ARIA and + // HTML5 Specs should be hidden from screen readers. + // (Note that whilst ARIA buttons can have only presentational children, HTML5 + // buttons are allowed to have content.) + switch (this._role) { + case 'doc-cover': + case 'graphics-symbol': + case 'img': + case 'Meter': + case 'scrollbar': + case 'slider': + case 'separator': + case 'progressbar': + return true; + default: + break; + } + // Here and below: Android heuristics + if (this._hasFocusableChild()) + return false; + if (this._focusable && this._name) + return true; + if (this._role === 'heading' && this._name) + return true; + return false; + } + isControl() { + switch (this._role) { + case 'button': + case 'checkbox': + case 'ColorWell': + case 'combobox': + case 'DisclosureTriangle': + case 'listbox': + case 'menu': + case 'menubar': + case 'menuitem': + case 'menuitemcheckbox': + case 'menuitemradio': + case 'radio': + case 'scrollbar': + case 'searchbox': + case 'slider': + case 'spinbutton': + case 'switch': + case 'tab': + case 'textbox': + case 'tree': + return true; + default: + return false; + } + } + isInteresting(insideControl) { + const role = this._role; + if (role === 'Ignored' || this._hidden) + return false; + if (this._focusable || this._richlyEditable) + return true; + // If it's not focusable but has a control role, then it's interesting. + if (this.isControl()) + return true; + // A non focusable child of a control is not interesting + if (insideControl) + return false; + return this.isLeafNode() && !!this._name; + } + serialize() { + const properties = new Map(); + for (const property of this.payload.properties || []) + properties.set(property.name.toLowerCase(), property.value.value); + if (this.payload.name) + properties.set('name', this.payload.name.value); + if (this.payload.value) + properties.set('value', this.payload.value.value); + if (this.payload.description) + properties.set('description', this.payload.description.value); + const node = { + role: this._role, + }; + const userStringProperties = [ + 'name', + 'value', + 'description', + 'keyshortcuts', + 'roledescription', + 'valuetext', + ]; + const getUserStringPropertyValue = (key) => properties.get(key); + for (const userStringProperty of userStringProperties) { + if (!properties.has(userStringProperty)) + continue; + node[userStringProperty] = getUserStringPropertyValue(userStringProperty); + } + const booleanProperties = [ + 'disabled', + 'expanded', + 'focused', + 'modal', + 'multiline', + 'multiselectable', + 'readonly', + 'required', + 'selected', + ]; + const getBooleanPropertyValue = (key) => properties.get(key); + for (const booleanProperty of booleanProperties) { + // WebArea's treat focus differently than other nodes. They report whether + // their frame has focus, not whether focus is specifically on the root + // node. + if (booleanProperty === 'focused' && this._role === 'WebArea') + continue; + const value = getBooleanPropertyValue(booleanProperty); + if (!value) + continue; + node[booleanProperty] = getBooleanPropertyValue(booleanProperty); + } + const tristateProperties = ['checked', 'pressed']; + for (const tristateProperty of tristateProperties) { + if (!properties.has(tristateProperty)) + continue; + const value = properties.get(tristateProperty); + node[tristateProperty] = + value === 'mixed' ? 'mixed' : value === 'true' ? true : false; + } + const numericalProperties = [ + 'level', + 'valuemax', + 'valuemin', + ]; + const getNumericalPropertyValue = (key) => properties.get(key); + for (const numericalProperty of numericalProperties) { + if (!properties.has(numericalProperty)) + continue; + node[numericalProperty] = getNumericalPropertyValue(numericalProperty); + } + const tokenProperties = [ + 'autocomplete', + 'haspopup', + 'invalid', + 'orientation', + ]; + const getTokenPropertyValue = (key) => properties.get(key); + for (const tokenProperty of tokenProperties) { + const value = getTokenPropertyValue(tokenProperty); + if (!value || value === 'false') + continue; + node[tokenProperty] = getTokenPropertyValue(tokenProperty); + } + return node; + } + static createTree(payloads) { + const nodeById = new Map(); + for (const payload of payloads) + nodeById.set(payload.nodeId, new AXNode(payload)); + for (const node of nodeById.values()) { + for (const childId of node.payload.childIds || []) + node.children.push(nodeById.get(childId)); + } + return nodeById.values().next().value; + } +} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts new file mode 100644 index 00000000000..43df72baf69 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts @@ -0,0 +1,424 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// +import { ChildProcess } from 'child_process'; +import { Protocol } from 'devtools-protocol'; + +import { Connection } from './Connection.js'; +import { EventEmitter } from './EventEmitter.js'; +import { Page } from './Page.js'; +import { Viewport } from './PuppeteerViewport.js'; +import { Target } from './Target.js'; + +declare type BrowserCloseCallback = () => Promise | void; +/** + * @public + */ +export interface WaitForTargetOptions { + /** + * Maximum wait time in milliseconds. Pass `0` to disable the timeout. + * @defaultValue 30 seconds. + */ + timeout?: number; +} +/** + * All the events a {@link Browser | browser instance} may emit. + * + * @public + */ +export declare const enum BrowserEmittedEvents { + /** + * Emitted when Puppeteer gets disconnected from the Chromium instance. This + * might happen because of one of the following: + * + * - Chromium is closed or crashed + * + * - The {@link Browser.disconnect | browser.disconnect } method was called. + */ + Disconnected = "disconnected", + /** + * Emitted when the url of a target changes. Contains a {@link Target} instance. + * + * @remarks + * + * Note that this includes target changes in incognito browser contexts. + */ + TargetChanged = "targetchanged", + /** + * Emitted when a target is created, for example when a new page is opened by + * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/open | window.open} + * or by {@link Browser.newPage | browser.newPage} + * + * Contains a {@link Target} instance. + * + * @remarks + * + * Note that this includes target creations in incognito browser contexts. + */ + TargetCreated = "targetcreated", + /** + * Emitted when a target is destroyed, for example when a page is closed. + * Contains a {@link Target} instance. + * + * @remarks + * + * Note that this includes target destructions in incognito browser contexts. + */ + TargetDestroyed = "targetdestroyed" +} +/** + * A Browser is created when Puppeteer connects to a Chromium instance, either through + * {@link Puppeteer.launch} or {@link Puppeteer.connect}. + * + * @remarks + * + * The Browser class extends from Puppeteer's {@link EventEmitter} class and will + * emit various events which are documented in the {@link BrowserEmittedEvents} enum. + * + * @example + * + * An example of using a {@link Browser} to create a {@link Page}: + * ```js + * const puppeteer = require('puppeteer'); + * + * (async () => { + * const browser = await puppeteer.launch(); + * const page = await browser.newPage(); + * await page.goto('https://example.com'); + * await browser.close(); + * })(); + * ``` + * + * @example + * + * An example of disconnecting from and reconnecting to a {@link Browser}: + * ```js + * const puppeteer = require('puppeteer'); + * + * (async () => { + * const browser = await puppeteer.launch(); + * // Store the endpoint to be able to reconnect to Chromium + * const browserWSEndpoint = browser.wsEndpoint(); + * // Disconnect puppeteer from Chromium + * browser.disconnect(); + * + * // Use the endpoint to reestablish a connection + * const browser2 = await puppeteer.connect({browserWSEndpoint}); + * // Close Chromium + * await browser2.close(); + * })(); + * ``` + * + * @public + */ +export declare class Browser extends EventEmitter { + /** + * @internal + */ + static create(connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport, process?: ChildProcess, closeCallback?: BrowserCloseCallback): Promise; + private _ignoreHTTPSErrors; + private _defaultViewport?; + private _process?; + private _connection; + private _closeCallback; + private _defaultContext; + private _contexts; + /** + * @internal + * Used in Target.ts directly so cannot be marked private. + */ + _targets: Map; + /** + * @internal + */ + constructor(connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport, process?: ChildProcess, closeCallback?: BrowserCloseCallback); + /** + * The spawned browser process. Returns `null` if the browser instance was created with + * {@link Puppeteer.connect}. + */ + process(): ChildProcess | null; + /** + * Creates a new incognito browser context. This won't share cookies/cache with other + * browser contexts. + * + * @example + * ```js + * (async () => { + * const browser = await puppeteer.launch(); + * // Create a new incognito browser context. + * const context = await browser.createIncognitoBrowserContext(); + * // Create a new page in a pristine context. + * const page = await context.newPage(); + * // Do stuff + * await page.goto('https://example.com'); + * })(); + * ``` + */ + createIncognitoBrowserContext(): Promise; + /** + * Returns an array of all open browser contexts. In a newly created browser, this will + * return a single instance of {@link BrowserContext}. + */ + browserContexts(): BrowserContext[]; + /** + * Returns the default browser context. The default browser context cannot be closed. + */ + defaultBrowserContext(): BrowserContext; + /** + * @internal + * Used by BrowserContext directly so cannot be marked private. + */ + _disposeContext(contextId?: string): Promise; + private _targetCreated; + private _targetDestroyed; + private _targetInfoChanged; + /** + * The browser websocket endpoint which can be used as an argument to + * {@link Puppeteer.connect}. + * + * @returns The Browser websocket url. + * + * @remarks + * + * The format is `ws://${host}:${port}/devtools/browser/`. + * + * You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. + * Learn more about the + * {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and + * the {@link + * https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target + * | browser endpoint}. + */ + wsEndpoint(): string; + /** + * Creates a {@link Page} in the default browser context. + */ + newPage(): Promise; + /** + * @internal + * Used by BrowserContext directly so cannot be marked private. + */ + _createPageInContext(contextId?: string): Promise; + /** + * All active targets inside the Browser. In case of multiple browser contexts, returns + * an array with all the targets in all browser contexts. + */ + targets(): Target[]; + /** + * The target associated with the browser. + */ + target(): Target; + /** + * Searches for a target in all browser contexts. + * + * @param predicate - A function to be run for every target. + * @returns The first target found that matches the `predicate` function. + * + * @example + * + * An example of finding a target for a page opened via `window.open`: + * ```js + * await page.evaluate(() => window.open('https://www.example.com/')); + * const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/'); + * ``` + */ + waitForTarget(predicate: (x: Target) => boolean, options?: WaitForTargetOptions): Promise; + /** + * An array of all open pages inside the Browser. + * + * @remarks + * + * In case of multiple browser contexts, returns an array with all the pages in all + * browser contexts. Non-visible pages, such as `"background_page"`, will not be listed + * here. You can find them using {@link Target.page}. + */ + pages(): Promise; + /** + * A string representing the browser name and version. + * + * @remarks + * + * For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For + * non-headless, this is similar to `Chrome/61.0.3153.0`. + * + * The format of browser.version() might change with future releases of Chromium. + */ + version(): Promise; + /** + * The browser's original user agent. Pages can override the browser user agent with + * {@link Page.setUserAgent}. + */ + userAgent(): Promise; + /** + * Closes Chromium and all of its pages (if any were opened). The {@link Browser} object + * itself is considered to be disposed and cannot be used anymore. + */ + close(): Promise; + /** + * Disconnects Puppeteer from the browser, but leaves the Chromium process running. + * After calling `disconnect`, the {@link Browser} object is considered disposed and + * cannot be used anymore. + */ + disconnect(): void; + /** + * Indicates that the browser is connected. + */ + isConnected(): boolean; + private _getVersion; +} +export declare const enum BrowserContextEmittedEvents { + /** + * Emitted when the url of a target inside the browser context changes. + * Contains a {@link Target} instance. + */ + TargetChanged = "targetchanged", + /** + * Emitted when a target is created within the browser context, for example + * when a new page is opened by + * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/open | window.open} + * or by {@link BrowserContext.newPage | browserContext.newPage} + * + * Contains a {@link Target} instance. + */ + TargetCreated = "targetcreated", + /** + * Emitted when a target is destroyed within the browser context, for example + * when a page is closed. Contains a {@link Target} instance. + */ + TargetDestroyed = "targetdestroyed" +} +/** + * BrowserContexts provide a way to operate multiple independent browser + * sessions. When a browser is launched, it has a single BrowserContext used by + * default. The method {@link Browser.newPage | Browser.newPage} creates a page + * in the default browser context. + * + * @remarks + * + * The Browser class extends from Puppeteer's {@link EventEmitter} class and + * will emit various events which are documented in the + * {@link BrowserContextEmittedEvents} enum. + * + * If a page opens another page, e.g. with a `window.open` call, the popup will + * belong to the parent page's browser context. + * + * Puppeteer allows creation of "incognito" browser contexts with + * {@link Browser.createIncognitoBrowserContext | Browser.createIncognitoBrowserContext} + * method. "Incognito" browser contexts don't write any browsing data to disk. + * + * @example + * ```js + * // Create a new incognito browser context + * const context = await browser.createIncognitoBrowserContext(); + * // Create a new page inside context. + * const page = await context.newPage(); + * // ... do stuff with page ... + * await page.goto('https://example.com'); + * // Dispose context once it's no longer needed. + * await context.close(); + * ``` + */ +export declare class BrowserContext extends EventEmitter { + private _connection; + private _browser; + private _id?; + /** + * @internal + */ + constructor(connection: Connection, browser: Browser, contextId?: string); + /** + * An array of all active targets inside the browser context. + */ + targets(): Target[]; + /** + * This searches for a target in this specific browser context. + * + * @example + * An example of finding a target for a page opened via `window.open`: + * ```js + * await page.evaluate(() => window.open('https://www.example.com/')); + * const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/'); + * ``` + * + * @param predicate - A function to be run for every target + * @param options - An object of options. Accepts a timout, + * which is the maximum wait time in milliseconds. + * Pass `0` to disable the timeout. Defaults to 30 seconds. + * @returns Promise which resolves to the first target found + * that matches the `predicate` function. + */ + waitForTarget(predicate: (x: Target) => boolean, options?: { + timeout?: number; + }): Promise; + /** + * An array of all pages inside the browser context. + * + * @returns Promise which resolves to an array of all open pages. + * Non visible pages, such as `"background_page"`, will not be listed here. + * You can find them using {@link Target.page | the target page}. + */ + pages(): Promise; + /** + * Returns whether BrowserContext is incognito. + * The default browser context is the only non-incognito browser context. + * + * @remarks + * The default browser context cannot be closed. + */ + isIncognito(): boolean; + /** + * @example + * ```js + * const context = browser.defaultBrowserContext(); + * await context.overridePermissions('https://html5demos.com', ['geolocation']); + * ``` + * + * @param origin - The origin to grant permissions to, e.g. "https://example.com". + * @param permissions - An array of permissions to grant. + * All permissions that are not listed here will be automatically denied. + */ + overridePermissions(origin: string, permissions: Protocol.Browser.PermissionType[]): Promise; + /** + * Clears all permission overrides for the browser context. + * + * @example + * ```js + * const context = browser.defaultBrowserContext(); + * context.overridePermissions('https://example.com', ['clipboard-read']); + * // do stuff .. + * context.clearPermissionOverrides(); + * ``` + */ + clearPermissionOverrides(): Promise; + /** + * Creates a new page in the browser context. + */ + newPage(): Promise; + /** + * The browser this browser context belongs to. + */ + browser(): Browser; + /** + * Closes the browser context. All the targets that belong to the browser context + * will be closed. + * + * @remarks + * Only incognito browser contexts can be closed. + */ + close(): Promise; +} +export {}; +//# sourceMappingURL=Browser.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map new file mode 100644 index 00000000000..2e1d5273b1e --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Browser.d.ts","sourceRoot":"","sources":["../../../../src/common/Browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAA2B,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,aAAK,oBAAoB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,0BAAkB,oBAAoB;IACpC;;;;;;;OAOG;IACH,YAAY,iBAAiB;IAE7B;;;;;;OAMG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;;;;OAUG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;OAOG;IACH,eAAe,oBAAoB;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBAAa,OAAQ,SAAQ,YAAY;IACvC;;OAEG;WACU,MAAM,CACjB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,OAAO,EAC1B,eAAe,CAAC,EAAE,QAAQ,EAC1B,OAAO,CAAC,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,oBAAoB,GACnC,OAAO,CAAC,OAAO,CAAC;IAYnB,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,gBAAgB,CAAC,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,SAAS,CAA8B;IAC/C;;;OAGG;IACH,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B;;OAEG;gBAED,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,OAAO,EAC1B,eAAe,CAAC,EAAE,QAAQ,EAC1B,OAAO,CAAC,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,oBAAoB;IAgCtC;;;OAGG;IACH,OAAO,IAAI,YAAY,GAAG,IAAI;IAI9B;;;;;;;;;;;;;;;;OAgBG;IACG,6BAA6B,IAAI,OAAO,CAAC,cAAc,CAAC;IAa9D;;;OAGG;IACH,eAAe,IAAI,cAAc,EAAE;IAInC;;OAEG;IACH,qBAAqB,IAAI,cAAc;IAIvC;;;OAGG;IACG,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAO1C,cAAc;YA6Bd,gBAAgB;IAa9B,OAAO,CAAC,kBAAkB;IAgB1B;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7D;;;OAGG;IACH,OAAO,IAAI,MAAM,EAAE;IAMnB;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;;;;;;;;;;OAaG;IACG,aAAa,CACjB,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,EACjC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,MAAM,CAAC;IAyBlB;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAQ9B;;;;;;;;;OASG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAKlC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB,OAAO,CAAC,WAAW;CAGpB;AAED,0BAAkB,2BAA2B;IAC3C;;;OAGG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;OAOG;IACH,aAAa,kBAAkB;IAC/B;;;OAGG;IACH,eAAe,oBAAoB;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAS;IAErB;;OAEG;gBACS,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM;IAOxE;;OAEG;IACH,OAAO,IAAI,MAAM,EAAE;IAMnB;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CACX,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,EACjC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GACjC,OAAO,CAAC,MAAM,CAAC;IAOlB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAS9B;;;;;;OAMG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;;;;;;OAUG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,GAC7C,OAAO,CAAC,IAAI,CAAC;IAqChB;;;;;;;;;;OAUG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAM/C;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js new file mode 100644 index 00000000000..31d98a7e675 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js @@ -0,0 +1,519 @@ +"use strict"; +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BrowserContext = exports.Browser = void 0; +const assert_js_1 = require("./assert.js"); +const helper_js_1 = require("./helper.js"); +const Target_js_1 = require("./Target.js"); +const EventEmitter_js_1 = require("./EventEmitter.js"); +const Connection_js_1 = require("./Connection.js"); +/** + * A Browser is created when Puppeteer connects to a Chromium instance, either through + * {@link Puppeteer.launch} or {@link Puppeteer.connect}. + * + * @remarks + * + * The Browser class extends from Puppeteer's {@link EventEmitter} class and will + * emit various events which are documented in the {@link BrowserEmittedEvents} enum. + * + * @example + * + * An example of using a {@link Browser} to create a {@link Page}: + * ```js + * const puppeteer = require('puppeteer'); + * + * (async () => { + * const browser = await puppeteer.launch(); + * const page = await browser.newPage(); + * await page.goto('https://example.com'); + * await browser.close(); + * })(); + * ``` + * + * @example + * + * An example of disconnecting from and reconnecting to a {@link Browser}: + * ```js + * const puppeteer = require('puppeteer'); + * + * (async () => { + * const browser = await puppeteer.launch(); + * // Store the endpoint to be able to reconnect to Chromium + * const browserWSEndpoint = browser.wsEndpoint(); + * // Disconnect puppeteer from Chromium + * browser.disconnect(); + * + * // Use the endpoint to reestablish a connection + * const browser2 = await puppeteer.connect({browserWSEndpoint}); + * // Close Chromium + * await browser2.close(); + * })(); + * ``` + * + * @public + */ +class Browser extends EventEmitter_js_1.EventEmitter { + /** + * @internal + */ + constructor(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) { + super(); + this._ignoreHTTPSErrors = ignoreHTTPSErrors; + this._defaultViewport = defaultViewport; + this._process = process; + this._connection = connection; + this._closeCallback = closeCallback || function () { }; + this._defaultContext = new BrowserContext(this._connection, this, null); + this._contexts = new Map(); + for (const contextId of contextIds) + this._contexts.set(contextId, new BrowserContext(this._connection, this, contextId)); + this._targets = new Map(); + this._connection.on(Connection_js_1.ConnectionEmittedEvents.Disconnected, () => this.emit("disconnected" /* Disconnected */)); + this._connection.on('Target.targetCreated', this._targetCreated.bind(this)); + this._connection.on('Target.targetDestroyed', this._targetDestroyed.bind(this)); + this._connection.on('Target.targetInfoChanged', this._targetInfoChanged.bind(this)); + } + /** + * @internal + */ + static async create(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) { + const browser = new Browser(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback); + await connection.send('Target.setDiscoverTargets', { discover: true }); + return browser; + } + /** + * The spawned browser process. Returns `null` if the browser instance was created with + * {@link Puppeteer.connect}. + */ + process() { + return this._process; + } + /** + * Creates a new incognito browser context. This won't share cookies/cache with other + * browser contexts. + * + * @example + * ```js + * (async () => { + * const browser = await puppeteer.launch(); + * // Create a new incognito browser context. + * const context = await browser.createIncognitoBrowserContext(); + * // Create a new page in a pristine context. + * const page = await context.newPage(); + * // Do stuff + * await page.goto('https://example.com'); + * })(); + * ``` + */ + async createIncognitoBrowserContext() { + const { browserContextId } = await this._connection.send('Target.createBrowserContext'); + const context = new BrowserContext(this._connection, this, browserContextId); + this._contexts.set(browserContextId, context); + return context; + } + /** + * Returns an array of all open browser contexts. In a newly created browser, this will + * return a single instance of {@link BrowserContext}. + */ + browserContexts() { + return [this._defaultContext, ...Array.from(this._contexts.values())]; + } + /** + * Returns the default browser context. The default browser context cannot be closed. + */ + defaultBrowserContext() { + return this._defaultContext; + } + /** + * @internal + * Used by BrowserContext directly so cannot be marked private. + */ + async _disposeContext(contextId) { + await this._connection.send('Target.disposeBrowserContext', { + browserContextId: contextId || undefined, + }); + this._contexts.delete(contextId); + } + async _targetCreated(event) { + const targetInfo = event.targetInfo; + const { browserContextId } = targetInfo; + const context = browserContextId && this._contexts.has(browserContextId) + ? this._contexts.get(browserContextId) + : this._defaultContext; + const target = new Target_js_1.Target(targetInfo, context, () => this._connection.createSession(targetInfo), this._ignoreHTTPSErrors, this._defaultViewport); + assert_js_1.assert(!this._targets.has(event.targetInfo.targetId), 'Target should not exist before targetCreated'); + this._targets.set(event.targetInfo.targetId, target); + if (await target._initializedPromise) { + this.emit("targetcreated" /* TargetCreated */, target); + context.emit("targetcreated" /* TargetCreated */, target); + } + } + async _targetDestroyed(event) { + const target = this._targets.get(event.targetId); + target._initializedCallback(false); + this._targets.delete(event.targetId); + target._closedCallback(); + if (await target._initializedPromise) { + this.emit("targetdestroyed" /* TargetDestroyed */, target); + target + .browserContext() + .emit("targetdestroyed" /* TargetDestroyed */, target); + } + } + _targetInfoChanged(event) { + const target = this._targets.get(event.targetInfo.targetId); + assert_js_1.assert(target, 'target should exist before targetInfoChanged'); + const previousURL = target.url(); + const wasInitialized = target._isInitialized; + target._targetInfoChanged(event.targetInfo); + if (wasInitialized && previousURL !== target.url()) { + this.emit("targetchanged" /* TargetChanged */, target); + target + .browserContext() + .emit("targetchanged" /* TargetChanged */, target); + } + } + /** + * The browser websocket endpoint which can be used as an argument to + * {@link Puppeteer.connect}. + * + * @returns The Browser websocket url. + * + * @remarks + * + * The format is `ws://${host}:${port}/devtools/browser/`. + * + * You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. + * Learn more about the + * {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and + * the {@link + * https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target + * | browser endpoint}. + */ + wsEndpoint() { + return this._connection.url(); + } + /** + * Creates a {@link Page} in the default browser context. + */ + async newPage() { + return this._defaultContext.newPage(); + } + /** + * @internal + * Used by BrowserContext directly so cannot be marked private. + */ + async _createPageInContext(contextId) { + const { targetId } = await this._connection.send('Target.createTarget', { + url: 'about:blank', + browserContextId: contextId || undefined, + }); + const target = await this._targets.get(targetId); + assert_js_1.assert(await target._initializedPromise, 'Failed to create target for page'); + const page = await target.page(); + return page; + } + /** + * All active targets inside the Browser. In case of multiple browser contexts, returns + * an array with all the targets in all browser contexts. + */ + targets() { + return Array.from(this._targets.values()).filter((target) => target._isInitialized); + } + /** + * The target associated with the browser. + */ + target() { + return this.targets().find((target) => target.type() === 'browser'); + } + /** + * Searches for a target in all browser contexts. + * + * @param predicate - A function to be run for every target. + * @returns The first target found that matches the `predicate` function. + * + * @example + * + * An example of finding a target for a page opened via `window.open`: + * ```js + * await page.evaluate(() => window.open('https://www.example.com/')); + * const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/'); + * ``` + */ + async waitForTarget(predicate, options = {}) { + const { timeout = 30000 } = options; + const existingTarget = this.targets().find(predicate); + if (existingTarget) + return existingTarget; + let resolve; + const targetPromise = new Promise((x) => (resolve = x)); + this.on("targetcreated" /* TargetCreated */, check); + this.on("targetchanged" /* TargetChanged */, check); + try { + if (!timeout) + return await targetPromise; + return await helper_js_1.helper.waitWithTimeout(targetPromise, 'target', timeout); + } + finally { + this.removeListener("targetcreated" /* TargetCreated */, check); + this.removeListener("targetchanged" /* TargetChanged */, check); + } + function check(target) { + if (predicate(target)) + resolve(target); + } + } + /** + * An array of all open pages inside the Browser. + * + * @remarks + * + * In case of multiple browser contexts, returns an array with all the pages in all + * browser contexts. Non-visible pages, such as `"background_page"`, will not be listed + * here. You can find them using {@link Target.page}. + */ + async pages() { + const contextPages = await Promise.all(this.browserContexts().map((context) => context.pages())); + // Flatten array. + return contextPages.reduce((acc, x) => acc.concat(x), []); + } + /** + * A string representing the browser name and version. + * + * @remarks + * + * For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For + * non-headless, this is similar to `Chrome/61.0.3153.0`. + * + * The format of browser.version() might change with future releases of Chromium. + */ + async version() { + const version = await this._getVersion(); + return version.product; + } + /** + * The browser's original user agent. Pages can override the browser user agent with + * {@link Page.setUserAgent}. + */ + async userAgent() { + const version = await this._getVersion(); + return version.userAgent; + } + /** + * Closes Chromium and all of its pages (if any were opened). The {@link Browser} object + * itself is considered to be disposed and cannot be used anymore. + */ + async close() { + await this._closeCallback.call(null); + this.disconnect(); + } + /** + * Disconnects Puppeteer from the browser, but leaves the Chromium process running. + * After calling `disconnect`, the {@link Browser} object is considered disposed and + * cannot be used anymore. + */ + disconnect() { + this._connection.dispose(); + } + /** + * Indicates that the browser is connected. + */ + isConnected() { + return !this._connection._closed; + } + _getVersion() { + return this._connection.send('Browser.getVersion'); + } +} +exports.Browser = Browser; +/** + * BrowserContexts provide a way to operate multiple independent browser + * sessions. When a browser is launched, it has a single BrowserContext used by + * default. The method {@link Browser.newPage | Browser.newPage} creates a page + * in the default browser context. + * + * @remarks + * + * The Browser class extends from Puppeteer's {@link EventEmitter} class and + * will emit various events which are documented in the + * {@link BrowserContextEmittedEvents} enum. + * + * If a page opens another page, e.g. with a `window.open` call, the popup will + * belong to the parent page's browser context. + * + * Puppeteer allows creation of "incognito" browser contexts with + * {@link Browser.createIncognitoBrowserContext | Browser.createIncognitoBrowserContext} + * method. "Incognito" browser contexts don't write any browsing data to disk. + * + * @example + * ```js + * // Create a new incognito browser context + * const context = await browser.createIncognitoBrowserContext(); + * // Create a new page inside context. + * const page = await context.newPage(); + * // ... do stuff with page ... + * await page.goto('https://example.com'); + * // Dispose context once it's no longer needed. + * await context.close(); + * ``` + */ +class BrowserContext extends EventEmitter_js_1.EventEmitter { + /** + * @internal + */ + constructor(connection, browser, contextId) { + super(); + this._connection = connection; + this._browser = browser; + this._id = contextId; + } + /** + * An array of all active targets inside the browser context. + */ + targets() { + return this._browser + .targets() + .filter((target) => target.browserContext() === this); + } + /** + * This searches for a target in this specific browser context. + * + * @example + * An example of finding a target for a page opened via `window.open`: + * ```js + * await page.evaluate(() => window.open('https://www.example.com/')); + * const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/'); + * ``` + * + * @param predicate - A function to be run for every target + * @param options - An object of options. Accepts a timout, + * which is the maximum wait time in milliseconds. + * Pass `0` to disable the timeout. Defaults to 30 seconds. + * @returns Promise which resolves to the first target found + * that matches the `predicate` function. + */ + waitForTarget(predicate, options = {}) { + return this._browser.waitForTarget((target) => target.browserContext() === this && predicate(target), options); + } + /** + * An array of all pages inside the browser context. + * + * @returns Promise which resolves to an array of all open pages. + * Non visible pages, such as `"background_page"`, will not be listed here. + * You can find them using {@link Target.page | the target page}. + */ + async pages() { + const pages = await Promise.all(this.targets() + .filter((target) => target.type() === 'page') + .map((target) => target.page())); + return pages.filter((page) => !!page); + } + /** + * Returns whether BrowserContext is incognito. + * The default browser context is the only non-incognito browser context. + * + * @remarks + * The default browser context cannot be closed. + */ + isIncognito() { + return !!this._id; + } + /** + * @example + * ```js + * const context = browser.defaultBrowserContext(); + * await context.overridePermissions('https://html5demos.com', ['geolocation']); + * ``` + * + * @param origin - The origin to grant permissions to, e.g. "https://example.com". + * @param permissions - An array of permissions to grant. + * All permissions that are not listed here will be automatically denied. + */ + async overridePermissions(origin, permissions) { + const webPermissionToProtocol = new Map([ + ['geolocation', 'geolocation'], + ['midi', 'midi'], + ['notifications', 'notifications'], + // TODO: push isn't a valid type? + // ['push', 'push'], + ['camera', 'videoCapture'], + ['microphone', 'audioCapture'], + ['background-sync', 'backgroundSync'], + ['ambient-light-sensor', 'sensors'], + ['accelerometer', 'sensors'], + ['gyroscope', 'sensors'], + ['magnetometer', 'sensors'], + ['accessibility-events', 'accessibilityEvents'], + ['clipboard-read', 'clipboardReadWrite'], + ['clipboard-write', 'clipboardReadWrite'], + ['payment-handler', 'paymentHandler'], + // chrome-specific permissions we have. + ['midi-sysex', 'midiSysex'], + ]); + permissions = permissions.map((permission) => { + const protocolPermission = webPermissionToProtocol.get(permission); + if (!protocolPermission) + throw new Error('Unknown permission: ' + permission); + return protocolPermission; + }); + await this._connection.send('Browser.grantPermissions', { + origin, + browserContextId: this._id || undefined, + permissions, + }); + } + /** + * Clears all permission overrides for the browser context. + * + * @example + * ```js + * const context = browser.defaultBrowserContext(); + * context.overridePermissions('https://example.com', ['clipboard-read']); + * // do stuff .. + * context.clearPermissionOverrides(); + * ``` + */ + async clearPermissionOverrides() { + await this._connection.send('Browser.resetPermissions', { + browserContextId: this._id || undefined, + }); + } + /** + * Creates a new page in the browser context. + */ + newPage() { + return this._browser._createPageInContext(this._id); + } + /** + * The browser this browser context belongs to. + */ + browser() { + return this._browser; + } + /** + * Closes the browser context. All the targets that belong to the browser context + * will be closed. + * + * @remarks + * Only incognito browser contexts can be closed. + */ + async close() { + assert_js_1.assert(this._id, 'Non-incognito profiles cannot be closed!'); + await this._browser._disposeContext(this._id); + } +} +exports.BrowserContext = BrowserContext; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts new file mode 100644 index 00000000000..0756d87f1b7 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts @@ -0,0 +1,120 @@ +import { Protocol } from 'devtools-protocol'; +import { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js'; +import { ConnectionTransport } from './ConnectionTransport.js'; +import { EventEmitter } from './EventEmitter.js'; +interface ConnectionCallback { + resolve: Function; + reject: Function; + error: Error; + method: string; +} +/** + * Internal events that the Connection class emits. + * + * @internal + */ +export declare const ConnectionEmittedEvents: { + readonly Disconnected: symbol; +}; +/** + * @internal + */ +export declare class Connection extends EventEmitter { + _url: string; + _transport: ConnectionTransport; + _delay: number; + _lastId: number; + _sessions: Map; + _closed: boolean; + _callbacks: Map; + constructor(url: string, transport: ConnectionTransport, delay?: number); + static fromSession(session: CDPSession): Connection; + /** + * @param {string} sessionId + * @returns {?CDPSession} + */ + session(sessionId: string): CDPSession | null; + url(): string; + send(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise; + _rawSend(message: {}): number; + _onMessage(message: string): Promise; + _onClose(): void; + dispose(): void; + /** + * @param {Protocol.Target.TargetInfo} targetInfo + * @returns {!Promise} + */ + createSession(targetInfo: Protocol.Target.TargetInfo): Promise; +} +interface CDPSessionOnMessageObject { + id?: number; + method: string; + params: {}; + error: { + message: string; + data: any; + }; + result?: any; +} +/** + * Internal events that the CDPSession class emits. + * + * @internal + */ +export declare const CDPSessionEmittedEvents: { + readonly Disconnected: symbol; +}; +/** + * The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. + * + * @remarks + * + * Protocol methods can be called with {@link CDPSession.send} method and protocol + * events can be subscribed to with `CDPSession.on` method. + * + * Useful links: {@link https://chromedevtools.github.io/devtools-protocol/ | DevTools Protocol Viewer} + * and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md | Getting Started with DevTools Protocol}. + * + * @example + * ```js + * const client = await page.target().createCDPSession(); + * await client.send('Animation.enable'); + * client.on('Animation.animationCreated', () => console.log('Animation created!')); + * const response = await client.send('Animation.getPlaybackRate'); + * console.log('playback rate is ' + response.playbackRate); + * await client.send('Animation.setPlaybackRate', { + * playbackRate: response.playbackRate / 2 + * }); + * ``` + * + * @public + */ +export declare class CDPSession extends EventEmitter { + /** + * @internal + */ + _connection: Connection; + private _sessionId; + private _targetType; + private _callbacks; + /** + * @internal + */ + constructor(connection: Connection, targetType: string, sessionId: string); + send(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise; + /** + * @internal + */ + _onMessage(object: CDPSessionOnMessageObject): void; + /** + * Detaches the cdpSession from the target. Once detached, the cdpSession object + * won't emit any events and can't be used to send messages. + */ + detach(): Promise; + /** + * @internal + */ + _onClosed(): void; +} +export {}; +//# sourceMappingURL=Connection.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map new file mode 100644 index 00000000000..dff726e837a --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../../../src/common/Connection.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX;;GAEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,SAAK;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;IAC/C,OAAO,UAAS;IAEhB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAa;gBAE5C,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,KAAK,SAAI;IAUlE,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU;IAInD;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAI7C,GAAG,IAAI,MAAM;IAIb,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,EACT,GAAG,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GACtD,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAcrD,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM;IAQvB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsChD,QAAQ,IAAI,IAAI;IAkBhB,OAAO,IAAI,IAAI;IAKf;;;OAGG;IACG,aAAa,CACjB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,GACrC,OAAO,CAAC,UAAU,CAAC;CAOvB;AAED,UAAU,yBAAyB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,EAAE,CAAC;IACX,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC;IACtC,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAA8C;IAEhE;;OAEG;gBACS,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAOzE,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,EACT,GAAG,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GACtD,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IA0BrD;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI;IAenD;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B;;OAEG;IACH,SAAS,IAAI,IAAI;CAYlB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js new file mode 100644 index 00000000000..8ca18019a1f --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js @@ -0,0 +1,271 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CDPSession = exports.CDPSessionEmittedEvents = exports.Connection = exports.ConnectionEmittedEvents = void 0; +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const assert_js_1 = require("./assert.js"); +const Debug_js_1 = require("./Debug.js"); +const debugProtocolSend = Debug_js_1.debug('puppeteer:protocol:SEND ►'); +const debugProtocolReceive = Debug_js_1.debug('puppeteer:protocol:RECV ◀'); +const EventEmitter_js_1 = require("./EventEmitter.js"); +/** + * Internal events that the Connection class emits. + * + * @internal + */ +exports.ConnectionEmittedEvents = { + Disconnected: Symbol('Connection.Disconnected'), +}; +/** + * @internal + */ +class Connection extends EventEmitter_js_1.EventEmitter { + constructor(url, transport, delay = 0) { + super(); + this._lastId = 0; + this._sessions = new Map(); + this._closed = false; + this._callbacks = new Map(); + this._url = url; + this._delay = delay; + this._transport = transport; + this._transport.onmessage = this._onMessage.bind(this); + this._transport.onclose = this._onClose.bind(this); + } + static fromSession(session) { + return session._connection; + } + /** + * @param {string} sessionId + * @returns {?CDPSession} + */ + session(sessionId) { + return this._sessions.get(sessionId) || null; + } + url() { + return this._url; + } + send(method, ...paramArgs) { + // There is only ever 1 param arg passed, but the Protocol defines it as an + // array of 0 or 1 items See this comment: + // https://github.com/ChromeDevTools/devtools-protocol/pull/113#issuecomment-412603285 + // which explains why the protocol defines the params this way for better + // type-inference. + // So now we check if there are any params or not and deal with them accordingly. + const params = paramArgs.length ? paramArgs[0] : undefined; + const id = this._rawSend({ method, params }); + return new Promise((resolve, reject) => { + this._callbacks.set(id, { resolve, reject, error: new Error(), method }); + }); + } + _rawSend(message) { + const id = ++this._lastId; + message = JSON.stringify(Object.assign({}, message, { id })); + debugProtocolSend(message); + this._transport.send(message); + return id; + } + async _onMessage(message) { + if (this._delay) + await new Promise((f) => setTimeout(f, this._delay)); + debugProtocolReceive(message); + const object = JSON.parse(message); + if (object.method === 'Target.attachedToTarget') { + const sessionId = object.params.sessionId; + const session = new CDPSession(this, object.params.targetInfo.type, sessionId); + this._sessions.set(sessionId, session); + } + else if (object.method === 'Target.detachedFromTarget') { + const session = this._sessions.get(object.params.sessionId); + if (session) { + session._onClosed(); + this._sessions.delete(object.params.sessionId); + } + } + if (object.sessionId) { + const session = this._sessions.get(object.sessionId); + if (session) + session._onMessage(object); + } + else if (object.id) { + const callback = this._callbacks.get(object.id); + // Callbacks could be all rejected if someone has called `.dispose()`. + if (callback) { + this._callbacks.delete(object.id); + if (object.error) + callback.reject(createProtocolError(callback.error, callback.method, object)); + else + callback.resolve(object.result); + } + } + else { + this.emit(object.method, object.params); + } + } + _onClose() { + if (this._closed) + return; + this._closed = true; + this._transport.onmessage = null; + this._transport.onclose = null; + for (const callback of this._callbacks.values()) + callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`)); + this._callbacks.clear(); + for (const session of this._sessions.values()) + session._onClosed(); + this._sessions.clear(); + this.emit(exports.ConnectionEmittedEvents.Disconnected); + } + dispose() { + this._onClose(); + this._transport.close(); + } + /** + * @param {Protocol.Target.TargetInfo} targetInfo + * @returns {!Promise} + */ + async createSession(targetInfo) { + const { sessionId } = await this.send('Target.attachToTarget', { + targetId: targetInfo.targetId, + flatten: true, + }); + return this._sessions.get(sessionId); + } +} +exports.Connection = Connection; +/** + * Internal events that the CDPSession class emits. + * + * @internal + */ +exports.CDPSessionEmittedEvents = { + Disconnected: Symbol('CDPSession.Disconnected'), +}; +/** + * The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. + * + * @remarks + * + * Protocol methods can be called with {@link CDPSession.send} method and protocol + * events can be subscribed to with `CDPSession.on` method. + * + * Useful links: {@link https://chromedevtools.github.io/devtools-protocol/ | DevTools Protocol Viewer} + * and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md | Getting Started with DevTools Protocol}. + * + * @example + * ```js + * const client = await page.target().createCDPSession(); + * await client.send('Animation.enable'); + * client.on('Animation.animationCreated', () => console.log('Animation created!')); + * const response = await client.send('Animation.getPlaybackRate'); + * console.log('playback rate is ' + response.playbackRate); + * await client.send('Animation.setPlaybackRate', { + * playbackRate: response.playbackRate / 2 + * }); + * ``` + * + * @public + */ +class CDPSession extends EventEmitter_js_1.EventEmitter { + /** + * @internal + */ + constructor(connection, targetType, sessionId) { + super(); + this._callbacks = new Map(); + this._connection = connection; + this._targetType = targetType; + this._sessionId = sessionId; + } + send(method, ...paramArgs) { + if (!this._connection) + return Promise.reject(new Error(`Protocol error (${method}): Session closed. Most likely the ${this._targetType} has been closed.`)); + // See the comment in Connection#send explaining why we do this. + const params = paramArgs.length ? paramArgs[0] : undefined; + const id = this._connection._rawSend({ + sessionId: this._sessionId, + method, + /* TODO(jacktfranklin@): once this Firefox bug is solved + * we no longer need the `|| {}` check + * https://bugzilla.mozilla.org/show_bug.cgi?id=1631570 + */ + params: params || {}, + }); + return new Promise((resolve, reject) => { + this._callbacks.set(id, { resolve, reject, error: new Error(), method }); + }); + } + /** + * @internal + */ + _onMessage(object) { + if (object.id && this._callbacks.has(object.id)) { + const callback = this._callbacks.get(object.id); + this._callbacks.delete(object.id); + if (object.error) + callback.reject(createProtocolError(callback.error, callback.method, object)); + else + callback.resolve(object.result); + } + else { + assert_js_1.assert(!object.id); + this.emit(object.method, object.params); + } + } + /** + * Detaches the cdpSession from the target. Once detached, the cdpSession object + * won't emit any events and can't be used to send messages. + */ + async detach() { + if (!this._connection) + throw new Error(`Session already detached. Most likely the ${this._targetType} has been closed.`); + await this._connection.send('Target.detachFromTarget', { + sessionId: this._sessionId, + }); + } + /** + * @internal + */ + _onClosed() { + for (const callback of this._callbacks.values()) + callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`)); + this._callbacks.clear(); + this._connection = null; + this.emit(exports.CDPSessionEmittedEvents.Disconnected); + } +} +exports.CDPSession = CDPSession; +/** + * @param {!Error} error + * @param {string} method + * @param {{error: {message: string, data: any}}} object + * @returns {!Error} + */ +function createProtocolError(error, method, object) { + let message = `Protocol error (${method}): ${object.error.message}`; + if ('data' in object.error) + message += ` ${object.error.data}`; + return rewriteError(error, message); +} +/** + * @param {!Error} error + * @param {string} message + * @returns {!Error} + */ +function rewriteError(error, message) { + error.message = message; + return error; +} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts new file mode 100644 index 00000000000..cfe6c04c657 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts @@ -0,0 +1,22 @@ +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export interface ConnectionTransport { + send(string: any): any; + close(): any; + onmessage?: (message: string) => void; + onclose?: () => void; +} +//# sourceMappingURL=ConnectionTransport.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map new file mode 100644 index 00000000000..7b55f821811 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ConnectionTransport.d.ts","sourceRoot":"","sources":["../../../../src/common/ConnectionTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,MAAM,KAAA,OAAE;IACb,KAAK,QAAG;IACR,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.js similarity index 88% rename from front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js rename to front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.js index 0188e3a5de5..9f20b2da41e 100644 --- a/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.js @@ -1,3 +1,4 @@ +"use strict"; /** * Copyright 2020 Google Inc. All rights reserved. * @@ -13,3 +14,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts new file mode 100644 index 00000000000..0ca5f94dd3f --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts @@ -0,0 +1,68 @@ +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { JSHandle } from './JSHandle.js'; +/** + * @public + */ +export interface ConsoleMessageLocation { + /** + * URL of the resource if known or `undefined` otherwise. + */ + url?: string; + /** + * 0-based line number in the resource if known or `undefined` otherwise. + */ + lineNumber?: number; + /** + * 0-based column number in the resource if known or `undefined` otherwise. + */ + columnNumber?: number; +} +/** + * The supported types for console messages. + */ +export declare type ConsoleMessageType = 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd' | 'verbose'; +/** + * ConsoleMessage objects are dispatched by page via the 'console' event. + * @public + */ +export declare class ConsoleMessage { + private _type; + private _text; + private _args; + private _location; + /** + * @public + */ + constructor(type: ConsoleMessageType, text: string, args: JSHandle[], location?: ConsoleMessageLocation); + /** + * @returns The type of the console message. + */ + type(): ConsoleMessageType; + /** + * @returns The text of the console message. + */ + text(): string; + /** + * @returns An array of arguments passed to the console. + */ + args(): JSHandle[]; + /** + * @returns The location of the console message. + */ + location(): ConsoleMessageLocation; +} +//# sourceMappingURL=ConsoleMessage.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map new file mode 100644 index 00000000000..b241d856c42 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ConsoleMessage.d.ts","sourceRoot":"","sources":["../../../../src/common/ConsoleMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,kBAAkB,GAC1B,KAAK,GACL,OAAO,GACP,MAAM,GACN,OAAO,GACP,SAAS,GACT,KAAK,GACL,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,YAAY,GACZ,qBAAqB,GACrB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,OAAO,GACP,SAAS,GACT,SAAS,CAAC;AAEd;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAyB;IAE1C;;OAEG;gBAED,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,EAAE,EAChB,QAAQ,GAAE,sBAA2B;IAQvC;;OAEG;IACH,IAAI,IAAI,kBAAkB;IAI1B;;OAEG;IACH,IAAI,IAAI,MAAM;IAId;;OAEG;IACH,IAAI,IAAI,QAAQ,EAAE;IAIlB;;OAEG;IACH,QAAQ,IAAI,sBAAsB;CAGnC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js new file mode 100644 index 00000000000..7f2edb39cf0 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js @@ -0,0 +1,58 @@ +"use strict"; +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ConsoleMessage = void 0; +/** + * ConsoleMessage objects are dispatched by page via the 'console' event. + * @public + */ +class ConsoleMessage { + /** + * @public + */ + constructor(type, text, args, location = {}) { + this._type = type; + this._text = text; + this._args = args; + this._location = location; + } + /** + * @returns The type of the console message. + */ + type() { + return this._type; + } + /** + * @returns The text of the console message. + */ + text() { + return this._text; + } + /** + * @returns An array of arguments passed to the console. + */ + args() { + return this._args; + } + /** + * @returns The location of the console message. + */ + location() { + return this._location; + } +} +exports.ConsoleMessage = ConsoleMessage; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts new file mode 100644 index 00000000000..0233eaac1fc --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts @@ -0,0 +1,181 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Protocol } from 'devtools-protocol'; + +import { CDPSession } from './Connection.js'; +import { PuppeteerEventListener } from './helper.js'; + +/** + * The CoverageEntry class represents one entry of the coverage report. + * @public + */ +export interface CoverageEntry { + /** + * The URL of the style sheet or script. + */ + url: string; + /** + * The content of the style sheet or script. + */ + text: string; + /** + * The covered range as start and end positions. + */ + ranges: Array<{ + start: number; + end: number; + }>; +} +/** + * Set of configurable options for JS coverage. + * @public + */ +export interface JSCoverageOptions { + /** + * Whether to reset coverage on every navigation. + */ + resetOnNavigation?: boolean; + /** + * Whether anonymous scripts generated by the page should be reported. + */ + reportAnonymousScripts?: boolean; +} +/** + * Set of configurable options for CSS coverage. + * @public + */ +export interface CSSCoverageOptions { + /** + * Whether to reset coverage on every navigation. + */ + resetOnNavigation?: boolean; +} +/** + * The Coverage class provides methods to gathers information about parts of + * JavaScript and CSS that were used by the page. + * + * @remarks + * To output coverage in a form consumable by {@link https://github.com/istanbuljs | Istanbul}, + * see {@link https://github.com/istanbuljs/puppeteer-to-istanbul | puppeteer-to-istanbul}. + * + * @example + * An example of using JavaScript and CSS coverage to get percentage of initially + * executed code: + * ```js + * // Enable both JavaScript and CSS coverage + * await Promise.all([ + * page.coverage.startJSCoverage(), + * page.coverage.startCSSCoverage() + * ]); + * // Navigate to page + * await page.goto('https://example.com'); + * // Disable both JavaScript and CSS coverage + * const [jsCoverage, cssCoverage] = await Promise.all([ + * page.coverage.stopJSCoverage(), + * page.coverage.stopCSSCoverage(), + * ]); + * let totalBytes = 0; + * let usedBytes = 0; + * const coverage = [...jsCoverage, ...cssCoverage]; + * for (const entry of coverage) { + * totalBytes += entry.text.length; + * for (const range of entry.ranges) + * usedBytes += range.end - range.start - 1; + * } + * console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`); + * ``` + * @public + */ +export declare class Coverage { + /** + * @internal + */ + _jsCoverage: JSCoverage; + /** + * @internal + */ + _cssCoverage: CSSCoverage; + constructor(client: CDPSession); + /** + * @param options - defaults to + * `{ resetOnNavigation : true, reportAnonymousScripts : false }` + * @returns Promise that resolves when coverage is started. + * + * @remarks + * Anonymous scripts are ones that don't have an associated url. These are + * scripts that are dynamically created on the page using `eval` or + * `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous + * scripts will have `__puppeteer_evaluation_script__` as their URL. + */ + startJSCoverage(options?: JSCoverageOptions): Promise; + /** + * @returns Promise that resolves to the array of coverage reports for + * all scripts. + * + * @remarks + * JavaScript Coverage doesn't include anonymous scripts by default. + * However, scripts with sourceURLs are reported. + */ + stopJSCoverage(): Promise; + /** + * @param options - defaults to `{ resetOnNavigation : true }` + * @returns Promise that resolves when coverage is started. + */ + startCSSCoverage(options?: CSSCoverageOptions): Promise; + /** + * @returns Promise that resolves to the array of coverage reports + * for all stylesheets. + * @remarks + * CSS Coverage doesn't include dynamically injected style tags + * without sourceURLs. + */ + stopCSSCoverage(): Promise; +} +declare class JSCoverage { + _client: CDPSession; + _enabled: boolean; + _scriptURLs: Map; + _scriptSources: Map; + _eventListeners: PuppeteerEventListener[]; + _resetOnNavigation: boolean; + _reportAnonymousScripts: boolean; + constructor(client: CDPSession); + start(options?: { + resetOnNavigation?: boolean; + reportAnonymousScripts?: boolean; + }): Promise; + _onExecutionContextsCleared(): void; + _onScriptParsed(event: Protocol.Debugger.ScriptParsedEvent): Promise; + stop(): Promise; +} +declare class CSSCoverage { + _client: CDPSession; + _enabled: boolean; + _stylesheetURLs: Map; + _stylesheetSources: Map; + _eventListeners: PuppeteerEventListener[]; + _resetOnNavigation: boolean; + _reportAnonymousScripts: boolean; + constructor(client: CDPSession); + start(options?: { + resetOnNavigation?: boolean; + }): Promise; + _onExecutionContextsCleared(): void; + _onStyleSheet(event: Protocol.CSS.StyleSheetAddedEvent): Promise; + stop(): Promise; +} +export {}; +//# sourceMappingURL=Coverage.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map new file mode 100644 index 00000000000..cb4f25d4194 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Coverage.d.ts","sourceRoot":"","sources":["../../../../src/common/Coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAsB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,QAAQ;IACnB;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,YAAY,EAAE,WAAW,CAAC;gBAEd,MAAM,EAAE,UAAU;IAK9B;;;;;;;;;;OAUG;IACG,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;;;;;OAOG;IACG,cAAc,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAIhD;;;OAGG;IACG,gBAAgB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE;;;;;;OAMG;IACG,eAAe,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAGlD;AAED,cAAM,UAAU;IACd,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,UAAS;IACjB,WAAW,sBAA6B;IACxC,cAAc,sBAA6B;IAC3C,eAAe,EAAE,sBAAsB,EAAE,CAAM;IAC/C,kBAAkB,UAAS;IAC3B,uBAAuB,UAAS;gBAEpB,MAAM,EAAE,UAAU;IAIxB,KAAK,CACT,OAAO,GAAE;QACP,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAC7B,GACL,OAAO,CAAC,IAAI,CAAC;IAkChB,2BAA2B,IAAI,IAAI;IAM7B,eAAe,CACnB,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,GACzC,OAAO,CAAC,IAAI,CAAC;IAiBV,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAkCvC;AAED,cAAM,WAAW;IACf,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,UAAS;IACjB,eAAe,sBAA6B;IAC5C,kBAAkB,sBAA6B;IAC/C,eAAe,EAAE,sBAAsB,EAAE,CAAM;IAC/C,kBAAkB,UAAS;IAC3B,uBAAuB,UAAS;gBAEpB,MAAM,EAAE,UAAU;IAIxB,KAAK,CAAC,OAAO,GAAE;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BzE,2BAA2B,IAAI,IAAI;IAM7B,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBtE,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAuCvC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js new file mode 100644 index 00000000000..9bb4d3ed7e0 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js @@ -0,0 +1,319 @@ +"use strict"; +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Coverage = void 0; +const assert_js_1 = require("./assert.js"); +const helper_js_1 = require("./helper.js"); +const ExecutionContext_js_1 = require("./ExecutionContext.js"); +/** + * The Coverage class provides methods to gathers information about parts of + * JavaScript and CSS that were used by the page. + * + * @remarks + * To output coverage in a form consumable by {@link https://github.com/istanbuljs | Istanbul}, + * see {@link https://github.com/istanbuljs/puppeteer-to-istanbul | puppeteer-to-istanbul}. + * + * @example + * An example of using JavaScript and CSS coverage to get percentage of initially + * executed code: + * ```js + * // Enable both JavaScript and CSS coverage + * await Promise.all([ + * page.coverage.startJSCoverage(), + * page.coverage.startCSSCoverage() + * ]); + * // Navigate to page + * await page.goto('https://example.com'); + * // Disable both JavaScript and CSS coverage + * const [jsCoverage, cssCoverage] = await Promise.all([ + * page.coverage.stopJSCoverage(), + * page.coverage.stopCSSCoverage(), + * ]); + * let totalBytes = 0; + * let usedBytes = 0; + * const coverage = [...jsCoverage, ...cssCoverage]; + * for (const entry of coverage) { + * totalBytes += entry.text.length; + * for (const range of entry.ranges) + * usedBytes += range.end - range.start - 1; + * } + * console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`); + * ``` + * @public + */ +class Coverage { + constructor(client) { + this._jsCoverage = new JSCoverage(client); + this._cssCoverage = new CSSCoverage(client); + } + /** + * @param options - defaults to + * `{ resetOnNavigation : true, reportAnonymousScripts : false }` + * @returns Promise that resolves when coverage is started. + * + * @remarks + * Anonymous scripts are ones that don't have an associated url. These are + * scripts that are dynamically created on the page using `eval` or + * `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous + * scripts will have `__puppeteer_evaluation_script__` as their URL. + */ + async startJSCoverage(options = {}) { + return await this._jsCoverage.start(options); + } + /** + * @returns Promise that resolves to the array of coverage reports for + * all scripts. + * + * @remarks + * JavaScript Coverage doesn't include anonymous scripts by default. + * However, scripts with sourceURLs are reported. + */ + async stopJSCoverage() { + return await this._jsCoverage.stop(); + } + /** + * @param options - defaults to `{ resetOnNavigation : true }` + * @returns Promise that resolves when coverage is started. + */ + async startCSSCoverage(options = {}) { + return await this._cssCoverage.start(options); + } + /** + * @returns Promise that resolves to the array of coverage reports + * for all stylesheets. + * @remarks + * CSS Coverage doesn't include dynamically injected style tags + * without sourceURLs. + */ + async stopCSSCoverage() { + return await this._cssCoverage.stop(); + } +} +exports.Coverage = Coverage; +class JSCoverage { + constructor(client) { + this._enabled = false; + this._scriptURLs = new Map(); + this._scriptSources = new Map(); + this._eventListeners = []; + this._resetOnNavigation = false; + this._reportAnonymousScripts = false; + this._client = client; + } + async start(options = {}) { + assert_js_1.assert(!this._enabled, 'JSCoverage is already enabled'); + const { resetOnNavigation = true, reportAnonymousScripts = false, } = options; + this._resetOnNavigation = resetOnNavigation; + this._reportAnonymousScripts = reportAnonymousScripts; + this._enabled = true; + this._scriptURLs.clear(); + this._scriptSources.clear(); + this._eventListeners = [ + helper_js_1.helper.addEventListener(this._client, 'Debugger.scriptParsed', this._onScriptParsed.bind(this)), + helper_js_1.helper.addEventListener(this._client, 'Runtime.executionContextsCleared', this._onExecutionContextsCleared.bind(this)), + ]; + await Promise.all([ + this._client.send('Profiler.enable'), + this._client.send('Profiler.startPreciseCoverage', { + callCount: false, + detailed: true, + }), + this._client.send('Debugger.enable'), + this._client.send('Debugger.setSkipAllPauses', { skip: true }), + ]); + } + _onExecutionContextsCleared() { + if (!this._resetOnNavigation) + return; + this._scriptURLs.clear(); + this._scriptSources.clear(); + } + async _onScriptParsed(event) { + // Ignore puppeteer-injected scripts + if (event.url === ExecutionContext_js_1.EVALUATION_SCRIPT_URL) + return; + // Ignore other anonymous scripts unless the reportAnonymousScripts option is true. + if (!event.url && !this._reportAnonymousScripts) + return; + try { + const response = await this._client.send('Debugger.getScriptSource', { + scriptId: event.scriptId, + }); + this._scriptURLs.set(event.scriptId, event.url); + this._scriptSources.set(event.scriptId, response.scriptSource); + } + catch (error) { + // This might happen if the page has already navigated away. + helper_js_1.debugError(error); + } + } + async stop() { + assert_js_1.assert(this._enabled, 'JSCoverage is not enabled'); + this._enabled = false; + const result = await Promise.all([ + this._client.send('Profiler.takePreciseCoverage'), + this._client.send('Profiler.stopPreciseCoverage'), + this._client.send('Profiler.disable'), + this._client.send('Debugger.disable'), + ]); + helper_js_1.helper.removeEventListeners(this._eventListeners); + const coverage = []; + const profileResponse = result[0]; + for (const entry of profileResponse.result) { + let url = this._scriptURLs.get(entry.scriptId); + if (!url && this._reportAnonymousScripts) + url = 'debugger://VM' + entry.scriptId; + const text = this._scriptSources.get(entry.scriptId); + if (text === undefined || url === undefined) + continue; + const flattenRanges = []; + for (const func of entry.functions) + flattenRanges.push(...func.ranges); + const ranges = convertToDisjointRanges(flattenRanges); + coverage.push({ url, ranges, text }); + } + return coverage; + } +} +class CSSCoverage { + constructor(client) { + this._enabled = false; + this._stylesheetURLs = new Map(); + this._stylesheetSources = new Map(); + this._eventListeners = []; + this._resetOnNavigation = false; + this._reportAnonymousScripts = false; + this._client = client; + } + async start(options = {}) { + assert_js_1.assert(!this._enabled, 'CSSCoverage is already enabled'); + const { resetOnNavigation = true } = options; + this._resetOnNavigation = resetOnNavigation; + this._enabled = true; + this._stylesheetURLs.clear(); + this._stylesheetSources.clear(); + this._eventListeners = [ + helper_js_1.helper.addEventListener(this._client, 'CSS.styleSheetAdded', this._onStyleSheet.bind(this)), + helper_js_1.helper.addEventListener(this._client, 'Runtime.executionContextsCleared', this._onExecutionContextsCleared.bind(this)), + ]; + await Promise.all([ + this._client.send('DOM.enable'), + this._client.send('CSS.enable'), + this._client.send('CSS.startRuleUsageTracking'), + ]); + } + _onExecutionContextsCleared() { + if (!this._resetOnNavigation) + return; + this._stylesheetURLs.clear(); + this._stylesheetSources.clear(); + } + async _onStyleSheet(event) { + const header = event.header; + // Ignore anonymous scripts + if (!header.sourceURL) + return; + try { + const response = await this._client.send('CSS.getStyleSheetText', { + styleSheetId: header.styleSheetId, + }); + this._stylesheetURLs.set(header.styleSheetId, header.sourceURL); + this._stylesheetSources.set(header.styleSheetId, response.text); + } + catch (error) { + // This might happen if the page has already navigated away. + helper_js_1.debugError(error); + } + } + async stop() { + assert_js_1.assert(this._enabled, 'CSSCoverage is not enabled'); + this._enabled = false; + const ruleTrackingResponse = await this._client.send('CSS.stopRuleUsageTracking'); + await Promise.all([ + this._client.send('CSS.disable'), + this._client.send('DOM.disable'), + ]); + helper_js_1.helper.removeEventListeners(this._eventListeners); + // aggregate by styleSheetId + const styleSheetIdToCoverage = new Map(); + for (const entry of ruleTrackingResponse.ruleUsage) { + let ranges = styleSheetIdToCoverage.get(entry.styleSheetId); + if (!ranges) { + ranges = []; + styleSheetIdToCoverage.set(entry.styleSheetId, ranges); + } + ranges.push({ + startOffset: entry.startOffset, + endOffset: entry.endOffset, + count: entry.used ? 1 : 0, + }); + } + const coverage = []; + for (const styleSheetId of this._stylesheetURLs.keys()) { + const url = this._stylesheetURLs.get(styleSheetId); + const text = this._stylesheetSources.get(styleSheetId); + const ranges = convertToDisjointRanges(styleSheetIdToCoverage.get(styleSheetId) || []); + coverage.push({ url, ranges, text }); + } + return coverage; + } +} +function convertToDisjointRanges(nestedRanges) { + const points = []; + for (const range of nestedRanges) { + points.push({ offset: range.startOffset, type: 0, range }); + points.push({ offset: range.endOffset, type: 1, range }); + } + // Sort points to form a valid parenthesis sequence. + points.sort((a, b) => { + // Sort with increasing offsets. + if (a.offset !== b.offset) + return a.offset - b.offset; + // All "end" points should go before "start" points. + if (a.type !== b.type) + return b.type - a.type; + const aLength = a.range.endOffset - a.range.startOffset; + const bLength = b.range.endOffset - b.range.startOffset; + // For two "start" points, the one with longer range goes first. + if (a.type === 0) + return bLength - aLength; + // For two "end" points, the one with shorter range goes first. + return aLength - bLength; + }); + const hitCountStack = []; + const results = []; + let lastOffset = 0; + // Run scanning line to intersect all ranges. + for (const point of points) { + if (hitCountStack.length && + lastOffset < point.offset && + hitCountStack[hitCountStack.length - 1] > 0) { + const lastResult = results.length ? results[results.length - 1] : null; + if (lastResult && lastResult.end === lastOffset) + lastResult.end = point.offset; + else + results.push({ start: lastOffset, end: point.offset }); + } + lastOffset = point.offset; + if (point.type === 0) + hitCountStack.push(point.range.count); + else + hitCountStack.pop(); + } + // Filter out empty ranges. + return results.filter((range) => range.end - range.start > 1); +} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts new file mode 100644 index 00000000000..a2276edb037 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts @@ -0,0 +1,136 @@ +/** + * Copyright 2019 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// +import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike , WrapElementHandle} from './EvalTypes.js'; +import { ExecutionContext } from './ExecutionContext.js'; +import { Frame , FrameManager} from './FrameManager.js'; +import { MouseButton } from './Input.js'; +import { ElementHandle , JSHandle} from './JSHandle.js'; +import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js'; +import { TimeoutSettings } from './TimeoutSettings.js'; + +/** + * @public + */ +export interface WaitForSelectorOptions { + visible?: boolean; + hidden?: boolean; + timeout?: number; +} +/** + * @internal + */ +export declare class DOMWorld { + private _frameManager; + private _frame; + private _timeoutSettings; + private _documentPromise?; + private _contextPromise?; + private _contextResolveCallback?; + private _detached; + /** + * internal + */ + _waitTasks: Set; + constructor(frameManager: FrameManager, frame: Frame, timeoutSettings: TimeoutSettings); + frame(): Frame; + _setContext(context?: ExecutionContext): void; + _hasContext(): boolean; + _detach(): void; + executionContext(): Promise; + evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; + evaluate(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise>>; + $(selector: string): Promise; + _document(): Promise; + $x(expression: string): Promise; + $eval(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; + $$eval(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; + $$(selector: string): Promise; + content(): Promise; + setContent(html: string, options?: { + timeout?: number; + waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; + }): Promise; + /** + * Adds a script tag into the current context. + * + * @remarks + * + * You can pass a URL, filepath or string of contents. Note that when running Puppeteer + * in a browser environment you cannot pass a filepath and should use either + * `url` or `content`. + */ + addScriptTag(options: { + url?: string; + path?: string; + content?: string; + type?: string; + }): Promise; + /** + * Adds a style tag into the current context. + * + * @remarks + * + * You can pass a URL, filepath or string of contents. Note that when running Puppeteer + * in a browser environment you cannot pass a filepath and should use either + * `url` or `content`. + * + */ + addStyleTag(options: { + url?: string; + path?: string; + content?: string; + }): Promise; + click(selector: string, options: { + delay?: number; + button?: MouseButton; + clickCount?: number; + }): Promise; + focus(selector: string): Promise; + hover(selector: string): Promise; + select(selector: string, ...values: string[]): Promise; + tap(selector: string): Promise; + type(selector: string, text: string, options?: { + delay: number; + }): Promise; + waitForSelector(selector: string, options: WaitForSelectorOptions): Promise; + waitForXPath(xpath: string, options: WaitForSelectorOptions): Promise; + waitForFunction(pageFunction: Function | string, options?: { + polling?: string | number; + timeout?: number; + }, ...args: SerializableOrJSHandle[]): Promise; + title(): Promise; + private _waitForSelectorOrXPath; +} +declare class WaitTask { + _domWorld: DOMWorld; + _polling: string | number; + _timeout: number; + _predicateBody: string; + _args: SerializableOrJSHandle[]; + _runCount: number; + promise: Promise; + _resolve: (x: JSHandle) => void; + _reject: (x: Error) => void; + _timeoutTimer?: NodeJS.Timeout; + _terminated: boolean; + constructor(domWorld: DOMWorld, predicateBody: Function | string, predicateQueryHandlerBody: Function | string | undefined, title: string, polling: string | number, timeout: number, ...args: SerializableOrJSHandle[]); + terminate(error: Error): void; + rerun(): Promise; + _cleanup(): void; +} +export {}; +//# sourceMappingURL=DOMWorld.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map new file mode 100644 index 00000000000..cc6a070e792 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMWorld.d.ts","sourceRoot":"","sources":["../../../../src/common/DOMWorld.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAIH,OAAO,EAEL,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAUxB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,gBAAgB,CAAC,CAAgC;IACzD,OAAO,CAAC,eAAe,CAAC,CAAmC;IAE3D,OAAO,CAAC,uBAAuB,CAAC,CAAwC;IAExE,OAAO,CAAC,SAAS,CAAS;IAC1B;;OAEG;IACH,UAAU,gBAAuB;gBAG/B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe;IAQlC,KAAK,IAAI,KAAK;IAId,WAAW,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAa7C,WAAW,IAAI,OAAO;IAItB,OAAO,IAAI,IAAI;IAQf,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAQvC,cAAc,CAAC,WAAW,SAAS,QAAQ,GAAG,QAAQ,EAC1D,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,WAAW,CAAC;IAKjB,QAAQ,CAAC,CAAC,SAAS,UAAU,EACjC,YAAY,EAAE,CAAC,EACf,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAQhD,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAMlD,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC;IASnC,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAMhD,KAAK,CAAC,UAAU,EACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CACZ,OAAO,EAAE,OAAO,EAChB,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,EACrC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAKnC,MAAM,CAAC,UAAU,EACrB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,EACrC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAUnC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAM9C,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAW1B,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,CAAC;KAC5D,GACL,OAAO,CAAC,IAAI,CAAC;IA0BhB;;;;;;;;OAQG;IACG,YAAY,CAAC,OAAO,EAAE;QAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,aAAa,CAAC;IA0E1B;;;;;;;;;OASG;IACG,WAAW,CAAC,OAAO,EAAE;QACzB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoEpB,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACrE,OAAO,CAAC,IAAI,CAAC;IAOV,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQhE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOpC,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;IAOhB,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIhC,YAAY,CACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIhC,eAAe,CACb,YAAY,EAAE,QAAQ,GAAG,MAAM,EAC/B,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,EAC7D,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,QAAQ,CAAC;IAgBd,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;YAIhB,uBAAuB;CAyEtC;AAED,cAAM,QAAQ;IACZ,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,SAAS,SAAK;IACd,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IAC/B,WAAW,UAAS;gBAGlB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,QAAQ,GAAG,MAAM,EAChC,yBAAyB,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,EACxD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,GAAG,IAAI,EAAE,sBAAsB,EAAE;IAsDnC,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAMvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoD5B,QAAQ,IAAI,IAAI;CAIjB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js new file mode 100644 index 00000000000..d0a17eae3c0 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js @@ -0,0 +1,520 @@ +"use strict"; +/** + * Copyright 2019 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DOMWorld = void 0; +const assert_js_1 = require("./assert.js"); +const helper_js_1 = require("./helper.js"); +const LifecycleWatcher_js_1 = require("./LifecycleWatcher.js"); +const Errors_js_1 = require("./Errors.js"); +const QueryHandler_js_1 = require("./QueryHandler.js"); +const environment_js_1 = require("../environment.js"); +/** + * @internal + */ +class DOMWorld { + constructor(frameManager, frame, timeoutSettings) { + this._documentPromise = null; + this._contextPromise = null; + this._contextResolveCallback = null; + this._detached = false; + /** + * internal + */ + this._waitTasks = new Set(); + this._frameManager = frameManager; + this._frame = frame; + this._timeoutSettings = timeoutSettings; + this._setContext(null); + } + frame() { + return this._frame; + } + _setContext(context) { + if (context) { + this._contextResolveCallback.call(null, context); + this._contextResolveCallback = null; + for (const waitTask of this._waitTasks) + waitTask.rerun(); + } + else { + this._documentPromise = null; + this._contextPromise = new Promise((fulfill) => { + this._contextResolveCallback = fulfill; + }); + } + } + _hasContext() { + return !this._contextResolveCallback; + } + _detach() { + this._detached = true; + for (const waitTask of this._waitTasks) + waitTask.terminate(new Error('waitForFunction failed: frame got detached.')); + } + executionContext() { + if (this._detached) + throw new Error(`Execution Context is not available in detached frame "${this._frame.url()}" (are you trying to evaluate?)`); + return this._contextPromise; + } + async evaluateHandle(pageFunction, ...args) { + const context = await this.executionContext(); + return context.evaluateHandle(pageFunction, ...args); + } + async evaluate(pageFunction, ...args) { + const context = await this.executionContext(); + return context.evaluate(pageFunction, ...args); + } + async $(selector) { + const document = await this._document(); + const value = await document.$(selector); + return value; + } + async _document() { + if (this._documentPromise) + return this._documentPromise; + this._documentPromise = this.executionContext().then(async (context) => { + const document = await context.evaluateHandle('document'); + return document.asElement(); + }); + return this._documentPromise; + } + async $x(expression) { + const document = await this._document(); + const value = await document.$x(expression); + return value; + } + async $eval(selector, pageFunction, ...args) { + const document = await this._document(); + return document.$eval(selector, pageFunction, ...args); + } + async $$eval(selector, pageFunction, ...args) { + const document = await this._document(); + const value = await document.$$eval(selector, pageFunction, ...args); + return value; + } + async $$(selector) { + const document = await this._document(); + const value = await document.$$(selector); + return value; + } + async content() { + return await this.evaluate(() => { + let retVal = ''; + if (document.doctype) + retVal = new XMLSerializer().serializeToString(document.doctype); + if (document.documentElement) + retVal += document.documentElement.outerHTML; + return retVal; + }); + } + async setContent(html, options = {}) { + const { waitUntil = ['load'], timeout = this._timeoutSettings.navigationTimeout(), } = options; + // We rely upon the fact that document.open() will reset frame lifecycle with "init" + // lifecycle event. @see https://crrev.com/608658 + await this.evaluate((html) => { + document.open(); + document.write(html); + document.close(); + }, html); + const watcher = new LifecycleWatcher_js_1.LifecycleWatcher(this._frameManager, this._frame, waitUntil, timeout); + const error = await Promise.race([ + watcher.timeoutOrTerminationPromise(), + watcher.lifecyclePromise(), + ]); + watcher.dispose(); + if (error) + throw error; + } + /** + * Adds a script tag into the current context. + * + * @remarks + * + * You can pass a URL, filepath or string of contents. Note that when running Puppeteer + * in a browser environment you cannot pass a filepath and should use either + * `url` or `content`. + */ + async addScriptTag(options) { + const { url = null, path = null, content = null, type = '' } = options; + if (url !== null) { + try { + const context = await this.executionContext(); + return (await context.evaluateHandle(addScriptUrl, url, type)).asElement(); + } + catch (error) { + throw new Error(`Loading script from ${url} failed`); + } + } + if (path !== null) { + if (!environment_js_1.isNode) { + throw new Error('Cannot pass a filepath to addScriptTag in the browser environment.'); + } + // eslint-disable-next-line @typescript-eslint/no-var-requires + const fs = require('fs'); + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { promisify } = require('util'); + const readFileAsync = promisify(fs.readFile); + let contents = await readFileAsync(path, 'utf8'); + contents += '//# sourceURL=' + path.replace(/\n/g, ''); + const context = await this.executionContext(); + return (await context.evaluateHandle(addScriptContent, contents, type)).asElement(); + } + if (content !== null) { + const context = await this.executionContext(); + return (await context.evaluateHandle(addScriptContent, content, type)).asElement(); + } + throw new Error('Provide an object with a `url`, `path` or `content` property'); + async function addScriptUrl(url, type) { + const script = document.createElement('script'); + script.src = url; + if (type) + script.type = type; + const promise = new Promise((res, rej) => { + script.onload = res; + script.onerror = rej; + }); + document.head.appendChild(script); + await promise; + return script; + } + function addScriptContent(content, type = 'text/javascript') { + const script = document.createElement('script'); + script.type = type; + script.text = content; + let error = null; + script.onerror = (e) => (error = e); + document.head.appendChild(script); + if (error) + throw error; + return script; + } + } + /** + * Adds a style tag into the current context. + * + * @remarks + * + * You can pass a URL, filepath or string of contents. Note that when running Puppeteer + * in a browser environment you cannot pass a filepath and should use either + * `url` or `content`. + * + */ + async addStyleTag(options) { + const { url = null, path = null, content = null } = options; + if (url !== null) { + try { + const context = await this.executionContext(); + return (await context.evaluateHandle(addStyleUrl, url)).asElement(); + } + catch (error) { + throw new Error(`Loading style from ${url} failed`); + } + } + if (path !== null) { + if (!environment_js_1.isNode) { + throw new Error('Cannot pass a filepath to addStyleTag in the browser environment.'); + } + // eslint-disable-next-line @typescript-eslint/no-var-requires + const fs = require('fs'); + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { promisify } = require('util'); + const readFileAsync = promisify(fs.readFile); + let contents = await readFileAsync(path, 'utf8'); + contents += '/*# sourceURL=' + path.replace(/\n/g, '') + '*/'; + const context = await this.executionContext(); + return (await context.evaluateHandle(addStyleContent, contents)).asElement(); + } + if (content !== null) { + const context = await this.executionContext(); + return (await context.evaluateHandle(addStyleContent, content)).asElement(); + } + throw new Error('Provide an object with a `url`, `path` or `content` property'); + async function addStyleUrl(url) { + const link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = url; + const promise = new Promise((res, rej) => { + link.onload = res; + link.onerror = rej; + }); + document.head.appendChild(link); + await promise; + return link; + } + async function addStyleContent(content) { + const style = document.createElement('style'); + style.type = 'text/css'; + style.appendChild(document.createTextNode(content)); + const promise = new Promise((res, rej) => { + style.onload = res; + style.onerror = rej; + }); + document.head.appendChild(style); + await promise; + return style; + } + } + async click(selector, options) { + const handle = await this.$(selector); + assert_js_1.assert(handle, 'No node found for selector: ' + selector); + await handle.click(options); + await handle.dispose(); + } + async focus(selector) { + const handle = await this.$(selector); + assert_js_1.assert(handle, 'No node found for selector: ' + selector); + await handle.focus(); + await handle.dispose(); + } + async hover(selector) { + const handle = await this.$(selector); + assert_js_1.assert(handle, 'No node found for selector: ' + selector); + await handle.hover(); + await handle.dispose(); + } + async select(selector, ...values) { + const handle = await this.$(selector); + assert_js_1.assert(handle, 'No node found for selector: ' + selector); + const result = await handle.select(...values); + await handle.dispose(); + return result; + } + async tap(selector) { + const handle = await this.$(selector); + assert_js_1.assert(handle, 'No node found for selector: ' + selector); + await handle.tap(); + await handle.dispose(); + } + async type(selector, text, options) { + const handle = await this.$(selector); + assert_js_1.assert(handle, 'No node found for selector: ' + selector); + await handle.type(text, options); + await handle.dispose(); + } + waitForSelector(selector, options) { + return this._waitForSelectorOrXPath(selector, false, options); + } + waitForXPath(xpath, options) { + return this._waitForSelectorOrXPath(xpath, true, options); + } + waitForFunction(pageFunction, options = {}, ...args) { + const { polling = 'raf', timeout = this._timeoutSettings.timeout(), } = options; + return new WaitTask(this, pageFunction, undefined, 'function', polling, timeout, ...args).promise; + } + async title() { + return this.evaluate(() => document.title); + } + async _waitForSelectorOrXPath(selectorOrXPath, isXPath, options = {}) { + const { visible: waitForVisible = false, hidden: waitForHidden = false, timeout = this._timeoutSettings.timeout(), } = options; + const polling = waitForVisible || waitForHidden ? 'raf' : 'mutation'; + const title = `${isXPath ? 'XPath' : 'selector'} "${selectorOrXPath}"${waitForHidden ? ' to be hidden' : ''}`; + const { updatedSelector, queryHandler } = QueryHandler_js_1.getQueryHandlerAndSelector(selectorOrXPath); + const waitTask = new WaitTask(this, predicate, queryHandler.queryOne, title, polling, timeout, updatedSelector, isXPath, waitForVisible, waitForHidden); + const handle = await waitTask.promise; + if (!handle.asElement()) { + await handle.dispose(); + return null; + } + return handle.asElement(); + function predicate(selectorOrXPath, isXPath, waitForVisible, waitForHidden) { + const node = isXPath + ? document.evaluate(selectorOrXPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue + : predicateQueryHandler + ? predicateQueryHandler(document, selectorOrXPath) + : document.querySelector(selectorOrXPath); + if (!node) + return waitForHidden; + if (!waitForVisible && !waitForHidden) + return node; + const element = node.nodeType === Node.TEXT_NODE + ? node.parentElement + : node; + const style = window.getComputedStyle(element); + const isVisible = style && style.visibility !== 'hidden' && hasVisibleBoundingBox(); + const success = waitForVisible === isVisible || waitForHidden === !isVisible; + return success ? node : null; + function hasVisibleBoundingBox() { + const rect = element.getBoundingClientRect(); + return !!(rect.top || rect.bottom || rect.width || rect.height); + } + } + } +} +exports.DOMWorld = DOMWorld; +class WaitTask { + constructor(domWorld, predicateBody, predicateQueryHandlerBody, title, polling, timeout, ...args) { + this._runCount = 0; + this._terminated = false; + if (helper_js_1.helper.isString(polling)) + assert_js_1.assert(polling === 'raf' || polling === 'mutation', 'Unknown polling option: ' + polling); + else if (helper_js_1.helper.isNumber(polling)) + assert_js_1.assert(polling > 0, 'Cannot poll with non-positive interval: ' + polling); + else + throw new Error('Unknown polling options: ' + polling); + function getPredicateBody(predicateBody, predicateQueryHandlerBody) { + if (helper_js_1.helper.isString(predicateBody)) + return `return (${predicateBody});`; + if (predicateQueryHandlerBody) { + return ` + return (function wrapper(args) { + const predicateQueryHandler = ${predicateQueryHandlerBody}; + return (${predicateBody})(...args); + })(args);`; + } + return `return (${predicateBody})(...args);`; + } + this._domWorld = domWorld; + this._polling = polling; + this._timeout = timeout; + this._predicateBody = getPredicateBody(predicateBody, predicateQueryHandlerBody); + this._args = args; + this._runCount = 0; + domWorld._waitTasks.add(this); + this.promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + }); + // Since page navigation requires us to re-install the pageScript, we should track + // timeout on our end. + if (timeout) { + const timeoutError = new Errors_js_1.TimeoutError(`waiting for ${title} failed: timeout ${timeout}ms exceeded`); + this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), timeout); + } + this.rerun(); + } + terminate(error) { + this._terminated = true; + this._reject(error); + this._cleanup(); + } + async rerun() { + const runCount = ++this._runCount; + /** @type {?JSHandle} */ + let success = null; + let error = null; + try { + success = await (await this._domWorld.executionContext()).evaluateHandle(waitForPredicatePageFunction, this._predicateBody, this._polling, this._timeout, ...this._args); + } + catch (error_) { + error = error_; + } + if (this._terminated || runCount !== this._runCount) { + if (success) + await success.dispose(); + return; + } + // Ignore timeouts in pageScript - we track timeouts ourselves. + // If the frame's execution context has already changed, `frame.evaluate` will + // throw an error - ignore this predicate run altogether. + if (!error && + (await this._domWorld.evaluate((s) => !s, success).catch(() => true))) { + await success.dispose(); + return; + } + // When the page is navigated, the promise is rejected. + // We will try again in the new execution context. + if (error && error.message.includes('Execution context was destroyed')) + return; + // We could have tried to evaluate in a context which was already + // destroyed. + if (error && + error.message.includes('Cannot find context with specified id')) + return; + if (error) + this._reject(error); + else + this._resolve(success); + this._cleanup(); + } + _cleanup() { + clearTimeout(this._timeoutTimer); + this._domWorld._waitTasks.delete(this); + } +} +async function waitForPredicatePageFunction(predicateBody, polling, timeout, ...args) { + const predicate = new Function('...args', predicateBody); + let timedOut = false; + if (timeout) + setTimeout(() => (timedOut = true), timeout); + if (polling === 'raf') + return await pollRaf(); + if (polling === 'mutation') + return await pollMutation(); + if (typeof polling === 'number') + return await pollInterval(polling); + /** + * @returns {!Promise<*>} + */ + async function pollMutation() { + const success = await predicate(...args); + if (success) + return Promise.resolve(success); + let fulfill; + const result = new Promise((x) => (fulfill = x)); + const observer = new MutationObserver(async () => { + if (timedOut) { + observer.disconnect(); + fulfill(); + } + const success = await predicate(...args); + if (success) { + observer.disconnect(); + fulfill(success); + } + }); + observer.observe(document, { + childList: true, + subtree: true, + attributes: true, + }); + return result; + } + async function pollRaf() { + let fulfill; + const result = new Promise((x) => (fulfill = x)); + await onRaf(); + return result; + async function onRaf() { + if (timedOut) { + fulfill(); + return; + } + const success = await predicate(...args); + if (success) + fulfill(success); + else + requestAnimationFrame(onRaf); + } + } + async function pollInterval(pollInterval) { + let fulfill; + const result = new Promise((x) => (fulfill = x)); + await onTimeout(); + return result; + async function onTimeout() { + if (timedOut) { + fulfill(); + return; + } + const success = await predicate(...args); + if (success) + fulfill(success); + else + setTimeout(onTimeout, pollInterval); + } + } +} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts new file mode 100644 index 00000000000..77b2e5bcd6f --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts @@ -0,0 +1,53 @@ +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * A debug function that can be used in any environment. + * + * @remarks + * + * If used in Node, it falls back to the + * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it + * uses `console.log`. + * + * @param prefix - this will be prefixed to each log. + * @returns a function that can be called to log to that debug channel. + * + * In Node, use the `DEBUG` environment variable to control logging: + * + * ``` + * DEBUG=* // logs all channels + * DEBUG=foo // logs the `foo` channel + * DEBUG=foo* // logs any channels starting with `foo` + * ``` + * + * In the browser, set `window.__PUPPETEER_DEBUG` to a string: + * + * ``` + * window.__PUPPETEER_DEBUG='*'; // logs all channels + * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel + * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` + * ``` + * + * @example + * ``` + * const log = debug('Page'); + * + * log('new page created') + * // logs "Page: new page created" + * ``` + */ +export declare const debug: (prefix: string) => (...args: unknown[]) => void; +//# sourceMappingURL=Debug.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map new file mode 100644 index 00000000000..2f3bd79bec9 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Debug.d.ts","sourceRoot":"","sources":["../../../../src/common/Debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,KAAK,WAAY,MAAM,eAAc,OAAO,EAAE,KAAK,IA4B/D,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js new file mode 100644 index 00000000000..6a01693c17d --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js @@ -0,0 +1,80 @@ +"use strict"; +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.debug = void 0; +const environment_js_1 = require("../environment.js"); +/** + * A debug function that can be used in any environment. + * + * @remarks + * + * If used in Node, it falls back to the + * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it + * uses `console.log`. + * + * @param prefix - this will be prefixed to each log. + * @returns a function that can be called to log to that debug channel. + * + * In Node, use the `DEBUG` environment variable to control logging: + * + * ``` + * DEBUG=* // logs all channels + * DEBUG=foo // logs the `foo` channel + * DEBUG=foo* // logs any channels starting with `foo` + * ``` + * + * In the browser, set `window.__PUPPETEER_DEBUG` to a string: + * + * ``` + * window.__PUPPETEER_DEBUG='*'; // logs all channels + * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel + * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` + * ``` + * + * @example + * ``` + * const log = debug('Page'); + * + * log('new page created') + * // logs "Page: new page created" + * ``` + */ +exports.debug = (prefix) => { + if (environment_js_1.isNode) { + // eslint-disable-next-line @typescript-eslint/no-var-requires + return require('debug')(prefix); + } + return (...logArgs) => { + const debugLevel = globalThis.__PUPPETEER_DEBUG; + if (!debugLevel) + return; + const everythingShouldBeLogged = debugLevel === '*'; + const prefixMatchesDebugLevel = everythingShouldBeLogged || + /** + * If the debug level is `foo*`, that means we match any prefix that + * starts with `foo`. If the level is `foo`, we match only the prefix + * `foo`. + */ + (debugLevel.endsWith('*') + ? prefix.startsWith(debugLevel) + : prefix === debugLevel); + if (!prefixMatchesDebugLevel) + return; + // eslint-disable-next-line no-console + console.log(`${prefix}:`, ...logArgs); + }; +}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts new file mode 100644 index 00000000000..f74e0171162 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts @@ -0,0 +1,33 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +interface Device { + name: string; + userAgent: string; + viewport: { + width: number; + height: number; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + isLandscape: boolean; + }; +} +export declare type DevicesMap = { + [name: string]: Device; +}; +declare const devicesMap: DevicesMap; +export { devicesMap }; +//# sourceMappingURL=DeviceDescriptors.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map new file mode 100644 index 00000000000..6215766fb6e --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"DeviceDescriptors.d.ts","sourceRoot":"","sources":["../../../../src/common/DeviceDescriptors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,EAAE,MAAM,CAAC;QAC1B,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;CACH;AAg6BD,oBAAY,UAAU,GAAG;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,UAAe,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js new file mode 100644 index 00000000000..60e7af7c142 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js @@ -0,0 +1,876 @@ +"use strict"; +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.devicesMap = void 0; +const devices = [ + { + name: 'Blackberry PlayBook', + userAgent: 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+', + viewport: { + width: 600, + height: 1024, + deviceScaleFactor: 1, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Blackberry PlayBook landscape', + userAgent: 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+', + viewport: { + width: 1024, + height: 600, + deviceScaleFactor: 1, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'BlackBerry Z30', + userAgent: 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+', + viewport: { + width: 360, + height: 640, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'BlackBerry Z30 landscape', + userAgent: 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Galaxy Note 3', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', + viewport: { + width: 360, + height: 640, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Galaxy Note 3 landscape', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Galaxy Note II', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', + viewport: { + width: 360, + height: 640, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Galaxy Note II landscape', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Galaxy S III', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', + viewport: { + width: 360, + height: 640, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Galaxy S III landscape', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Galaxy S5', + userAgent: 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 360, + height: 640, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Galaxy S5 landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPad', + userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', + viewport: { + width: 768, + height: 1024, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPad landscape', + userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', + viewport: { + width: 1024, + height: 768, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPad Mini', + userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', + viewport: { + width: 768, + height: 1024, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPad Mini landscape', + userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', + viewport: { + width: 1024, + height: 768, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPad Pro', + userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', + viewport: { + width: 1024, + height: 1366, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPad Pro landscape', + userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', + viewport: { + width: 1366, + height: 1024, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 4', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53', + viewport: { + width: 320, + height: 480, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 4 landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53', + viewport: { + width: 480, + height: 320, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 5', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', + viewport: { + width: 320, + height: 568, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 5 landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', + viewport: { + width: 568, + height: 320, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 6', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 375, + height: 667, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 6 landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 667, + height: 375, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 6 Plus', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 414, + height: 736, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 6 Plus landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 736, + height: 414, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 7', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 375, + height: 667, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 7 landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 667, + height: 375, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 7 Plus', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 414, + height: 736, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 7 Plus landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 736, + height: 414, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 8', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 375, + height: 667, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 8 landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 667, + height: 375, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone 8 Plus', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 414, + height: 736, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone 8 Plus landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 736, + height: 414, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone SE', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', + viewport: { + width: 320, + height: 568, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone SE landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', + viewport: { + width: 568, + height: 320, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone X', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 375, + height: 812, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone X landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + viewport: { + width: 812, + height: 375, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'iPhone XR', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1', + viewport: { + width: 414, + height: 896, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'iPhone XR landscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1', + viewport: { + width: 896, + height: 414, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'JioPhone 2', + userAgent: 'Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5', + viewport: { + width: 240, + height: 320, + deviceScaleFactor: 1, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'JioPhone 2 landscape', + userAgent: 'Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5', + viewport: { + width: 320, + height: 240, + deviceScaleFactor: 1, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Kindle Fire HDX', + userAgent: 'Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true', + viewport: { + width: 800, + height: 1280, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Kindle Fire HDX landscape', + userAgent: 'Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true', + viewport: { + width: 1280, + height: 800, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'LG Optimus L70', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 384, + height: 640, + deviceScaleFactor: 1.25, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'LG Optimus L70 landscape', + userAgent: 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 640, + height: 384, + deviceScaleFactor: 1.25, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Microsoft Lumia 550', + userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Microsoft Lumia 950', + userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', + viewport: { + width: 360, + height: 640, + deviceScaleFactor: 4, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Microsoft Lumia 950 landscape', + userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 4, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nexus 10', + userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', + viewport: { + width: 800, + height: 1280, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nexus 10 landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', + viewport: { + width: 1280, + height: 800, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nexus 4', + userAgent: 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 384, + height: 640, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nexus 4 landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 640, + height: 384, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nexus 5', + userAgent: 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 360, + height: 640, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nexus 5 landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 640, + height: 360, + deviceScaleFactor: 3, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nexus 5X', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 412, + height: 732, + deviceScaleFactor: 2.625, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nexus 5X landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 732, + height: 412, + deviceScaleFactor: 2.625, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nexus 6', + userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 412, + height: 732, + deviceScaleFactor: 3.5, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nexus 6 landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 732, + height: 412, + deviceScaleFactor: 3.5, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nexus 6P', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 412, + height: 732, + deviceScaleFactor: 3.5, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nexus 6P landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 732, + height: 412, + deviceScaleFactor: 3.5, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nexus 7', + userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', + viewport: { + width: 600, + height: 960, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nexus 7 landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', + viewport: { + width: 960, + height: 600, + deviceScaleFactor: 2, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nokia Lumia 520', + userAgent: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)', + viewport: { + width: 320, + height: 533, + deviceScaleFactor: 1.5, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nokia Lumia 520 landscape', + userAgent: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)', + viewport: { + width: 533, + height: 320, + deviceScaleFactor: 1.5, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Nokia N9', + userAgent: 'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13', + viewport: { + width: 480, + height: 854, + deviceScaleFactor: 1, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Nokia N9 landscape', + userAgent: 'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13', + viewport: { + width: 854, + height: 480, + deviceScaleFactor: 1, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Pixel 2', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 411, + height: 731, + deviceScaleFactor: 2.625, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Pixel 2 landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 731, + height: 411, + deviceScaleFactor: 2.625, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, + { + name: 'Pixel 2 XL', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 411, + height: 823, + deviceScaleFactor: 3.5, + isMobile: true, + hasTouch: true, + isLandscape: false, + }, + }, + { + name: 'Pixel 2 XL landscape', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 823, + height: 411, + deviceScaleFactor: 3.5, + isMobile: true, + hasTouch: true, + isLandscape: true, + }, + }, +]; +const devicesMap = {}; +exports.devicesMap = devicesMap; +for (const device of devices) + devicesMap[device.name] = device; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts new file mode 100644 index 00000000000..660e1d946b8 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts @@ -0,0 +1,76 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Protocol } from 'devtools-protocol'; + +import { CDPSession } from './Connection.js'; + +/** + * Dialog instances are dispatched by the {@link Page} via the `dialog` event. + * + * @remarks + * + * @example + * ```js + * const puppeteer = require('puppeteer'); + * + * (async () => { + * const browser = await puppeteer.launch(); + * const page = await browser.newPage(); + * page.on('dialog', async dialog => { + * console.log(dialog.message()); + * await dialog.dismiss(); + * await browser.close(); + * }); + * page.evaluate(() => alert('1')); + * })(); + * ``` + */ +export declare class Dialog { + private _client; + private _type; + private _message; + private _defaultValue; + private _handled; + /** + * @internal + */ + constructor(client: CDPSession, type: Protocol.Page.DialogType, message: string, defaultValue?: string); + /** + * @returns The type of the dialog. + */ + type(): Protocol.Page.DialogType; + /** + * @returns The message displayed in the dialog. + */ + message(): string; + /** + * @returns The default value of the prompt, or an empty string if the dialog + * is not a `prompt`. + */ + defaultValue(): string; + /** + * @param promptText - optional text that will be entered in the dialog + * prompt. Has no effect if the dialog's type is not `prompt`. + * + * @returns A promise that resolves when the dialog has been accepted. + */ + accept(promptText?: string): Promise; + /** + * @returns A promise which will resolve once the dialog has been dismissed + */ + dismiss(): Promise; +} +//# sourceMappingURL=Dialog.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map new file mode 100644 index 00000000000..d2fee6a7328 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/common/Dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBAED,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAC9B,OAAO,EAAE,MAAM,EACf,YAAY,SAAK;IAQnB;;OAEG;IACH,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU;IAIhC;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;OAKG;IACG,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js new file mode 100644 index 00000000000..0013a0d1016 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js @@ -0,0 +1,96 @@ +"use strict"; +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Dialog = void 0; +const assert_js_1 = require("./assert.js"); +/** + * Dialog instances are dispatched by the {@link Page} via the `dialog` event. + * + * @remarks + * + * @example + * ```js + * const puppeteer = require('puppeteer'); + * + * (async () => { + * const browser = await puppeteer.launch(); + * const page = await browser.newPage(); + * page.on('dialog', async dialog => { + * console.log(dialog.message()); + * await dialog.dismiss(); + * await browser.close(); + * }); + * page.evaluate(() => alert('1')); + * })(); + * ``` + */ +class Dialog { + /** + * @internal + */ + constructor(client, type, message, defaultValue = '') { + this._handled = false; + this._client = client; + this._type = type; + this._message = message; + this._defaultValue = defaultValue; + } + /** + * @returns The type of the dialog. + */ + type() { + return this._type; + } + /** + * @returns The message displayed in the dialog. + */ + message() { + return this._message; + } + /** + * @returns The default value of the prompt, or an empty string if the dialog + * is not a `prompt`. + */ + defaultValue() { + return this._defaultValue; + } + /** + * @param promptText - optional text that will be entered in the dialog + * prompt. Has no effect if the dialog's type is not `prompt`. + * + * @returns A promise that resolves when the dialog has been accepted. + */ + async accept(promptText) { + assert_js_1.assert(!this._handled, 'Cannot accept dialog which is already handled!'); + this._handled = true; + await this._client.send('Page.handleJavaScriptDialog', { + accept: true, + promptText: promptText, + }); + } + /** + * @returns A promise which will resolve once the dialog has been dismissed + */ + async dismiss() { + assert_js_1.assert(!this._handled, 'Cannot dismiss dialog which is already handled!'); + this._handled = true; + await this._client.send('Page.handleJavaScriptDialog', { + accept: false, + }); + } +} +exports.Dialog = Dialog; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts new file mode 100644 index 00000000000..c9abdc158a4 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts @@ -0,0 +1,25 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { CDPSession } from './Connection.js'; +import { Viewport } from './PuppeteerViewport.js'; +export declare class EmulationManager { + _client: CDPSession; + _emulatingMobile: boolean; + _hasTouch: boolean; + constructor(client: CDPSession); + emulateViewport(viewport: Viewport): Promise; +} +//# sourceMappingURL=EmulationManager.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map new file mode 100644 index 00000000000..0cfbf8e6a60 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"EmulationManager.d.ts","sourceRoot":"","sources":["../../../../src/common/EmulationManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,qBAAa,gBAAgB;IAC3B,OAAO,EAAE,UAAU,CAAC;IACpB,gBAAgB,UAAS;IACzB,SAAS,UAAS;gBAEN,MAAM,EAAE,UAAU;IAIxB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CA6B5D"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js new file mode 100644 index 00000000000..c0914dbea0c --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EmulationManager = void 0; +class EmulationManager { + constructor(client) { + this._emulatingMobile = false; + this._hasTouch = false; + this._client = client; + } + async emulateViewport(viewport) { + const mobile = viewport.isMobile || false; + const width = viewport.width; + const height = viewport.height; + const deviceScaleFactor = viewport.deviceScaleFactor || 1; + const screenOrientation = viewport.isLandscape + ? { angle: 90, type: 'landscapePrimary' } + : { angle: 0, type: 'portraitPrimary' }; + const hasTouch = viewport.hasTouch || false; + await Promise.all([ + this._client.send('Emulation.setDeviceMetricsOverride', { + mobile, + width, + height, + deviceScaleFactor, + screenOrientation, + }), + this._client.send('Emulation.setTouchEmulationEnabled', { + enabled: hasTouch, + }), + ]); + const reloadNeeded = this._emulatingMobile !== mobile || this._hasTouch !== hasTouch; + this._emulatingMobile = mobile; + this._hasTouch = hasTouch; + return reloadNeeded; + } +} +exports.EmulationManager = EmulationManager; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts new file mode 100644 index 00000000000..a0b094b522a --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts @@ -0,0 +1,34 @@ +/** + * Copyright 2018 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare class CustomError extends Error { + constructor(message: string); +} +/** + * TimeoutError is emitted whenever certain operations are terminated due to timeout. + * + * @remarks + * + * Example operations are {@link Page.waitForSelector | page.waitForSelector} + * or {@link Puppeteer.launch | puppeteer.launch}. + * + * @public + */ +export declare class TimeoutError extends CustomError { +} +export declare type PuppeteerErrors = Record; +export declare const puppeteerErrors: PuppeteerErrors; +export {}; +//# sourceMappingURL=Errors.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map new file mode 100644 index 00000000000..442a102c159 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../../../../src/common/Errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,EAAE,MAAM;CAK5B;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAa,SAAQ,WAAW;CAAG;AAEhD,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,WAAW,CAAC,CAAC;AAEjE,eAAO,MAAM,eAAe,EAAE,eAE7B,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js new file mode 100644 index 00000000000..1ce3eb058e4 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js @@ -0,0 +1,41 @@ +"use strict"; +/** + * Copyright 2018 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.puppeteerErrors = exports.TimeoutError = void 0; +class CustomError extends Error { + constructor(message) { + super(message); + this.name = this.constructor.name; + Error.captureStackTrace(this, this.constructor); + } +} +/** + * TimeoutError is emitted whenever certain operations are terminated due to timeout. + * + * @remarks + * + * Example operations are {@link Page.waitForSelector | page.waitForSelector} + * or {@link Puppeteer.launch | puppeteer.launch}. + * + * @public + */ +class TimeoutError extends CustomError { +} +exports.TimeoutError = TimeoutError; +exports.puppeteerErrors = { + TimeoutError, +}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts new file mode 100644 index 00000000000..46fbd894f6e --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts @@ -0,0 +1,59 @@ +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ElementHandle , JSHandle} from './JSHandle.js'; + +/** + * @public + */ +export declare type EvaluateFn = string | ((arg1: T, ...args: unknown[]) => unknown); +export declare type UnwrapPromiseLike = T extends PromiseLike ? U : T; +/** + * @public + */ +export declare type EvaluateFnReturnType = T extends (...args: unknown[]) => infer R ? R : unknown; +/** + * @public + */ +export declare type EvaluateHandleFn = string | ((...args: unknown[]) => unknown); +/** + * @public + */ +export declare type Serializable = number | string | boolean | null | BigInt | JSONArray | JSONObject; +/** + * @public + */ +export declare type JSONArray = Serializable[]; +/** + * @public + */ +export interface JSONObject { + [key: string]: Serializable; +} +/** + * @public + */ +export declare type SerializableOrJSHandle = Serializable | JSHandle; +/** + * Wraps a DOM element into an ElementHandle instance + * @public + **/ +export declare type WrapElementHandle = X extends Element ? ElementHandle : X; +/** + * Unwraps a DOM element out of an ElementHandle instance + * @public + **/ +export declare type UnwrapElementHandle = X extends ElementHandle ? E : X; +//# sourceMappingURL=EvalTypes.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map new file mode 100644 index 00000000000..cb2b74fe21d --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"EvalTypes.d.ts","sourceRoot":"","sources":["../../../../src/common/EvalTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExD;;GAEG;AACH,oBAAY,UAAU,CAAC,CAAC,GAAG,OAAO,IAC9B,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;AAE/C,oBAAY,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE1E;;GAEG;AACH,oBAAY,oBAAoB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,SAAS,CACjE,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,MAAM,CAAC,GACR,CAAC,GACD,OAAO,CAAC;AAEZ;;GAEG;AACH,oBAAY,gBAAgB,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;AAE1E;;GAEG;AACH,oBAAY,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,SAAS,GACT,UAAU,CAAC;AAEf;;GAEG;AACH,oBAAY,SAAS,GAAG,YAAY,EAAE,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B;AAED;;GAEG;AACH,oBAAY,sBAAsB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE7D;;;IAGI;AACJ,oBAAY,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAE5E;;;IAGI;AACJ,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.js similarity index 86% rename from front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts rename to front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.js index bb88ac8d189..9f20b2da41e 100644 --- a/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.js @@ -1,3 +1,4 @@ +"use strict"; /** * Copyright 2020 Google Inc. All rights reserved. * @@ -13,5 +14,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export declare const getFetch: () => Promise; -//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts new file mode 100644 index 00000000000..fa24ddd3818 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts @@ -0,0 +1,89 @@ +import { EventType, Handler } from '../../vendor/mitt/src/index.js'; +/** + * @internal + */ +export interface CommonEventEmitter { + on(event: EventType, handler: Handler): CommonEventEmitter; + off(event: EventType, handler: Handler): CommonEventEmitter; + addListener(event: EventType, handler: Handler): CommonEventEmitter; + removeListener(event: EventType, handler: Handler): CommonEventEmitter; + emit(event: EventType, eventData?: any): boolean; + once(event: EventType, handler: Handler): CommonEventEmitter; + listenerCount(event: string): number; + removeAllListeners(event?: EventType): CommonEventEmitter; +} +/** + * The EventEmitter class that many Puppeteer classes extend. + * + * @remarks + * + * This allows you to listen to events that Puppeteer classes fire and act + * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and + * {@link EventEmitter.off | off} to bind + * and unbind to event listeners. + * + * @public + */ +export declare class EventEmitter implements CommonEventEmitter { + private emitter; + private eventsMap; + /** + * @internal + */ + constructor(); + /** + * Bind an event listener to fire when an event occurs. + * @param event - the event type you'd like to listen to. Can be a string or symbol. + * @param handler - the function to be called when the event occurs. + * @returns `this` to enable you to chain calls. + */ + on(event: EventType, handler: Handler): EventEmitter; + /** + * Remove an event listener from firing. + * @param event - the event type you'd like to stop listening to. + * @param handler - the function that should be removed. + * @returns `this` to enable you to chain calls. + */ + off(event: EventType, handler: Handler): EventEmitter; + /** + * Remove an event listener. + * @deprecated please use `off` instead. + */ + removeListener(event: EventType, handler: Handler): EventEmitter; + /** + * Add an event listener. + * @deprecated please use `on` instead. + */ + addListener(event: EventType, handler: Handler): EventEmitter; + /** + * Emit an event and call any associated listeners. + * + * @param event - the event you'd like to emit + * @param eventData - any data you'd like to emit with the event + * @returns `true` if there are any listeners, `false` if there are not. + */ + emit(event: EventType, eventData?: any): boolean; + /** + * Like `on` but the listener will only be fired once and then it will be removed. + * @param event - the event you'd like to listen to + * @param handler - the handler function to run when the event occurs + * @returns `this` to enable you to chain calls. + */ + once(event: EventType, handler: Handler): EventEmitter; + /** + * Gets the number of listeners for a given event. + * + * @param event - the event to get the listener count for + * @returns the number of listeners bound to the given event + */ + listenerCount(event: EventType): number; + /** + * Removes all listeners. If given an event argument, it will remove only + * listeners for that event. + * @param event - the event to remove listeners for. + * @returns `this` to enable you to chain calls. + */ + removeAllListeners(event?: EventType): EventEmitter; + private eventListenersCount; +} +//# sourceMappingURL=EventEmitter.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map new file mode 100644 index 00000000000..fa7686c64c2 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/common/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAa,EAEX,SAAS,EACT,OAAO,EACR,MAAM,gCAAgC,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC3D,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAK5D,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACpE,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACvE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC7D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAErC,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,kBAAkB,CAAC;CAC3D;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,YAAW,kBAAkB;IACrD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,SAAS,CAAmC;IAEpD;;OAEG;;IAKH;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKpD;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKrD;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKhE;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAK7D;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO;IAKhD;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAStD;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAIvC;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY;IASnD,OAAO,CAAC,mBAAmB;CAG5B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js new file mode 100644 index 00000000000..1e6d5345d5f --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js @@ -0,0 +1,116 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EventEmitter = void 0; +const index_js_1 = __importDefault(require("../../vendor/mitt/src/index.js")); +/** + * The EventEmitter class that many Puppeteer classes extend. + * + * @remarks + * + * This allows you to listen to events that Puppeteer classes fire and act + * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and + * {@link EventEmitter.off | off} to bind + * and unbind to event listeners. + * + * @public + */ +class EventEmitter { + /** + * @internal + */ + constructor() { + this.eventsMap = new Map(); + this.emitter = index_js_1.default(this.eventsMap); + } + /** + * Bind an event listener to fire when an event occurs. + * @param event - the event type you'd like to listen to. Can be a string or symbol. + * @param handler - the function to be called when the event occurs. + * @returns `this` to enable you to chain calls. + */ + on(event, handler) { + this.emitter.on(event, handler); + return this; + } + /** + * Remove an event listener from firing. + * @param event - the event type you'd like to stop listening to. + * @param handler - the function that should be removed. + * @returns `this` to enable you to chain calls. + */ + off(event, handler) { + this.emitter.off(event, handler); + return this; + } + /** + * Remove an event listener. + * @deprecated please use `off` instead. + */ + removeListener(event, handler) { + this.off(event, handler); + return this; + } + /** + * Add an event listener. + * @deprecated please use `on` instead. + */ + addListener(event, handler) { + this.on(event, handler); + return this; + } + /** + * Emit an event and call any associated listeners. + * + * @param event - the event you'd like to emit + * @param eventData - any data you'd like to emit with the event + * @returns `true` if there are any listeners, `false` if there are not. + */ + emit(event, eventData) { + this.emitter.emit(event, eventData); + return this.eventListenersCount(event) > 0; + } + /** + * Like `on` but the listener will only be fired once and then it will be removed. + * @param event - the event you'd like to listen to + * @param handler - the handler function to run when the event occurs + * @returns `this` to enable you to chain calls. + */ + once(event, handler) { + const onceHandler = (eventData) => { + handler(eventData); + this.off(event, onceHandler); + }; + return this.on(event, onceHandler); + } + /** + * Gets the number of listeners for a given event. + * + * @param event - the event to get the listener count for + * @returns the number of listeners bound to the given event + */ + listenerCount(event) { + return this.eventListenersCount(event); + } + /** + * Removes all listeners. If given an event argument, it will remove only + * listeners for that event. + * @param event - the event to remove listeners for. + * @returns `this` to enable you to chain calls. + */ + removeAllListeners(event) { + if (event) { + this.eventsMap.delete(event); + } + else { + this.eventsMap.clear(); + } + return this; + } + eventListenersCount(event) { + return this.eventsMap.has(event) ? this.eventsMap.get(event).length : 0; + } +} +exports.EventEmitter = EventEmitter; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts new file mode 100644 index 00000000000..d717c7464f9 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts @@ -0,0 +1,82 @@ +/** + * Copyright 2019 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * IMPORTANT: we are mid-way through migrating away from this Events.ts file + * in favour of defining events next to the class that emits them. + * + * However we need to maintain this file for now because the legacy DocLint + * system relies on them. Be aware in the mean time if you make a change here + * you probably need to replicate it in the relevant class. For example if you + * add a new Page event, you should update the PageEmittedEvents enum in + * src/common/Page.ts. + * + * Chat to @jackfranklin if you're unsure. + */ +export declare const Events: { + readonly Page: { + readonly Close: "close"; + readonly Console: "console"; + readonly Dialog: "dialog"; + readonly DOMContentLoaded: "domcontentloaded"; + readonly Error: "error"; + readonly PageError: "pageerror"; + readonly Request: "request"; + readonly Response: "response"; + readonly RequestFailed: "requestfailed"; + readonly RequestFinished: "requestfinished"; + readonly FrameAttached: "frameattached"; + readonly FrameDetached: "framedetached"; + readonly FrameNavigated: "framenavigated"; + readonly Load: "load"; + readonly Metrics: "metrics"; + readonly Popup: "popup"; + readonly WorkerCreated: "workercreated"; + readonly WorkerDestroyed: "workerdestroyed"; + }; + readonly Browser: { + readonly TargetCreated: "targetcreated"; + readonly TargetDestroyed: "targetdestroyed"; + readonly TargetChanged: "targetchanged"; + readonly Disconnected: "disconnected"; + }; + readonly BrowserContext: { + readonly TargetCreated: "targetcreated"; + readonly TargetDestroyed: "targetdestroyed"; + readonly TargetChanged: "targetchanged"; + }; + readonly NetworkManager: { + readonly Request: symbol; + readonly Response: symbol; + readonly RequestFailed: symbol; + readonly RequestFinished: symbol; + }; + readonly FrameManager: { + readonly FrameAttached: symbol; + readonly FrameNavigated: symbol; + readonly FrameDetached: symbol; + readonly LifecycleEvent: symbol; + readonly FrameNavigatedWithinDocument: symbol; + readonly ExecutionContextCreated: symbol; + readonly ExecutionContextDestroyed: symbol; + }; + readonly Connection: { + readonly Disconnected: symbol; + }; + readonly CDPSession: { + readonly Disconnected: symbol; + }; +}; +//# sourceMappingURL=Events.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map new file mode 100644 index 00000000000..0ef025a148a --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Events.d.ts","sourceRoot":"","sources":["../../../../src/common/Events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmET,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js new file mode 100644 index 00000000000..106a3d5609a --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js @@ -0,0 +1,86 @@ +"use strict"; +/** + * Copyright 2019 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Events = void 0; +/** + * IMPORTANT: we are mid-way through migrating away from this Events.ts file + * in favour of defining events next to the class that emits them. + * + * However we need to maintain this file for now because the legacy DocLint + * system relies on them. Be aware in the mean time if you make a change here + * you probably need to replicate it in the relevant class. For example if you + * add a new Page event, you should update the PageEmittedEvents enum in + * src/common/Page.ts. + * + * Chat to @jackfranklin if you're unsure. + */ +exports.Events = { + Page: { + Close: 'close', + Console: 'console', + Dialog: 'dialog', + DOMContentLoaded: 'domcontentloaded', + Error: 'error', + // Can't use just 'error' due to node.js special treatment of error events. + // @see https://nodejs.org/api/events.html#events_error_events + PageError: 'pageerror', + Request: 'request', + Response: 'response', + RequestFailed: 'requestfailed', + RequestFinished: 'requestfinished', + FrameAttached: 'frameattached', + FrameDetached: 'framedetached', + FrameNavigated: 'framenavigated', + Load: 'load', + Metrics: 'metrics', + Popup: 'popup', + WorkerCreated: 'workercreated', + WorkerDestroyed: 'workerdestroyed', + }, + Browser: { + TargetCreated: 'targetcreated', + TargetDestroyed: 'targetdestroyed', + TargetChanged: 'targetchanged', + Disconnected: 'disconnected', + }, + BrowserContext: { + TargetCreated: 'targetcreated', + TargetDestroyed: 'targetdestroyed', + TargetChanged: 'targetchanged', + }, + NetworkManager: { + Request: Symbol('Events.NetworkManager.Request'), + Response: Symbol('Events.NetworkManager.Response'), + RequestFailed: Symbol('Events.NetworkManager.RequestFailed'), + RequestFinished: Symbol('Events.NetworkManager.RequestFinished'), + }, + FrameManager: { + FrameAttached: Symbol('Events.FrameManager.FrameAttached'), + FrameNavigated: Symbol('Events.FrameManager.FrameNavigated'), + FrameDetached: Symbol('Events.FrameManager.FrameDetached'), + LifecycleEvent: Symbol('Events.FrameManager.LifecycleEvent'), + FrameNavigatedWithinDocument: Symbol('Events.FrameManager.FrameNavigatedWithinDocument'), + ExecutionContextCreated: Symbol('Events.FrameManager.ExecutionContextCreated'), + ExecutionContextDestroyed: Symbol('Events.FrameManager.ExecutionContextDestroyed'), + }, + Connection: { + Disconnected: Symbol('Events.Connection.Disconnected'), + }, + CDPSession: { + Disconnected: Symbol('Events.CDPSession.Disconnected'), + }, +}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts new file mode 100644 index 00000000000..fa4e0be9562 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts @@ -0,0 +1,186 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Protocol } from 'devtools-protocol'; + +import { CDPSession } from './Connection.js'; +import { DOMWorld } from './DOMWorld.js'; +import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js'; +import { Frame } from './FrameManager.js'; +import { ElementHandle , JSHandle} from './JSHandle.js'; + +export declare const EVALUATION_SCRIPT_URL = "__puppeteer_evaluation_script__"; +/** + * This class represents a context for JavaScript execution. A [Page] might have + * many execution contexts: + * - each + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe | + * frame } has "default" execution context that is always created after frame is + * attached to DOM. This context is returned by the + * {@link frame.executionContext()} method. + * - {@link https://developer.chrome.com/extensions | Extension}'s content scripts + * create additional execution contexts. + * + * Besides pages, execution contexts can be found in + * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | + * workers }. + * + * @public + */ +export declare class ExecutionContext { + /** + * @internal + */ + _client: CDPSession; + /** + * @internal + */ + _world: DOMWorld; + private _contextId; + /** + * @internal + */ + constructor(client: CDPSession, contextPayload: Protocol.Runtime.ExecutionContextDescription, world: DOMWorld); + /** + * @remarks + * + * Not every execution context is associated with a frame. For + * example, workers and extensions have execution contexts that are not + * associated with frames. + * + * @returns The frame associated with this execution context. + */ + frame(): Frame | null; + /** + * @remarks + * If the function passed to the `executionContext.evaluate` returns a + * Promise, then `executionContext.evaluate` would wait for the promise to + * resolve and return its value. If the function passed to the + * `executionContext.evaluate` returns a non-serializable value, then + * `executionContext.evaluate` resolves to `undefined`. DevTools Protocol also + * supports transferring some additional values that are not serializable by + * `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals. + * + * + * @example + * ```js + * const executionContext = await page.mainFrame().executionContext(); + * const result = await executionContext.evaluate(() => Promise.resolve(8 * 7))* ; + * console.log(result); // prints "56" + * ``` + * + * @example + * A string can also be passed in instead of a function. + * + * ```js + * console.log(await executionContext.evaluate('1 + 2')); // prints "3" + * ``` + * + * @example + * {@link JSHandle} instances can be passed as arguments to the + * `executionContext.* evaluate`: + * ```js + * const oneHandle = await executionContext.evaluateHandle(() => 1); + * const twoHandle = await executionContext.evaluateHandle(() => 2); + * const result = await executionContext.evaluate( + * (a, b) => a + b, oneHandle, * twoHandle + * ); + * await oneHandle.dispose(); + * await twoHandle.dispose(); + * console.log(result); // prints '3'. + * ``` + * @param pageFunction a function to be evaluated in the `executionContext` + * @param args argument to pass to the page function + * + * @returns A promise that resolves to the return value of the given function. + */ + evaluate(pageFunction: Function | string, ...args: unknown[]): Promise; + /** + * @remarks + * The only difference between `executionContext.evaluate` and + * `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` + * returns an in-page object (a {@link JSHandle}). + * If the function passed to the `executionContext.evaluateHandle` returns a + * Promise, then `executionContext.evaluateHandle` would wait for the + * promise to resolve and return its value. + * + * @example + * ```js + * const context = await page.mainFrame().executionContext(); + * const aHandle = await context.evaluateHandle(() => Promise.resolve(self)); + * aHandle; // Handle for the global object. + * ``` + * + * @example + * A string can also be passed in instead of a function. + * + * ```js + * // Handle for the '3' * object. + * const aHandle = await context.evaluateHandle('1 + 2'); + * ``` + * + * @example + * JSHandle instances can be passed as arguments + * to the `executionContext.* evaluateHandle`: + * + * ```js + * const aHandle = await context.evaluateHandle(() => document.body); + * const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle); + * console.log(await resultHandle.jsonValue()); // prints body's innerHTML + * await aHandle.dispose(); + * await resultHandle.dispose(); + * ``` + * + * @param pageFunction a function to be evaluated in the `executionContext` + * @param args argument to pass to the page function + * + * @returns A promise that resolves to the return value of the given function + * as an in-page object (a {@link JSHandle}). + */ + evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; + private _evaluateInternal; + /** + * This method iterates the JavaScript heap and finds all the objects with the + * given prototype. + * @remarks + * @example + * ```js + * // Create a Map object + * await page.evaluate(() => window.map = new Map()); + * // Get a handle to the Map object prototype + * const mapPrototype = await page.evaluateHandle(() => Map.prototype); + * // Query all map instances into an array + * const mapInstances = await page.queryObjects(mapPrototype); + * // Count amount of map objects in heap + * const count = await page.evaluate(maps => maps.length, mapInstances); + * await mapInstances.dispose(); + * await mapPrototype.dispose(); + * ``` + * + * @param prototypeHandle a handle to the object prototype + * + * @returns A handle to an array of objects with the given prototype. + */ + queryObjects(prototypeHandle: JSHandle): Promise; + /** + * @internal + */ + _adoptBackendNodeId(backendNodeId: Protocol.DOM.BackendNodeId): Promise; + /** + * @internal + */ + _adoptElementHandle(elementHandle: ElementHandle): Promise; +} +//# sourceMappingURL=ExecutionContext.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map new file mode 100644 index 00000000000..e53af2b64ec --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ExecutionContext.d.ts","sourceRoot":"","sources":["../../../../src/common/ExecutionContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAkB,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AAGvE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,OAAO,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,UAAU,CAAS;IAE3B;;OAEG;gBAED,MAAM,EAAE,UAAU,EAClB,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,2BAA2B,EAC5D,KAAK,EAAE,QAAQ;IAOjB;;;;;;;;OAQG;IACH,KAAK,IAAI,KAAK,GAAG,IAAI;IAIrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACG,QAAQ,CAAC,UAAU,SAAS,GAAG,EACnC,YAAY,EAAE,QAAQ,GAAG,MAAM,EAC/B,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,OAAO,CAAC,UAAU,CAAC;IAQtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACG,cAAc,CAAC,UAAU,SAAS,QAAQ,GAAG,aAAa,GAAG,QAAQ,EACzE,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,UAAU,CAAC;YAIR,iBAAiB;IAuI/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,YAAY,CAAC,eAAe,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAYhE;;OAEG;IACG,mBAAmB,CACvB,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,GACxC,OAAO,CAAC,aAAa,CAAC;IAQzB;;OAEG;IACG,mBAAmB,CACvB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,aAAa,CAAC;CAW1B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js new file mode 100644 index 00000000000..d8195474667 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js @@ -0,0 +1,317 @@ +"use strict"; +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExecutionContext = exports.EVALUATION_SCRIPT_URL = void 0; +const assert_js_1 = require("./assert.js"); +const helper_js_1 = require("./helper.js"); +const JSHandle_js_1 = require("./JSHandle.js"); +exports.EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__'; +const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m; +/** + * This class represents a context for JavaScript execution. A [Page] might have + * many execution contexts: + * - each + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe | + * frame } has "default" execution context that is always created after frame is + * attached to DOM. This context is returned by the + * {@link frame.executionContext()} method. + * - {@link https://developer.chrome.com/extensions | Extension}'s content scripts + * create additional execution contexts. + * + * Besides pages, execution contexts can be found in + * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | + * workers }. + * + * @public + */ +class ExecutionContext { + /** + * @internal + */ + constructor(client, contextPayload, world) { + this._client = client; + this._world = world; + this._contextId = contextPayload.id; + } + /** + * @remarks + * + * Not every execution context is associated with a frame. For + * example, workers and extensions have execution contexts that are not + * associated with frames. + * + * @returns The frame associated with this execution context. + */ + frame() { + return this._world ? this._world.frame() : null; + } + /** + * @remarks + * If the function passed to the `executionContext.evaluate` returns a + * Promise, then `executionContext.evaluate` would wait for the promise to + * resolve and return its value. If the function passed to the + * `executionContext.evaluate` returns a non-serializable value, then + * `executionContext.evaluate` resolves to `undefined`. DevTools Protocol also + * supports transferring some additional values that are not serializable by + * `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals. + * + * + * @example + * ```js + * const executionContext = await page.mainFrame().executionContext(); + * const result = await executionContext.evaluate(() => Promise.resolve(8 * 7))* ; + * console.log(result); // prints "56" + * ``` + * + * @example + * A string can also be passed in instead of a function. + * + * ```js + * console.log(await executionContext.evaluate('1 + 2')); // prints "3" + * ``` + * + * @example + * {@link JSHandle} instances can be passed as arguments to the + * `executionContext.* evaluate`: + * ```js + * const oneHandle = await executionContext.evaluateHandle(() => 1); + * const twoHandle = await executionContext.evaluateHandle(() => 2); + * const result = await executionContext.evaluate( + * (a, b) => a + b, oneHandle, * twoHandle + * ); + * await oneHandle.dispose(); + * await twoHandle.dispose(); + * console.log(result); // prints '3'. + * ``` + * @param pageFunction a function to be evaluated in the `executionContext` + * @param args argument to pass to the page function + * + * @returns A promise that resolves to the return value of the given function. + */ + async evaluate(pageFunction, ...args) { + return await this._evaluateInternal(true, pageFunction, ...args); + } + /** + * @remarks + * The only difference between `executionContext.evaluate` and + * `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` + * returns an in-page object (a {@link JSHandle}). + * If the function passed to the `executionContext.evaluateHandle` returns a + * Promise, then `executionContext.evaluateHandle` would wait for the + * promise to resolve and return its value. + * + * @example + * ```js + * const context = await page.mainFrame().executionContext(); + * const aHandle = await context.evaluateHandle(() => Promise.resolve(self)); + * aHandle; // Handle for the global object. + * ``` + * + * @example + * A string can also be passed in instead of a function. + * + * ```js + * // Handle for the '3' * object. + * const aHandle = await context.evaluateHandle('1 + 2'); + * ``` + * + * @example + * JSHandle instances can be passed as arguments + * to the `executionContext.* evaluateHandle`: + * + * ```js + * const aHandle = await context.evaluateHandle(() => document.body); + * const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle); + * console.log(await resultHandle.jsonValue()); // prints body's innerHTML + * await aHandle.dispose(); + * await resultHandle.dispose(); + * ``` + * + * @param pageFunction a function to be evaluated in the `executionContext` + * @param args argument to pass to the page function + * + * @returns A promise that resolves to the return value of the given function + * as an in-page object (a {@link JSHandle}). + */ + async evaluateHandle(pageFunction, ...args) { + return this._evaluateInternal(false, pageFunction, ...args); + } + async _evaluateInternal(returnByValue, pageFunction, ...args) { + const suffix = `//# sourceURL=${exports.EVALUATION_SCRIPT_URL}`; + if (helper_js_1.helper.isString(pageFunction)) { + const contextId = this._contextId; + const expression = pageFunction; + const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) + ? expression + : expression + '\n' + suffix; + const { exceptionDetails, result: remoteObject } = await this._client + .send('Runtime.evaluate', { + expression: expressionWithSourceUrl, + contextId, + returnByValue, + awaitPromise: true, + userGesture: true, + }) + .catch(rewriteError); + if (exceptionDetails) + throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); + return returnByValue + ? helper_js_1.helper.valueFromRemoteObject(remoteObject) + : JSHandle_js_1.createJSHandle(this, remoteObject); + } + if (typeof pageFunction !== 'function') + throw new Error(`Expected to get |string| or |function| as the first argument, but got "${pageFunction}" instead.`); + let functionText = pageFunction.toString(); + try { + new Function('(' + functionText + ')'); + } + catch (error) { + // This means we might have a function shorthand. Try another + // time prefixing 'function '. + if (functionText.startsWith('async ')) + functionText = + 'async function ' + functionText.substring('async '.length); + else + functionText = 'function ' + functionText; + try { + new Function('(' + functionText + ')'); + } + catch (error) { + // We tried hard to serialize, but there's a weird beast here. + throw new Error('Passed function is not well-serializable!'); + } + } + let callFunctionOnPromise; + try { + callFunctionOnPromise = this._client.send('Runtime.callFunctionOn', { + functionDeclaration: functionText + '\n' + suffix + '\n', + executionContextId: this._contextId, + arguments: args.map(convertArgument.bind(this)), + returnByValue, + awaitPromise: true, + userGesture: true, + }); + } + catch (error) { + if (error instanceof TypeError && + error.message.startsWith('Converting circular structure to JSON')) + error.message += ' Are you passing a nested JSHandle?'; + throw error; + } + const { exceptionDetails, result: remoteObject, } = await callFunctionOnPromise.catch(rewriteError); + if (exceptionDetails) + throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); + return returnByValue + ? helper_js_1.helper.valueFromRemoteObject(remoteObject) + : JSHandle_js_1.createJSHandle(this, remoteObject); + /** + * @param {*} arg + * @returns {*} + * @this {ExecutionContext} + */ + function convertArgument(arg) { + if (typeof arg === 'bigint') + // eslint-disable-line valid-typeof + return { unserializableValue: `${arg.toString()}n` }; + if (Object.is(arg, -0)) + return { unserializableValue: '-0' }; + if (Object.is(arg, Infinity)) + return { unserializableValue: 'Infinity' }; + if (Object.is(arg, -Infinity)) + return { unserializableValue: '-Infinity' }; + if (Object.is(arg, NaN)) + return { unserializableValue: 'NaN' }; + const objectHandle = arg && arg instanceof JSHandle_js_1.JSHandle ? arg : null; + if (objectHandle) { + if (objectHandle._context !== this) + throw new Error('JSHandles can be evaluated only in the context they were created!'); + if (objectHandle._disposed) + throw new Error('JSHandle is disposed!'); + if (objectHandle._remoteObject.unserializableValue) + return { + unserializableValue: objectHandle._remoteObject.unserializableValue, + }; + if (!objectHandle._remoteObject.objectId) + return { value: objectHandle._remoteObject.value }; + return { objectId: objectHandle._remoteObject.objectId }; + } + return { value: arg }; + } + function rewriteError(error) { + if (error.message.includes('Object reference chain is too long')) + return { result: { type: 'undefined' } }; + if (error.message.includes("Object couldn't be returned by value")) + return { result: { type: 'undefined' } }; + if (error.message.endsWith('Cannot find context with specified id') || + error.message.endsWith('Inspected target navigated or closed')) + throw new Error('Execution context was destroyed, most likely because of a navigation.'); + throw error; + } + } + /** + * This method iterates the JavaScript heap and finds all the objects with the + * given prototype. + * @remarks + * @example + * ```js + * // Create a Map object + * await page.evaluate(() => window.map = new Map()); + * // Get a handle to the Map object prototype + * const mapPrototype = await page.evaluateHandle(() => Map.prototype); + * // Query all map instances into an array + * const mapInstances = await page.queryObjects(mapPrototype); + * // Count amount of map objects in heap + * const count = await page.evaluate(maps => maps.length, mapInstances); + * await mapInstances.dispose(); + * await mapPrototype.dispose(); + * ``` + * + * @param prototypeHandle a handle to the object prototype + * + * @returns A handle to an array of objects with the given prototype. + */ + async queryObjects(prototypeHandle) { + assert_js_1.assert(!prototypeHandle._disposed, 'Prototype JSHandle is disposed!'); + assert_js_1.assert(prototypeHandle._remoteObject.objectId, 'Prototype JSHandle must not be referencing primitive value'); + const response = await this._client.send('Runtime.queryObjects', { + prototypeObjectId: prototypeHandle._remoteObject.objectId, + }); + return JSHandle_js_1.createJSHandle(this, response.objects); + } + /** + * @internal + */ + async _adoptBackendNodeId(backendNodeId) { + const { object } = await this._client.send('DOM.resolveNode', { + backendNodeId: backendNodeId, + executionContextId: this._contextId, + }); + return JSHandle_js_1.createJSHandle(this, object); + } + /** + * @internal + */ + async _adoptElementHandle(elementHandle) { + assert_js_1.assert(elementHandle.executionContext() !== this, 'Cannot adopt handle that already belongs to this execution context'); + assert_js_1.assert(this._world, 'Cannot adopt handle without DOMWorld'); + const nodeInfo = await this._client.send('DOM.describeNode', { + objectId: elementHandle._remoteObject.objectId, + }); + return this._adoptBackendNodeId(nodeInfo.node.backendNodeId); + } +} +exports.ExecutionContext = ExecutionContext; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts new file mode 100644 index 00000000000..1f9fd3b13d8 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts @@ -0,0 +1,60 @@ +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Protocol } from 'devtools-protocol'; + +import { ElementHandle } from './JSHandle.js'; + +/** + * File choosers let you react to the page requesting for a file. + * @remarks + * `FileChooser` objects are returned via the `page.waitForFileChooser` method. + * @example + * An example of using `FileChooser`: + * ```js + * const [fileChooser] = await Promise.all([ + * page.waitForFileChooser(), + * page.click('#upload-file-button'), // some button that triggers file selection + * ]); + * await fileChooser.accept(['/tmp/myfile.pdf']); + * ``` + * **NOTE** In browsers, only one file chooser can be opened at a time. + * All file choosers must be accepted or canceled. Not doing so will prevent + * subsequent file choosers from appearing. + */ +export declare class FileChooser { + private _element; + private _multiple; + private _handled; + /** + * @internal + */ + constructor(element: ElementHandle, event: Protocol.Page.FileChooserOpenedEvent); + /** + * Whether file chooser allow for {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} file selection. + */ + isMultiple(): boolean; + /** + * Accept the file chooser request with given paths. + * @param filePaths - If some of the `filePaths` are relative paths, + * then they are resolved relative to the {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. + */ + accept(filePaths: string[]): Promise; + /** + * Closes the file chooser without selecting any files. + */ + cancel(): Promise; +} +//# sourceMappingURL=FileChooser.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map new file mode 100644 index 00000000000..3305117b8d2 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"FileChooser.d.ts","sourceRoot":"","sources":["../../../../src/common/FileChooser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBAED,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,sBAAsB;IAM7C;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;OAIG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAO9B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js new file mode 100644 index 00000000000..50b913f09c0 --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js @@ -0,0 +1,70 @@ +"use strict"; +/** + * Copyright 2020 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FileChooser = void 0; +const assert_js_1 = require("./assert.js"); +/** + * File choosers let you react to the page requesting for a file. + * @remarks + * `FileChooser` objects are returned via the `page.waitForFileChooser` method. + * @example + * An example of using `FileChooser`: + * ```js + * const [fileChooser] = await Promise.all([ + * page.waitForFileChooser(), + * page.click('#upload-file-button'), // some button that triggers file selection + * ]); + * await fileChooser.accept(['/tmp/myfile.pdf']); + * ``` + * **NOTE** In browsers, only one file chooser can be opened at a time. + * All file choosers must be accepted or canceled. Not doing so will prevent + * subsequent file choosers from appearing. + */ +class FileChooser { + /** + * @internal + */ + constructor(element, event) { + this._handled = false; + this._element = element; + this._multiple = event.mode !== 'selectSingle'; + } + /** + * Whether file chooser allow for {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} file selection. + */ + isMultiple() { + return this._multiple; + } + /** + * Accept the file chooser request with given paths. + * @param filePaths - If some of the `filePaths` are relative paths, + * then they are resolved relative to the {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. + */ + async accept(filePaths) { + assert_js_1.assert(!this._handled, 'Cannot accept FileChooser which is already handled!'); + this._handled = true; + await this._element.uploadFile(...filePaths); + } + /** + * Closes the file chooser without selecting any files. + */ + async cancel() { + assert_js_1.assert(!this._handled, 'Cannot cancel FileChooser which is already handled!'); + this._handled = true; + } +} +exports.FileChooser = FileChooser; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts new file mode 100644 index 00000000000..c108ae26d0a --- /dev/null +++ b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts @@ -0,0 +1,710 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Protocol } from 'devtools-protocol'; + +import { CDPSession } from './Connection.js'; +import { DOMWorld, WaitForSelectorOptions } from './DOMWorld.js'; +import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike , WrapElementHandle} from './EvalTypes.js'; +import { EventEmitter } from './EventEmitter.js'; +import { ExecutionContext } from './ExecutionContext.js'; +import { HTTPResponse } from './HTTPResponse.js'; +import { MouseButton } from './Input.js'; +import { ElementHandle , JSHandle} from './JSHandle.js'; +import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js'; +import { NetworkManager } from './NetworkManager.js'; +import { Page } from './Page.js'; +import { TimeoutSettings } from './TimeoutSettings.js'; + +/** + * We use symbols to prevent external parties listening to these events. + * They are internal to Puppeteer. + * + * @internal + */ +export declare const FrameManagerEmittedEvents: { + FrameAttached: symbol; + FrameNavigated: symbol; + FrameDetached: symbol; + LifecycleEvent: symbol; + FrameNavigatedWithinDocument: symbol; + ExecutionContextCreated: symbol; + ExecutionContextDestroyed: symbol; +}; +/** + * @internal + */ +export declare class FrameManager extends EventEmitter { + _client: CDPSession; + private _page; + private _networkManager; + _timeoutSettings: TimeoutSettings; + private _frames; + private _contextIdToContext; + private _isolatedWorlds; + private _mainFrame; + constructor(client: CDPSession, page: Page, ignoreHTTPSErrors: boolean, timeoutSettings: TimeoutSettings); + initialize(): Promise; + networkManager(): NetworkManager; + navigateFrame(frame: Frame, url: string, options?: { + referer?: string; + timeout?: number; + waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; + }): Promise; + waitForFrameNavigation(frame: Frame, options?: { + timeout?: number; + waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; + }): Promise; + _onLifecycleEvent(event: Protocol.Page.LifecycleEventEvent): void; + _onFrameStoppedLoading(frameId: string): void; + _handleFrameTree(frameTree: Protocol.Page.FrameTree): void; + page(): Page; + mainFrame(): Frame; + frames(): Frame[]; + frame(frameId: string): Frame | null; + _onFrameAttached(frameId: string, parentFrameId?: string): void; + _onFrameNavigated(framePayload: Protocol.Page.Frame): void; + _ensureIsolatedWorld(name: string): Promise; + _onFrameNavigatedWithinDocument(frameId: string, url: string): void; + _onFrameDetached(frameId: string): void; + _onExecutionContextCreated(contextPayload: Protocol.Runtime.ExecutionContextDescription): void; + private _onExecutionContextDestroyed; + private _onExecutionContextsCleared; + executionContextById(contextId: number): ExecutionContext; + private _removeFramesRecursively; +} +/** + * @public + */ +export interface FrameWaitForFunctionOptions { + /** + * An interval at which the `pageFunction` is executed, defaults to `raf`. If + * `polling` is a number, then it is treated as an interval in milliseconds at + * which the function would be executed. If `polling` is a string, then it can + * be one of the following values: + * + * - `raf` - to constantly execute `pageFunction` in `requestAnimationFrame` + * callback. This is the tightest polling mode which is suitable to observe + * styling changes. + * + * - `mutation` - to execute `pageFunction` on every DOM mutation. + */ + polling?: string | number; + /** + * Maximum time to wait in milliseconds. Defaults to `30000` (30 seconds). + * Pass `0` to disable the timeout. Puppeteer's default timeout can be changed + * using {@link Page.setDefaultTimeout}. + */ + timeout?: number; +} +/** + * @public + */ +export interface FrameAddScriptTagOptions { + /** + * the URL of the script to be added. + */ + url?: string; + /** + * The path to a JavaScript file to be injected into the frame. + * @remarks + * If `path` is a relative path, it is resolved relative to the current + * working directory (`process.cwd()` in Node.js). + */ + path?: string; + /** + * Raw JavaScript content to be injected into the frame. + */ + content?: string; + /** + * Set the script's `type`. Use `module` in order to load an ES2015 module. + */ + type?: string; +} +/** + * @public + */ +export interface FrameAddStyleTagOptions { + /** + * the URL of the CSS file to be added. + */ + url?: string; + /** + * The path to a CSS file to be injected into the frame. + * @remarks + * If `path` is a relative path, it is resolved relative to the current + * working directory (`process.cwd()` in Node.js). + */ + path?: string; + /** + * Raw CSS content to be injected into the frame. + */ + content?: string; +} +/** + * At every point of time, page exposes its current frame tree via the + * {@link Page.mainFrame | page.mainFrame} and + * {@link Frame.childFrames | frame.childFrames} methods. + * + * @remarks + * + * `Frame` object lifecycles are controlled by three events that are all + * dispatched on the page object: + * + * - {@link PageEmittedEvents.FrameAttached} + * + * - {@link PageEmittedEvents.FrameNavigated} + * + * - {@link PageEmittedEvents.FrameDetached} + * + * @Example + * An example of dumping frame tree: + * + * ```js + * const puppeteer = require('puppeteer'); + * + * (async () => { + * const browser = await puppeteer.launch(); + * const page = await browser.newPage(); + * await page.goto('https://www.google.com/chrome/browser/canary.html'); + * dumpFrameTree(page.mainFrame(), ''); + * await browser.close(); + * + * function dumpFrameTree(frame, indent) { + * console.log(indent + frame.url()); + * for (const child of frame.childFrames()) { + * dumpFrameTree(child, indent + ' '); + * } + * } + * })(); + * ``` + * + * @Example + * An example of getting text from an iframe element: + * + * ```js + * const frame = page.frames().find(frame => frame.name() === 'myframe'); + * const text = await frame.$eval('.selector', element => element.textContent); + * console.log(text); + * ``` + * + * @public + */ +export declare class Frame { + /** + * @internal + */ + _frameManager: FrameManager; + private _parentFrame?; + /** + * @internal + */ + _id: string; + private _url; + private _detached; + /** + * @internal + */ + _loaderId: string; + /** + * @internal + */ + _name?: string; + /** + * @internal + */ + _lifecycleEvents: Set; + /** + * @internal + */ + _mainWorld: DOMWorld; + /** + * @internal + */ + _secondaryWorld: DOMWorld; + /** + * @internal + */ + _childFrames: Set; + /** + * @internal + */ + constructor(frameManager: FrameManager, parentFrame: Frame | null, frameId: string); + /** + * @remarks + * + * `frame.goto` will throw an error if: + * - there's an SSL error (e.g. in case of self-signed certificates). + * + * - target URL is invalid. + * + * - the `timeout` is exceeded during navigation. + * + * - the remote server does not respond or is unreachable. + * + * - the main resource failed to load. + * + * `frame.goto` will not throw an error when any valid HTTP status code is + * returned by the remote server, including 404 "Not Found" and 500 "Internal + * Server Error". The status code for such responses can be retrieved by + * calling {@link HTTPResponse.status}. + * + * NOTE: `frame.goto` either throws an error or returns a main resource + * response. The only exceptions are navigation to `about:blank` or + * navigation to the same URL with a different hash, which would succeed and + * return `null`. + * + * NOTE: Headless mode doesn't support navigation to a PDF document. See + * the {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295 | upstream + * issue}. + * + * @param url - the URL to navigate the frame to. This should include the + * scheme, e.g. `https://`. + * @param options - navigation options. `waitUntil` is useful to define when + * the navigation should be considered successful - see the docs for + * {@link PuppeteerLifeCycleEvent} for more details. + * + * @returns A promise which resolves to the main resource response. In case of + * multiple redirects, the navigation will resolve with the response of the + * last redirect. + */ + goto(url: string, options?: { + referer?: string; + timeout?: number; + waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; + }): Promise; + /** + * @remarks + * + * This resolves when the frame navigates to a new URL. It is useful for when + * you run code which will indirectly cause the frame to navigate. Consider + * this example: + * + * ```js + * const [response] = await Promise.all([ + * // The navigation promise resolves after navigation has finished + * frame.waitForNavigation(), + * // Clicking the link will indirectly cause a navigation + * frame.click('a.my-link'), + * ]); + * ``` + * + * Usage of the {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API} to change the URL is considered a navigation. + * + * @param options - options to configure when the navigation is consided finished. + * @returns a promise that resolves when the frame navigates to a new URL. + */ + waitForNavigation(options?: { + timeout?: number; + waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; + }): Promise; + /** + * @returns a promise that resolves to the frame's default execution context. + */ + executionContext(): Promise; + /** + * @remarks + * + * The only difference between {@link Frame.evaluate} and + * `frame.evaluateHandle` is that `evaluateHandle` will return the value + * wrapped in an in-page object. + * + * This method behaves identically to {@link Page.evaluateHandle} except it's + * run within the context of the `frame`, rather than the entire page. + * + * @param pageFunction - a function that is run within the frame + * @param args - arguments to be passed to the pageFunction + */ + evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; + /** + * @remarks + * + * This method behaves identically to {@link Page.evaluate} except it's run + * within the context of the `frame`, rather than the entire page. + * + * @param pageFunction - a function that is run within the frame + * @param args - arguments to be passed to the pageFunction + */ + evaluate(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise>>; + /** + * This method queries the frame for the given selector. + * + * @param selector - a selector to query for. + * @returns A promise which resolves to an `ElementHandle` pointing at the + * element, or `null` if it was not found. + */ + $(selector: string): Promise; + /** + * This method evaluates the given XPath expression and returns the results. + * + * @param expression - the XPath expression to evaluate. + */ + $x(expression: string): Promise; + /** + * @remarks + * + * This method runs `document.querySelector` within + * the frame and passes it as the first argument to `pageFunction`. + * + * If `pageFunction` returns a Promise, then `frame.$eval` would wait for + * the promise to resolve and return its value. + * + * @example + * + * ```js + * const searchValue = await frame.$eval('#search', el => el.value); + * ``` + * + * @param selector - the selector to query for + * @param pageFunction - the function to be evaluated in the frame's context + * @param args - additional arguments to pass to `pageFuncton` + */ + $eval(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; + /** + * @remarks + * + * This method runs `Array.from(document.querySelectorAll(selector))` within + * the frame and passes it as the first argument to `pageFunction`. + * + * If `pageFunction` returns a Promise, then `frame.$$eval` would wait for + * the promise to resolve and return its value. + * + * @example + * + * ```js + * const divsCounts = await frame.$$eval('div', divs => divs.length); + * ``` + * + * @param selector - the selector to query for + * @param pageFunction - the function to be evaluated in the frame's context + * @param args - additional arguments to pass to `pageFuncton` + */ + $$eval(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; + /** + * This runs `document.querySelectorAll` in the frame and returns the result. + * + * @param selector - a selector to search for + * @returns An array of element handles pointing to the found frame elements. + */ + $$(selector: string): Promise; + /** + * @returns the full HTML contents of the frame, including the doctype. + */ + content(): Promise; + /** + * Set the content of the frame. + * + * @param html - HTML markup to assign to the page. + * @param options - options to configure how long before timing out and at + * what point to consider the content setting successful. + */ + setContent(html: string, options?: { + timeout?: number; + waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; + }): Promise; + /** + * @remarks + * + * If the name is empty, it returns the `id` attribute instead. + * + * Note: This value is calculated once when the frame is created, and will not + * update if the attribute is changed later. + * + * @returns the frame's `name` attribute as specified in the tag. + */ + name(): string; + /** + * @returns the frame's URL. + */ + url(): string; + /** + * @returns the parent `Frame`, if any. Detached and main frames return `null`. + */ + parentFrame(): Frame | null; + /** + * @returns an array of child frames. + */ + childFrames(): Frame[]; + /** + * @returns `true` if the frame has been detached, or `false` otherwise. + */ + isDetached(): boolean; + /** + * Adds a ` diff --git a/test/e2e/resources/application/service-worker.js b/test/e2e/resources/application/service-worker.js deleted file mode 100644 index 1ee35a4b8f3..00000000000 --- a/test/e2e/resources/application/service-worker.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// @ts-nocheck -const CACHE_NAME = 'cache-v1'; - -const urlsToCache = [ - '/test/e2e/resources/application/main.css', -]; - - -self.addEventListener('install', (event) => { - event.waitUntil(caches.open(CACHE_NAME).then(function(cache) { - return cache.addAll(urlsToCache); - })); -}); - -self.addEventListener('fetch', (event) => { - event.respondWith(caches.match(event.request).then(function(response) { - if (response) { - return response; - } - return fetch(event.request); - })); -}); From 9ba3967cc43344dff5170bc2187f80c978a71d4d Mon Sep 17 00:00:00 2001 From: Kim-Anh Tran Date: Wed, 28 Oct 2020 09:07:46 +0100 Subject: [PATCH 16/85] Move SimpleHistoryManager from sources to common This history class is independent of sources and will therefore be moved to common. Change-Id: I926051cc1f808c15c175c40a9c181dd5f84db320 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2505130 Commit-Queue: Kim-Anh Tran Auto-Submit: Kim-Anh Tran Reviewed-by: Alex Rudenko --- all_devtools_modules.gni | 2 +- devtools_grd_files.gni | 2 +- front_end/common/BUILD.gn | 1 + front_end/{sources => common}/SimpleHistoryManager.js | 7 ++++++- front_end/common/common.js | 2 ++ front_end/common/module.json | 1 + front_end/sources/BUILD.gn | 1 - front_end/sources/EditingLocationHistoryManager.js | 5 ++--- front_end/sources/module.json | 1 - front_end/sources/sources-legacy.js | 6 ------ front_end/sources/sources.js | 2 -- 11 files changed, 14 insertions(+), 16 deletions(-) rename front_end/{sources => common}/SimpleHistoryManager.js (96%) diff --git a/all_devtools_modules.gni b/all_devtools_modules.gni index 8b3274dbca2..fac18dcc9a3 100644 --- a/all_devtools_modules.gni +++ b/all_devtools_modules.gni @@ -76,6 +76,7 @@ all_typescript_module_sources = [ "common/Runnable.js", "common/SegmentedRange.js", "common/Settings.js", + "common/SimpleHistoryManager.js", "common/StringOutputStream.js", "common/TextDictionary.js", "common/Throttler.js", @@ -511,7 +512,6 @@ all_typescript_module_sources = [ "sources/ScriptFormatterEditorAction.js", "sources/ScriptOriginPlugin.js", "sources/SearchSourcesView.js", - "sources/SimpleHistoryManager.js", "sources/SnippetsPlugin.js", "sources/SourceMapNamesResolver.js", "sources/SourcesNavigator.js", diff --git a/devtools_grd_files.gni b/devtools_grd_files.gni index 10b79ec26a4..75a828d9a25 100644 --- a/devtools_grd_files.gni +++ b/devtools_grd_files.gni @@ -430,6 +430,7 @@ grd_files_debug_sources = [ "front_end/common/Runnable.js", "front_end/common/SegmentedRange.js", "front_end/common/Settings.js", + "front_end/common/SimpleHistoryManager.js", "front_end/common/StringOutputStream.js", "front_end/common/TextDictionary.js", "front_end/common/Throttler.js", @@ -865,7 +866,6 @@ grd_files_debug_sources = [ "front_end/sources/ScriptFormatterEditorAction.js", "front_end/sources/ScriptOriginPlugin.js", "front_end/sources/SearchSourcesView.js", - "front_end/sources/SimpleHistoryManager.js", "front_end/sources/SnippetsPlugin.js", "front_end/sources/SourceMapNamesResolver.js", "front_end/sources/SourcesNavigator.js", diff --git a/front_end/common/BUILD.gn b/front_end/common/BUILD.gn index 918404eb83b..7ec746959e1 100644 --- a/front_end/common/BUILD.gn +++ b/front_end/common/BUILD.gn @@ -28,6 +28,7 @@ devtools_module("common") { "Runnable.js", "SegmentedRange.js", "Settings.js", + "SimpleHistoryManager.js", "StringOutputStream.js", "TextDictionary.js", "Throttler.js", diff --git a/front_end/sources/SimpleHistoryManager.js b/front_end/common/SimpleHistoryManager.js similarity index 96% rename from front_end/sources/SimpleHistoryManager.js rename to front_end/common/SimpleHistoryManager.js index f2ed508576d..14bceceb543 100644 --- a/front_end/sources/SimpleHistoryManager.js +++ b/front_end/common/SimpleHistoryManager.js @@ -39,7 +39,8 @@ export class HistoryEntry { throw new Error('not implemented'); } - reveal() {} + reveal() { + } } /** @@ -53,6 +54,10 @@ export class SimpleHistoryManager { /** @type {!Array} */ this._entries = []; this._activeEntryIndex = -1; + + // Lock is used to make sure that reveal() does not + // make any changes to the history while we are + // rolling back or rolling over. this._coalescingReadonly = 0; this._historyDepth = historyDepth; } diff --git a/front_end/common/common.js b/front_end/common/common.js index 21b8f59b669..72ef92c480e 100644 --- a/front_end/common/common.js +++ b/front_end/common/common.js @@ -25,6 +25,7 @@ import * as Revealer from './Revealer.js'; import * as Runnable from './Runnable.js'; import * as SegmentedRange from './SegmentedRange.js'; import * as Settings from './Settings.js'; +import * as SimpleHistoryManager from './SimpleHistoryManager.js'; import * as StringOutputStream from './StringOutputStream.js'; import * as TextDictionary from './TextDictionary.js'; import * as Throttler from './Throttler.js'; @@ -69,6 +70,7 @@ export { Runnable, SegmentedRange, Settings, + SimpleHistoryManager, StringOutputStream, TextDictionary, Throttler, diff --git a/front_end/common/module.json b/front_end/common/module.json index b075f1acf57..2a5a22daffd 100644 --- a/front_end/common/module.json +++ b/front_end/common/module.json @@ -30,6 +30,7 @@ "Revealer.js", "Runnable.js", "StringOutputStream.js", + "SimpleHistoryManager.js", "CharacterIdMap.js", "Lazy.js", "Base64.js" diff --git a/front_end/sources/BUILD.gn b/front_end/sources/BUILD.gn index 26f6ecaa2a2..e02c8e8f563 100644 --- a/front_end/sources/BUILD.gn +++ b/front_end/sources/BUILD.gn @@ -30,7 +30,6 @@ devtools_module("sources") { "ScriptFormatterEditorAction.js", "ScriptOriginPlugin.js", "SearchSourcesView.js", - "SimpleHistoryManager.js", "SnippetsPlugin.js", "SourceMapNamesResolver.js", "SourcesNavigator.js", diff --git a/front_end/sources/EditingLocationHistoryManager.js b/front_end/sources/EditingLocationHistoryManager.js index eb0cc432f0b..8bf4e0e0aa0 100644 --- a/front_end/sources/EditingLocationHistoryManager.js +++ b/front_end/sources/EditingLocationHistoryManager.js @@ -33,7 +33,6 @@ import * as SourceFrame from '../source_frame/source_frame.js'; import * as TextUtils from '../text_utils/text_utils.js'; // eslint-disable-line no-unused-vars import * as Workspace from '../workspace/workspace.js'; // eslint-disable-line no-unused-vars -import {HistoryEntry, SimpleHistoryManager} from './SimpleHistoryManager.js'; // eslint-disable-line no-unused-vars import {SourcesView} from './SourcesView.js'; // eslint-disable-line no-unused-vars import {UISourceCodeFrame} from './UISourceCodeFrame.js'; // eslint-disable-line no-unused-vars @@ -47,7 +46,7 @@ export class EditingLocationHistoryManager { */ constructor(sourcesView, currentSourceFrameCallback) { this._sourcesView = sourcesView; - this._historyManager = new SimpleHistoryManager(HistoryDepth); + this._historyManager = new Common.SimpleHistoryManager.SimpleHistoryManager(HistoryDepth); this._currentSourceFrameCallback = currentSourceFrameCallback; } @@ -137,7 +136,7 @@ export class EditingLocationHistoryManager { export const HistoryDepth = 20; /** - * @implements {HistoryEntry} + * @implements {Common.SimpleHistoryManager.HistoryEntry} * @unrestricted */ export class EditingLocationHistoryEntry { diff --git a/front_end/sources/module.json b/front_end/sources/module.json index 458e6231ab3..bba9a36199f 100644 --- a/front_end/sources/module.json +++ b/front_end/sources/module.json @@ -1145,7 +1145,6 @@ "BreakpointEditDialog.js", "CallStackSidebarPane.js", "DebuggerPausedMessage.js", - "SimpleHistoryManager.js", "EditingLocationHistoryManager.js", "FilePathScoreFunction.js", "FilteredUISourceCodeListProvider.js", diff --git a/front_end/sources/sources-legacy.js b/front_end/sources/sources-legacy.js index 3ee26d580d2..ac7b2890710 100644 --- a/front_end/sources/sources-legacy.js +++ b/front_end/sources/sources-legacy.js @@ -150,12 +150,6 @@ Sources.SearchSourcesView = SourcesModule.SearchSourcesView.SearchSourcesView; /** @constructor */ Sources.SearchSourcesView.ActionDelegate = SourcesModule.SearchSourcesView.ActionDelegate; -/** @constructor */ -Sources.SimpleHistoryManager = SourcesModule.SimpleHistoryManager.SimpleHistoryManager; - -/** @interface */ -Sources.HistoryEntry = SourcesModule.SimpleHistoryManager.HistoryEntry; - /** @constructor */ Sources.SnippetsPlugin = SourcesModule.SnippetsPlugin.SnippetsPlugin; diff --git a/front_end/sources/sources.js b/front_end/sources/sources.js index 73a4db102ab..add4dba771d 100644 --- a/front_end/sources/sources.js +++ b/front_end/sources/sources.js @@ -25,7 +25,6 @@ import * as ScopeChainSidebarPane from './ScopeChainSidebarPane.js'; import * as ScriptFormatterEditorAction from './ScriptFormatterEditorAction.js'; import * as ScriptOriginPlugin from './ScriptOriginPlugin.js'; import * as SearchSourcesView from './SearchSourcesView.js'; -import * as SimpleHistoryManager from './SimpleHistoryManager.js'; import * as SnippetsPlugin from './SnippetsPlugin.js'; import * as SourceMapNamesResolver from './SourceMapNamesResolver.js'; import * as SourcesNavigator from './SourcesNavigator.js'; @@ -61,7 +60,6 @@ export { ScriptFormatterEditorAction, ScriptOriginPlugin, SearchSourcesView, - SimpleHistoryManager, SnippetsPlugin, SourceMapNamesResolver, SourcesNavigator, From b3b545ad25f25327da7473c48dbff13c0a93701b Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Tue, 27 Oct 2020 23:09:33 -0700 Subject: [PATCH 17/85] Update DevTools Chromium DEPS. TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: I9792318ba2fe8b1b7245ecd84ccaf80d5751924b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2503366 Reviewed-by: Devtools Autoroller Commit-Queue: Sigurd Schneider --- DEPS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 06336eb3d9a..2da1421e7d8 100644 --- a/DEPS +++ b/DEPS @@ -27,11 +27,11 @@ vars = { # Chromium build number for unit tests. It should be regularly updated to # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE - 'chromium_linux': '821100', + 'chromium_linux': '821617', # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE - 'chromium_win': '821083', + 'chromium_win': '821612', # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE - 'chromium_mac': '821071', + 'chromium_mac': '821606', } # Only these hosts are allowed for dependencies in this DEPS file. From ad406d668bb490e185a1694e3e337c74d78e0ead Mon Sep 17 00:00:00 2001 From: Jack Franklin Date: Tue, 27 Oct 2020 13:51:51 +0000 Subject: [PATCH 18/85] Migrate emulation/DeviceModeView to TypeScript Bug: 1011811 Change-Id: I20f5d21e3e79bba93a826b6bb995d8b12d393ab5 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2502610 Auto-Submit: Jack Franklin Reviewed-by: Tim van der Lippe Commit-Queue: Jack Franklin --- front_end/emulation/DeviceModeView.js | 151 ++++++++++++++++++-------- 1 file changed, 108 insertions(+), 43 deletions(-) diff --git a/front_end/emulation/DeviceModeView.js b/front_end/emulation/DeviceModeView.js index ba4e36aa143..f9ce764ee74 100644 --- a/front_end/emulation/DeviceModeView.js +++ b/front_end/emulation/DeviceModeView.js @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks - import * as Common from '../common/common.js'; import * as Host from '../host/host.js'; import * as Platform from '../platform/platform.js'; @@ -14,6 +11,7 @@ import {DeviceModeModel, Events, MaxDeviceSize, MinDeviceSize, Type} from './Dev import {DeviceModeToolbar} from './DeviceModeToolbar.js'; import {MediaQueryInspector} from './MediaQueryInspector.js'; + /** * @unrestricted */ @@ -24,6 +22,9 @@ export class DeviceModeView extends UI.Widget.VBox { /** @type {?UI.Widget.VBox} */ this.wrapperInstance; + /** @type {!WeakMap} */ + this.blockElementToWidth = new WeakMap(); + this.setMinimumSize(150, 150); this.element.classList.add('device-mode-view'); this.registerRequiredCSS('emulation/deviceModeView.css'); @@ -44,52 +45,95 @@ export class DeviceModeView extends UI.Widget.VBox { this._leftRuler.element.classList.add('device-mode-ruler-left'); this._createUI(); UI.ZoomManager.ZoomManager.instance().addEventListener(UI.ZoomManager.Events.ZoomChanged, this._zoomChanged, this); + + /** @type {!Array} */ + this._presetBlocks; + /** @type {!HTMLElement} */ + this._responsivePresetsContainer; + /** @type {!HTMLElement} */ + this._screenArea; + /** @type {!HTMLElement} */ + this._pageArea; + /** @type {!HTMLElement} */ + this._outlineImage; + /** @type {!HTMLElement} */ + this._contentClip; + /** @type {!HTMLElement} */ + this._contentArea; + /** @type {!HTMLElement} */ + this._rightResizerElement; + /** @type {!HTMLElement} */ + this._leftResizerElement; + /** @type {!HTMLElement} */ + this._bottomResizerElement; + /** @type {!HTMLElement} */ + this._bottomRightResizerElement; + /** @type {!HTMLElement} */ + this._bottomLeftResizerElement; + /** @type {boolean|undefined} */ + this._cachedResizable; + /** @type {!HTMLElement} */ + this._mediaInspectorContainer; + /** @type {!HTMLElement} */ + this._screenImage; + /** @type {!DeviceModeToolbar} */ + this._toolbar; } _createUI() { this._toolbar = new DeviceModeToolbar(this._model, this._showMediaInspectorSetting, this._showRulersSetting); this.contentElement.appendChild(this._toolbar.element()); - this._contentClip = this.contentElement.createChild('div', 'device-mode-content-clip vbox'); - this._responsivePresetsContainer = this._contentClip.createChild('div', 'device-mode-presets-container'); + this._contentClip = + /** @type {!HTMLElement} */ (this.contentElement.createChild('div', 'device-mode-content-clip vbox')); + this._responsivePresetsContainer = + /** @type {!HTMLElement} */ (this._contentClip.createChild('div', 'device-mode-presets-container')); this._populatePresetsContainer(); - this._mediaInspectorContainer = this._contentClip.createChild('div', 'device-mode-media-container'); - this._contentArea = this._contentClip.createChild('div', 'device-mode-content-area'); + this._mediaInspectorContainer = + /** @type {!HTMLElement} */ (this._contentClip.createChild('div', 'device-mode-media-container')); + this._contentArea = /** @type {!HTMLElement} */ (this._contentClip.createChild('div', 'device-mode-content-area')); - this._outlineImage = this._contentArea.createChild('img', 'device-mode-outline-image hidden fill'); + this._outlineImage = + /** @type {!HTMLElement} */ (this._contentArea.createChild('img', 'device-mode-outline-image hidden fill')); this._outlineImage.addEventListener('load', this._onImageLoaded.bind(this, this._outlineImage, true), false); this._outlineImage.addEventListener('error', this._onImageLoaded.bind(this, this._outlineImage, false), false); - this._screenArea = this._contentArea.createChild('div', 'device-mode-screen-area'); - this._screenImage = this._screenArea.createChild('img', 'device-mode-screen-image hidden'); + this._screenArea = /** @type {!HTMLElement} */ (this._contentArea.createChild('div', 'device-mode-screen-area')); + this._screenImage = + /** @type {!HTMLElement} */ (this._screenArea.createChild('img', 'device-mode-screen-image hidden')); this._screenImage.addEventListener('load', this._onImageLoaded.bind(this, this._screenImage, true), false); this._screenImage.addEventListener('error', this._onImageLoaded.bind(this, this._screenImage, false), false); this._bottomRightResizerElement = - this._screenArea.createChild('div', 'device-mode-resizer device-mode-bottom-right-resizer'); + /** @type {!HTMLElement} */ ( + this._screenArea.createChild('div', 'device-mode-resizer device-mode-bottom-right-resizer')); this._bottomRightResizerElement.createChild('div', ''); this._createResizer(this._bottomRightResizerElement, 2, 1); this._bottomLeftResizerElement = - this._screenArea.createChild('div', 'device-mode-resizer device-mode-bottom-left-resizer'); + /** @type {!HTMLElement} */ ( + this._screenArea.createChild('div', 'device-mode-resizer device-mode-bottom-left-resizer')); this._bottomLeftResizerElement.createChild('div', ''); this._createResizer(this._bottomLeftResizerElement, -2, 1); - this._rightResizerElement = this._screenArea.createChild('div', 'device-mode-resizer device-mode-right-resizer'); + this._rightResizerElement = /** @type {!HTMLElement} */ ( + this._screenArea.createChild('div', 'device-mode-resizer device-mode-right-resizer')); this._rightResizerElement.createChild('div', ''); this._createResizer(this._rightResizerElement, 2, 0); - this._leftResizerElement = this._screenArea.createChild('div', 'device-mode-resizer device-mode-left-resizer'); + this._leftResizerElement = /** @type {!HTMLElement} */ ( + this._screenArea.createChild('div', 'device-mode-resizer device-mode-left-resizer')); this._leftResizerElement.createChild('div', ''); this._createResizer(this._leftResizerElement, -2, 0); - this._bottomResizerElement = this._screenArea.createChild('div', 'device-mode-resizer device-mode-bottom-resizer'); + this._bottomResizerElement = /** @type {!HTMLElement} */ ( + this._screenArea.createChild('div', 'device-mode-resizer device-mode-bottom-resizer')); this._bottomResizerElement.createChild('div', ''); this._createResizer(this._bottomResizerElement, 0, 1); this._bottomResizerElement.addEventListener('dblclick', this._model.setHeight.bind(this._model, 0), false); this._bottomResizerElement.title = Common.UIString.UIString('Double-click for full height'); - this._pageArea = this._screenArea.createChild('div', 'device-mode-page-area'); + this._pageArea = /** @type {!HTMLElement} */ (this._screenArea.createChild('div', 'device-mode-page-area')); this._pageArea.createChild('slot'); } @@ -104,10 +148,10 @@ export class DeviceModeView extends UI.Widget.VBox { const inner = this._responsivePresetsContainer.createChild('div', 'device-mode-presets-container-inner'); for (let i = sizes.length - 1; i >= 0; --i) { const outer = inner.createChild('div', 'fill device-mode-preset-bar-outer'); - const block = outer.createChild('div', 'device-mode-preset-bar'); + const block = /** @type {!HTMLElement} */ (outer.createChild('div', 'device-mode-preset-bar')); block.createChild('span').textContent = titles[i] + ' \u2013 ' + sizes[i] + 'px'; block.addEventListener('click', applySize.bind(this, sizes[i]), false); - block.__width = sizes[i]; + this.blockElementToWidth.set(block, sizes[i]); this._presetBlocks.push(block); } @@ -175,7 +219,7 @@ export class DeviceModeView extends UI.Widget.VBox { (event.data.currentY - this._slowPositionStart.y) / 10 + this._slowPositionStart.y - event.data.startY; } - if (widthFactor) { + if (widthFactor && this._resizeStart) { const dipOffsetX = cssOffsetX * UI.ZoomManager.ZoomManager.instance().zoomFactor(); let newWidth = this._resizeStart.width + dipOffsetX * widthFactor; newWidth = Math.round(newWidth / this._model.scale()); @@ -184,7 +228,7 @@ export class DeviceModeView extends UI.Widget.VBox { } } - if (heightFactor) { + if (heightFactor && this._resizeStart) { const dipOffsetY = cssOffsetY * UI.ZoomManager.ZoomManager.instance().zoomFactor(); let newHeight = this._resizeStart.height + dipOffsetY * heightFactor; newHeight = Math.round(newHeight / this._model.scale()); @@ -210,7 +254,7 @@ export class DeviceModeView extends UI.Widget.VBox { _updateUI() { /** - * @param {!Element} element + * @param {!HTMLElement} element * @param {!UI.Geometry.Rect} rect */ function applyRect(element, rect) { @@ -231,7 +275,7 @@ export class DeviceModeView extends UI.Widget.VBox { let updateRulers = false; const cssScreenRect = this._model.screenRect().scale(1 / zoomFactor); - if (!cssScreenRect.isEqual(this._cachedCssScreenRect)) { + if (!this._cachedCssScreenRect || !cssScreenRect.isEqual(this._cachedCssScreenRect)) { applyRect(this._screenArea, cssScreenRect); updateRulers = true; callDoResize = true; @@ -239,14 +283,14 @@ export class DeviceModeView extends UI.Widget.VBox { } const cssVisiblePageRect = this._model.visiblePageRect().scale(1 / zoomFactor); - if (!cssVisiblePageRect.isEqual(this._cachedCssVisiblePageRect)) { + if (!this._cachedCssVisiblePageRect || !cssVisiblePageRect.isEqual(this._cachedCssVisiblePageRect)) { applyRect(this._pageArea, cssVisiblePageRect); callDoResize = true; this._cachedCssVisiblePageRect = cssVisiblePageRect; } const outlineRect = this._model.outlineRect().scale(1 / zoomFactor); - if (!outlineRect.isEqual(this._cachedOutlineRect)) { + if (!this._cachedOutlineRect || !outlineRect.isEqual(this._cachedOutlineRect)) { applyRect(this._outlineImage, outlineRect); callDoResize = true; this._cachedOutlineRect = outlineRect; @@ -293,7 +337,11 @@ export class DeviceModeView extends UI.Widget.VBox { updateRulers = true; callDoResize = true; for (const block of this._presetBlocks) { - block.style.width = block.__width * this._model.scale() + 'px'; + const blockWidth = this.blockElementToWidth.get(block); + if (!blockWidth) { + throw new Error('Could not get width for block.'); + } + block.style.width = blockWidth * this._model.scale() + 'px'; } this._cachedScale = this._model.scale(); } @@ -361,6 +409,9 @@ export class DeviceModeView extends UI.Widget.VBox { const rect = this._contentArea.getBoundingClientRect(); const availableSize = new UI.Geometry.Size(Math.max(rect.width * zoomFactor, 1), Math.max(rect.height * zoomFactor, 1)); + if (!this._handleHeight || !this._handleWidth) { + return; + } const preferredSize = new UI.Geometry.Size( Math.max((rect.width - 2 * this._handleWidth) * zoomFactor, 1), Math.max((rect.height - this._handleHeight) * zoomFactor, 1)); @@ -411,7 +462,7 @@ export class DeviceModeView extends UI.Widget.VBox { } /** - * @return {!Promise} + * @return {!Promise} */ async captureScreenshot() { const screenshot = await this._model.captureScreenshot(false); @@ -429,10 +480,13 @@ export class DeviceModeView extends UI.Widget.VBox { const contentLeft = screenRect.left + visiblePageRect.left - outlineRect.left; const contentTop = screenRect.top + visiblePageRect.top - outlineRect.top; - const canvas = createElement('canvas'); + const canvas = document.createElement('canvas'); canvas.width = Math.floor(outlineRect.width); canvas.height = Math.floor(outlineRect.height); const ctx = canvas.getContext('2d'); + if (!ctx) { + throw new Error('Could not get 2d context from canvas.'); + } ctx.imageSmoothingEnabled = false; if (this._model.outlineImage()) { @@ -442,12 +496,12 @@ export class DeviceModeView extends UI.Widget.VBox { await this._paintImage(ctx, this._model.screenImage(), screenRect.relativeTo(outlineRect)); } ctx.drawImage(pageImage, Math.floor(contentLeft), Math.floor(contentTop)); - this._saveScreenshot(canvas); + this._saveScreenshot(/** @type {!HTMLCanvasElement} */ (canvas)); }; } /** - * @return {!Promise} + * @return {!Promise} */ async captureFullSizeScreenshot() { const screenshot = await this._model.captureScreenshot(true); @@ -459,7 +513,7 @@ export class DeviceModeView extends UI.Widget.VBox { /** * @param {!Protocol.Page.Viewport=} clip - * @return {!Promise} + * @return {!Promise} */ async captureAreaScreenshot(clip) { const screenshot = await this._model.captureScreenshot(false, clip); @@ -476,13 +530,16 @@ export class DeviceModeView extends UI.Widget.VBox { const pageImage = new Image(); pageImage.src = 'data:image/png;base64,' + screenshot; pageImage.onload = () => { - const canvas = createElement('canvas'); + const canvas = document.createElement('canvas'); canvas.width = pageImage.naturalWidth; canvas.height = pageImage.naturalHeight; const ctx = canvas.getContext('2d'); + if (!ctx) { + throw new Error('Could not get 2d context for base64 screenshot.'); + } ctx.imageSmoothingEnabled = false; ctx.drawImage(pageImage, 0, 0); - this._saveScreenshot(canvas); + this._saveScreenshot(/** @type {!HTMLCanvasElement} */ (canvas)); }; } @@ -490,23 +547,23 @@ export class DeviceModeView extends UI.Widget.VBox { * @param {!CanvasRenderingContext2D} ctx * @param {string} src * @param {!UI.Geometry.Rect} rect - * @return {!Promise} + * @return {!Promise} */ _paintImage(ctx, src, rect) { - return new Promise(fulfill => { + return new Promise(resolve => { const image = new Image(); image.crossOrigin = 'Anonymous'; image.srcset = src; - image.onerror = fulfill; + image.onerror = () => resolve(); image.onload = () => { ctx.drawImage(image, rect.left, rect.top, rect.width, rect.height); - fulfill(); + resolve(); }; }); } /** - * @param {!Element} canvas + * @param {!HTMLCanvasElement} canvas */ _saveScreenshot(canvas) { const url = this._model.inspectedURL(); @@ -516,10 +573,11 @@ export class DeviceModeView extends UI.Widget.VBox { fileName = Platform.StringUtilities.trimURL(withoutFragment); } - if (this._model.type() === Type.Device) { - fileName += Common.UIString.UIString('(%s)', this._model.device().title); + const device = this._model.device(); + if (device && this._model.type() === Type.Device) { + fileName += Common.UIString.UIString('(%s)', device.title); } - const link = createElement('a'); + const link = document.createElement('a'); link.download = fileName + '.png'; canvas.toBlob(blob => { link.href = URL.createObjectURL(blob); @@ -534,7 +592,7 @@ export class DeviceModeView extends UI.Widget.VBox { export class Ruler extends UI.Widget.VBox { /** * @param {boolean} horizontal - * @param {function(number)} applyCallback + * @param {function(number):void} applyCallback */ constructor(horizontal, applyCallback) { super(); @@ -546,6 +604,10 @@ export class Ruler extends UI.Widget.VBox { this._count = 0; this._throttler = new Common.Throttler.Throttler(0); this._applyCallback = applyCallback; + /** @type {number|undefined} */ + this._renderedScale; + /** @type {number|undefined} */ + this._renderedZoomFactor; } /** @@ -598,7 +660,10 @@ export class Ruler extends UI.Widget.VBox { for (let i = count; i < this._count; i++) { if (!(i % step)) { - this._contentElement.lastChild.remove(); + const lastChild = this._contentElement.lastChild; + if (lastChild) { + lastChild.remove(); + } } } @@ -615,7 +680,7 @@ export class Ruler extends UI.Widget.VBox { } if (!(i % 20)) { const text = marker.createChild('div', 'device-mode-ruler-text'); - text.textContent = i * 5; + text.textContent = String(i * 5); text.addEventListener('click', this._onMarkerClick.bind(this, i * 5), false); } } From 1e8f608def5d897c23d10bab8468853a02b7873a Mon Sep 17 00:00:00 2001 From: Philip Pfaffe Date: Mon, 26 Oct 2020 12:55:57 +0100 Subject: [PATCH 19/85] Add a DebuggerPaused DOM event and some tooling to await it in tests I will use it to get rid of a timeout() in the sources panel tests, but that will be a followup CL to simplify reverting it if necessary. Change-Id: I4362135e1dac306d67f29474d1d6aea4ef0f1102 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2498224 Reviewed-by: Benedikt Meurer Reviewed-by: Paul Lewis Reviewed-by: Jack Franklin Commit-Queue: Benedikt Meurer --- front_end/sdk/DebuggerModel.js | 2 ++ test/shared/helper.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/front_end/sdk/DebuggerModel.js b/front_end/sdk/DebuggerModel.js index af9d175f9a5..813ffc82760 100644 --- a/front_end/sdk/DebuggerModel.js +++ b/front_end/sdk/DebuggerModel.js @@ -752,6 +752,8 @@ export class DebuggerModel extends SDKModel { } else { this.stepInto(); } + } else { + Common.EventTarget.fireEvent('DevTools.DebuggerPaused'); } _scheduledPauseOnAsyncCall = null; diff --git a/test/shared/helper.ts b/test/shared/helper.ts index 5c6b6f4c54f..d38c7c7479a 100644 --- a/test/shared/helper.ts +++ b/test/shared/helper.ts @@ -10,6 +10,12 @@ import {reloadDevTools} from '../conductor/hooks.js'; import {getBrowserAndPages, getHostedModeServerPort} from '../conductor/puppeteer-state.js'; import {AsyncScope} from './mocha-extensions.js'; +declare global { + interface Window { + __pendingEvents: Map; + } +} + export let platform: string; switch (os.platform()) { case 'darwin': @@ -450,4 +456,31 @@ export const scrollElementIntoView = async (selector: string, root?: puppeteer.J }); }; +export const installEventListener = function(frontend: puppeteer.Page, eventType: string) { + return frontend.evaluate(eventType => { + if (!('__pendingEvents' in window)) { + window.__pendingEvents = new Map(); + } + window.addEventListener(eventType, (e: Event) => { + let events = window.__pendingEvents.get(eventType); + if (!events) { + events = []; + window.__pendingEvents.set(eventType, events); + } + events.push(e); + }); + }, eventType); +}; + +export const getPendingEvents = function(frontend: puppeteer.Page, eventType: string) { + return frontend.evaluate(eventType => { + if (!('__pendingEvents' in window)) { + return []; + } + const pendingEvents = window.__pendingEvents.get(eventType); + window.__pendingEvents.set(eventType, []); + return pendingEvents || []; + }, eventType); +}; + export {getBrowserAndPages, getHostedModeServerPort, reloadDevTools}; From 148652b585b08e53b2368c50c601baa4444c28bd Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Tue, 27 Oct 2020 20:10:04 -0700 Subject: [PATCH 20/85] Update DevTools DEPS. Rolling build: https://chromium.googlesource.com/chromium/src/build/+log/0401de7..eef4a9f Rolling third_party/depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools/+log/77cd4b4..dfa44da TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: Ia5e6574e0a74bc4bb860e2bf548f4c66f760b734 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2504949 Commit-Queue: Sigurd Schneider Reviewed-by: Devtools Autoroller --- DEPS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2da1421e7d8..1c2df33d5b8 100644 --- a/DEPS +++ b/DEPS @@ -6,13 +6,13 @@ use_relative_paths = True vars = { 'build_url': 'https://chromium.googlesource.com/chromium/src/build.git', - 'build_revision': '0401de79c7264d72452bc01a4a054a44f3861c31', + 'build_revision': 'eef4a9f3b45882b9ab380f9e7cfe5126dce9e595', 'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git', 'buildtools_revision': '98881a1297863de584fad20fb671e8c44ad1a7d0', 'depot_tools_url': 'https://chromium.googlesource.com/chromium/tools/depot_tools.git', - 'depot_tools_revision': '77cd4b459b10e96b4023da12e4ca280ef3d0489a', + 'depot_tools_revision': 'dfa44daef92dbf2a22a7c89216bd898b20f358c9', 'inspector_protocol_url': 'https://chromium.googlesource.com/deps/inspector_protocol', 'inspector_protocol_revision': '351a2b717e7cd0e59c3d81505c1a803673667dac', From 26079a4008a0cb56dfbf52d0d670ea4bf2cff297 Mon Sep 17 00:00:00 2001 From: Sigurd Schneider Date: Tue, 27 Oct 2020 18:16:15 +0100 Subject: [PATCH 21/85] [ts] Type-check resources/AppManifestView.js with TypeScript Bug: chromium:1011811 Change-Id: If8e20dea61d61d333f2cc37f13a791563f1940b2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2503509 Reviewed-by: Tim van der Lippe Commit-Queue: Sigurd Schneider --- front_end/resources/AppManifestView.js | 36 ++++++++++++++-------- front_end/resources/resources_strings.grdp | 3 ++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/front_end/resources/AppManifestView.js b/front_end/resources/AppManifestView.js index 3978c0c720f..02c03cb5d54 100644 --- a/front_end/resources/AppManifestView.js +++ b/front_end/resources/AppManifestView.js @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks - import * as Common from '../common/common.js'; import * as Components from '../components/components.js'; import * as InlineEditor from '../inline_editor/inline_editor.js'; @@ -42,6 +39,7 @@ export class AppManifestView extends UI.Widget.VBox { this._presentationSection = this._reportView.appendSection(Common.UIString.UIString('Presentation')); this._iconsSection = this._reportView.appendSection(Common.UIString.UIString('Icons'), 'report-section-icons'); + /** @type {!Array} */ this._shortcutSections = []; this._nameField = this._identitySection.appendField(Common.UIString.UIString('Name')); @@ -62,6 +60,8 @@ export class AppManifestView extends UI.Widget.VBox { this._throttler = new Common.Throttler.Throttler(1000); SDK.SDKModel.TargetManager.instance().observeTargets(this); + /** @type {!Array} */ + this._registeredListeners = []; } /** @@ -115,6 +115,9 @@ export class AppManifestView extends UI.Widget.VBox { * @param {boolean} immediately */ async _updateManifest(immediately) { + if (!this._resourceTreeModel) { + return; + } const {url, data, errors} = await this._resourceTreeModel.fetchAppManifest(); const installabilityErrors = await this._resourceTreeModel.getInstallabilityErrors(); const manifestIcons = await this._resourceTreeModel.getManifestIcons(); @@ -128,6 +131,7 @@ export class AppManifestView extends UI.Widget.VBox { * @param {?string} data * @param {!Array} errors * @param {!Array} installabilityErrors + * @param {!{primaryIcon: ?string}} manifestIcons */ async _renderManifest(url, data, errors, installabilityErrors, manifestIcons) { if (!data && !errors.length) { @@ -164,7 +168,8 @@ export class AppManifestView extends UI.Widget.VBox { const startURL = stringProperty('start_url'); if (startURL) { const completeURL = /** @type {string} */ (Common.ParsedURL.ParsedURL.completeURL(url, startURL)); - const link = Components.Linkifier.Linkifier.linkifyURL(completeURL, {text: startURL}); + const link = Components.Linkifier.Linkifier.linkifyURL( + completeURL, /** @type {!Components.Linkifier.LinkifyURLOptions} */ ({text: startURL})); link.tabIndex = 0; this._startURLField.appendChild(link); } @@ -209,9 +214,9 @@ export class AppManifestView extends UI.Widget.VBox { UI.UIUtils.formatLocalized('Need help? Read our %s.', [documentationLink])); if (manifestIcons && manifestIcons.primaryIcon) { - const wrapper = createElement('div'); + const wrapper = document.createElement('div'); wrapper.classList.add('image-wrapper'); - const image = createElement('img'); + const image = document.createElement('img'); image.style.maxWidth = '200px'; image.style.maxHeight = '200px'; image.src = 'data:image/png;base64,' + manifestIcons.primaryIcon; @@ -241,7 +246,8 @@ export class AppManifestView extends UI.Widget.VBox { } const urlField = shortcutSection.appendFlexedField('URL'); const shortcutUrl = /** @type {string} */ (Common.ParsedURL.ParsedURL.completeURL(url, shortcut.url)); - const link = Components.Linkifier.Linkifier.linkifyURL(shortcutUrl, {text: shortcut.url}); + const link = Components.Linkifier.Linkifier.linkifyURL( + shortcutUrl, /** @type {!Components.Linkifier.LinkifyURLOptions} */ ({text: shortcut.url})); link.tabIndex = 0; urlField.appendChild(link); @@ -388,7 +394,7 @@ export class AppManifestView extends UI.Widget.VBox { console.error(`Installability error id '${installabilityError.errorId}' is not recognized`); break; } - if (errorMessages) { + if (errorMessage) { errorMessages.push(errorMessage); } } @@ -396,13 +402,13 @@ export class AppManifestView extends UI.Widget.VBox { } /** - * @param {?string} url - * @return {!Promise} + * @param {string} url + * @return {!Promise} */ async _loadImage(url) { - const wrapper = createElement('div'); + const wrapper = document.createElement('div'); wrapper.classList.add('image-wrapper'); - const image = createElement('img'); + const image = /** @type {!HTMLImageElement} */ (document.createElement('img')); const result = new Promise((resolve, reject) => { image.onload = resolve; image.onerror = reject; @@ -431,6 +437,10 @@ export class AppManifestView extends UI.Widget.VBox { return iconErrors; } const iconUrl = Common.ParsedURL.ParsedURL.completeURL(baseUrl, icon['src']); + if (!iconUrl) { + iconErrors.push(ls`Icon URL '${icon['src']}' failed to parse`); + return iconErrors; + } const result = await this._loadImage(iconUrl); if (!result) { iconErrors.push(ls`Icon ${iconUrl} failed to load`); @@ -445,7 +455,7 @@ export class AppManifestView extends UI.Widget.VBox { } else if (!/^\d+x\d+$/.test(icon.sizes)) { iconErrors.push(ls`Icon ${iconUrl} should specify its size as \`{width}x{height}\``); } else { - const [width, height] = icon.sizes.split('x').map(x => parseInt(x, 10)); + const [width, height] = icon.sizes.split('x').map(/** @param {*} x*/ x => parseInt(x, 10)); if (width !== height) { iconErrors.push(ls`Icon ${iconUrl} dimensions should be square`); } else if (image.naturalWidth !== width && image.naturalHeight !== height) { diff --git a/front_end/resources/resources_strings.grdp b/front_end/resources/resources_strings.grdp index 8dbeb556951..fd87ba8b691 100644 --- a/front_end/resources/resources_strings.grdp +++ b/front_end/resources/resources_strings.grdp @@ -516,6 +516,9 @@ as used by Chrome Primary key + + Icon URL '$1sfoo/icon.png' failed to parse + Actual width ($1s100px) of icon $2shttps://example.com/icon.png does not match specified width ($3s100px) From 4efa41ab8e03763f27c20689e0d770f0ba2c5486 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Wed, 28 Oct 2020 10:42:52 +0000 Subject: [PATCH 22/85] Typecheck input/InputModel.js with TypeScript R=sigurds@chromium.org Bug: 1011811 Change-Id: I21a7edeae07024c75596ef6b37b7138d364e2f8e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2502615 Commit-Queue: Tim van der Lippe Auto-Submit: Tim van der Lippe Reviewed-by: Sigurd Schneider --- front_end/input/InputModel.js | 90 +++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 30 deletions(-) diff --git a/front_end/input/InputModel.js b/front_end/input/InputModel.js index 8d83b4fc397..beae37ce868 100644 --- a/front_end/input/InputModel.js +++ b/front_end/input/InputModel.js @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks - import * as SDK from '../sdk/sdk.js'; export class InputModel extends SDK.SDKModel.SDKModel { @@ -14,12 +11,14 @@ export class InputModel extends SDK.SDKModel.SDKModel { constructor(target) { super(target); this._inputAgent = target.inputAgent(); - /** @type {?number} */ - this._eventDispatchTimer = null; + /** @type {number} */ + this._eventDispatchTimer = 0; /** @type {!Array}*/ this._dispatchEventDataList = []; - /** @type {?function()} */ + /** @type {?function():void} */ this._finishCallback = null; + /** @type {number} */ + this._dispatchingIndex; this._reset(); } @@ -31,7 +30,7 @@ export class InputModel extends SDK.SDKModel.SDKModel { this._replayPaused = false; /** @type {number} */ this._dispatchingIndex = 0; - clearTimeout(this._eventDispatchTimer); + window.clearTimeout(this._eventDispatchTimer); } /** @@ -44,6 +43,10 @@ export class InputModel extends SDK.SDKModel.SDKModel { this._processThreadEvents(tracingModel, thread); } } + /** + * @param {!EventData} a + * @param {!EventData} b + */ function compareTimestamp(a, b) { return a.timestamp - b.timestamp; } @@ -51,7 +54,7 @@ export class InputModel extends SDK.SDKModel.SDKModel { } /** - * @param {?function()} finishCallback + * @param {?function():void} finishCallback */ startReplay(finishCallback) { this._reset(); @@ -64,7 +67,7 @@ export class InputModel extends SDK.SDKModel.SDKModel { } pause() { - clearTimeout(this._eventDispatchTimer); + window.clearTimeout(this._eventDispatchTimer); if (this._dispatchingIndex >= this._dispatchEventDataList.length) { this._replayStopped(); } else { @@ -106,7 +109,7 @@ export class InputModel extends SDK.SDKModel.SDKModel { * @return {boolean} */ _isMouseEvent(eventData) { - if (!InputModel.MouseEventTypes.has(eventData.type)) { + if (!MOUSE_EVENT_TYPE_TO_REQUEST_TYPE.has(eventData.type)) { return false; } if (!('x' in eventData && 'y' in eventData)) { @@ -120,7 +123,7 @@ export class InputModel extends SDK.SDKModel.SDKModel { * @return {boolean} */ _isKeyboardEvent(eventData) { - if (!InputModel.KeyboardEventTypes.has(eventData.type)) { + if (!KEYBOARD_EVENT_TYPE_TO_REQUEST_TYPE.has(eventData.type)) { return false; } if (!('code' in eventData && 'key' in eventData)) { @@ -132,16 +135,16 @@ export class InputModel extends SDK.SDKModel.SDKModel { _dispatchNextEvent() { const eventData = this._dispatchEventDataList[this._dispatchingIndex]; this._lastEventTime = eventData.timestamp; - if (InputModel.MouseEventTypes.has(eventData.type)) { + if (MOUSE_EVENT_TYPE_TO_REQUEST_TYPE.has(eventData.type)) { this._dispatchMouseEvent(/** @type {!MouseEventData} */ (eventData)); - } else if (InputModel.KeyboardEventTypes.has(eventData.type)) { + } else if (KEYBOARD_EVENT_TYPE_TO_REQUEST_TYPE.has(eventData.type)) { this._dispatchKeyEvent(/** @type {!KeyboardEventData} */ (eventData)); } ++this._dispatchingIndex; if (this._dispatchingIndex < this._dispatchEventDataList.length) { const waitTime = (this._dispatchEventDataList[this._dispatchingIndex].timestamp - this._lastEventTime) / 1000; - this._eventDispatchTimer = setTimeout(this._dispatchNextEvent.bind(this), waitTime); + this._eventDispatchTimer = window.setTimeout(this._dispatchNextEvent.bind(this), waitTime); } else { this._replayStopped(); } @@ -151,14 +154,18 @@ export class InputModel extends SDK.SDKModel.SDKModel { * @param {!MouseEventData} eventData */ async _dispatchMouseEvent(eventData) { - console.assert(InputModel.MouseEventTypes.has(eventData.type)); - const buttons = {0: 'left', 1: 'middle', 2: 'right', 3: 'back', 4: 'forward'}; + const type = MOUSE_EVENT_TYPE_TO_REQUEST_TYPE.get(eventData.type); + if (!type) { + throw new Error(`Could not find mouse event type for eventData ${eventData.type}`); + } + const buttonActionName = BUTTONID_TO_ACTION_NAME.get(eventData.button); const params = { - type: InputModel.MouseEventTypes.get(eventData.type), + type, x: eventData.x, y: eventData.y, modifiers: eventData.modifiers, - button: (eventData.type === 'mousedown' || eventData.type === 'mouseup') ? buttons[eventData.button] : 'none', + button: (eventData.type === 'mousedown' || eventData.type === 'mouseup') ? buttonActionName : + Protocol.Input.MouseButton.None, buttons: eventData.buttons, clickCount: eventData.clickCount, deltaX: eventData.deltaX, @@ -171,10 +178,13 @@ export class InputModel extends SDK.SDKModel.SDKModel { * @param {!KeyboardEventData} eventData */ async _dispatchKeyEvent(eventData) { - console.assert(InputModel.KeyboardEventTypes.has(eventData.type)); + const type = KEYBOARD_EVENT_TYPE_TO_REQUEST_TYPE.get(eventData.type); + if (!type) { + throw new Error(`Could not find key event type for eventData ${eventData.type}`); + } const text = eventData.type === 'keypress' ? eventData.key[0] : undefined; const params = { - type: InputModel.KeyboardEventTypes.get(eventData.type), + type, modifiers: eventData.modifiers, text: text, unmodifiedText: text ? text.toLowerCase() : undefined, @@ -185,25 +195,45 @@ export class InputModel extends SDK.SDKModel.SDKModel { } _replayStopped() { - clearTimeout(this._eventDispatchTimer); + window.clearTimeout(this._eventDispatchTimer); this._reset(); - this._finishCallback(); + if (this._finishCallback) { + this._finishCallback(); + } } } -InputModel.MouseEventTypes = new Map([ - ['mousedown', 'mousePressed'], ['mouseup', 'mouseReleased'], ['mousemove', 'mouseMoved'], ['wheel', 'mouseWheel'] +/** @type {!Map} */ +const MOUSE_EVENT_TYPE_TO_REQUEST_TYPE = new Map([ + ['mousedown', Protocol.Input.DispatchMouseEventRequestType.MousePressed], + ['mouseup', Protocol.Input.DispatchMouseEventRequestType.MouseReleased], + ['mousemove', Protocol.Input.DispatchMouseEventRequestType.MouseMoved], + ['wheel', Protocol.Input.DispatchMouseEventRequestType.MouseWheel], ]); -InputModel.KeyboardEventTypes = new Map([['keydown', 'keyDown'], ['keyup', 'keyUp'], ['keypress', 'char']]); +/** @type {!Map} */ +const KEYBOARD_EVENT_TYPE_TO_REQUEST_TYPE = new Map([ + ['keydown', Protocol.Input.DispatchKeyEventRequestType.KeyDown], + ['keyup', Protocol.Input.DispatchKeyEventRequestType.KeyUp], + ['keypress', Protocol.Input.DispatchKeyEventRequestType.Char], +]); -SDK.SDKModel.SDKModel.register(InputModel, SDK.SDKModel.Capability.Input, false); +/** @type {!Map} */ +const BUTTONID_TO_ACTION_NAME = new Map([ + [0, Protocol.Input.MouseButton.Left], [1, Protocol.Input.MouseButton.Middle], [2, Protocol.Input.MouseButton.Right], + [3, Protocol.Input.MouseButton.Back], [4, Protocol.Input.MouseButton.Forward] +]); -/** @typedef {{type: string, modifiers: number, timestamp: number}} */ -export let EventData; +SDK.SDKModel.SDKModel.register(InputModel, SDK.SDKModel.Capability.Input, false); -/** @typedef {{x: number, y: number, button: number, buttons: number, clickCount: number, deltaX: number, deltaY: number}} */ +/** @typedef {{type: string, modifiers: number, timestamp: number, x: number, y: number, button: number, buttons: number, clickCount: number, deltaX: number, deltaY: number}} */ +// @ts-ignore typedef export let MouseEventData; -/** @typedef {{code: string, key: string, modifiers: number}} */ +/** @typedef {{type: string, modifiers: number, timestamp: number, code: string, key: string}} */ +// @ts-ignore typedef export let KeyboardEventData; + +/** @typedef {(!MouseEventData|!KeyboardEventData)} */ +// @ts-ignore typedef +export let EventData; From 0a2628ef5692f8fb5a9e0176081eba1a31fb19cd Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Wed, 28 Oct 2020 10:38:41 +0000 Subject: [PATCH 23/85] Reset grid layer counters on reset() Given that the overlay instances are persisted now, we need to reset the gridLayerCounter in Overlay::reset() to avoid clean up previously rendered label containers. Change-Id: I56d709a49998beb9a4c5e018f77a7d7582e0a342 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2505135 Reviewed-by: Patrick Brosset Reviewed-by: Changhao Han Commit-Queue: Alex Rudenko --- inspector_overlay/tool_highlight_grid_impl.ts | 7 ++++++- inspector_overlay/tool_highlight_impl.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/inspector_overlay/tool_highlight_grid_impl.ts b/inspector_overlay/tool_highlight_grid_impl.ts index c8c0f8eeb62..ccfa920edd1 100644 --- a/inspector_overlay/tool_highlight_grid_impl.ts +++ b/inspector_overlay/tool_highlight_grid_impl.ts @@ -28,7 +28,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import {Overlay} from './common.js'; +import {Overlay, ResetData} from './common.js'; import {drawLayoutGridHighlight, GridHighlight} from './highlight_grid_common.js'; export class HighlightGridOverlay extends Overlay { @@ -39,6 +39,11 @@ export class HighlightGridOverlay extends Overlay { private gridLabels!: HTMLElement; + reset(data: ResetData) { + super.reset(data); + this.gridLabelState.gridLayerCounter = 0; + } + renderGridMarkup() { const gridLabels = this.document.createElement('div'); gridLabels.id = 'grid-label-container'; diff --git a/inspector_overlay/tool_highlight_impl.ts b/inspector_overlay/tool_highlight_impl.ts index a9b1106a796..0b1aab6caf2 100644 --- a/inspector_overlay/tool_highlight_impl.ts +++ b/inspector_overlay/tool_highlight_impl.ts @@ -80,6 +80,7 @@ export class HighlightOverlay extends Overlay { reset(resetData: ResetData) { super.reset(resetData); this.tooltip.innerHTML = ''; + this.gridLabelState.gridLayerCounter = 0; if (this.gridOverlay) { this.gridOverlay.reset(resetData); } From 7a518f6f9b527da83fd3a7bed85a1804c1a6c678 Mon Sep 17 00:00:00 2001 From: Paul Lewis Date: Wed, 28 Oct 2020 11:29:30 +0000 Subject: [PATCH 24/85] TypeScriptify AnimationUI.js R=tvanderlippe@chromium.org Bug: 1011811 Change-Id: I7af4ae1162076f6920a8bb13b1288f845dbe0859 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2484971 Commit-Queue: Paul Lewis Reviewed-by: Tim van der Lippe --- front_end/animation/AnimationUI.js | 185 +++++++++++++++++------------ 1 file changed, 110 insertions(+), 75 deletions(-) diff --git a/front_end/animation/AnimationUI.js b/front_end/animation/AnimationUI.js index 41163bd266b..ce89355830d 100644 --- a/front_end/animation/AnimationUI.js +++ b/front_end/animation/AnimationUI.js @@ -1,8 +1,6 @@ // Copyright (c) 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks import * as Common from '../common/common.js'; import * as InlineEditor from '../inline_editor/inline_editor.js'; @@ -26,25 +24,27 @@ export class AnimationUI { this._timeline = timeline; this._parentElement = parentElement; - if (this._animation.source().keyframesRule()) { - this._keyframes = this._animation.source().keyframesRule().keyframes(); + const keyframesRule = this._animation.source().keyframesRule(); + if (keyframesRule) { + this._keyframes = keyframesRule.keyframes(); } - this._nameElement = parentElement.createChild('div', 'animation-name'); + /** @type {!HTMLElement} */ + this._nameElement = /** @type {!HTMLElement} */ (parentElement.createChild('div', 'animation-name')); this._nameElement.textContent = this._animation.name(); - this._svg = parentElement.createSVGChild('svg', 'animation-ui'); - this._svg.setAttribute('height', Options.AnimationSVGHeight); + this._svg = /** @type {!HTMLElement} */ (parentElement).createSVGChild('svg', 'animation-ui'); + this._svg.setAttribute('height', Options.AnimationSVGHeight.toString()); this._svg.style.marginLeft = '-' + Options.AnimationMargin + 'px'; this._svg.addEventListener('contextmenu', this._onContextMenu.bind(this)); this._activeIntervalGroup = this._svg.createSVGChild('g'); UI.UIUtils.installDragHandle( this._activeIntervalGroup, this._mouseDown.bind(this, Events.AnimationDrag, null), this._mouseMove.bind(this), this._mouseUp.bind(this), '-webkit-grabbing', '-webkit-grab'); - Animation.AnimationUI.installDragHandleKeyboard( - this._activeIntervalGroup, this._keydownMove.bind(this, Animation.AnimationUI.Events.AnimationDrag, null)); + AnimationUI.installDragHandleKeyboard( + this._activeIntervalGroup, this._keydownMove.bind(this, Events.AnimationDrag, null)); - /** @type {!Array.<{group: ?Element, animationLine: ?Element, keyframePoints: !Object., keyframeRender: !Object.}>} */ + /** @type {!Array.<{group: ?HTMLElement, animationLine: ?HTMLElement, keyframePoints: !Object., keyframeRender: !Object.}>} */ this._cachedElements = []; this._movementInMs = 0; @@ -57,14 +57,20 @@ export class AnimationUI { * @return {string} */ static Color(animation) { - const names = Object.keys(Colors); - const color = Colors[names[String.hashCode(animation.name() || animation.id()) % names.length]]; - return color.asString(Common.Color.Format.RGB); + const names = Array.from(Colors.keys()); + const hashCode = String.hashCode(animation.name() || animation.id()); + const cappedHashCode = hashCode % names.length; + const colorName = names[cappedHashCode]; + const color = Colors.get(colorName); + if (!color) { + throw new Error('Unable to locate color'); + } + return color.asString(Common.Color.Format.RGB) || ''; } /** * @param {!Element} element - * @param {function(...?)} elementDrag + * @param {function(!Event):void} elementDrag */ static installDragHandleKeyboard(element, elementDrag) { element.addEventListener('keydown', elementDrag, false); @@ -85,21 +91,21 @@ export class AnimationUI { } /** - * @param {!Element} parentElement + * @param {!HTMLElement} parentElement * @param {string} className */ _createLine(parentElement, className) { const line = parentElement.createSVGChild('line', className); - line.setAttribute('x1', Options.AnimationMargin); - line.setAttribute('y1', Options.AnimationHeight); - line.setAttribute('y2', Options.AnimationHeight); + line.setAttribute('x1', Options.AnimationMargin.toString()); + line.setAttribute('y1', Options.AnimationHeight.toString()); + line.setAttribute('y2', Options.AnimationHeight.toString()); line.style.stroke = this._color; return line; } /** * @param {number} iteration - * @param {!Element} parentElement + * @param {!HTMLElement} parentElement */ _drawAnimationLine(iteration, parentElement) { const cache = this._cachedElements[iteration]; @@ -111,17 +117,17 @@ export class AnimationUI { } /** - * @param {!Element} parentElement + * @param {!HTMLElement} parentElement */ _drawDelayLine(parentElement) { - if (!this._delayLine) { + if (!this._delayLine || !this._endDelayLine) { this._delayLine = this._createLine(parentElement, 'animation-delay-line'); this._endDelayLine = this._createLine(parentElement, 'animation-delay-line'); } const fill = this._animation.source().fill(); this._delayLine.classList.toggle('animation-fill', fill === 'backwards' || fill === 'both'); const margin = Options.AnimationMargin; - this._delayLine.setAttribute('x1', margin); + this._delayLine.setAttribute('x1', margin.toString()); this._delayLine.setAttribute('x2', (this._delay() * this._timeline.pixelMsRatio() + margin).toFixed(2)); const forwardsFill = fill === 'forwards' || fill === 'both'; this._endDelayLine.classList.toggle('animation-fill', forwardsFill); @@ -129,7 +135,7 @@ export class AnimationUI { this._timeline.width(), (this._delay() + this._duration() * this._animation.source().iterations()) * this._timeline.pixelMsRatio()); this._endDelayLine.style.transform = 'translateX(' + leftMargin.toFixed(2) + 'px)'; - this._endDelayLine.setAttribute('x1', margin); + this._endDelayLine.setAttribute('x1', margin.toString()); this._endDelayLine.setAttribute( 'x2', forwardsFill ? (this._timeline.width() - leftMargin + margin).toFixed(2) : (this._animation.source().endDelay() * this._timeline.pixelMsRatio() + margin).toFixed(2)); @@ -149,11 +155,12 @@ export class AnimationUI { } const circle = - parentElement.createSVGChild('circle', keyframeIndex <= 0 ? 'animation-endpoint' : 'animation-keyframe-point'); + /** @type {!HTMLElement} */ (parentElement) + .createSVGChild('circle', keyframeIndex <= 0 ? 'animation-endpoint' : 'animation-keyframe-point'); circle.setAttribute('cx', x.toFixed(2)); - circle.setAttribute('cy', Options.AnimationHeight); + circle.setAttribute('cy', Options.AnimationHeight.toString()); circle.style.stroke = this._color; - circle.setAttribute('r', Options.AnimationMargin / 2); + circle.setAttribute('r', (Options.AnimationMargin / 2).toString()); circle.tabIndex = 0; UI.ARIAUtils.setAccessibleName( circle, keyframeIndex <= 0 ? ls`Animation Endpoint slider` : ls`Animation Keyframe slider`); @@ -162,12 +169,13 @@ export class AnimationUI { circle.style.fill = this._color; } - this._cachedElements[iteration].keyframePoints[keyframeIndex] = circle; + this._cachedElements[iteration].keyframePoints[keyframeIndex] = /** @type {!HTMLElement} */ (circle); if (!attachEvents) { return; } + /** @type {string} */ let eventType; if (keyframeIndex === 0) { eventType = Events.StartEndpointMove; @@ -179,37 +187,38 @@ export class AnimationUI { UI.UIUtils.installDragHandle( circle, this._mouseDown.bind(this, eventType, keyframeIndex), this._mouseMove.bind(this), this._mouseUp.bind(this), 'ew-resize'); - Animation.AnimationUI.installDragHandleKeyboard(circle, this._keydownMove.bind(this, eventType, keyframeIndex)); + AnimationUI.installDragHandleKeyboard(circle, this._keydownMove.bind(this, eventType, keyframeIndex)); } /** * @param {number} iteration * @param {number} keyframeIndex - * @param {!Element} parentElement + * @param {!HTMLElement} parentElement * @param {number} leftDistance * @param {number} width * @param {string} easing */ _renderKeyframe(iteration, keyframeIndex, parentElement, leftDistance, width, easing) { /** - * @param {!Element} parentElement + * @param {!HTMLElement} parentElement * @param {number} x * @param {string} strokeColor */ function createStepLine(parentElement, x, strokeColor) { const line = parentElement.createSVGChild('line'); - line.setAttribute('x1', x); - line.setAttribute('x2', x); - line.setAttribute('y1', Options.AnimationMargin); - line.setAttribute('y2', Options.AnimationHeight); + line.setAttribute('x1', x.toString()); + line.setAttribute('x2', x.toString()); + line.setAttribute('y1', Options.AnimationMargin.toString()); + line.setAttribute('y2', Options.AnimationHeight.toString()); line.style.stroke = strokeColor; } const bezier = UI.Geometry.CubicBezier.parse(easing); const cache = this._cachedElements[iteration].keyframeRender; if (!cache[keyframeIndex]) { - cache[keyframeIndex] = bezier ? parentElement.createSVGChild('path', 'animation-keyframe') : - parentElement.createSVGChild('g', 'animation-keyframe-step'); + cache[keyframeIndex] = /** @type {!HTMLElement} */ ( + bezier ? parentElement.createSVGChild('path', 'animation-keyframe') : + parentElement.createSVGChild('g', 'animation-keyframe-step')); } const group = cache[keyframeIndex]; group.tabIndex = 0; @@ -227,10 +236,13 @@ export class AnimationUI { } else { const stepFunction = StepTimingFunction.parse(easing); group.removeChildren(); - /** @const */ const offsetMap = {'start': 0, 'middle': 0.5, 'end': 1}; - /** @const */ const offsetWeight = offsetMap[stepFunction.stepAtPosition]; - for (let i = 0; i < stepFunction.steps; i++) { - createStepLine(group, (i + offsetWeight) * width / stepFunction.steps, this._color); + /** @type {!Object.} */ + const offsetMap = {'start': 0, 'middle': 0.5, 'end': 1}; + if (stepFunction) { + const offsetWeight = offsetMap[stepFunction.stepAtPosition]; + for (let i = 0; i < stepFunction.steps; i++) { + createStepLine(group, (i + offsetWeight) * width / stepFunction.steps, this._color); + } } } } @@ -245,7 +257,7 @@ export class AnimationUI { this._nameElement.style.transform = 'translateX(' + (this._delay() * this._timeline.pixelMsRatio() + Options.AnimationMargin).toFixed(2) + 'px)'; this._nameElement.style.width = (this._duration() * this._timeline.pixelMsRatio()).toFixed(2) + 'px'; - this._drawDelayLine(this._svg); + this._drawDelayLine(/** @type {!HTMLElement} */ (this._svg)); if (this._animation.type() === 'CSSTransition') { this._renderTransition(); @@ -264,22 +276,25 @@ export class AnimationUI { this._renderIteration(this._tailGroup, iteration); } while (iteration < this._cachedElements.length) { - this._cachedElements.pop().group.remove(); + const poppedElement = this._cachedElements.pop(); + if (poppedElement && poppedElement.group) { + poppedElement.group.remove(); + } } } _renderTransition() { + const activeIntervalGroup = /** @type {!HTMLElement} */ (this._activeIntervalGroup); if (!this._cachedElements[0]) { this._cachedElements[0] = {animationLine: null, keyframePoints: {}, keyframeRender: {}, group: null}; } - this._drawAnimationLine(0, this._activeIntervalGroup); + this._drawAnimationLine(0, activeIntervalGroup); this._renderKeyframe( - 0, 0, this._activeIntervalGroup, Options.AnimationMargin, this._duration() * this._timeline.pixelMsRatio(), + 0, 0, activeIntervalGroup, Options.AnimationMargin, this._duration() * this._timeline.pixelMsRatio(), this._animation.source().easing()); - this._drawPoint(0, this._activeIntervalGroup, Options.AnimationMargin, 0, true); + this._drawPoint(0, activeIntervalGroup, Options.AnimationMargin, 0, true); this._drawPoint( - 0, this._activeIntervalGroup, this._duration() * this._timeline.pixelMsRatio() + Options.AnimationMargin, -1, - true); + 0, activeIntervalGroup, this._duration() * this._timeline.pixelMsRatio() + Options.AnimationMargin, -1, true); } /** @@ -288,20 +303,27 @@ export class AnimationUI { */ _renderIteration(parentElement, iteration) { if (!this._cachedElements[iteration]) { + const group = /** @type {!HTMLElement} */ (parentElement).createSVGChild('g'); this._cachedElements[iteration] = - {animationLine: null, keyframePoints: {}, keyframeRender: {}, group: parentElement.createSVGChild('g')}; + {animationLine: null, keyframePoints: {}, keyframeRender: {}, group: /** @type {!HTMLElement} */ (group)}; } const group = this._cachedElements[iteration].group; + if (!group) { + return; + } + group.style.transform = 'translateX(' + (iteration * this._duration() * this._timeline.pixelMsRatio()).toFixed(2) + 'px)'; this._drawAnimationLine(iteration, group); - console.assert(this._keyframes.length > 1); - for (let i = 0; i < this._keyframes.length - 1; i++) { - const leftDistance = this._offset(i) * this._duration() * this._timeline.pixelMsRatio() + Options.AnimationMargin; - const width = this._duration() * (this._offset(i + 1) - this._offset(i)) * this._timeline.pixelMsRatio(); - this._renderKeyframe(iteration, i, group, leftDistance, width, this._keyframes[i].easing()); - if (i || (!i && iteration === 0)) { - this._drawPoint(iteration, group, leftDistance, i, iteration === 0); + if (this._keyframes && this._keyframes.length > 1) { + for (let i = 0; i < this._keyframes.length - 1; i++) { + const leftDistance = + this._offset(i) * this._duration() * this._timeline.pixelMsRatio() + Options.AnimationMargin; + const width = this._duration() * (this._offset(i + 1) - this._offset(i)) * this._timeline.pixelMsRatio(); + this._renderKeyframe(iteration, i, group, leftDistance, width, this._keyframes[i].easing()); + if (i || (!i && iteration === 0)) { + this._drawPoint(iteration, group, leftDistance, i, iteration === 0); + } } } this._drawPoint( @@ -340,6 +362,10 @@ export class AnimationUI { * @return {number} offset */ _offset(i) { + if (!this._keyframes) { + throw new Error('Unable to calculate offset; keyframes do not exist'); + } + let offset = this._keyframes[i].offsetAsNumber(); if (this._mouseEventType === Events.KeyframeMove && i === this._keyframeMoved) { console.assert(i > 0 && i < this._keyframes.length - 1, 'First and last keyframe cannot be moved'); @@ -356,7 +382,8 @@ export class AnimationUI { * @param {!Event} event */ _mouseDown(mouseEventType, keyframeIndex, event) { - if (event.buttons === 2) { + const mouseEvent = /** @type {!MouseEvent} */ (event); + if (mouseEvent.buttons === 2) { return false; } if (this._svg.enclosingNodeOrSelfWithClass('animation-node-removed')) { @@ -364,7 +391,7 @@ export class AnimationUI { } this._mouseEventType = mouseEventType; this._keyframeMoved = keyframeIndex; - this._downMouseX = event.clientX; + this._downMouseX = mouseEvent.clientX; event.consume(true); if (this._node) { Common.Revealer.reveal(this._node); @@ -376,7 +403,8 @@ export class AnimationUI { * @param {!Event} event */ _mouseMove(event) { - this._setMovementAndRedraw((event.clientX - this._downMouseX) / this._timeline.pixelMsRatio()); + const mouseEvent = /** @type {!MouseEvent} */ (event); + this._setMovementAndRedraw((mouseEvent.clientX - (this._downMouseX || 0)) / this._timeline.pixelMsRatio()); } /** @@ -394,11 +422,14 @@ export class AnimationUI { * @param {!Event} event */ _mouseUp(event) { - this._movementInMs = (event.clientX - this._downMouseX) / this._timeline.pixelMsRatio(); + const mouseEvent = /** @type {!MouseEvent} */ (event); + this._movementInMs = (mouseEvent.clientX - (this._downMouseX || 0)) / this._timeline.pixelMsRatio(); // Commit changes if (this._mouseEventType === Events.KeyframeMove) { - this._keyframes[this._keyframeMoved].setOffset(this._offset(this._keyframeMoved)); + if (this._keyframes && this._keyframeMoved !== null && typeof this._keyframeMoved !== 'undefined') { + this._keyframes[this._keyframeMoved].setOffset(this._offset(this._keyframeMoved)); + } } else { this._animation.setTiming(this._duration(), this._delay()); } @@ -411,10 +442,16 @@ export class AnimationUI { delete this._keyframeMoved; } + /** + * @param {!Events} mouseEventType + * @param {?number} keyframeIndex + * @param {!Event} event + */ _keydownMove(mouseEventType, keyframeIndex, event) { + const keyboardEvent = /** @type {!KeyboardEvent} */ (event); this._mouseEventType = mouseEventType; this._keyframeMoved = keyframeIndex; - switch (event.key) { + switch (keyboardEvent.key) { case 'ArrowLeft': case 'ArrowUp': this._movementInMs = -this._keyboardMovementRateMs; @@ -426,8 +463,10 @@ export class AnimationUI { default: return; } - if (this._mouseEventType === Animation.AnimationUI.Events.KeyframeMove) { - this._keyframes[this._keyframeMoved].setOffset(this._offset(this._keyframeMoved)); + if (this._mouseEventType === Events.KeyframeMove) { + if (this._keyframes && this._keyframeMoved !== null) { + this._keyframes[this._keyframeMoved].setOffset(this._offset(this._keyframeMoved)); + } } else { this._animation.setTiming(this._duration(), this._delay()); } @@ -478,15 +517,11 @@ export const Options = { GridCanvasHeight: 40 }; -export const Colors = { - 'Purple': Common.Color.Color.parse('#9C27B0'), - 'Light Blue': Common.Color.Color.parse('#03A9F4'), - 'Deep Orange': Common.Color.Color.parse('#FF5722'), - 'Blue': Common.Color.Color.parse('#5677FC'), - 'Lime': Common.Color.Color.parse('#CDDC39'), - 'Blue Grey': Common.Color.Color.parse('#607D8B'), - 'Pink': Common.Color.Color.parse('#E91E63'), - 'Green': Common.Color.Color.parse('#0F9D58'), - 'Brown': Common.Color.Color.parse('#795548'), - 'Cyan': Common.Color.Color.parse('#00BCD4') -}; +/** @type {!Map} */ +export const Colors = new Map([ + ['Purple', Common.Color.Color.parse('#9C27B0')], ['Light Blue', Common.Color.Color.parse('#03A9F4')], + ['Deep Orange', Common.Color.Color.parse('#FF5722')], ['Blue', Common.Color.Color.parse('#5677FC')], + ['Lime', Common.Color.Color.parse('#CDDC39')], ['Blue Grey', Common.Color.Color.parse('#607D8B')], + ['Pink', Common.Color.Color.parse('#E91E63')], ['Green', Common.Color.Color.parse('#0F9D58')], + ['Brown', Common.Color.Color.parse('#795548')], ['Cyan', Common.Color.Color.parse('#00BCD4')] +]); From 30c3c74a29eb8ae177019336efc8e781a06990aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfonso=20Casta=C3=B1o?= Date: Wed, 28 Oct 2020 11:45:53 +0000 Subject: [PATCH 25/85] Report Trusted Type violations in the Issues Tab (Frontend) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL adds custom issues for Trusted Type violations (sink and policy) in the Issues Tab. Screenshot: https://i.imgur.com/tE1zLtu.png, https://i.imgur.com/aFIkrrw.png Bug: chromium:1137838 Change-Id: Ieddf8aa060851c8009d563b0d52c5c225d2f9c70 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2489425 Commit-Queue: Alfonso Castaño Reviewed-by: Sigurd Schneider --- all_devtools_files.gni | 2 ++ front_end/issues/IssuesPane.js | 14 ++++++++++ .../cspTrustedTypesPolicyViolation.md | 5 ++++ .../cspTrustedTypesSinkViolation.md | 8 ++++++ front_end/issues/module.json | 2 ++ front_end/sdk/ContentSecurityPolicyIssue.js | 26 +++++++++++++++++++ front_end/sdk/sdk_strings.grdp | 6 +++++ 7 files changed, 63 insertions(+) create mode 100644 front_end/issues/descriptions/cspTrustedTypesPolicyViolation.md create mode 100644 front_end/issues/descriptions/cspTrustedTypesSinkViolation.md diff --git a/all_devtools_files.gni b/all_devtools_files.gni index 2d234f12ed6..02814038d27 100644 --- a/all_devtools_files.gni +++ b/all_devtools_files.gni @@ -244,6 +244,8 @@ all_devtools_files = [ "front_end/issues/descriptions/cspEvalViolation.md", "front_end/issues/descriptions/cspInlineViolation.md", "front_end/issues/descriptions/cspURLViolation.md", + "front_end/issues/descriptions/cspTrustedTypesSinkViolation.md", + "front_end/issues/descriptions/cspTrustedTypesPolicyViolation.md", "front_end/issues/descriptions/mixedContent.md", "front_end/issues/issuesPane.css", "front_end/issues/issuesTree.css", diff --git a/front_end/issues/IssuesPane.js b/front_end/issues/IssuesPane.js index 7d21ef05099..0e39cbad7c1 100644 --- a/front_end/issues/IssuesPane.js +++ b/front_end/issues/IssuesPane.js @@ -524,6 +524,13 @@ class AffectedDirectivesView extends AffectedResourcesView { this._appendSourceCodeColumnTitle(header); this._appendDirectiveColumnTitle(header); this._appendStatusColumnTitle(header); + } else if (this._issue.code() === SDK.ContentSecurityPolicyIssue.trustedTypesSinkViolationCode) { + this._appendSourceCodeColumnTitle(header); + this._appendStatusColumnTitle(header); + } else if (this._issue.code() === SDK.ContentSecurityPolicyIssue.trustedTypesPolicyViolationCode) { + this._appendSourceCodeColumnTitle(header); + this._appendDirectiveColumnTitle(header); + this._appendStatusColumnTitle(header); } else { this.updateAffectedResourceCount(0); return; @@ -560,6 +567,13 @@ class AffectedDirectivesView extends AffectedResourcesView { this._appendSourceLocation(element, cspIssueDetails.sourceCodeLocation); this._appendViolatedDirective(element, cspIssueDetails.violatedDirective); this._appendStatus(element, cspIssueDetails.isReportOnly); + } else if (this._issue.code() === SDK.ContentSecurityPolicyIssue.trustedTypesSinkViolationCode) { + this._appendSourceLocation(element, cspIssueDetails.sourceCodeLocation); + this._appendStatus(element, cspIssueDetails.isReportOnly); + } else if (this._issue.code() === SDK.ContentSecurityPolicyIssue.trustedTypesPolicyViolationCode) { + this._appendSourceLocation(element, cspIssueDetails.sourceCodeLocation); + this._appendViolatedDirective(element, cspIssueDetails.violatedDirective); + this._appendStatus(element, cspIssueDetails.isReportOnly); } else { return; } diff --git a/front_end/issues/descriptions/cspTrustedTypesPolicyViolation.md b/front_end/issues/descriptions/cspTrustedTypesPolicyViolation.md new file mode 100644 index 00000000000..3d8b90a7aa0 --- /dev/null +++ b/front_end/issues/descriptions/cspTrustedTypesPolicyViolation.md @@ -0,0 +1,5 @@ +# Trusted Type policy creation blocked by Content Security Policy + +Your site tries to create a Trusted Type policy that has not been allowed by the Content Security Policy. The Content Security Policy may restrict the set of valid names for Trusted Type policies, and forbid more than one policy of each name. + +To solve this, make sure that the names of the policies listed below are declared in the `trusted-types` CSP directive. To allow redefining policies add the `allow-duplicates` keyword. If you want to remove all restrictions on policy names, remove the `trusted-types` directive entirely (not recommended). \ No newline at end of file diff --git a/front_end/issues/descriptions/cspTrustedTypesSinkViolation.md b/front_end/issues/descriptions/cspTrustedTypesSinkViolation.md new file mode 100644 index 00000000000..dd9dc8df9a9 --- /dev/null +++ b/front_end/issues/descriptions/cspTrustedTypesSinkViolation.md @@ -0,0 +1,8 @@ +# Trusted Type expected, but String received + +Your site tries to use a plain string in a DOM modification where a Trusted Type is expected. Requiring Trusted Types for DOM modifications helps to prevent cross-site scripting attacks. + +To solve this, provide a Trusted Type to all the DOM modifications listed below. You can convert a string into a Trusted Type by: + +* defining a policy and using its corresponding `createHTML`, `createScript` or `createScriptURL` function. +* defining a policy named `default` which will be automatically called. \ No newline at end of file diff --git a/front_end/issues/module.json b/front_end/issues/module.json index 91200ef3633..52ca7f80438 100644 --- a/front_end/issues/module.json +++ b/front_end/issues/module.json @@ -46,6 +46,8 @@ "descriptions/cspEvalViolation.md", "descriptions/cspInlineViolation.md", "descriptions/cspURLViolation.md", + "descriptions/cspTrustedTypesSinkViolation.md", + "descriptions/cspTrustedTypesPolicyViolation.md", "descriptions/mixedContent.md", "issuesPane.css", "issuesTree.css" diff --git a/front_end/sdk/ContentSecurityPolicyIssue.js b/front_end/sdk/ContentSecurityPolicyIssue.js index da31374a7b3..18d38b27038 100644 --- a/front_end/sdk/ContentSecurityPolicyIssue.js +++ b/front_end/sdk/ContentSecurityPolicyIssue.js @@ -95,6 +95,18 @@ const cspEvalViolation = { }], }; +const cspTrustedTypesSinkViolation = { + file: 'issues/descriptions/cspTrustedTypesSinkViolation.md', + issueKind: IssueKind.BreakingChange, + links: [{link: 'https://web.dev/trusted-types/#fix-the-violations', linkTitle: ls`Trusted Types - Fix violations`}], +}; + +const cspTrustedTypesPolicyViolation = { + file: 'issues/descriptions/cspTrustedTypesPolicyViolation.md', + issueKind: IssueKind.BreakingChange, + links: [{link: 'https://web.dev/trusted-types/', linkTitle: ls`Trusted Types - Policy violation`}], +}; + /** @type {string} */ export const urlViolationCode = [ Protocol.Audits.InspectorIssueCode.ContentSecurityPolicyIssue, @@ -113,10 +125,24 @@ export const evalViolationCode = [ Protocol.Audits.ContentSecurityPolicyViolationType.KEvalViolation ].join('::'); +/** @type {string} */ +export const trustedTypesSinkViolationCode = [ + Protocol.Audits.InspectorIssueCode.ContentSecurityPolicyIssue, + Protocol.Audits.ContentSecurityPolicyViolationType.KTrustedTypesSinkViolation +].join('::'); + +/** @type {string} */ +export const trustedTypesPolicyViolationCode = [ + Protocol.Audits.InspectorIssueCode.ContentSecurityPolicyIssue, + Protocol.Audits.ContentSecurityPolicyViolationType.KTrustedTypesPolicyViolation +].join('::'); + // TODO(crbug.com/1082628): Add handling of other CSP violation types later as they'll need more work. /** @type {!Map} */ const issueDescriptions = new Map([ [Protocol.Audits.ContentSecurityPolicyViolationType.KURLViolation, cspURLViolation], [Protocol.Audits.ContentSecurityPolicyViolationType.KInlineViolation, cspInlineViolation], [Protocol.Audits.ContentSecurityPolicyViolationType.KEvalViolation, cspEvalViolation], + [Protocol.Audits.ContentSecurityPolicyViolationType.KTrustedTypesSinkViolation, cspTrustedTypesSinkViolation], + [Protocol.Audits.ContentSecurityPolicyViolationType.KTrustedTypesPolicyViolation, cspTrustedTypesPolicyViolation], ]); diff --git a/front_end/sdk/sdk_strings.grdp b/front_end/sdk/sdk_strings.grdp index 8a30d05a02b..9c2352db71d 100644 --- a/front_end/sdk/sdk_strings.grdp +++ b/front_end/sdk/sdk_strings.grdp @@ -194,6 +194,9 @@ Show grid named areas + + Trusted Types - Fix violations + Show line numbers @@ -241,6 +244,9 @@ Migrate entirely to HTTPS to allow cookies to be set by same-site subresources + + Trusted Types - Policy violation + This cookie was blocked because it had the "SameSite=Strict" attribute but the request was cross-site. This includes top-level navigation requests initiated by other sites. This request is considered cross-site because the URL has a different scheme than the current site. From 698810c1ca56747dc20e366ffd828e818eb31dd1 Mon Sep 17 00:00:00 2001 From: Jan Scheffler Date: Wed, 28 Oct 2020 11:17:16 +0100 Subject: [PATCH 26/85] Update workflow documentation Change-Id: I22ad5399a7cf562d1b1a5e303fd320fe8191f5db Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2505132 Reviewed-by: Mathias Bynens Commit-Queue: Jan Scheffler --- docs/workflows.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/workflows.md b/docs/workflows.md index 2fae15a739d..fb95e91efb2 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -55,10 +55,12 @@ This works with Chromium 79 or later. /chrome --custom-devtools-frontend=file://$(realpath out/Default/resources/inspector) ``` -Note that `(realpath out/Default/resources/inspector)` expands to the absolute path to build artifacts for DevTools frontend. +Note that `$(realpath out/Default/resources/inspector)` expands to the absolute path to build artifacts for DevTools frontend. Open DevTools via F12 on Windows/Linux or Cmd+Option+I on Mac. +If you get errors along the line of `Uncaught TypeError: Cannot read property 'setInspectedTabId'` you probably specified an incorrect path - the path has to be absolute. On Mac and Linux, the file url will start with __three__ slashes: `file:///Users/...`. + Tip: You can inspect DevTools with DevTools by undocking DevTools and then opening a second instance of DevTools (F12 on Windows/Linux, Cmd+Option+I on Mac). ##### Running from remote URL From 96031ac770d60bf49b71cb9c9fa07cdf12782f13 Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Wed, 28 Oct 2020 05:14:59 -0700 Subject: [PATCH 27/85] Update DevTools DEPS. Rolling build: https://chromium.googlesource.com/chromium/src/build/+log/eef4a9f..899545e TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: If4abe4dadfd75861e76ab4de04c9f2e1550b7fec Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2505490 Reviewed-by: Devtools Autoroller Commit-Queue: Devtools Autoroller --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 1c2df33d5b8..87a85b4f8c6 100644 --- a/DEPS +++ b/DEPS @@ -6,7 +6,7 @@ use_relative_paths = True vars = { 'build_url': 'https://chromium.googlesource.com/chromium/src/build.git', - 'build_revision': 'eef4a9f3b45882b9ab380f9e7cfe5126dce9e595', + 'build_revision': '899545e432451d168713126c4c4238ba3c80baa9', 'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git', 'buildtools_revision': '98881a1297863de584fad20fb671e8c44ad1a7d0', From 5994ef430f3da2efc9e45661263932c38f1a6fab Mon Sep 17 00:00:00 2001 From: Jan Scheffler Date: Wed, 28 Oct 2020 14:36:12 +0100 Subject: [PATCH 28/85] [ts] Type-check sdk/EmulationModel.js R=aerotwist@chromium.org Bug: chromium:1011811 Change-Id: I0e50ab8f864d21a7083732dd63a6536eeeb44405 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2463342 Commit-Queue: Jan Scheffler Reviewed-by: Paul Lewis --- front_end/protocol_client/InspectorBackend.js | 14 ++ front_end/sdk/EmulationModel.js | 129 ++++++++++-------- 2 files changed, 89 insertions(+), 54 deletions(-) diff --git a/front_end/protocol_client/InspectorBackend.js b/front_end/protocol_client/InspectorBackend.js index 58e88eeb660..63192dbcbd3 100644 --- a/front_end/protocol_client/InspectorBackend.js +++ b/front_end/protocol_client/InspectorBackend.js @@ -738,6 +738,13 @@ export class TargetBase { throw new Error('Implemented in InspectorBackend.js'); } + /** + * @return {!ProtocolProxyApi.DeviceOrientationApi} + */ + deviceOrientationAgent() { + throw new Error('Implemented in InspectorBackend.js'); + } + /** * @return {!ProtocolProxyApi.DOMApi} */ @@ -766,6 +773,13 @@ export class TargetBase { throw new Error('Implemented in InspectorBackend.js'); } + /** + * @return {!ProtocolProxyApi.EmulationApi} + */ + emulationAgent() { + throw new Error('Implemented in InspectorBackend.js'); + } + /** * @return {!ProtocolProxyApi.HeapProfilerApi} */ diff --git a/front_end/sdk/EmulationModel.js b/front_end/sdk/EmulationModel.js index ad27afb3d7e..0f2c8cf9806 100644 --- a/front_end/sdk/EmulationModel.js +++ b/front_end/sdk/EmulationModel.js @@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks - import * as Common from '../common/common.js'; import {CSSModel} from './CSSModel.js'; +import {MultitargetNetworkManager} from './NetworkManager.js'; import {Events, OverlayModel} from './OverlayModel.js'; import {Capability, SDKModel, Target} from './SDKModel.js'; // eslint-disable-line no-unused-vars @@ -23,14 +21,17 @@ export class EmulationModel extends SDKModel { this._cssModel = target.model(CSSModel); this._overlayModel = target.model(OverlayModel); if (this._overlayModel) { - this._overlayModel.addEventListener(Events.InspectModeWillBeToggled, this._updateTouch, this); + this._overlayModel.addEventListener(Events.InspectModeWillBeToggled, () => { + this._updateTouch(); + }, this); } const disableJavascriptSetting = Common.Settings.Settings.instance().moduleSetting('javaScriptDisabled'); disableJavascriptSetting.addChangeListener( - () => this._emulationAgent.setScriptExecutionDisabled(disableJavascriptSetting.get())); + async () => + await this._emulationAgent.invoke_setScriptExecutionDisabled({value: disableJavascriptSetting.get()})); if (disableJavascriptSetting.get()) { - this._emulationAgent.setScriptExecutionDisabled(true); + this._emulationAgent.invoke_setScriptExecutionDisabled({value: true}); } const touchSetting = Common.Settings.Settings.instance().moduleSetting('emulation.touch'); @@ -106,7 +107,6 @@ export class EmulationModel extends SDKModel { this._touchConfiguration = { enabled: false, configuration: Protocol.Emulation.SetEmitTouchEventsForMouseRequestConfiguration.Mobile, - scriptId: '' }; } @@ -118,21 +118,22 @@ export class EmulationModel extends SDKModel { } /** - * @return {!Promise} + * @return {!Promise} */ - resetPageScaleFactor() { - return this._emulationAgent.resetPageScaleFactor(); + async resetPageScaleFactor() { + await this._emulationAgent.invoke_resetPageScaleFactor(); } /** * @param {?Protocol.Page.SetDeviceMetricsOverrideRequest} metrics * @return {!Promise} */ - emulateDevice(metrics) { + async emulateDevice(metrics) { if (metrics) { - return this._emulationAgent.invoke_setDeviceMetricsOverride(metrics); + await this._emulationAgent.invoke_setDeviceMetricsOverride(metrics); + } else { + await this._emulationAgent.invoke_clearDeviceMetricsOverride(); } - return this._emulationAgent.clearDeviceMetricsOverride(); } /** @@ -146,20 +147,20 @@ export class EmulationModel extends SDKModel { * @param {?Location} location */ async emulateLocation(location) { - if (!location) { - this._emulationAgent.clearGeolocationOverride(); - this._emulationAgent.setTimezoneOverride(''); - this._emulationAgent.setLocaleOverride(''); - this._emulationAgent.setUserAgentOverride(SDK.multitargetNetworkManager.currentUserAgent()); - } - - if (location.error) { - this._emulationAgent.setGeolocationOverride(); - this._emulationAgent.setTimezoneOverride(''); - this._emulationAgent.setLocaleOverride(''); - this._emulationAgent.setUserAgentOverride(SDK.multitargetNetworkManager.currentUserAgent()); + if (!location || location.error) { + await Promise.all([ + this._emulationAgent.invoke_clearGeolocationOverride(), + this._emulationAgent.invoke_setTimezoneOverride({timezoneId: ''}), + this._emulationAgent.invoke_setLocaleOverride({locale: ''}), + this._emulationAgent.invoke_setUserAgentOverride( + {userAgent: MultitargetNetworkManager.instance().currentUserAgent()}), + ]); } else { - const processEmulationResult = (errorType, result) => { + /** + * @param {string} errorType + * @param {*} result + */ + function processEmulationResult(errorType, result) { const errorMessage = result.getError(); if (errorMessage) { return Promise.reject({ @@ -167,10 +168,10 @@ export class EmulationModel extends SDKModel { message: errorMessage, }); } - return Promise.resolve(result); - }; + return Promise.resolve(); + } - return Promise.all([ + await Promise.all([ this._emulationAgent .invoke_setGeolocationOverride({ latitude: location.latitude, @@ -190,7 +191,7 @@ export class EmulationModel extends SDKModel { .then(result => processEmulationResult('emulation-set-locale', result)), this._emulationAgent .invoke_setUserAgentOverride({ - userAgent: SDK.multitargetNetworkManager.currentUserAgent(), + userAgent: MultitargetNetworkManager.instance().currentUserAgent(), acceptLanguage: location.locale, }) .then(result => processEmulationResult('emulation-set-user-agent', result)), @@ -200,13 +201,14 @@ export class EmulationModel extends SDKModel { /** * @param {?DeviceOrientation} deviceOrientation + * @returns {!Promise} */ - emulateDeviceOrientation(deviceOrientation) { + async emulateDeviceOrientation(deviceOrientation) { if (deviceOrientation) { - this._deviceOrientationAgent.setDeviceOrientationOverride( - deviceOrientation.alpha, deviceOrientation.beta, deviceOrientation.gamma); + await this._deviceOrientationAgent.invoke_setDeviceOrientationOverride( + {alpha: deviceOrientation.alpha, beta: deviceOrientation.beta, gamma: deviceOrientation.gamma}); } else { - this._deviceOrientationAgent.clearDeviceOrientationOverride(); + await this._deviceOrientationAgent.invoke_clearDeviceOrientationOverride(); } } @@ -224,9 +226,10 @@ export class EmulationModel extends SDKModel { /** * @param {string} type * @param {!Array<{name: string, value: string}>} features + * @returns {!Promise} */ - _emulateCSSMedia(type, features) { - this._emulationAgent.setEmulatedMedia(type, features); + async _emulateCSSMedia(type, features) { + await this._emulationAgent.invoke_setEmulatedMedia({media: type, features}); if (this._cssModel) { this._cssModel.mediaQueryResultChanged(); } @@ -234,41 +237,52 @@ export class EmulationModel extends SDKModel { /** * @param {!Protocol.Emulation.SetEmulatedVisionDeficiencyRequestType} type + * @returns {!Promise} */ - _emulateVisionDeficiency(type) { - this._emulationAgent.setEmulatedVisionDeficiency(type); + async _emulateVisionDeficiency(type) { + await this._emulationAgent.invoke_setEmulatedVisionDeficiency({type}); } + /** + * + * @param {boolean} disabled + */ _setLocalFontsDisabled(disabled) { + if (!this._cssModel) { + return; + } this._cssModel.setLocalFontsEnabled(!disabled); } /** * @param {number} rate + * @returns {!Promise} */ - setCPUThrottlingRate(rate) { - this._emulationAgent.setCPUThrottlingRate(rate); + async setCPUThrottlingRate(rate) { + await this._emulationAgent.invoke_setCPUThrottlingRate({rate}); } /** * @param {boolean} enabled * @param {boolean} mobile + * @returns {!Promise} */ - emulateTouch(enabled, mobile) { + async emulateTouch(enabled, mobile) { this._touchEnabled = enabled; this._touchMobile = mobile; - this._updateTouch(); + await this._updateTouch(); } /** * @param {boolean} enabled + * @returns {!Promise} */ - overrideEmulateTouch(enabled) { + async overrideEmulateTouch(enabled) { this._customTouchEnabled = enabled; - this._updateTouch(); + await this._updateTouch(); } - _updateTouch() { + async _updateTouch() { let configuration = { enabled: this._touchEnabled, configuration: this._touchMobile ? Protocol.Emulation.SetEmitTouchEventsForMouseRequestConfiguration.Mobile : @@ -277,14 +291,14 @@ export class EmulationModel extends SDKModel { if (this._customTouchEnabled) { configuration = { enabled: true, - configuration: Protocol.Emulation.SetEmitTouchEventsForMouseRequestConfiguration.Mobile + configuration: Protocol.Emulation.SetEmitTouchEventsForMouseRequestConfiguration.Mobile, }; } if (this._overlayModel && this._overlayModel.inspectModeEnabled()) { configuration = { enabled: false, - configuration: Protocol.Emulation.SetEmitTouchEventsForMouseRequestConfiguration.Mobile + configuration: Protocol.Emulation.SetEmitTouchEventsForMouseRequestConfiguration.Mobile, }; } @@ -297,8 +311,9 @@ export class EmulationModel extends SDKModel { } this._touchConfiguration = configuration; - this._emulationAgent.setTouchEmulationEnabled(configuration.enabled, 1); - this._emulationAgent.setEmitTouchEventsForMouse(configuration.enabled, configuration.configuration); + await this._emulationAgent.invoke_setTouchEmulationEnabled({enabled: configuration.enabled, maxTouchPoints: 1}); + await this._emulationAgent.invoke_setEmitTouchEventsForMouse( + {enabled: configuration.enabled, configuration: configuration.configuration}); } _updateCssMedia() { @@ -339,6 +354,7 @@ export class Location { } /** + * @param {string} value * @return {!Location} */ static parseSetting(value) { @@ -354,6 +370,7 @@ export class Location { * @param {string} latitudeString * @param {string} longitudeString * @param {string} timezoneId + * @param {string} locale * @return {?Location} */ static parseUserInput(latitudeString, longitudeString, timezoneId, locale) { @@ -380,7 +397,7 @@ export class Location { static latitudeValidator(value) { const numValue = parseFloat(value); const valid = /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && numValue >= -90 && numValue <= 90; - return {valid}; + return {valid, errorMessage: undefined}; } /** @@ -390,7 +407,7 @@ export class Location { static longitudeValidator(value) { const numValue = parseFloat(value); const valid = /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && numValue >= -180 && numValue <= 180; - return {valid}; + return {valid, errorMessage: undefined}; } /** @@ -405,7 +422,7 @@ export class Location { // the input other than checking if it contains at least one alphabet. // The empty string resets the override, and is accepted as well. const valid = value === '' || /[a-zA-Z]/.test(value); - return {valid}; + return {valid, errorMessage: undefined}; } /** @@ -420,7 +437,7 @@ export class Location { // The empty string resets the override, and is accepted as // well. const valid = value === '' || /[a-zA-Z]{2}/.test(value); - return {valid}; + return {valid, errorMessage: undefined}; } /** @@ -446,6 +463,7 @@ export class DeviceOrientation { } /** + * @param {string} value * @return {!DeviceOrientation} */ static parseSetting(value) { @@ -457,6 +475,9 @@ export class DeviceOrientation { } /** + * @param {string} alphaString + * @param {string} betaString + * @param {string} gammaString * @return {?DeviceOrientation} */ static parseUserInput(alphaString, betaString, gammaString) { @@ -485,7 +506,7 @@ export class DeviceOrientation { */ static validator(value) { const valid = /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value); - return {valid}; + return {valid, errorMessage: undefined}; } /** From b0266369c5a2d1e6ccf0fbaf3cf718d7e1cb17f5 Mon Sep 17 00:00:00 2001 From: Andres Olivares Date: Tue, 27 Oct 2020 10:50:53 -0500 Subject: [PATCH 29/85] [ts] Typecheck settings/KeybindsSettingsTab.js with TypeScript Bug: chromium:1011811 Change-Id: I344168e2117ef4e1c22cb27ef3a235ad8c182642 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2495770 Reviewed-by: Jack Franklin Commit-Queue: Andres Olivares --- front_end/settings/KeybindsSettingsTab.js | 78 ++++++++++++++--------- 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/front_end/settings/KeybindsSettingsTab.js b/front_end/settings/KeybindsSettingsTab.js index 99045c3c75c..478549a8147 100644 --- a/front_end/settings/KeybindsSettingsTab.js +++ b/front_end/settings/KeybindsSettingsTab.js @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @ts-nocheck -// TODO(crbug.com/1011811): Enable TypeScript compiler checks import * as Common from '../common/common.js'; import * as Host from '../host/host.js'; import * as i18n from '../i18n/i18n.js'; +import * as Root from '../root/root.js'; import * as UI from '../ui/ui.js'; export const UIStrings = { @@ -92,8 +91,10 @@ export class KeybindsSettingsTab extends UI.Widget.VBox { keybindsSetSetting.addChangeListener(this.update, this); const keybindsSetSelect = UI.SettingsUI.createControlForSetting(keybindsSetSetting, i18nString(UIStrings.matchShortcutsFromPreset)); - keybindsSetSelect.classList.add('keybinds-set-select'); - this.contentElement.appendChild(keybindsSetSelect); + if (keybindsSetSelect) { + keybindsSetSelect.classList.add('keybinds-set-select'); + this.contentElement.appendChild(keybindsSetSelect); + } /** @type {!UI.ListModel.ListModel} */ this._items = new UI.ListModel.ListModel(); @@ -162,7 +163,7 @@ export class KeybindsSettingsTab extends UI.Widget.VBox { } if (newDescriptors) { UI.ShortcutRegistry.ShortcutRegistry.instance().registerUserShortcut( - originalShortcut.changeKeys(/** @type !Array. */ (newDescriptors)) + originalShortcut.changeKeys(/** @type {!Array.} */ (newDescriptors)) .changeType(UI.KeyboardShortcut.Type.UserShortcut)); if (originalShortcut.type === UI.KeyboardShortcut.Type.UnsetShortcut) { Host.userMetrics.actionTaken(Host.UserMetrics.Action.UserShortcutAdded); @@ -198,14 +199,14 @@ export class KeybindsSettingsTab extends UI.Widget.VBox { * @override * @param {?KeybindsItem} from * @param {?KeybindsItem} to - * @param {?Element} fromElement - * @param {?Element} toElement + * @param {?HTMLElement} fromElement + * @param {?HTMLElement} toElement */ selectedItemChanged(from, to, fromElement, toElement) { if (fromElement) { fromElement.tabIndex = -1; } - if (toElement) { + if (toElement && this._editingRow) { if (to === this._editingItem) { this._editingRow.focus(); } else { @@ -271,7 +272,10 @@ export class KeybindsSettingsTab extends UI.Widget.VBox { return 0; }); + /** @type {!Array.} */ const items = []; + + /** @type {string} */ let currentCategory; actions.forEach(action => { if (currentCategory !== action.category()) { @@ -287,7 +291,8 @@ export class KeybindsSettingsTab extends UI.Widget.VBox { * @param {!Event} event */ onEscapeKeyPressed(event) { - if (this._editingRow && document.deepActiveElement().nodeName === 'INPUT') { + const deepActiveElement = document.deepActiveElement(); + if (this._editingRow && deepActiveElement && deepActiveElement.nodeName === 'INPUT') { this._editingRow.onEscapeKeyPressed(event); } } @@ -329,9 +334,9 @@ export class ShortcutListItem { this._shortcutInputs = new Map(); /** @type {!Array.} */ this._shortcuts = UI.ShortcutRegistry.ShortcutRegistry.instance().shortcutsForAction(item.id()); - /** @type {?Element} */ + /** @type {?HTMLElement} */ this._elementToFocus = null; - /** @type {?Element} */ + /** @type {?HTMLButtonElement} */ this._confirmButton = null; /** @type {?Element} */ this._addShortcutLinkContainer = null; @@ -380,7 +385,8 @@ export class ShortcutListItem { _setupEditor() { this._addShortcutLinkContainer = this.element.createChild('div', 'keybinds-shortcut devtools-link'); - const addShortcutLink = this._addShortcutLinkContainer.createChild('span', 'devtools-link'); + const addShortcutLink = + /** @type {!HTMLDivElement} */ (this._addShortcutLinkContainer.createChild('span', 'devtools-link')); addShortcutLink.textContent = i18nString(UIStrings.addAShortcut); addShortcutLink.tabIndex = 0; UI.ARIAUtils.markAsLink(addShortcutLink); @@ -414,7 +420,10 @@ export class ShortcutListItem { new UI.KeyboardShortcut.KeyboardShortcut([], this._item.id(), UI.KeyboardShortcut.Type.UnsetShortcut); this._shortcuts.push(shortcut); this._update(); - this._shortcutInputs.get(shortcut).focus(); + const shortcutInput = /** @type {!HTMLElement} */ (this._shortcutInputs.get(shortcut)); + if (shortcutInput) { + shortcutInput.focus(); + } } /** @@ -425,6 +434,7 @@ export class ShortcutListItem { if (this._editedShortcuts.has(shortcut) && !this._editedShortcuts.get(shortcut)) { return; } + /** @type {!UI.Icon.Icon} */ let icon; if (shortcut.type !== UI.KeyboardShortcut.Type.UnsetShortcut && !shortcut.isDefault()) { icon = UI.Icon.Icon.create('largeicon-shortcut-changed', 'keybinds-modified'); @@ -433,7 +443,7 @@ export class ShortcutListItem { } const shortcutElement = this.element.createChild('div', 'keybinds-shortcut keybinds-list-text'); if (this._isEditing) { - const shortcutInput = shortcutElement.createChild('input', 'harmony-input'); + const shortcutInput = /** @type {!HTMLInputElement} */ (shortcutElement.createChild('input', 'harmony-input')); shortcutInput.spellcheck = false; this._shortcutInputs.set(shortcut, shortcutInput); if (!this._elementToFocus) { @@ -480,11 +490,11 @@ export class ShortcutListItem { * @param {string} label * @param {string} iconName * @param {string} className - * @param {!Function} listener - * @return {!Element} + * @param {function():void} listener + * @return {!HTMLButtonElement} */ _createIconButton(label, iconName, className, listener) { - const button = document.createElement('button'); + const button = /** @type {!HTMLButtonElement}*/ (document.createElement('button')); button.appendChild(UI.Icon.Icon.create(iconName)); button.addEventListener('click', listener); UI.ARIAUtils.setAccessibleName(button, label); @@ -496,15 +506,15 @@ export class ShortcutListItem { /** * @param {!UI.KeyboardShortcut.KeyboardShortcut} shortcut - * @param {!Element} shortcutInput + * @param {!HTMLInputElement} shortcutInput * @param {!Event} event */ _onShortcutInputKeyDown(shortcut, shortcutInput, event) { - if (event.key !== 'Tab') { + if (/** @type {!KeyboardEvent} */ (event).key !== 'Tab') { const userKey = UI.KeyboardShortcut.KeyboardShortcut.makeKeyFromEvent(/** @type {!KeyboardEvent} */ (event)); const codeAndModifiers = UI.KeyboardShortcut.KeyboardShortcut.keyCodeAndModifiersFromKey(userKey); const userDescriptor = UI.KeyboardShortcut.KeyboardShortcut.makeDescriptor( - {code: userKey, name: event.key}, codeAndModifiers.modifiers); + {code: userKey, name: /** @type {!KeyboardEvent} */ (event).key}, codeAndModifiers.modifiers); shortcutInput.value = this._shortcutInputTextForDescriptor(userDescriptor); this._editedShortcuts.set(shortcut, [userDescriptor]); this._validateInputs(); @@ -551,37 +561,46 @@ export class ShortcutListItem { if (activeElement === shortcutInput) { this._onShortcutInputKeyDown( /** @type {!UI.KeyboardShortcut.KeyboardShortcut} */ (shortcut), - /** @type {!HTMLInputElement} */ (shortcutInput), event); + /** @type {!HTMLInputElement} */ (shortcutInput), /** @type {!KeyboardEvent} */ (event)); } } } _validateInputs() { - this._confirmButton.disabled = false; - this._errorMessageElement.classList.add('hidden'); + const confirmButton = this._confirmButton; + const errorMessageElement = this._errorMessageElement; + if (!confirmButton || !errorMessageElement) { + return; + } + + confirmButton.disabled = false; + errorMessageElement.classList.add('hidden'); this._shortcutInputs.forEach((shortcutInput, shortcut) => { const userDescriptors = this._editedShortcuts.get(shortcut); if (!userDescriptors) { return; } if (UI.KeyboardShortcut.KeyboardShortcut.isModifier(userDescriptors[0].key)) { - this._confirmButton.disabled = true; + confirmButton.disabled = true; shortcutInput.classList.add('error-input'); UI.ARIAUtils.setInvalid(shortcutInput, true); - this._errorMessageElement.classList.remove('hidden'); - this._errorMessageElement.textContent = i18nString(UIStrings.shortcutsCannotContainOnly); + errorMessageElement.classList.remove('hidden'); + errorMessageElement.textContent = i18nString(UIStrings.shortcutsCannotContainOnly); return; } const conflicts = UI.ShortcutRegistry.ShortcutRegistry.instance() .actionsForDescriptors(userDescriptors) .filter(actionId => actionId !== this._item.id()); if (conflicts.length) { - this._confirmButton.disabled = true; + confirmButton.disabled = true; shortcutInput.classList.add('error-input'); UI.ARIAUtils.setInvalid(shortcutInput, true); - this._errorMessageElement.classList.remove('hidden'); + errorMessageElement.classList.remove('hidden'); const action = UI.ActionRegistry.ActionRegistry.instance().action(conflicts[0]); - this._errorMessageElement.textContent = i18nString(UIStrings.thisShortcutIsInUseByS, {PH1: action.title()}); + if (!action) { + return; + } + errorMessageElement.textContent = i18nString(UIStrings.thisShortcutIsInUseByS, {PH1: action.title()}); return; } shortcutInput.classList.remove('error-input'); @@ -591,4 +610,5 @@ export class ShortcutListItem { } /** @typedef {string|!UI.Action.Action} */ +// @ts-ignore typedef export let KeybindsItem; From a93c4377035e148171b9fe18100a74e98af91730 Mon Sep 17 00:00:00 2001 From: Jan Scheffler Date: Wed, 28 Oct 2020 16:10:59 +0100 Subject: [PATCH 30/85] Reland "[Puppeteer] Update puppeteer to v.5.4.0" This reverts commit 89a6d325b7e6b20e0c41f24b95a7ad7c30193e3f Original change's description: > Revert "[Puppeteer] Update puppeteer to v.5.4.0" > > This reverts commit a759e62ec6f4c64816013433b96363f6cc1004de. > > Reason for revert: breaks CQ > > Original change's description: > > [Puppeteer] Update puppeteer to v.5.4.0 > > > > Change-Id: I831d23e24f840d1898959814809839a34b6b9eb7 > > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2502001 > > Commit-Queue: Jan Scheffler > > Reviewed-by: Mathias Bynens > > Reviewed-by: Paul Lewis > > TBR=aerotwist@chromium.org,mathias@chromium.org,janscheffler@chromium.org,jacktfranklin@chromium.org > > Change-Id: Idc901e648ddaba20697c4b4b5d1580f6e07087e6 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2503514 > Reviewed-by: Mathias Bynens > Commit-Queue: Mathias Bynens TBR=aerotwist@chromium.org,mathias@chromium.org,janscheffler@chromium.org,jacktfranklin@chromium.org Change-Id: Ib7ffa336327ac5c0b133cd6fc1660d03d16885d0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2505652 Reviewed-by: Jan Scheffler Commit-Queue: Jan Scheffler --- all_devtools_modules.gni | 17 +- devtools_grd_files.gni | 17 +- front_end/third_party/puppeteer/BUILD.gn | 51 +- .../third_party/puppeteer/package/LICENSE | 4 +- .../third_party/puppeteer/package/README.md | 22 +- .../puppeteer/package/cjs-entry-core.js | 2 +- .../puppeteer/package/cjs-entry.js | 2 +- .../third_party/puppeteer/package/install.js | 2 +- .../lib/cjs/puppeteer/api-docs-entry.d.ts | 49 - .../lib/cjs/puppeteer/api-docs-entry.d.ts.map | 1 - .../lib/cjs/puppeteer/api-docs-entry.js | 71 - .../cjs/puppeteer/common/Accessibility.d.ts | 176 - .../puppeteer/common/Accessibility.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Accessibility.js | 360 -- .../lib/cjs/puppeteer/common/Browser.d.ts | 424 -- .../lib/cjs/puppeteer/common/Browser.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Browser.js | 519 -- .../lib/cjs/puppeteer/common/Connection.d.ts | 120 - .../cjs/puppeteer/common/Connection.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Connection.js | 271 -- .../common/ConnectionTransport.d.ts.map | 1 - .../cjs/puppeteer/common/ConsoleMessage.d.ts | 68 - .../puppeteer/common/ConsoleMessage.d.ts.map | 1 - .../cjs/puppeteer/common/ConsoleMessage.js | 58 - .../lib/cjs/puppeteer/common/Coverage.d.ts | 181 - .../cjs/puppeteer/common/Coverage.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Coverage.js | 319 -- .../lib/cjs/puppeteer/common/DOMWorld.d.ts | 136 - .../cjs/puppeteer/common/DOMWorld.d.ts.map | 1 - .../lib/cjs/puppeteer/common/DOMWorld.js | 520 -- .../lib/cjs/puppeteer/common/Debug.d.ts | 53 - .../lib/cjs/puppeteer/common/Debug.d.ts.map | 1 - .../package/lib/cjs/puppeteer/common/Debug.js | 80 - .../puppeteer/common/DeviceDescriptors.d.ts | 33 - .../common/DeviceDescriptors.d.ts.map | 1 - .../cjs/puppeteer/common/DeviceDescriptors.js | 876 ---- .../lib/cjs/puppeteer/common/Dialog.d.ts | 76 - .../lib/cjs/puppeteer/common/Dialog.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Dialog.js | 96 - .../puppeteer/common/EmulationManager.d.ts | 25 - .../common/EmulationManager.d.ts.map | 1 - .../cjs/puppeteer/common/EmulationManager.js | 37 - .../lib/cjs/puppeteer/common/Errors.d.ts | 34 - .../lib/cjs/puppeteer/common/Errors.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Errors.js | 41 - .../lib/cjs/puppeteer/common/EvalTypes.d.ts | 59 - .../cjs/puppeteer/common/EvalTypes.d.ts.map | 1 - .../cjs/puppeteer/common/EventEmitter.d.ts | 89 - .../puppeteer/common/EventEmitter.d.ts.map | 1 - .../lib/cjs/puppeteer/common/EventEmitter.js | 116 - .../lib/cjs/puppeteer/common/Events.d.ts | 82 - .../lib/cjs/puppeteer/common/Events.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Events.js | 86 - .../puppeteer/common/ExecutionContext.d.ts | 186 - .../common/ExecutionContext.d.ts.map | 1 - .../cjs/puppeteer/common/ExecutionContext.js | 317 -- .../lib/cjs/puppeteer/common/FileChooser.d.ts | 60 - .../cjs/puppeteer/common/FileChooser.d.ts.map | 1 - .../lib/cjs/puppeteer/common/FileChooser.js | 70 - .../cjs/puppeteer/common/FrameManager.d.ts | 710 --- .../puppeteer/common/FrameManager.d.ts.map | 1 - .../lib/cjs/puppeteer/common/FrameManager.js | 924 ---- .../lib/cjs/puppeteer/common/HTTPRequest.d.ts | 276 -- .../cjs/puppeteer/common/HTTPRequest.d.ts.map | 1 - .../lib/cjs/puppeteer/common/HTTPRequest.js | 421 -- .../cjs/puppeteer/common/HTTPResponse.d.ts | 128 - .../puppeteer/common/HTTPResponse.d.ts.map | 1 - .../lib/cjs/puppeteer/common/HTTPResponse.js | 154 - .../lib/cjs/puppeteer/common/Input.d.ts | 322 -- .../lib/cjs/puppeteer/common/Input.d.ts.map | 1 - .../package/lib/cjs/puppeteer/common/Input.js | 476 -- .../lib/cjs/puppeteer/common/JSHandle.d.ts | 439 -- .../cjs/puppeteer/common/JSHandle.d.ts.map | 1 - .../lib/cjs/puppeteer/common/JSHandle.js | 746 --- .../puppeteer/common/LifecycleWatcher.d.ts | 62 - .../common/LifecycleWatcher.d.ts.map | 1 - .../cjs/puppeteer/common/LifecycleWatcher.js | 148 - .../cjs/puppeteer/common/NetworkManager.d.ts | 80 - .../puppeteer/common/NetworkManager.d.ts.map | 1 - .../cjs/puppeteer/common/NetworkManager.js | 265 -- .../lib/cjs/puppeteer/common/PDFOptions.d.ts | 152 - .../cjs/puppeteer/common/PDFOptions.d.ts.map | 1 - .../lib/cjs/puppeteer/common/PDFOptions.js | 34 - .../lib/cjs/puppeteer/common/Page.d.ts | 815 ---- .../lib/cjs/puppeteer/common/Page.d.ts.map | 1 - .../package/lib/cjs/puppeteer/common/Page.js | 1275 ----- .../cjs/puppeteer/common/Puppeteer.d.ts.map | 1 - .../puppeteer/common/PuppeteerViewport.d.ts | 24 - .../common/PuppeteerViewport.d.ts.map | 1 - .../cjs/puppeteer/common/PuppeteerViewport.js | 2 - .../cjs/puppeteer/common/QueryHandler.d.ts | 31 - .../puppeteer/common/QueryHandler.d.ts.map | 1 - .../lib/cjs/puppeteer/common/QueryHandler.js | 63 - .../cjs/puppeteer/common/SecurityDetails.d.ts | 61 - .../puppeteer/common/SecurityDetails.d.ts.map | 1 - .../cjs/puppeteer/common/SecurityDetails.js | 76 - .../lib/cjs/puppeteer/common/Target.d.ts | 98 - .../lib/cjs/puppeteer/common/Target.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Target.js | 141 - .../cjs/puppeteer/common/TimeoutSettings.d.ts | 28 - .../puppeteer/common/TimeoutSettings.d.ts.map | 1 - .../cjs/puppeteer/common/TimeoutSettings.js | 47 - .../lib/cjs/puppeteer/common/Tracing.d.ts | 47 - .../lib/cjs/puppeteer/common/Tracing.d.ts.map | 1 - .../lib/cjs/puppeteer/common/Tracing.js | 94 - .../puppeteer/common/USKeyboardLayout.d.ts | 40 - .../common/USKeyboardLayout.d.ts.map | 1 - .../cjs/puppeteer/common/USKeyboardLayout.js | 406 -- .../common/WebSocketTransport.d.ts.map | 1 - .../lib/cjs/puppeteer/common/WebWorker.d.ts | 102 - .../cjs/puppeteer/common/WebWorker.d.ts.map | 1 - .../lib/cjs/puppeteer/common/WebWorker.js | 112 - .../lib/cjs/puppeteer/common/assert.d.ts | 22 - .../lib/cjs/puppeteer/common/assert.d.ts.map | 1 - .../lib/cjs/puppeteer/common/assert.js | 27 - .../lib/cjs/puppeteer/common/helper.d.ts | 42 - .../lib/cjs/puppeteer/common/helper.d.ts.map | 1 - .../lib/cjs/puppeteer/common/helper.js | 206 - .../lib/cjs/puppeteer/environment.d.ts.map | 1 - .../package/lib/cjs/puppeteer/environment.js | 21 - .../lib/cjs/puppeteer/index-core.d.ts.map | 1 - .../package/lib/cjs/puppeteer/index-core.js | 20 - .../package/lib/cjs/puppeteer/index.d.ts.map | 1 - .../lib/cjs/puppeteer/initialize.d.ts.map | 1 - .../package/lib/cjs/puppeteer/initialize.js | 38 - .../lib/cjs/puppeteer/install.d.ts.map | 1 - .../package/lib/cjs/puppeteer/install.js | 152 - .../cjs/puppeteer/node/BrowserFetcher.d.ts | 136 - .../puppeteer/node/BrowserFetcher.d.ts.map | 1 - .../lib/cjs/puppeteer/node/BrowserFetcher.js | 492 -- .../lib/cjs/puppeteer/node/BrowserRunner.d.ts | 40 - .../cjs/puppeteer/node/BrowserRunner.d.ts.map | 1 - .../lib/cjs/puppeteer/node/BrowserRunner.js | 220 - .../cjs/puppeteer/node/LaunchOptions.d.ts.map | 1 - .../lib/cjs/puppeteer/node/Launcher.d.ts | 16 - .../lib/cjs/puppeteer/node/Launcher.d.ts.map | 1 - .../lib/cjs/puppeteer/node/Launcher.js | 563 --- .../lib/cjs/puppeteer/node/PipeTransport.d.ts | 31 - .../cjs/puppeteer/node/PipeTransport.d.ts.map | 1 - .../lib/cjs/puppeteer/node/PipeTransport.js | 64 - .../package/lib/cjs/puppeteer/revisions.d.ts | 22 - .../lib/cjs/puppeteer/revisions.d.ts.map | 1 - .../cjs/puppeteer/tsconfig.cjs.tsbuildinfo | 4214 ----------------- .../lib/cjs/vendor/mitt/src/index.d.ts | 20 - .../lib/cjs/vendor/mitt/src/index.d.ts.map | 1 - .../package/lib/cjs/vendor/mitt/src/index.js | 52 - .../lib/cjs/vendor/tsconfig.cjs.tsbuildinfo | 2901 ------------ .../lib/esm/puppeteer/api-docs-entry.d.ts | 6 +- .../lib/esm/puppeteer/api-docs-entry.d.ts.map | 2 +- .../lib/esm/puppeteer/api-docs-entry.js | 11 +- .../esm/puppeteer/common/Accessibility.d.ts | 4 +- .../lib/esm/puppeteer/common/Accessibility.js | 14 +- .../puppeteer/common/AriaQueryHandler.d.ts | 21 + .../common/AriaQueryHandler.d.ts.map | 1 + .../esm/puppeteer/common/AriaQueryHandler.js | 81 + .../lib/esm/puppeteer/common/Browser.d.ts | 5 +- .../lib/esm/puppeteer/common/Browser.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Browser.js | 7 +- .../puppeteer/common/BrowserConnector.d.ts} | 43 +- .../common/BrowserConnector.d.ts.map | 1 + .../esm/puppeteer/common/BrowserConnector.js | 76 + ...rt.d.ts => BrowserWebSocketTransport.d.ts} | 17 +- .../common/BrowserWebSocketTransport.d.ts.map | 1 + .../common/BrowserWebSocketTransport.js} | 17 +- .../lib/esm/puppeteer/common/Connection.d.ts | 4 +- .../esm/puppeteer/common/Connection.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Connection.js | 6 +- .../esm/puppeteer/common/ConsoleMessage.d.ts | 8 +- .../puppeteer/common/ConsoleMessage.d.ts.map | 2 +- .../esm/puppeteer/common/ConsoleMessage.js | 12 +- .../lib/esm/puppeteer/common/DOMWorld.d.ts | 27 +- .../esm/puppeteer/common/DOMWorld.d.ts.map | 2 +- .../lib/esm/puppeteer/common/DOMWorld.js | 248 +- .../lib/esm/puppeteer/common/Errors.d.ts | 2 +- .../lib/esm/puppeteer/common/Errors.js | 2 +- .../puppeteer/common/ExecutionContext.d.ts | 5 +- .../common/ExecutionContext.d.ts.map | 2 +- .../esm/puppeteer/common/FrameManager.d.ts | 27 +- .../puppeteer/common/FrameManager.d.ts.map | 2 +- .../lib/esm/puppeteer/common/FrameManager.js | 44 +- .../esm/puppeteer/common/HTTPRequest.d.ts.map | 2 +- .../lib/esm/puppeteer/common/HTTPRequest.js | 5 +- .../lib/esm/puppeteer/common/JSHandle.d.ts | 2 +- .../esm/puppeteer/common/JSHandle.d.ts.map | 2 +- .../lib/esm/puppeteer/common/JSHandle.js | 51 +- .../lib/esm/puppeteer/common/Page.d.ts | 99 +- .../lib/esm/puppeteer/common/Page.d.ts.map | 2 +- .../package/lib/esm/puppeteer/common/Page.js | 201 +- .../puppeteer/common/Product.d.ts} | 8 +- .../lib/esm/puppeteer/common/Product.d.ts.map | 1 + .../puppeteer/common/Product.js} | 2 - .../lib/esm/puppeteer/common/Puppeteer.d.ts | 183 +- .../esm/puppeteer/common/Puppeteer.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Puppeteer.js | 186 +- .../esm/puppeteer/common/QueryHandler.d.ts | 47 +- .../puppeteer/common/QueryHandler.d.ts.map | 2 +- .../lib/esm/puppeteer/common/QueryHandler.js | 132 +- .../lib/esm/puppeteer/common/Tracing.d.ts.map | 2 +- .../lib/esm/puppeteer/common/Tracing.js | 8 +- .../common/WebSocketTransport.d.ts.map | 1 - .../puppeteer/common/fetch.d.ts} | 4 +- .../lib/esm/puppeteer/common/fetch.d.ts.map | 1 + .../puppeteer/common/fetch.js} | 10 +- .../lib/esm/puppeteer/common/helper.d.ts | 24 + .../lib/esm/puppeteer/common/helper.d.ts.map | 2 +- .../lib/esm/puppeteer/common/helper.js | 124 +- .../lib/esm/puppeteer/index-core.d.ts.map | 1 - .../package/lib/esm/puppeteer/index-core.js | 18 - .../package/lib/esm/puppeteer/index.d.ts | 18 - .../package/lib/esm/puppeteer/index.d.ts.map | 1 - .../package/lib/esm/puppeteer/index.js | 18 - .../lib/esm/puppeteer/initialize-node.d.ts | 18 + .../esm/puppeteer/initialize-node.d.ts.map | 1 + .../{initialize.js => initialize-node.js} | 15 +- .../puppeteer/initialize-web.d.ts} | 4 +- .../lib/esm/puppeteer/initialize-web.d.ts.map | 1 + .../{initialize.d.ts => initialize-web.js} | 8 +- .../lib/esm/puppeteer/initialize.d.ts.map | 1 - .../package/lib/esm/puppeteer/install.d.ts | 18 - .../lib/esm/puppeteer/install.d.ts.map | 1 - .../puppeteer/node-puppeteer-core.d.ts} | 4 +- .../puppeteer/node-puppeteer-core.d.ts.map | 1 + ...index-core.d.ts => node-puppeteer-core.js} | 9 +- .../index.d.ts => esm/puppeteer/node.d.ts} | 6 +- .../package/lib/esm/puppeteer/node.d.ts.map | 1 + .../index.js => esm/puppeteer/node.js} | 12 +- .../esm/puppeteer/node/BrowserFetcher.d.ts | 6 +- .../puppeteer/node/BrowserFetcher.d.ts.map | 2 +- .../lib/esm/puppeteer/node/BrowserRunner.js | 2 +- .../lib/esm/puppeteer/node/LaunchOptions.d.ts | 10 - .../esm/puppeteer/node/LaunchOptions.d.ts.map | 2 +- .../lib/esm/puppeteer/node/LaunchOptions.js | 15 - .../lib/esm/puppeteer/node/Launcher.d.ts | 4 +- .../lib/esm/puppeteer/node/Launcher.d.ts.map | 2 +- .../lib/esm/puppeteer/node/Launcher.js | 107 +- .../node/NodeWebSocketTransport.d.ts} | 12 +- .../node/NodeWebSocketTransport.d.ts.map | 1 + .../NodeWebSocketTransport.js} | 4 +- .../puppeteer/node}/Puppeteer.d.ts | 156 +- .../lib/esm/puppeteer/node/Puppeteer.d.ts.map | 1 + .../puppeteer/node}/Puppeteer.js | 181 +- .../puppeteer/node}/install.d.ts | 0 .../lib/esm/puppeteer/node/install.d.ts.map | 1 + .../lib/esm/puppeteer/{ => node}/install.js | 19 +- .../package/lib/esm/puppeteer/revisions.js | 2 +- .../esm/puppeteer/tsconfig.esm.tsbuildinfo | 3962 ++++------------ .../EvalTypes.js => esm/puppeteer/web.d.ts} | 5 +- .../package/lib/esm/puppeteer/web.d.ts.map | 1 + .../puppeteer/web.js} | 12 +- .../lib/esm/vendor/mitt/src/index.d.ts | 14 +- .../lib/esm/vendor/mitt/src/index.d.ts.map | 2 +- .../package/lib/esm/vendor/mitt/src/index.js | 12 +- .../lib/esm/vendor/tsconfig.esm.tsbuildinfo | 2500 ++-------- .../puppeteer/package/package.json | 62 +- scripts/deps/roll-puppeteer-into-frontend.py | 115 + 255 files changed, 3174 insertions(+), 29955 deletions(-) delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PuppeteerViewport.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebSocketTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index-core.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index-core.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/index.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/install.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/install.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/puppeteer/tsconfig.cjs.tsbuildinfo delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.js delete mode 100644 front_end/third_party/puppeteer/package/lib/cjs/vendor/tsconfig.cjs.tsbuildinfo create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/node/LaunchOptions.d.ts => esm/puppeteer/common/BrowserConnector.d.ts} (54%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/{WebSocketTransport.d.ts => BrowserWebSocketTransport.d.ts} (66%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/WebSocketTransport.js => esm/puppeteer/common/BrowserWebSocketTransport.js} (56%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/environment.d.ts => esm/puppeteer/common/Product.d.ts} (82%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/node/LaunchOptions.js => esm/puppeteer/common/Product.js} (88%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/ConnectionTransport.js => esm/puppeteer/common/fetch.d.ts} (86%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/revisions.js => esm/puppeteer/common/fetch.js} (72%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.js delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.js create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{initialize.js => initialize-node.js} (75%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/initialize.d.ts => esm/puppeteer/initialize-web.d.ts} (84%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{initialize.d.ts => initialize-web.js} (78%) delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize.d.ts.map delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/install.d.ts delete mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/install.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/index-core.d.ts => esm/puppeteer/node-puppeteer-core.d.ts} (92%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{index-core.d.ts => node-puppeteer-core.js} (71%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/index.d.ts => esm/puppeteer/node.d.ts} (82%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/index.js => esm/puppeteer/node.js} (70%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/WebSocketTransport.d.ts => esm/puppeteer/node/NodeWebSocketTransport.d.ts} (71%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{common/WebSocketTransport.js => node/NodeWebSocketTransport.js} (88%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common => esm/puppeteer/node}/Puppeteer.d.ts (56%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common => esm/puppeteer/node}/Puppeteer.js (57%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer => esm/puppeteer/node}/install.d.ts (100%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map rename front_end/third_party/puppeteer/package/lib/esm/puppeteer/{ => node}/install.js (90%) rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/EvalTypes.js => esm/puppeteer/web.d.ts} (83%) create mode 100644 front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.d.ts.map rename front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/common/ConnectionTransport.d.ts => esm/puppeteer/web.js} (71%) create mode 100755 scripts/deps/roll-puppeteer-into-frontend.py diff --git a/all_devtools_modules.gni b/all_devtools_modules.gni index fac18dcc9a3..da7da08162c 100644 --- a/all_devtools_modules.gni +++ b/all_devtools_modules.gni @@ -589,7 +589,10 @@ all_typescript_module_sources = [ "third_party/marked/package/lib/marked.esm.js", "third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js", @@ -614,6 +617,7 @@ all_typescript_module_sources = [ "third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js", @@ -622,20 +626,25 @@ all_typescript_module_sources = [ "third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js", - "third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js", + "third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js", "third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js", "third_party/puppeteer/package/lib/esm/puppeteer/environment.js", - "third_party/puppeteer/package/lib/esm/puppeteer/index-core.js", - "third_party/puppeteer/package/lib/esm/puppeteer/index.js", - "third_party/puppeteer/package/lib/esm/puppeteer/initialize.js", + "third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js", + "third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js", + "third_party/puppeteer/package/lib/esm/puppeteer/node/install.js", "third_party/puppeteer/package/lib/esm/puppeteer/revisions.js", + "third_party/puppeteer/package/lib/esm/puppeteer/web.js", "third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js", "third_party/wasmparser/package/dist/esm/WasmDis.js", "third_party/wasmparser/package/dist/esm/WasmParser.js", diff --git a/devtools_grd_files.gni b/devtools_grd_files.gni index 75a828d9a25..6d0e62623c7 100644 --- a/devtools_grd_files.gni +++ b/devtools_grd_files.gni @@ -942,7 +942,10 @@ grd_files_debug_sources = [ "front_end/third_party/marked/package/lib/marked.esm.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js", @@ -967,6 +970,7 @@ grd_files_debug_sources = [ "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js", @@ -975,20 +979,25 @@ grd_files_debug_sources = [ "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/index-core.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/index.js", - "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js", "front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js", + "front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js", "front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js", "front_end/third_party/wasmparser/package/dist/esm/WasmDis.js", "front_end/third_party/wasmparser/package/dist/esm/WasmParser.js", diff --git a/front_end/third_party/puppeteer/BUILD.gn b/front_end/third_party/puppeteer/BUILD.gn index d62e1dd413c..a843eacf486 100644 --- a/front_end/third_party/puppeteer/BUILD.gn +++ b/front_end/third_party/puppeteer/BUILD.gn @@ -13,9 +13,18 @@ devtools_pre_built("puppeteer") { "package/lib/esm/puppeteer/common/Accessibility.d.ts", "package/lib/esm/puppeteer/common/Accessibility.d.ts.map", "package/lib/esm/puppeteer/common/Accessibility.js", + "package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts", + "package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map", + "package/lib/esm/puppeteer/common/AriaQueryHandler.js", "package/lib/esm/puppeteer/common/Browser.d.ts", "package/lib/esm/puppeteer/common/Browser.d.ts.map", "package/lib/esm/puppeteer/common/Browser.js", + "package/lib/esm/puppeteer/common/BrowserConnector.d.ts", + "package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map", + "package/lib/esm/puppeteer/common/BrowserConnector.js", + "package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts", + "package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map", + "package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js", "package/lib/esm/puppeteer/common/Connection.d.ts", "package/lib/esm/puppeteer/common/Connection.d.ts.map", "package/lib/esm/puppeteer/common/Connection.js", @@ -88,6 +97,9 @@ devtools_pre_built("puppeteer") { "package/lib/esm/puppeteer/common/Page.d.ts", "package/lib/esm/puppeteer/common/Page.d.ts.map", "package/lib/esm/puppeteer/common/Page.js", + "package/lib/esm/puppeteer/common/Product.d.ts", + "package/lib/esm/puppeteer/common/Product.d.ts.map", + "package/lib/esm/puppeteer/common/Product.js", "package/lib/esm/puppeteer/common/Puppeteer.d.ts", "package/lib/esm/puppeteer/common/Puppeteer.d.ts.map", "package/lib/esm/puppeteer/common/Puppeteer.js", @@ -112,30 +124,33 @@ devtools_pre_built("puppeteer") { "package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts", "package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map", "package/lib/esm/puppeteer/common/USKeyboardLayout.js", - "package/lib/esm/puppeteer/common/WebSocketTransport.d.ts", - "package/lib/esm/puppeteer/common/WebSocketTransport.d.ts.map", - "package/lib/esm/puppeteer/common/WebSocketTransport.js", "package/lib/esm/puppeteer/common/WebWorker.d.ts", "package/lib/esm/puppeteer/common/WebWorker.d.ts.map", "package/lib/esm/puppeteer/common/WebWorker.js", "package/lib/esm/puppeteer/common/assert.d.ts", "package/lib/esm/puppeteer/common/assert.d.ts.map", "package/lib/esm/puppeteer/common/assert.js", + "package/lib/esm/puppeteer/common/fetch.d.ts", + "package/lib/esm/puppeteer/common/fetch.d.ts.map", + "package/lib/esm/puppeteer/common/fetch.js", "package/lib/esm/puppeteer/common/helper.d.ts", "package/lib/esm/puppeteer/common/helper.d.ts.map", "package/lib/esm/puppeteer/common/helper.js", "package/lib/esm/puppeteer/environment.d.ts", "package/lib/esm/puppeteer/environment.d.ts.map", "package/lib/esm/puppeteer/environment.js", - "package/lib/esm/puppeteer/index-core.d.ts", - "package/lib/esm/puppeteer/index-core.d.ts.map", - "package/lib/esm/puppeteer/index-core.js", - "package/lib/esm/puppeteer/index.d.ts", - "package/lib/esm/puppeteer/index.d.ts.map", - "package/lib/esm/puppeteer/index.js", - "package/lib/esm/puppeteer/initialize.d.ts", - "package/lib/esm/puppeteer/initialize.d.ts.map", - "package/lib/esm/puppeteer/initialize.js", + "package/lib/esm/puppeteer/initialize-node.d.ts", + "package/lib/esm/puppeteer/initialize-node.d.ts.map", + "package/lib/esm/puppeteer/initialize-node.js", + "package/lib/esm/puppeteer/initialize-web.d.ts", + "package/lib/esm/puppeteer/initialize-web.d.ts.map", + "package/lib/esm/puppeteer/initialize-web.js", + "package/lib/esm/puppeteer/node-puppeteer-core.d.ts", + "package/lib/esm/puppeteer/node-puppeteer-core.d.ts.map", + "package/lib/esm/puppeteer/node-puppeteer-core.js", + "package/lib/esm/puppeteer/node.d.ts", + "package/lib/esm/puppeteer/node.d.ts.map", + "package/lib/esm/puppeteer/node.js", "package/lib/esm/puppeteer/node/BrowserFetcher.d.ts", "package/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map", "package/lib/esm/puppeteer/node/BrowserFetcher.js", @@ -148,12 +163,24 @@ devtools_pre_built("puppeteer") { "package/lib/esm/puppeteer/node/Launcher.d.ts", "package/lib/esm/puppeteer/node/Launcher.d.ts.map", "package/lib/esm/puppeteer/node/Launcher.js", + "package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts", + "package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map", + "package/lib/esm/puppeteer/node/NodeWebSocketTransport.js", "package/lib/esm/puppeteer/node/PipeTransport.d.ts", "package/lib/esm/puppeteer/node/PipeTransport.d.ts.map", "package/lib/esm/puppeteer/node/PipeTransport.js", + "package/lib/esm/puppeteer/node/Puppeteer.d.ts", + "package/lib/esm/puppeteer/node/Puppeteer.d.ts.map", + "package/lib/esm/puppeteer/node/Puppeteer.js", + "package/lib/esm/puppeteer/node/install.d.ts", + "package/lib/esm/puppeteer/node/install.d.ts.map", + "package/lib/esm/puppeteer/node/install.js", "package/lib/esm/puppeteer/revisions.d.ts", "package/lib/esm/puppeteer/revisions.d.ts.map", "package/lib/esm/puppeteer/revisions.js", + "package/lib/esm/puppeteer/web.d.ts", + "package/lib/esm/puppeteer/web.d.ts.map", + "package/lib/esm/puppeteer/web.js", "package/lib/esm/vendor/mitt/src/index.d.ts", "package/lib/esm/vendor/mitt/src/index.d.ts.map", "package/lib/esm/vendor/mitt/src/index.js", diff --git a/front_end/third_party/puppeteer/package/LICENSE b/front_end/third_party/puppeteer/package/LICENSE index afdfe50e72e..d2c171df74e 100644 --- a/front_end/third_party/puppeteer/package/LICENSE +++ b/front_end/third_party/puppeteer/package/LICENSE @@ -1,7 +1,7 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -193,7 +193,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/front_end/third_party/puppeteer/package/README.md b/front_end/third_party/puppeteer/package/README.md index a7e87358942..82467c0ee3c 100644 --- a/front_end/third_party/puppeteer/package/README.md +++ b/front_end/third_party/puppeteer/package/README.md @@ -6,7 +6,7 @@ -###### [API](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) +###### [API](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) > Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium. @@ -37,7 +37,7 @@ npm i puppeteer # or "yarn add puppeteer" ``` -Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#environment-variables). +Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#environment-variables). ### puppeteer-core @@ -63,7 +63,7 @@ Note: Prior to v1.18.1, Puppeteer required at least Node v6.4.0. Versions from v Node 8.9.0+. Starting from v3.0.0 Puppeteer starts to rely on Node 10.18.1+. All examples below use async/await which is only supported in Node v7.6.0 or greater. Puppeteer will be familiar to people using other browser testing frameworks. You create an instance -of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#). +of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#). **Example** - navigating to https://example.com and saving a screenshot as *example.png*: @@ -88,7 +88,7 @@ Execute script on the command line node example.js ``` -Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pagesetviewportviewport). +Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pagesetviewportviewport). **Example** - create a PDF. @@ -113,7 +113,7 @@ Execute script on the command line node hn.js ``` -See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pagepdfoptions) for more information about creating pdfs. +See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pagepdfoptions) for more information about creating pdfs. **Example** - evaluate script in the context of the page @@ -148,7 +148,7 @@ Execute script on the command line node get-dimensions.js ``` -See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. +See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`. @@ -157,7 +157,7 @@ See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/ **1. Uses Headless mode** -Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) when launching a browser: +Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) when launching a browser: ```js const browser = await puppeteer.launch({headless: false}); // default is true @@ -173,7 +173,7 @@ pass in the executable's path when creating a `Browser` instance: const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'}); ``` -You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) for more information. +You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) for more information. See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users. @@ -185,7 +185,7 @@ Puppeteer creates its own browser user profile which it **cleans up on every run ## Resources -- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md) +- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md) - [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples/) - [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer) @@ -328,7 +328,7 @@ See [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING Official Firefox support is currently experimental. The ongoing collaboration with Mozilla aims to support common end-to-end testing use cases, for which developers expect cross-browser coverage. The Puppeteer team needs input from users to stabilize Firefox support and to bring missing APIs to our attention. -From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. +From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox. We will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari. This effort includes exploration of a standard for executing cross-browser commands (instead of relying on the non-standard DevTools Protocol used by Chrome). @@ -424,7 +424,7 @@ await page.evaluate(() => { You may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/puppeteer/puppeteer/issues/291).) There are two reasons for this: -* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) +* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.) * Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming). #### Q: I am having trouble installing / running Puppeteer in my test environment. Where should I look for help? diff --git a/front_end/third_party/puppeteer/package/cjs-entry-core.js b/front_end/third_party/puppeteer/package/cjs-entry-core.js index 70e9b88040f..446726fafa3 100644 --- a/front_end/third_party/puppeteer/package/cjs-entry-core.js +++ b/front_end/third_party/puppeteer/package/cjs-entry-core.js @@ -25,5 +25,5 @@ * This means that we can publish to CJS and ESM whilst maintaining the expected * import behaviour for CJS and ESM users. */ -const puppeteerExport = require('./lib/cjs/puppeteer/index-core'); +const puppeteerExport = require('./lib/cjs/puppeteer/node-puppeteer-core'); module.exports = puppeteerExport.default; diff --git a/front_end/third_party/puppeteer/package/cjs-entry.js b/front_end/third_party/puppeteer/package/cjs-entry.js index 1bcec7d85af..d1840a9bea1 100644 --- a/front_end/third_party/puppeteer/package/cjs-entry.js +++ b/front_end/third_party/puppeteer/package/cjs-entry.js @@ -25,5 +25,5 @@ * This means that we can publish to CJS and ESM whilst maintaining the expected * import behaviour for CJS and ESM users. */ -const puppeteerExport = require('./lib/cjs/puppeteer/index'); +const puppeteerExport = require('./lib/cjs/puppeteer/node'); module.exports = puppeteerExport.default; diff --git a/front_end/third_party/puppeteer/package/install.js b/front_end/third_party/puppeteer/package/install.js index 5fe1314e4a6..11518a595f5 100644 --- a/front_end/third_party/puppeteer/package/install.js +++ b/front_end/third_party/puppeteer/package/install.js @@ -32,7 +32,7 @@ async function download() { const { downloadBrowser, logPolitely, - } = require('./lib/cjs/puppeteer/install'); + } = require('./lib/cjs/puppeteer/node/install'); if (process.env.PUPPETEER_SKIP_DOWNLOAD) { logPolitely( diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts deleted file mode 100644 index 4fca5db7228..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './common/Accessibility.js'; -export * from './common/Browser.js'; -export * from './node/BrowserFetcher.js'; -export * from './common/Connection.js'; -export * from './common/ConsoleMessage.js'; -export * from './common/Coverage.js'; -export * from './common/DeviceDescriptors.js'; -export * from './common/Dialog.js'; -export * from './common/DOMWorld.js'; -export * from './common/JSHandle.js'; -export * from './common/ExecutionContext.js'; -export * from './common/EventEmitter.js'; -export * from './common/FileChooser.js'; -export * from './common/FrameManager.js'; -export * from './common/Input.js'; -export * from './common/Page.js'; -export * from './common/Puppeteer.js'; -export * from './node/LaunchOptions.js'; -export * from './node/Launcher.js'; -export * from './common/HTTPRequest.js'; -export * from './common/HTTPResponse.js'; -export * from './common/SecurityDetails.js'; -export * from './common/Target.js'; -export * from './common/Errors.js'; -export * from './common/Tracing.js'; -export * from './common/NetworkManager.js'; -export * from './common/WebWorker.js'; -export * from './common/USKeyboardLayout.js'; -export * from './common/EvalTypes.js'; -export * from './common/PDFOptions.js'; -export * from './common/TimeoutSettings.js'; -export * from './common/LifecycleWatcher.js'; -export * from 'devtools-protocol/types/protocol'; -//# sourceMappingURL=api-docs-entry.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map deleted file mode 100644 index 1e462ec6c80..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api-docs-entry.d.ts","sourceRoot":"","sources":["../../../src/api-docs-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAaH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js deleted file mode 100644 index c98190a29e7..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -/* - * This file re-exports any APIs that we want to have documentation generated - * for. It is used by API Extractor to determine what parts of the system to - * document. - * - * We also have src/api.ts. This is used in `index.js` and by the legacy DocLint - * system. src/api-docs-entry.ts is ONLY used by API Extractor. - * - * Once we have migrated to API Extractor and removed DocLint we can remove the - * duplication and use this file. - */ -__exportStar(require("./common/Accessibility.js"), exports); -__exportStar(require("./common/Browser.js"), exports); -__exportStar(require("./node/BrowserFetcher.js"), exports); -__exportStar(require("./common/Connection.js"), exports); -__exportStar(require("./common/ConsoleMessage.js"), exports); -__exportStar(require("./common/Coverage.js"), exports); -__exportStar(require("./common/DeviceDescriptors.js"), exports); -__exportStar(require("./common/Dialog.js"), exports); -__exportStar(require("./common/DOMWorld.js"), exports); -__exportStar(require("./common/JSHandle.js"), exports); -__exportStar(require("./common/ExecutionContext.js"), exports); -__exportStar(require("./common/EventEmitter.js"), exports); -__exportStar(require("./common/FileChooser.js"), exports); -__exportStar(require("./common/FrameManager.js"), exports); -__exportStar(require("./common/Input.js"), exports); -__exportStar(require("./common/Page.js"), exports); -__exportStar(require("./common/Puppeteer.js"), exports); -__exportStar(require("./node/LaunchOptions.js"), exports); -__exportStar(require("./node/Launcher.js"), exports); -__exportStar(require("./common/HTTPRequest.js"), exports); -__exportStar(require("./common/HTTPResponse.js"), exports); -__exportStar(require("./common/SecurityDetails.js"), exports); -__exportStar(require("./common/Target.js"), exports); -__exportStar(require("./common/Errors.js"), exports); -__exportStar(require("./common/Tracing.js"), exports); -__exportStar(require("./common/NetworkManager.js"), exports); -__exportStar(require("./common/WebWorker.js"), exports); -__exportStar(require("./common/USKeyboardLayout.js"), exports); -__exportStar(require("./common/EvalTypes.js"), exports); -__exportStar(require("./common/PDFOptions.js"), exports); -__exportStar(require("./common/TimeoutSettings.js"), exports); -__exportStar(require("./common/LifecycleWatcher.js"), exports); -__exportStar(require("devtools-protocol/types/protocol"), exports); diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts deleted file mode 100644 index 736b3b54394..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts +++ /dev/null @@ -1,176 +0,0 @@ -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { CDPSession } from './Connection.js'; -import { ElementHandle } from './JSHandle.js'; -/** - * Represents a Node and the properties of it that are relevant to Accessibility. - * @public - */ -export interface SerializedAXNode { - /** - * The {@link https://www.w3.org/TR/wai-aria/#usage_intro | role} of the node. - */ - role: string; - /** - * A human readable name for the node. - */ - name?: string; - /** - * The current value of the node. - */ - value?: string | number; - /** - * An additional human readable description of the node. - */ - description?: string; - /** - * Any keyboard shortcuts associated with this node. - */ - keyshortcuts?: string; - /** - * A human readable alternative to the role. - */ - roledescription?: string; - /** - * A description of the current value. - */ - valuetext?: string; - disabled?: boolean; - expanded?: boolean; - focused?: boolean; - modal?: boolean; - multiline?: boolean; - /** - * Whether more than one child can be selected. - */ - multiselectable?: boolean; - readonly?: boolean; - required?: boolean; - selected?: boolean; - /** - * Whether the checkbox is checked, or in a - * {@link https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-2/checkbox-2.html | mixed state}. - */ - checked?: boolean | 'mixed'; - /** - * Whether the node is checked or in a mixed state. - */ - pressed?: boolean | 'mixed'; - /** - * The level of a heading. - */ - level?: number; - valuemin?: number; - valuemax?: number; - autocomplete?: string; - haspopup?: string; - /** - * Whether and in what way this node's value is invalid. - */ - invalid?: string; - orientation?: string; - /** - * Children of this node, if there are any. - */ - children?: SerializedAXNode[]; -} -/** - * @public - */ -export interface SnapshotOptions { - /** - * Prune unintersting nodes from the tree. - * @defaultValue true - */ - interestingOnly?: boolean; - /** - * Prune unintersting nodes from the tree. - * @defaultValue The root node of the entire page. - */ - root?: ElementHandle; -} -/** - * The Accessibility class provides methods for inspecting Chromium's - * accessibility tree. The accessibility tree is used by assistive technology - * such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or - * {@link https://en.wikipedia.org/wiki/Switch_access | switches}. - * - * @remarks - * - * Accessibility is a very platform-specific thing. On different platforms, - * there are different screen readers that might have wildly different output. - * - * Blink - Chrome's rendering engine - has a concept of "accessibility tree", - * which is then translated into different platform-specific APIs. Accessibility - * namespace gives users access to the Blink Accessibility Tree. - * - * Most of the accessibility tree gets filtered out when converting from Blink - * AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. - * By default, Puppeteer tries to approximate this filtering, exposing only - * the "interesting" nodes of the tree. - * - * @public - */ -export declare class Accessibility { - private _client; - /** - * @internal - */ - constructor(client: CDPSession); - /** - * Captures the current state of the accessibility tree. - * The returned object represents the root accessible node of the page. - * - * @remarks - * - * **NOTE** The Chromium accessibility tree contains nodes that go unused on - * most platforms and by most screen readers. Puppeteer will discard them as - * well for an easier to process tree, unless `interestingOnly` is set to - * `false`. - * - * @example - * An example of dumping the entire accessibility tree: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * console.log(snapshot); - * ``` - * - * @example - * An example of logging the focused node's name: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * const node = findFocusedNode(snapshot); - * console.log(node && node.name); - * - * function findFocusedNode(node) { - * if (node.focused) - * return node; - * for (const child of node.children || []) { - * const foundNode = findFocusedNode(child); - * return foundNode; - * } - * return null; - * } - * ``` - * - * @returns An AXNode object representing the snapshot. - * - */ - snapshot(options?: SnapshotOptions): Promise; - private serializeTree; - private collectInterestingNodes; -} -//# sourceMappingURL=Accessibility.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map deleted file mode 100644 index 09e4537815d..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Accessibility.d.ts","sourceRoot":"","sources":["../../../../src/common/Accessibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAa;IAE5B;;OAEG;gBACS,MAAM,EAAE,UAAU;IAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACU,QAAQ,CACnB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC;IA0B5B,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,uBAAuB;CAWhC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js deleted file mode 100644 index 03dff902668..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js +++ /dev/null @@ -1,360 +0,0 @@ -"use strict"; -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Accessibility = void 0; -/** - * The Accessibility class provides methods for inspecting Chromium's - * accessibility tree. The accessibility tree is used by assistive technology - * such as {@link https://en.wikipedia.org/wiki/Screen_reader | screen readers} or - * {@link https://en.wikipedia.org/wiki/Switch_access | switches}. - * - * @remarks - * - * Accessibility is a very platform-specific thing. On different platforms, - * there are different screen readers that might have wildly different output. - * - * Blink - Chrome's rendering engine - has a concept of "accessibility tree", - * which is then translated into different platform-specific APIs. Accessibility - * namespace gives users access to the Blink Accessibility Tree. - * - * Most of the accessibility tree gets filtered out when converting from Blink - * AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. - * By default, Puppeteer tries to approximate this filtering, exposing only - * the "interesting" nodes of the tree. - * - * @public - */ -class Accessibility { - /** - * @internal - */ - constructor(client) { - this._client = client; - } - /** - * Captures the current state of the accessibility tree. - * The returned object represents the root accessible node of the page. - * - * @remarks - * - * **NOTE** The Chromium accessibility tree contains nodes that go unused on - * most platforms and by most screen readers. Puppeteer will discard them as - * well for an easier to process tree, unless `interestingOnly` is set to - * `false`. - * - * @example - * An example of dumping the entire accessibility tree: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * console.log(snapshot); - * ``` - * - * @example - * An example of logging the focused node's name: - * ```js - * const snapshot = await page.accessibility.snapshot(); - * const node = findFocusedNode(snapshot); - * console.log(node && node.name); - * - * function findFocusedNode(node) { - * if (node.focused) - * return node; - * for (const child of node.children || []) { - * const foundNode = findFocusedNode(child); - * return foundNode; - * } - * return null; - * } - * ``` - * - * @returns An AXNode object representing the snapshot. - * - */ - async snapshot(options = {}) { - const { interestingOnly = true, root = null } = options; - const { nodes } = await this._client.send('Accessibility.getFullAXTree'); - let backendNodeId = null; - if (root) { - const { node } = await this._client.send('DOM.describeNode', { - objectId: root._remoteObject.objectId, - }); - backendNodeId = node.backendNodeId; - } - const defaultRoot = AXNode.createTree(nodes); - let needle = defaultRoot; - if (backendNodeId) { - needle = defaultRoot.find((node) => node.payload.backendDOMNodeId === backendNodeId); - if (!needle) - return null; - } - if (!interestingOnly) - return this.serializeTree(needle)[0]; - const interestingNodes = new Set(); - this.collectInterestingNodes(interestingNodes, defaultRoot, false); - if (!interestingNodes.has(needle)) - return null; - return this.serializeTree(needle, interestingNodes)[0]; - } - serializeTree(node, whitelistedNodes) { - const children = []; - for (const child of node.children) - children.push(...this.serializeTree(child, whitelistedNodes)); - if (whitelistedNodes && !whitelistedNodes.has(node)) - return children; - const serializedNode = node.serialize(); - if (children.length) - serializedNode.children = children; - return [serializedNode]; - } - collectInterestingNodes(collection, node, insideControl) { - if (node.isInteresting(insideControl)) - collection.add(node); - if (node.isLeafNode()) - return; - insideControl = insideControl || node.isControl(); - for (const child of node.children) - this.collectInterestingNodes(collection, child, insideControl); - } -} -exports.Accessibility = Accessibility; -class AXNode { - constructor(payload) { - this.children = []; - this._richlyEditable = false; - this._editable = false; - this._focusable = false; - this._hidden = false; - this.payload = payload; - this._name = this.payload.name ? this.payload.name.value : ''; - this._role = this.payload.role ? this.payload.role.value : 'Unknown'; - for (const property of this.payload.properties || []) { - if (property.name === 'editable') { - this._richlyEditable = property.value.value === 'richtext'; - this._editable = true; - } - if (property.name === 'focusable') - this._focusable = property.value.value; - if (property.name === 'hidden') - this._hidden = property.value.value; - } - } - _isPlainTextField() { - if (this._richlyEditable) - return false; - if (this._editable) - return true; - return (this._role === 'textbox' || - this._role === 'ComboBox' || - this._role === 'searchbox'); - } - _isTextOnlyObject() { - const role = this._role; - return role === 'LineBreak' || role === 'text' || role === 'InlineTextBox'; - } - _hasFocusableChild() { - if (this._cachedHasFocusableChild === undefined) { - this._cachedHasFocusableChild = false; - for (const child of this.children) { - if (child._focusable || child._hasFocusableChild()) { - this._cachedHasFocusableChild = true; - break; - } - } - } - return this._cachedHasFocusableChild; - } - find(predicate) { - if (predicate(this)) - return this; - for (const child of this.children) { - const result = child.find(predicate); - if (result) - return result; - } - return null; - } - isLeafNode() { - if (!this.children.length) - return true; - // These types of objects may have children that we use as internal - // implementation details, but we want to expose them as leaves to platform - // accessibility APIs because screen readers might be confused if they find - // any children. - if (this._isPlainTextField() || this._isTextOnlyObject()) - return true; - // Roles whose children are only presentational according to the ARIA and - // HTML5 Specs should be hidden from screen readers. - // (Note that whilst ARIA buttons can have only presentational children, HTML5 - // buttons are allowed to have content.) - switch (this._role) { - case 'doc-cover': - case 'graphics-symbol': - case 'img': - case 'Meter': - case 'scrollbar': - case 'slider': - case 'separator': - case 'progressbar': - return true; - default: - break; - } - // Here and below: Android heuristics - if (this._hasFocusableChild()) - return false; - if (this._focusable && this._name) - return true; - if (this._role === 'heading' && this._name) - return true; - return false; - } - isControl() { - switch (this._role) { - case 'button': - case 'checkbox': - case 'ColorWell': - case 'combobox': - case 'DisclosureTriangle': - case 'listbox': - case 'menu': - case 'menubar': - case 'menuitem': - case 'menuitemcheckbox': - case 'menuitemradio': - case 'radio': - case 'scrollbar': - case 'searchbox': - case 'slider': - case 'spinbutton': - case 'switch': - case 'tab': - case 'textbox': - case 'tree': - return true; - default: - return false; - } - } - isInteresting(insideControl) { - const role = this._role; - if (role === 'Ignored' || this._hidden) - return false; - if (this._focusable || this._richlyEditable) - return true; - // If it's not focusable but has a control role, then it's interesting. - if (this.isControl()) - return true; - // A non focusable child of a control is not interesting - if (insideControl) - return false; - return this.isLeafNode() && !!this._name; - } - serialize() { - const properties = new Map(); - for (const property of this.payload.properties || []) - properties.set(property.name.toLowerCase(), property.value.value); - if (this.payload.name) - properties.set('name', this.payload.name.value); - if (this.payload.value) - properties.set('value', this.payload.value.value); - if (this.payload.description) - properties.set('description', this.payload.description.value); - const node = { - role: this._role, - }; - const userStringProperties = [ - 'name', - 'value', - 'description', - 'keyshortcuts', - 'roledescription', - 'valuetext', - ]; - const getUserStringPropertyValue = (key) => properties.get(key); - for (const userStringProperty of userStringProperties) { - if (!properties.has(userStringProperty)) - continue; - node[userStringProperty] = getUserStringPropertyValue(userStringProperty); - } - const booleanProperties = [ - 'disabled', - 'expanded', - 'focused', - 'modal', - 'multiline', - 'multiselectable', - 'readonly', - 'required', - 'selected', - ]; - const getBooleanPropertyValue = (key) => properties.get(key); - for (const booleanProperty of booleanProperties) { - // WebArea's treat focus differently than other nodes. They report whether - // their frame has focus, not whether focus is specifically on the root - // node. - if (booleanProperty === 'focused' && this._role === 'WebArea') - continue; - const value = getBooleanPropertyValue(booleanProperty); - if (!value) - continue; - node[booleanProperty] = getBooleanPropertyValue(booleanProperty); - } - const tristateProperties = ['checked', 'pressed']; - for (const tristateProperty of tristateProperties) { - if (!properties.has(tristateProperty)) - continue; - const value = properties.get(tristateProperty); - node[tristateProperty] = - value === 'mixed' ? 'mixed' : value === 'true' ? true : false; - } - const numericalProperties = [ - 'level', - 'valuemax', - 'valuemin', - ]; - const getNumericalPropertyValue = (key) => properties.get(key); - for (const numericalProperty of numericalProperties) { - if (!properties.has(numericalProperty)) - continue; - node[numericalProperty] = getNumericalPropertyValue(numericalProperty); - } - const tokenProperties = [ - 'autocomplete', - 'haspopup', - 'invalid', - 'orientation', - ]; - const getTokenPropertyValue = (key) => properties.get(key); - for (const tokenProperty of tokenProperties) { - const value = getTokenPropertyValue(tokenProperty); - if (!value || value === 'false') - continue; - node[tokenProperty] = getTokenPropertyValue(tokenProperty); - } - return node; - } - static createTree(payloads) { - const nodeById = new Map(); - for (const payload of payloads) - nodeById.set(payload.nodeId, new AXNode(payload)); - for (const node of nodeById.values()) { - for (const childId of node.payload.childIds || []) - node.children.push(nodeById.get(childId)); - } - return nodeById.values().next().value; - } -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts deleted file mode 100644 index 43df72baf69..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts +++ /dev/null @@ -1,424 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/// -import { ChildProcess } from 'child_process'; -import { Protocol } from 'devtools-protocol'; - -import { Connection } from './Connection.js'; -import { EventEmitter } from './EventEmitter.js'; -import { Page } from './Page.js'; -import { Viewport } from './PuppeteerViewport.js'; -import { Target } from './Target.js'; - -declare type BrowserCloseCallback = () => Promise | void; -/** - * @public - */ -export interface WaitForTargetOptions { - /** - * Maximum wait time in milliseconds. Pass `0` to disable the timeout. - * @defaultValue 30 seconds. - */ - timeout?: number; -} -/** - * All the events a {@link Browser | browser instance} may emit. - * - * @public - */ -export declare const enum BrowserEmittedEvents { - /** - * Emitted when Puppeteer gets disconnected from the Chromium instance. This - * might happen because of one of the following: - * - * - Chromium is closed or crashed - * - * - The {@link Browser.disconnect | browser.disconnect } method was called. - */ - Disconnected = "disconnected", - /** - * Emitted when the url of a target changes. Contains a {@link Target} instance. - * - * @remarks - * - * Note that this includes target changes in incognito browser contexts. - */ - TargetChanged = "targetchanged", - /** - * Emitted when a target is created, for example when a new page is opened by - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/open | window.open} - * or by {@link Browser.newPage | browser.newPage} - * - * Contains a {@link Target} instance. - * - * @remarks - * - * Note that this includes target creations in incognito browser contexts. - */ - TargetCreated = "targetcreated", - /** - * Emitted when a target is destroyed, for example when a page is closed. - * Contains a {@link Target} instance. - * - * @remarks - * - * Note that this includes target destructions in incognito browser contexts. - */ - TargetDestroyed = "targetdestroyed" -} -/** - * A Browser is created when Puppeteer connects to a Chromium instance, either through - * {@link Puppeteer.launch} or {@link Puppeteer.connect}. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and will - * emit various events which are documented in the {@link BrowserEmittedEvents} enum. - * - * @example - * - * An example of using a {@link Browser} to create a {@link Page}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * await page.goto('https://example.com'); - * await browser.close(); - * })(); - * ``` - * - * @example - * - * An example of disconnecting from and reconnecting to a {@link Browser}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * // Store the endpoint to be able to reconnect to Chromium - * const browserWSEndpoint = browser.wsEndpoint(); - * // Disconnect puppeteer from Chromium - * browser.disconnect(); - * - * // Use the endpoint to reestablish a connection - * const browser2 = await puppeteer.connect({browserWSEndpoint}); - * // Close Chromium - * await browser2.close(); - * })(); - * ``` - * - * @public - */ -export declare class Browser extends EventEmitter { - /** - * @internal - */ - static create(connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport, process?: ChildProcess, closeCallback?: BrowserCloseCallback): Promise; - private _ignoreHTTPSErrors; - private _defaultViewport?; - private _process?; - private _connection; - private _closeCallback; - private _defaultContext; - private _contexts; - /** - * @internal - * Used in Target.ts directly so cannot be marked private. - */ - _targets: Map; - /** - * @internal - */ - constructor(connection: Connection, contextIds: string[], ignoreHTTPSErrors: boolean, defaultViewport?: Viewport, process?: ChildProcess, closeCallback?: BrowserCloseCallback); - /** - * The spawned browser process. Returns `null` if the browser instance was created with - * {@link Puppeteer.connect}. - */ - process(): ChildProcess | null; - /** - * Creates a new incognito browser context. This won't share cookies/cache with other - * browser contexts. - * - * @example - * ```js - * (async () => { - * const browser = await puppeteer.launch(); - * // Create a new incognito browser context. - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page in a pristine context. - * const page = await context.newPage(); - * // Do stuff - * await page.goto('https://example.com'); - * })(); - * ``` - */ - createIncognitoBrowserContext(): Promise; - /** - * Returns an array of all open browser contexts. In a newly created browser, this will - * return a single instance of {@link BrowserContext}. - */ - browserContexts(): BrowserContext[]; - /** - * Returns the default browser context. The default browser context cannot be closed. - */ - defaultBrowserContext(): BrowserContext; - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - _disposeContext(contextId?: string): Promise; - private _targetCreated; - private _targetDestroyed; - private _targetInfoChanged; - /** - * The browser websocket endpoint which can be used as an argument to - * {@link Puppeteer.connect}. - * - * @returns The Browser websocket url. - * - * @remarks - * - * The format is `ws://${host}:${port}/devtools/browser/`. - * - * You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. - * Learn more about the - * {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and - * the {@link - * https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target - * | browser endpoint}. - */ - wsEndpoint(): string; - /** - * Creates a {@link Page} in the default browser context. - */ - newPage(): Promise; - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - _createPageInContext(contextId?: string): Promise; - /** - * All active targets inside the Browser. In case of multiple browser contexts, returns - * an array with all the targets in all browser contexts. - */ - targets(): Target[]; - /** - * The target associated with the browser. - */ - target(): Target; - /** - * Searches for a target in all browser contexts. - * - * @param predicate - A function to be run for every target. - * @returns The first target found that matches the `predicate` function. - * - * @example - * - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - */ - waitForTarget(predicate: (x: Target) => boolean, options?: WaitForTargetOptions): Promise; - /** - * An array of all open pages inside the Browser. - * - * @remarks - * - * In case of multiple browser contexts, returns an array with all the pages in all - * browser contexts. Non-visible pages, such as `"background_page"`, will not be listed - * here. You can find them using {@link Target.page}. - */ - pages(): Promise; - /** - * A string representing the browser name and version. - * - * @remarks - * - * For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For - * non-headless, this is similar to `Chrome/61.0.3153.0`. - * - * The format of browser.version() might change with future releases of Chromium. - */ - version(): Promise; - /** - * The browser's original user agent. Pages can override the browser user agent with - * {@link Page.setUserAgent}. - */ - userAgent(): Promise; - /** - * Closes Chromium and all of its pages (if any were opened). The {@link Browser} object - * itself is considered to be disposed and cannot be used anymore. - */ - close(): Promise; - /** - * Disconnects Puppeteer from the browser, but leaves the Chromium process running. - * After calling `disconnect`, the {@link Browser} object is considered disposed and - * cannot be used anymore. - */ - disconnect(): void; - /** - * Indicates that the browser is connected. - */ - isConnected(): boolean; - private _getVersion; -} -export declare const enum BrowserContextEmittedEvents { - /** - * Emitted when the url of a target inside the browser context changes. - * Contains a {@link Target} instance. - */ - TargetChanged = "targetchanged", - /** - * Emitted when a target is created within the browser context, for example - * when a new page is opened by - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/open | window.open} - * or by {@link BrowserContext.newPage | browserContext.newPage} - * - * Contains a {@link Target} instance. - */ - TargetCreated = "targetcreated", - /** - * Emitted when a target is destroyed within the browser context, for example - * when a page is closed. Contains a {@link Target} instance. - */ - TargetDestroyed = "targetdestroyed" -} -/** - * BrowserContexts provide a way to operate multiple independent browser - * sessions. When a browser is launched, it has a single BrowserContext used by - * default. The method {@link Browser.newPage | Browser.newPage} creates a page - * in the default browser context. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and - * will emit various events which are documented in the - * {@link BrowserContextEmittedEvents} enum. - * - * If a page opens another page, e.g. with a `window.open` call, the popup will - * belong to the parent page's browser context. - * - * Puppeteer allows creation of "incognito" browser contexts with - * {@link Browser.createIncognitoBrowserContext | Browser.createIncognitoBrowserContext} - * method. "Incognito" browser contexts don't write any browsing data to disk. - * - * @example - * ```js - * // Create a new incognito browser context - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page inside context. - * const page = await context.newPage(); - * // ... do stuff with page ... - * await page.goto('https://example.com'); - * // Dispose context once it's no longer needed. - * await context.close(); - * ``` - */ -export declare class BrowserContext extends EventEmitter { - private _connection; - private _browser; - private _id?; - /** - * @internal - */ - constructor(connection: Connection, browser: Browser, contextId?: string); - /** - * An array of all active targets inside the browser context. - */ - targets(): Target[]; - /** - * This searches for a target in this specific browser context. - * - * @example - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - * - * @param predicate - A function to be run for every target - * @param options - An object of options. Accepts a timout, - * which is the maximum wait time in milliseconds. - * Pass `0` to disable the timeout. Defaults to 30 seconds. - * @returns Promise which resolves to the first target found - * that matches the `predicate` function. - */ - waitForTarget(predicate: (x: Target) => boolean, options?: { - timeout?: number; - }): Promise; - /** - * An array of all pages inside the browser context. - * - * @returns Promise which resolves to an array of all open pages. - * Non visible pages, such as `"background_page"`, will not be listed here. - * You can find them using {@link Target.page | the target page}. - */ - pages(): Promise; - /** - * Returns whether BrowserContext is incognito. - * The default browser context is the only non-incognito browser context. - * - * @remarks - * The default browser context cannot be closed. - */ - isIncognito(): boolean; - /** - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * await context.overridePermissions('https://html5demos.com', ['geolocation']); - * ``` - * - * @param origin - The origin to grant permissions to, e.g. "https://example.com". - * @param permissions - An array of permissions to grant. - * All permissions that are not listed here will be automatically denied. - */ - overridePermissions(origin: string, permissions: Protocol.Browser.PermissionType[]): Promise; - /** - * Clears all permission overrides for the browser context. - * - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * context.overridePermissions('https://example.com', ['clipboard-read']); - * // do stuff .. - * context.clearPermissionOverrides(); - * ``` - */ - clearPermissionOverrides(): Promise; - /** - * Creates a new page in the browser context. - */ - newPage(): Promise; - /** - * The browser this browser context belongs to. - */ - browser(): Browser; - /** - * Closes the browser context. All the targets that belong to the browser context - * will be closed. - * - * @remarks - * Only incognito browser contexts can be closed. - */ - close(): Promise; -} -export {}; -//# sourceMappingURL=Browser.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map deleted file mode 100644 index 2e1d5273b1e..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Browser.d.ts","sourceRoot":"","sources":["../../../../src/common/Browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAA2B,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,aAAK,oBAAoB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,0BAAkB,oBAAoB;IACpC;;;;;;;OAOG;IACH,YAAY,iBAAiB;IAE7B;;;;;;OAMG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;;;;OAUG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;OAOG;IACH,eAAe,oBAAoB;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBAAa,OAAQ,SAAQ,YAAY;IACvC;;OAEG;WACU,MAAM,CACjB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,OAAO,EAC1B,eAAe,CAAC,EAAE,QAAQ,EAC1B,OAAO,CAAC,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,oBAAoB,GACnC,OAAO,CAAC,OAAO,CAAC;IAYnB,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,gBAAgB,CAAC,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,SAAS,CAA8B;IAC/C;;;OAGG;IACH,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B;;OAEG;gBAED,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,OAAO,EAC1B,eAAe,CAAC,EAAE,QAAQ,EAC1B,OAAO,CAAC,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,oBAAoB;IAgCtC;;;OAGG;IACH,OAAO,IAAI,YAAY,GAAG,IAAI;IAI9B;;;;;;;;;;;;;;;;OAgBG;IACG,6BAA6B,IAAI,OAAO,CAAC,cAAc,CAAC;IAa9D;;;OAGG;IACH,eAAe,IAAI,cAAc,EAAE;IAInC;;OAEG;IACH,qBAAqB,IAAI,cAAc;IAIvC;;;OAGG;IACG,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAO1C,cAAc;YA6Bd,gBAAgB;IAa9B,OAAO,CAAC,kBAAkB;IAgB1B;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7D;;;OAGG;IACH,OAAO,IAAI,MAAM,EAAE;IAMnB;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;;;;;;;;;;OAaG;IACG,aAAa,CACjB,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,EACjC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,MAAM,CAAC;IAyBlB;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAQ9B;;;;;;;;;OASG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAKlC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB,OAAO,CAAC,WAAW;CAGpB;AAED,0BAAkB,2BAA2B;IAC3C;;;OAGG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;OAOG;IACH,aAAa,kBAAkB;IAC/B;;;OAGG;IACH,eAAe,oBAAoB;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAS;IAErB;;OAEG;gBACS,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM;IAOxE;;OAEG;IACH,OAAO,IAAI,MAAM,EAAE;IAMnB;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CACX,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,EACjC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GACjC,OAAO,CAAC,MAAM,CAAC;IAOlB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAS9B;;;;;;OAMG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;;;;;;OAUG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,GAC7C,OAAO,CAAC,IAAI,CAAC;IAqChB;;;;;;;;;;OAUG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAM/C;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;;;;;OAMG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js deleted file mode 100644 index 31d98a7e675..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js +++ /dev/null @@ -1,519 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BrowserContext = exports.Browser = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const Target_js_1 = require("./Target.js"); -const EventEmitter_js_1 = require("./EventEmitter.js"); -const Connection_js_1 = require("./Connection.js"); -/** - * A Browser is created when Puppeteer connects to a Chromium instance, either through - * {@link Puppeteer.launch} or {@link Puppeteer.connect}. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and will - * emit various events which are documented in the {@link BrowserEmittedEvents} enum. - * - * @example - * - * An example of using a {@link Browser} to create a {@link Page}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * await page.goto('https://example.com'); - * await browser.close(); - * })(); - * ``` - * - * @example - * - * An example of disconnecting from and reconnecting to a {@link Browser}: - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * // Store the endpoint to be able to reconnect to Chromium - * const browserWSEndpoint = browser.wsEndpoint(); - * // Disconnect puppeteer from Chromium - * browser.disconnect(); - * - * // Use the endpoint to reestablish a connection - * const browser2 = await puppeteer.connect({browserWSEndpoint}); - * // Close Chromium - * await browser2.close(); - * })(); - * ``` - * - * @public - */ -class Browser extends EventEmitter_js_1.EventEmitter { - /** - * @internal - */ - constructor(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) { - super(); - this._ignoreHTTPSErrors = ignoreHTTPSErrors; - this._defaultViewport = defaultViewport; - this._process = process; - this._connection = connection; - this._closeCallback = closeCallback || function () { }; - this._defaultContext = new BrowserContext(this._connection, this, null); - this._contexts = new Map(); - for (const contextId of contextIds) - this._contexts.set(contextId, new BrowserContext(this._connection, this, contextId)); - this._targets = new Map(); - this._connection.on(Connection_js_1.ConnectionEmittedEvents.Disconnected, () => this.emit("disconnected" /* Disconnected */)); - this._connection.on('Target.targetCreated', this._targetCreated.bind(this)); - this._connection.on('Target.targetDestroyed', this._targetDestroyed.bind(this)); - this._connection.on('Target.targetInfoChanged', this._targetInfoChanged.bind(this)); - } - /** - * @internal - */ - static async create(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) { - const browser = new Browser(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback); - await connection.send('Target.setDiscoverTargets', { discover: true }); - return browser; - } - /** - * The spawned browser process. Returns `null` if the browser instance was created with - * {@link Puppeteer.connect}. - */ - process() { - return this._process; - } - /** - * Creates a new incognito browser context. This won't share cookies/cache with other - * browser contexts. - * - * @example - * ```js - * (async () => { - * const browser = await puppeteer.launch(); - * // Create a new incognito browser context. - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page in a pristine context. - * const page = await context.newPage(); - * // Do stuff - * await page.goto('https://example.com'); - * })(); - * ``` - */ - async createIncognitoBrowserContext() { - const { browserContextId } = await this._connection.send('Target.createBrowserContext'); - const context = new BrowserContext(this._connection, this, browserContextId); - this._contexts.set(browserContextId, context); - return context; - } - /** - * Returns an array of all open browser contexts. In a newly created browser, this will - * return a single instance of {@link BrowserContext}. - */ - browserContexts() { - return [this._defaultContext, ...Array.from(this._contexts.values())]; - } - /** - * Returns the default browser context. The default browser context cannot be closed. - */ - defaultBrowserContext() { - return this._defaultContext; - } - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - async _disposeContext(contextId) { - await this._connection.send('Target.disposeBrowserContext', { - browserContextId: contextId || undefined, - }); - this._contexts.delete(contextId); - } - async _targetCreated(event) { - const targetInfo = event.targetInfo; - const { browserContextId } = targetInfo; - const context = browserContextId && this._contexts.has(browserContextId) - ? this._contexts.get(browserContextId) - : this._defaultContext; - const target = new Target_js_1.Target(targetInfo, context, () => this._connection.createSession(targetInfo), this._ignoreHTTPSErrors, this._defaultViewport); - assert_js_1.assert(!this._targets.has(event.targetInfo.targetId), 'Target should not exist before targetCreated'); - this._targets.set(event.targetInfo.targetId, target); - if (await target._initializedPromise) { - this.emit("targetcreated" /* TargetCreated */, target); - context.emit("targetcreated" /* TargetCreated */, target); - } - } - async _targetDestroyed(event) { - const target = this._targets.get(event.targetId); - target._initializedCallback(false); - this._targets.delete(event.targetId); - target._closedCallback(); - if (await target._initializedPromise) { - this.emit("targetdestroyed" /* TargetDestroyed */, target); - target - .browserContext() - .emit("targetdestroyed" /* TargetDestroyed */, target); - } - } - _targetInfoChanged(event) { - const target = this._targets.get(event.targetInfo.targetId); - assert_js_1.assert(target, 'target should exist before targetInfoChanged'); - const previousURL = target.url(); - const wasInitialized = target._isInitialized; - target._targetInfoChanged(event.targetInfo); - if (wasInitialized && previousURL !== target.url()) { - this.emit("targetchanged" /* TargetChanged */, target); - target - .browserContext() - .emit("targetchanged" /* TargetChanged */, target); - } - } - /** - * The browser websocket endpoint which can be used as an argument to - * {@link Puppeteer.connect}. - * - * @returns The Browser websocket url. - * - * @remarks - * - * The format is `ws://${host}:${port}/devtools/browser/`. - * - * You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. - * Learn more about the - * {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and - * the {@link - * https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target - * | browser endpoint}. - */ - wsEndpoint() { - return this._connection.url(); - } - /** - * Creates a {@link Page} in the default browser context. - */ - async newPage() { - return this._defaultContext.newPage(); - } - /** - * @internal - * Used by BrowserContext directly so cannot be marked private. - */ - async _createPageInContext(contextId) { - const { targetId } = await this._connection.send('Target.createTarget', { - url: 'about:blank', - browserContextId: contextId || undefined, - }); - const target = await this._targets.get(targetId); - assert_js_1.assert(await target._initializedPromise, 'Failed to create target for page'); - const page = await target.page(); - return page; - } - /** - * All active targets inside the Browser. In case of multiple browser contexts, returns - * an array with all the targets in all browser contexts. - */ - targets() { - return Array.from(this._targets.values()).filter((target) => target._isInitialized); - } - /** - * The target associated with the browser. - */ - target() { - return this.targets().find((target) => target.type() === 'browser'); - } - /** - * Searches for a target in all browser contexts. - * - * @param predicate - A function to be run for every target. - * @returns The first target found that matches the `predicate` function. - * - * @example - * - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - */ - async waitForTarget(predicate, options = {}) { - const { timeout = 30000 } = options; - const existingTarget = this.targets().find(predicate); - if (existingTarget) - return existingTarget; - let resolve; - const targetPromise = new Promise((x) => (resolve = x)); - this.on("targetcreated" /* TargetCreated */, check); - this.on("targetchanged" /* TargetChanged */, check); - try { - if (!timeout) - return await targetPromise; - return await helper_js_1.helper.waitWithTimeout(targetPromise, 'target', timeout); - } - finally { - this.removeListener("targetcreated" /* TargetCreated */, check); - this.removeListener("targetchanged" /* TargetChanged */, check); - } - function check(target) { - if (predicate(target)) - resolve(target); - } - } - /** - * An array of all open pages inside the Browser. - * - * @remarks - * - * In case of multiple browser contexts, returns an array with all the pages in all - * browser contexts. Non-visible pages, such as `"background_page"`, will not be listed - * here. You can find them using {@link Target.page}. - */ - async pages() { - const contextPages = await Promise.all(this.browserContexts().map((context) => context.pages())); - // Flatten array. - return contextPages.reduce((acc, x) => acc.concat(x), []); - } - /** - * A string representing the browser name and version. - * - * @remarks - * - * For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For - * non-headless, this is similar to `Chrome/61.0.3153.0`. - * - * The format of browser.version() might change with future releases of Chromium. - */ - async version() { - const version = await this._getVersion(); - return version.product; - } - /** - * The browser's original user agent. Pages can override the browser user agent with - * {@link Page.setUserAgent}. - */ - async userAgent() { - const version = await this._getVersion(); - return version.userAgent; - } - /** - * Closes Chromium and all of its pages (if any were opened). The {@link Browser} object - * itself is considered to be disposed and cannot be used anymore. - */ - async close() { - await this._closeCallback.call(null); - this.disconnect(); - } - /** - * Disconnects Puppeteer from the browser, but leaves the Chromium process running. - * After calling `disconnect`, the {@link Browser} object is considered disposed and - * cannot be used anymore. - */ - disconnect() { - this._connection.dispose(); - } - /** - * Indicates that the browser is connected. - */ - isConnected() { - return !this._connection._closed; - } - _getVersion() { - return this._connection.send('Browser.getVersion'); - } -} -exports.Browser = Browser; -/** - * BrowserContexts provide a way to operate multiple independent browser - * sessions. When a browser is launched, it has a single BrowserContext used by - * default. The method {@link Browser.newPage | Browser.newPage} creates a page - * in the default browser context. - * - * @remarks - * - * The Browser class extends from Puppeteer's {@link EventEmitter} class and - * will emit various events which are documented in the - * {@link BrowserContextEmittedEvents} enum. - * - * If a page opens another page, e.g. with a `window.open` call, the popup will - * belong to the parent page's browser context. - * - * Puppeteer allows creation of "incognito" browser contexts with - * {@link Browser.createIncognitoBrowserContext | Browser.createIncognitoBrowserContext} - * method. "Incognito" browser contexts don't write any browsing data to disk. - * - * @example - * ```js - * // Create a new incognito browser context - * const context = await browser.createIncognitoBrowserContext(); - * // Create a new page inside context. - * const page = await context.newPage(); - * // ... do stuff with page ... - * await page.goto('https://example.com'); - * // Dispose context once it's no longer needed. - * await context.close(); - * ``` - */ -class BrowserContext extends EventEmitter_js_1.EventEmitter { - /** - * @internal - */ - constructor(connection, browser, contextId) { - super(); - this._connection = connection; - this._browser = browser; - this._id = contextId; - } - /** - * An array of all active targets inside the browser context. - */ - targets() { - return this._browser - .targets() - .filter((target) => target.browserContext() === this); - } - /** - * This searches for a target in this specific browser context. - * - * @example - * An example of finding a target for a page opened via `window.open`: - * ```js - * await page.evaluate(() => window.open('https://www.example.com/')); - * const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/'); - * ``` - * - * @param predicate - A function to be run for every target - * @param options - An object of options. Accepts a timout, - * which is the maximum wait time in milliseconds. - * Pass `0` to disable the timeout. Defaults to 30 seconds. - * @returns Promise which resolves to the first target found - * that matches the `predicate` function. - */ - waitForTarget(predicate, options = {}) { - return this._browser.waitForTarget((target) => target.browserContext() === this && predicate(target), options); - } - /** - * An array of all pages inside the browser context. - * - * @returns Promise which resolves to an array of all open pages. - * Non visible pages, such as `"background_page"`, will not be listed here. - * You can find them using {@link Target.page | the target page}. - */ - async pages() { - const pages = await Promise.all(this.targets() - .filter((target) => target.type() === 'page') - .map((target) => target.page())); - return pages.filter((page) => !!page); - } - /** - * Returns whether BrowserContext is incognito. - * The default browser context is the only non-incognito browser context. - * - * @remarks - * The default browser context cannot be closed. - */ - isIncognito() { - return !!this._id; - } - /** - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * await context.overridePermissions('https://html5demos.com', ['geolocation']); - * ``` - * - * @param origin - The origin to grant permissions to, e.g. "https://example.com". - * @param permissions - An array of permissions to grant. - * All permissions that are not listed here will be automatically denied. - */ - async overridePermissions(origin, permissions) { - const webPermissionToProtocol = new Map([ - ['geolocation', 'geolocation'], - ['midi', 'midi'], - ['notifications', 'notifications'], - // TODO: push isn't a valid type? - // ['push', 'push'], - ['camera', 'videoCapture'], - ['microphone', 'audioCapture'], - ['background-sync', 'backgroundSync'], - ['ambient-light-sensor', 'sensors'], - ['accelerometer', 'sensors'], - ['gyroscope', 'sensors'], - ['magnetometer', 'sensors'], - ['accessibility-events', 'accessibilityEvents'], - ['clipboard-read', 'clipboardReadWrite'], - ['clipboard-write', 'clipboardReadWrite'], - ['payment-handler', 'paymentHandler'], - // chrome-specific permissions we have. - ['midi-sysex', 'midiSysex'], - ]); - permissions = permissions.map((permission) => { - const protocolPermission = webPermissionToProtocol.get(permission); - if (!protocolPermission) - throw new Error('Unknown permission: ' + permission); - return protocolPermission; - }); - await this._connection.send('Browser.grantPermissions', { - origin, - browserContextId: this._id || undefined, - permissions, - }); - } - /** - * Clears all permission overrides for the browser context. - * - * @example - * ```js - * const context = browser.defaultBrowserContext(); - * context.overridePermissions('https://example.com', ['clipboard-read']); - * // do stuff .. - * context.clearPermissionOverrides(); - * ``` - */ - async clearPermissionOverrides() { - await this._connection.send('Browser.resetPermissions', { - browserContextId: this._id || undefined, - }); - } - /** - * Creates a new page in the browser context. - */ - newPage() { - return this._browser._createPageInContext(this._id); - } - /** - * The browser this browser context belongs to. - */ - browser() { - return this._browser; - } - /** - * Closes the browser context. All the targets that belong to the browser context - * will be closed. - * - * @remarks - * Only incognito browser contexts can be closed. - */ - async close() { - assert_js_1.assert(this._id, 'Non-incognito profiles cannot be closed!'); - await this._browser._disposeContext(this._id); - } -} -exports.BrowserContext = BrowserContext; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts deleted file mode 100644 index 0756d87f1b7..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Protocol } from 'devtools-protocol'; -import { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js'; -import { ConnectionTransport } from './ConnectionTransport.js'; -import { EventEmitter } from './EventEmitter.js'; -interface ConnectionCallback { - resolve: Function; - reject: Function; - error: Error; - method: string; -} -/** - * Internal events that the Connection class emits. - * - * @internal - */ -export declare const ConnectionEmittedEvents: { - readonly Disconnected: symbol; -}; -/** - * @internal - */ -export declare class Connection extends EventEmitter { - _url: string; - _transport: ConnectionTransport; - _delay: number; - _lastId: number; - _sessions: Map; - _closed: boolean; - _callbacks: Map; - constructor(url: string, transport: ConnectionTransport, delay?: number); - static fromSession(session: CDPSession): Connection; - /** - * @param {string} sessionId - * @returns {?CDPSession} - */ - session(sessionId: string): CDPSession | null; - url(): string; - send(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise; - _rawSend(message: {}): number; - _onMessage(message: string): Promise; - _onClose(): void; - dispose(): void; - /** - * @param {Protocol.Target.TargetInfo} targetInfo - * @returns {!Promise} - */ - createSession(targetInfo: Protocol.Target.TargetInfo): Promise; -} -interface CDPSessionOnMessageObject { - id?: number; - method: string; - params: {}; - error: { - message: string; - data: any; - }; - result?: any; -} -/** - * Internal events that the CDPSession class emits. - * - * @internal - */ -export declare const CDPSessionEmittedEvents: { - readonly Disconnected: symbol; -}; -/** - * The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. - * - * @remarks - * - * Protocol methods can be called with {@link CDPSession.send} method and protocol - * events can be subscribed to with `CDPSession.on` method. - * - * Useful links: {@link https://chromedevtools.github.io/devtools-protocol/ | DevTools Protocol Viewer} - * and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md | Getting Started with DevTools Protocol}. - * - * @example - * ```js - * const client = await page.target().createCDPSession(); - * await client.send('Animation.enable'); - * client.on('Animation.animationCreated', () => console.log('Animation created!')); - * const response = await client.send('Animation.getPlaybackRate'); - * console.log('playback rate is ' + response.playbackRate); - * await client.send('Animation.setPlaybackRate', { - * playbackRate: response.playbackRate / 2 - * }); - * ``` - * - * @public - */ -export declare class CDPSession extends EventEmitter { - /** - * @internal - */ - _connection: Connection; - private _sessionId; - private _targetType; - private _callbacks; - /** - * @internal - */ - constructor(connection: Connection, targetType: string, sessionId: string); - send(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise; - /** - * @internal - */ - _onMessage(object: CDPSessionOnMessageObject): void; - /** - * Detaches the cdpSession from the target. Once detached, the cdpSession object - * won't emit any events and can't be used to send messages. - */ - detach(): Promise; - /** - * @internal - */ - _onClosed(): void; -} -export {}; -//# sourceMappingURL=Connection.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map deleted file mode 100644 index dff726e837a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../../../src/common/Connection.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX;;GAEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,SAAK;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;IAC/C,OAAO,UAAS;IAEhB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAa;gBAE5C,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,KAAK,SAAI;IAUlE,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU;IAInD;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAI7C,GAAG,IAAI,MAAM;IAIb,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,EACT,GAAG,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GACtD,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAcrD,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM;IAQvB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsChD,QAAQ,IAAI,IAAI;IAkBhB,OAAO,IAAI,IAAI;IAKf;;;OAGG;IACG,aAAa,CACjB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,GACrC,OAAO,CAAC,UAAU,CAAC;CAOvB;AAED,UAAU,yBAAyB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,EAAE,CAAC;IACX,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC;IACtC,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAA8C;IAEhE;;OAEG;gBACS,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAOzE,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,CAAC,QAAQ,EAC3C,MAAM,EAAE,CAAC,EACT,GAAG,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GACtD,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IA0BrD;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI;IAenD;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B;;OAEG;IACH,SAAS,IAAI,IAAI;CAYlB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js deleted file mode 100644 index 8ca18019a1f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js +++ /dev/null @@ -1,271 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CDPSession = exports.CDPSessionEmittedEvents = exports.Connection = exports.ConnectionEmittedEvents = void 0; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const assert_js_1 = require("./assert.js"); -const Debug_js_1 = require("./Debug.js"); -const debugProtocolSend = Debug_js_1.debug('puppeteer:protocol:SEND ►'); -const debugProtocolReceive = Debug_js_1.debug('puppeteer:protocol:RECV ◀'); -const EventEmitter_js_1 = require("./EventEmitter.js"); -/** - * Internal events that the Connection class emits. - * - * @internal - */ -exports.ConnectionEmittedEvents = { - Disconnected: Symbol('Connection.Disconnected'), -}; -/** - * @internal - */ -class Connection extends EventEmitter_js_1.EventEmitter { - constructor(url, transport, delay = 0) { - super(); - this._lastId = 0; - this._sessions = new Map(); - this._closed = false; - this._callbacks = new Map(); - this._url = url; - this._delay = delay; - this._transport = transport; - this._transport.onmessage = this._onMessage.bind(this); - this._transport.onclose = this._onClose.bind(this); - } - static fromSession(session) { - return session._connection; - } - /** - * @param {string} sessionId - * @returns {?CDPSession} - */ - session(sessionId) { - return this._sessions.get(sessionId) || null; - } - url() { - return this._url; - } - send(method, ...paramArgs) { - // There is only ever 1 param arg passed, but the Protocol defines it as an - // array of 0 or 1 items See this comment: - // https://github.com/ChromeDevTools/devtools-protocol/pull/113#issuecomment-412603285 - // which explains why the protocol defines the params this way for better - // type-inference. - // So now we check if there are any params or not and deal with them accordingly. - const params = paramArgs.length ? paramArgs[0] : undefined; - const id = this._rawSend({ method, params }); - return new Promise((resolve, reject) => { - this._callbacks.set(id, { resolve, reject, error: new Error(), method }); - }); - } - _rawSend(message) { - const id = ++this._lastId; - message = JSON.stringify(Object.assign({}, message, { id })); - debugProtocolSend(message); - this._transport.send(message); - return id; - } - async _onMessage(message) { - if (this._delay) - await new Promise((f) => setTimeout(f, this._delay)); - debugProtocolReceive(message); - const object = JSON.parse(message); - if (object.method === 'Target.attachedToTarget') { - const sessionId = object.params.sessionId; - const session = new CDPSession(this, object.params.targetInfo.type, sessionId); - this._sessions.set(sessionId, session); - } - else if (object.method === 'Target.detachedFromTarget') { - const session = this._sessions.get(object.params.sessionId); - if (session) { - session._onClosed(); - this._sessions.delete(object.params.sessionId); - } - } - if (object.sessionId) { - const session = this._sessions.get(object.sessionId); - if (session) - session._onMessage(object); - } - else if (object.id) { - const callback = this._callbacks.get(object.id); - // Callbacks could be all rejected if someone has called `.dispose()`. - if (callback) { - this._callbacks.delete(object.id); - if (object.error) - callback.reject(createProtocolError(callback.error, callback.method, object)); - else - callback.resolve(object.result); - } - } - else { - this.emit(object.method, object.params); - } - } - _onClose() { - if (this._closed) - return; - this._closed = true; - this._transport.onmessage = null; - this._transport.onclose = null; - for (const callback of this._callbacks.values()) - callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`)); - this._callbacks.clear(); - for (const session of this._sessions.values()) - session._onClosed(); - this._sessions.clear(); - this.emit(exports.ConnectionEmittedEvents.Disconnected); - } - dispose() { - this._onClose(); - this._transport.close(); - } - /** - * @param {Protocol.Target.TargetInfo} targetInfo - * @returns {!Promise} - */ - async createSession(targetInfo) { - const { sessionId } = await this.send('Target.attachToTarget', { - targetId: targetInfo.targetId, - flatten: true, - }); - return this._sessions.get(sessionId); - } -} -exports.Connection = Connection; -/** - * Internal events that the CDPSession class emits. - * - * @internal - */ -exports.CDPSessionEmittedEvents = { - Disconnected: Symbol('CDPSession.Disconnected'), -}; -/** - * The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. - * - * @remarks - * - * Protocol methods can be called with {@link CDPSession.send} method and protocol - * events can be subscribed to with `CDPSession.on` method. - * - * Useful links: {@link https://chromedevtools.github.io/devtools-protocol/ | DevTools Protocol Viewer} - * and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md | Getting Started with DevTools Protocol}. - * - * @example - * ```js - * const client = await page.target().createCDPSession(); - * await client.send('Animation.enable'); - * client.on('Animation.animationCreated', () => console.log('Animation created!')); - * const response = await client.send('Animation.getPlaybackRate'); - * console.log('playback rate is ' + response.playbackRate); - * await client.send('Animation.setPlaybackRate', { - * playbackRate: response.playbackRate / 2 - * }); - * ``` - * - * @public - */ -class CDPSession extends EventEmitter_js_1.EventEmitter { - /** - * @internal - */ - constructor(connection, targetType, sessionId) { - super(); - this._callbacks = new Map(); - this._connection = connection; - this._targetType = targetType; - this._sessionId = sessionId; - } - send(method, ...paramArgs) { - if (!this._connection) - return Promise.reject(new Error(`Protocol error (${method}): Session closed. Most likely the ${this._targetType} has been closed.`)); - // See the comment in Connection#send explaining why we do this. - const params = paramArgs.length ? paramArgs[0] : undefined; - const id = this._connection._rawSend({ - sessionId: this._sessionId, - method, - /* TODO(jacktfranklin@): once this Firefox bug is solved - * we no longer need the `|| {}` check - * https://bugzilla.mozilla.org/show_bug.cgi?id=1631570 - */ - params: params || {}, - }); - return new Promise((resolve, reject) => { - this._callbacks.set(id, { resolve, reject, error: new Error(), method }); - }); - } - /** - * @internal - */ - _onMessage(object) { - if (object.id && this._callbacks.has(object.id)) { - const callback = this._callbacks.get(object.id); - this._callbacks.delete(object.id); - if (object.error) - callback.reject(createProtocolError(callback.error, callback.method, object)); - else - callback.resolve(object.result); - } - else { - assert_js_1.assert(!object.id); - this.emit(object.method, object.params); - } - } - /** - * Detaches the cdpSession from the target. Once detached, the cdpSession object - * won't emit any events and can't be used to send messages. - */ - async detach() { - if (!this._connection) - throw new Error(`Session already detached. Most likely the ${this._targetType} has been closed.`); - await this._connection.send('Target.detachFromTarget', { - sessionId: this._sessionId, - }); - } - /** - * @internal - */ - _onClosed() { - for (const callback of this._callbacks.values()) - callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`)); - this._callbacks.clear(); - this._connection = null; - this.emit(exports.CDPSessionEmittedEvents.Disconnected); - } -} -exports.CDPSession = CDPSession; -/** - * @param {!Error} error - * @param {string} method - * @param {{error: {message: string, data: any}}} object - * @returns {!Error} - */ -function createProtocolError(error, method, object) { - let message = `Protocol error (${method}): ${object.error.message}`; - if ('data' in object.error) - message += ` ${object.error.data}`; - return rewriteError(error, message); -} -/** - * @param {!Error} error - * @param {string} message - * @returns {!Error} - */ -function rewriteError(error, message) { - error.message = message; - return error; -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map deleted file mode 100644 index 7b55f821811..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ConnectionTransport.d.ts","sourceRoot":"","sources":["../../../../src/common/ConnectionTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,MAAM,KAAA,OAAE;IACb,KAAK,QAAG;IACR,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts deleted file mode 100644 index 0ca5f94dd3f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { JSHandle } from './JSHandle.js'; -/** - * @public - */ -export interface ConsoleMessageLocation { - /** - * URL of the resource if known or `undefined` otherwise. - */ - url?: string; - /** - * 0-based line number in the resource if known or `undefined` otherwise. - */ - lineNumber?: number; - /** - * 0-based column number in the resource if known or `undefined` otherwise. - */ - columnNumber?: number; -} -/** - * The supported types for console messages. - */ -export declare type ConsoleMessageType = 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd' | 'verbose'; -/** - * ConsoleMessage objects are dispatched by page via the 'console' event. - * @public - */ -export declare class ConsoleMessage { - private _type; - private _text; - private _args; - private _location; - /** - * @public - */ - constructor(type: ConsoleMessageType, text: string, args: JSHandle[], location?: ConsoleMessageLocation); - /** - * @returns The type of the console message. - */ - type(): ConsoleMessageType; - /** - * @returns The text of the console message. - */ - text(): string; - /** - * @returns An array of arguments passed to the console. - */ - args(): JSHandle[]; - /** - * @returns The location of the console message. - */ - location(): ConsoleMessageLocation; -} -//# sourceMappingURL=ConsoleMessage.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map deleted file mode 100644 index b241d856c42..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ConsoleMessage.d.ts","sourceRoot":"","sources":["../../../../src/common/ConsoleMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,kBAAkB,GAC1B,KAAK,GACL,OAAO,GACP,MAAM,GACN,OAAO,GACP,SAAS,GACT,KAAK,GACL,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,YAAY,GACZ,qBAAqB,GACrB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,OAAO,GACP,SAAS,GACT,SAAS,CAAC;AAEd;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAyB;IAE1C;;OAEG;gBAED,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,EAAE,EAChB,QAAQ,GAAE,sBAA2B;IAQvC;;OAEG;IACH,IAAI,IAAI,kBAAkB;IAI1B;;OAEG;IACH,IAAI,IAAI,MAAM;IAId;;OAEG;IACH,IAAI,IAAI,QAAQ,EAAE;IAIlB;;OAEG;IACH,QAAQ,IAAI,sBAAsB;CAGnC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js deleted file mode 100644 index 7f2edb39cf0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConsoleMessage = void 0; -/** - * ConsoleMessage objects are dispatched by page via the 'console' event. - * @public - */ -class ConsoleMessage { - /** - * @public - */ - constructor(type, text, args, location = {}) { - this._type = type; - this._text = text; - this._args = args; - this._location = location; - } - /** - * @returns The type of the console message. - */ - type() { - return this._type; - } - /** - * @returns The text of the console message. - */ - text() { - return this._text; - } - /** - * @returns An array of arguments passed to the console. - */ - args() { - return this._args; - } - /** - * @returns The location of the console message. - */ - location() { - return this._location; - } -} -exports.ConsoleMessage = ConsoleMessage; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts deleted file mode 100644 index 0233eaac1fc..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; -import { PuppeteerEventListener } from './helper.js'; - -/** - * The CoverageEntry class represents one entry of the coverage report. - * @public - */ -export interface CoverageEntry { - /** - * The URL of the style sheet or script. - */ - url: string; - /** - * The content of the style sheet or script. - */ - text: string; - /** - * The covered range as start and end positions. - */ - ranges: Array<{ - start: number; - end: number; - }>; -} -/** - * Set of configurable options for JS coverage. - * @public - */ -export interface JSCoverageOptions { - /** - * Whether to reset coverage on every navigation. - */ - resetOnNavigation?: boolean; - /** - * Whether anonymous scripts generated by the page should be reported. - */ - reportAnonymousScripts?: boolean; -} -/** - * Set of configurable options for CSS coverage. - * @public - */ -export interface CSSCoverageOptions { - /** - * Whether to reset coverage on every navigation. - */ - resetOnNavigation?: boolean; -} -/** - * The Coverage class provides methods to gathers information about parts of - * JavaScript and CSS that were used by the page. - * - * @remarks - * To output coverage in a form consumable by {@link https://github.com/istanbuljs | Istanbul}, - * see {@link https://github.com/istanbuljs/puppeteer-to-istanbul | puppeteer-to-istanbul}. - * - * @example - * An example of using JavaScript and CSS coverage to get percentage of initially - * executed code: - * ```js - * // Enable both JavaScript and CSS coverage - * await Promise.all([ - * page.coverage.startJSCoverage(), - * page.coverage.startCSSCoverage() - * ]); - * // Navigate to page - * await page.goto('https://example.com'); - * // Disable both JavaScript and CSS coverage - * const [jsCoverage, cssCoverage] = await Promise.all([ - * page.coverage.stopJSCoverage(), - * page.coverage.stopCSSCoverage(), - * ]); - * let totalBytes = 0; - * let usedBytes = 0; - * const coverage = [...jsCoverage, ...cssCoverage]; - * for (const entry of coverage) { - * totalBytes += entry.text.length; - * for (const range of entry.ranges) - * usedBytes += range.end - range.start - 1; - * } - * console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`); - * ``` - * @public - */ -export declare class Coverage { - /** - * @internal - */ - _jsCoverage: JSCoverage; - /** - * @internal - */ - _cssCoverage: CSSCoverage; - constructor(client: CDPSession); - /** - * @param options - defaults to - * `{ resetOnNavigation : true, reportAnonymousScripts : false }` - * @returns Promise that resolves when coverage is started. - * - * @remarks - * Anonymous scripts are ones that don't have an associated url. These are - * scripts that are dynamically created on the page using `eval` or - * `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous - * scripts will have `__puppeteer_evaluation_script__` as their URL. - */ - startJSCoverage(options?: JSCoverageOptions): Promise; - /** - * @returns Promise that resolves to the array of coverage reports for - * all scripts. - * - * @remarks - * JavaScript Coverage doesn't include anonymous scripts by default. - * However, scripts with sourceURLs are reported. - */ - stopJSCoverage(): Promise; - /** - * @param options - defaults to `{ resetOnNavigation : true }` - * @returns Promise that resolves when coverage is started. - */ - startCSSCoverage(options?: CSSCoverageOptions): Promise; - /** - * @returns Promise that resolves to the array of coverage reports - * for all stylesheets. - * @remarks - * CSS Coverage doesn't include dynamically injected style tags - * without sourceURLs. - */ - stopCSSCoverage(): Promise; -} -declare class JSCoverage { - _client: CDPSession; - _enabled: boolean; - _scriptURLs: Map; - _scriptSources: Map; - _eventListeners: PuppeteerEventListener[]; - _resetOnNavigation: boolean; - _reportAnonymousScripts: boolean; - constructor(client: CDPSession); - start(options?: { - resetOnNavigation?: boolean; - reportAnonymousScripts?: boolean; - }): Promise; - _onExecutionContextsCleared(): void; - _onScriptParsed(event: Protocol.Debugger.ScriptParsedEvent): Promise; - stop(): Promise; -} -declare class CSSCoverage { - _client: CDPSession; - _enabled: boolean; - _stylesheetURLs: Map; - _stylesheetSources: Map; - _eventListeners: PuppeteerEventListener[]; - _resetOnNavigation: boolean; - _reportAnonymousScripts: boolean; - constructor(client: CDPSession); - start(options?: { - resetOnNavigation?: boolean; - }): Promise; - _onExecutionContextsCleared(): void; - _onStyleSheet(event: Protocol.CSS.StyleSheetAddedEvent): Promise; - stop(): Promise; -} -export {}; -//# sourceMappingURL=Coverage.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map deleted file mode 100644 index cb4f25d4194..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Coverage.d.ts","sourceRoot":"","sources":["../../../../src/common/Coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAsB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,QAAQ;IACnB;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,YAAY,EAAE,WAAW,CAAC;gBAEd,MAAM,EAAE,UAAU;IAK9B;;;;;;;;;;OAUG;IACG,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;;;;;OAOG;IACG,cAAc,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAIhD;;;OAGG;IACG,gBAAgB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE;;;;;;OAMG;IACG,eAAe,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAGlD;AAED,cAAM,UAAU;IACd,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,UAAS;IACjB,WAAW,sBAA6B;IACxC,cAAc,sBAA6B;IAC3C,eAAe,EAAE,sBAAsB,EAAE,CAAM;IAC/C,kBAAkB,UAAS;IAC3B,uBAAuB,UAAS;gBAEpB,MAAM,EAAE,UAAU;IAIxB,KAAK,CACT,OAAO,GAAE;QACP,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAC7B,GACL,OAAO,CAAC,IAAI,CAAC;IAkChB,2BAA2B,IAAI,IAAI;IAM7B,eAAe,CACnB,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,GACzC,OAAO,CAAC,IAAI,CAAC;IAiBV,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAkCvC;AAED,cAAM,WAAW;IACf,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,UAAS;IACjB,eAAe,sBAA6B;IAC5C,kBAAkB,sBAA6B;IAC/C,eAAe,EAAE,sBAAsB,EAAE,CAAM;IAC/C,kBAAkB,UAAS;IAC3B,uBAAuB,UAAS;gBAEpB,MAAM,EAAE,UAAU;IAIxB,KAAK,CAAC,OAAO,GAAE;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BzE,2BAA2B,IAAI,IAAI;IAM7B,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBtE,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAuCvC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js deleted file mode 100644 index 9bb4d3ed7e0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js +++ /dev/null @@ -1,319 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Coverage = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const ExecutionContext_js_1 = require("./ExecutionContext.js"); -/** - * The Coverage class provides methods to gathers information about parts of - * JavaScript and CSS that were used by the page. - * - * @remarks - * To output coverage in a form consumable by {@link https://github.com/istanbuljs | Istanbul}, - * see {@link https://github.com/istanbuljs/puppeteer-to-istanbul | puppeteer-to-istanbul}. - * - * @example - * An example of using JavaScript and CSS coverage to get percentage of initially - * executed code: - * ```js - * // Enable both JavaScript and CSS coverage - * await Promise.all([ - * page.coverage.startJSCoverage(), - * page.coverage.startCSSCoverage() - * ]); - * // Navigate to page - * await page.goto('https://example.com'); - * // Disable both JavaScript and CSS coverage - * const [jsCoverage, cssCoverage] = await Promise.all([ - * page.coverage.stopJSCoverage(), - * page.coverage.stopCSSCoverage(), - * ]); - * let totalBytes = 0; - * let usedBytes = 0; - * const coverage = [...jsCoverage, ...cssCoverage]; - * for (const entry of coverage) { - * totalBytes += entry.text.length; - * for (const range of entry.ranges) - * usedBytes += range.end - range.start - 1; - * } - * console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`); - * ``` - * @public - */ -class Coverage { - constructor(client) { - this._jsCoverage = new JSCoverage(client); - this._cssCoverage = new CSSCoverage(client); - } - /** - * @param options - defaults to - * `{ resetOnNavigation : true, reportAnonymousScripts : false }` - * @returns Promise that resolves when coverage is started. - * - * @remarks - * Anonymous scripts are ones that don't have an associated url. These are - * scripts that are dynamically created on the page using `eval` or - * `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous - * scripts will have `__puppeteer_evaluation_script__` as their URL. - */ - async startJSCoverage(options = {}) { - return await this._jsCoverage.start(options); - } - /** - * @returns Promise that resolves to the array of coverage reports for - * all scripts. - * - * @remarks - * JavaScript Coverage doesn't include anonymous scripts by default. - * However, scripts with sourceURLs are reported. - */ - async stopJSCoverage() { - return await this._jsCoverage.stop(); - } - /** - * @param options - defaults to `{ resetOnNavigation : true }` - * @returns Promise that resolves when coverage is started. - */ - async startCSSCoverage(options = {}) { - return await this._cssCoverage.start(options); - } - /** - * @returns Promise that resolves to the array of coverage reports - * for all stylesheets. - * @remarks - * CSS Coverage doesn't include dynamically injected style tags - * without sourceURLs. - */ - async stopCSSCoverage() { - return await this._cssCoverage.stop(); - } -} -exports.Coverage = Coverage; -class JSCoverage { - constructor(client) { - this._enabled = false; - this._scriptURLs = new Map(); - this._scriptSources = new Map(); - this._eventListeners = []; - this._resetOnNavigation = false; - this._reportAnonymousScripts = false; - this._client = client; - } - async start(options = {}) { - assert_js_1.assert(!this._enabled, 'JSCoverage is already enabled'); - const { resetOnNavigation = true, reportAnonymousScripts = false, } = options; - this._resetOnNavigation = resetOnNavigation; - this._reportAnonymousScripts = reportAnonymousScripts; - this._enabled = true; - this._scriptURLs.clear(); - this._scriptSources.clear(); - this._eventListeners = [ - helper_js_1.helper.addEventListener(this._client, 'Debugger.scriptParsed', this._onScriptParsed.bind(this)), - helper_js_1.helper.addEventListener(this._client, 'Runtime.executionContextsCleared', this._onExecutionContextsCleared.bind(this)), - ]; - await Promise.all([ - this._client.send('Profiler.enable'), - this._client.send('Profiler.startPreciseCoverage', { - callCount: false, - detailed: true, - }), - this._client.send('Debugger.enable'), - this._client.send('Debugger.setSkipAllPauses', { skip: true }), - ]); - } - _onExecutionContextsCleared() { - if (!this._resetOnNavigation) - return; - this._scriptURLs.clear(); - this._scriptSources.clear(); - } - async _onScriptParsed(event) { - // Ignore puppeteer-injected scripts - if (event.url === ExecutionContext_js_1.EVALUATION_SCRIPT_URL) - return; - // Ignore other anonymous scripts unless the reportAnonymousScripts option is true. - if (!event.url && !this._reportAnonymousScripts) - return; - try { - const response = await this._client.send('Debugger.getScriptSource', { - scriptId: event.scriptId, - }); - this._scriptURLs.set(event.scriptId, event.url); - this._scriptSources.set(event.scriptId, response.scriptSource); - } - catch (error) { - // This might happen if the page has already navigated away. - helper_js_1.debugError(error); - } - } - async stop() { - assert_js_1.assert(this._enabled, 'JSCoverage is not enabled'); - this._enabled = false; - const result = await Promise.all([ - this._client.send('Profiler.takePreciseCoverage'), - this._client.send('Profiler.stopPreciseCoverage'), - this._client.send('Profiler.disable'), - this._client.send('Debugger.disable'), - ]); - helper_js_1.helper.removeEventListeners(this._eventListeners); - const coverage = []; - const profileResponse = result[0]; - for (const entry of profileResponse.result) { - let url = this._scriptURLs.get(entry.scriptId); - if (!url && this._reportAnonymousScripts) - url = 'debugger://VM' + entry.scriptId; - const text = this._scriptSources.get(entry.scriptId); - if (text === undefined || url === undefined) - continue; - const flattenRanges = []; - for (const func of entry.functions) - flattenRanges.push(...func.ranges); - const ranges = convertToDisjointRanges(flattenRanges); - coverage.push({ url, ranges, text }); - } - return coverage; - } -} -class CSSCoverage { - constructor(client) { - this._enabled = false; - this._stylesheetURLs = new Map(); - this._stylesheetSources = new Map(); - this._eventListeners = []; - this._resetOnNavigation = false; - this._reportAnonymousScripts = false; - this._client = client; - } - async start(options = {}) { - assert_js_1.assert(!this._enabled, 'CSSCoverage is already enabled'); - const { resetOnNavigation = true } = options; - this._resetOnNavigation = resetOnNavigation; - this._enabled = true; - this._stylesheetURLs.clear(); - this._stylesheetSources.clear(); - this._eventListeners = [ - helper_js_1.helper.addEventListener(this._client, 'CSS.styleSheetAdded', this._onStyleSheet.bind(this)), - helper_js_1.helper.addEventListener(this._client, 'Runtime.executionContextsCleared', this._onExecutionContextsCleared.bind(this)), - ]; - await Promise.all([ - this._client.send('DOM.enable'), - this._client.send('CSS.enable'), - this._client.send('CSS.startRuleUsageTracking'), - ]); - } - _onExecutionContextsCleared() { - if (!this._resetOnNavigation) - return; - this._stylesheetURLs.clear(); - this._stylesheetSources.clear(); - } - async _onStyleSheet(event) { - const header = event.header; - // Ignore anonymous scripts - if (!header.sourceURL) - return; - try { - const response = await this._client.send('CSS.getStyleSheetText', { - styleSheetId: header.styleSheetId, - }); - this._stylesheetURLs.set(header.styleSheetId, header.sourceURL); - this._stylesheetSources.set(header.styleSheetId, response.text); - } - catch (error) { - // This might happen if the page has already navigated away. - helper_js_1.debugError(error); - } - } - async stop() { - assert_js_1.assert(this._enabled, 'CSSCoverage is not enabled'); - this._enabled = false; - const ruleTrackingResponse = await this._client.send('CSS.stopRuleUsageTracking'); - await Promise.all([ - this._client.send('CSS.disable'), - this._client.send('DOM.disable'), - ]); - helper_js_1.helper.removeEventListeners(this._eventListeners); - // aggregate by styleSheetId - const styleSheetIdToCoverage = new Map(); - for (const entry of ruleTrackingResponse.ruleUsage) { - let ranges = styleSheetIdToCoverage.get(entry.styleSheetId); - if (!ranges) { - ranges = []; - styleSheetIdToCoverage.set(entry.styleSheetId, ranges); - } - ranges.push({ - startOffset: entry.startOffset, - endOffset: entry.endOffset, - count: entry.used ? 1 : 0, - }); - } - const coverage = []; - for (const styleSheetId of this._stylesheetURLs.keys()) { - const url = this._stylesheetURLs.get(styleSheetId); - const text = this._stylesheetSources.get(styleSheetId); - const ranges = convertToDisjointRanges(styleSheetIdToCoverage.get(styleSheetId) || []); - coverage.push({ url, ranges, text }); - } - return coverage; - } -} -function convertToDisjointRanges(nestedRanges) { - const points = []; - for (const range of nestedRanges) { - points.push({ offset: range.startOffset, type: 0, range }); - points.push({ offset: range.endOffset, type: 1, range }); - } - // Sort points to form a valid parenthesis sequence. - points.sort((a, b) => { - // Sort with increasing offsets. - if (a.offset !== b.offset) - return a.offset - b.offset; - // All "end" points should go before "start" points. - if (a.type !== b.type) - return b.type - a.type; - const aLength = a.range.endOffset - a.range.startOffset; - const bLength = b.range.endOffset - b.range.startOffset; - // For two "start" points, the one with longer range goes first. - if (a.type === 0) - return bLength - aLength; - // For two "end" points, the one with shorter range goes first. - return aLength - bLength; - }); - const hitCountStack = []; - const results = []; - let lastOffset = 0; - // Run scanning line to intersect all ranges. - for (const point of points) { - if (hitCountStack.length && - lastOffset < point.offset && - hitCountStack[hitCountStack.length - 1] > 0) { - const lastResult = results.length ? results[results.length - 1] : null; - if (lastResult && lastResult.end === lastOffset) - lastResult.end = point.offset; - else - results.push({ start: lastOffset, end: point.offset }); - } - lastOffset = point.offset; - if (point.type === 0) - hitCountStack.push(point.range.count); - else - hitCountStack.pop(); - } - // Filter out empty ranges. - return results.filter((range) => range.end - range.start > 1); -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts deleted file mode 100644 index a2276edb037..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/// -import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike , WrapElementHandle} from './EvalTypes.js'; -import { ExecutionContext } from './ExecutionContext.js'; -import { Frame , FrameManager} from './FrameManager.js'; -import { MouseButton } from './Input.js'; -import { ElementHandle , JSHandle} from './JSHandle.js'; -import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js'; -import { TimeoutSettings } from './TimeoutSettings.js'; - -/** - * @public - */ -export interface WaitForSelectorOptions { - visible?: boolean; - hidden?: boolean; - timeout?: number; -} -/** - * @internal - */ -export declare class DOMWorld { - private _frameManager; - private _frame; - private _timeoutSettings; - private _documentPromise?; - private _contextPromise?; - private _contextResolveCallback?; - private _detached; - /** - * internal - */ - _waitTasks: Set; - constructor(frameManager: FrameManager, frame: Frame, timeoutSettings: TimeoutSettings); - frame(): Frame; - _setContext(context?: ExecutionContext): void; - _hasContext(): boolean; - _detach(): void; - executionContext(): Promise; - evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; - evaluate(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise>>; - $(selector: string): Promise; - _document(): Promise; - $x(expression: string): Promise; - $eval(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - $$eval(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - $$(selector: string): Promise; - content(): Promise; - setContent(html: string, options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * Adds a script tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - */ - addScriptTag(options: { - url?: string; - path?: string; - content?: string; - type?: string; - }): Promise; - /** - * Adds a style tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - * - */ - addStyleTag(options: { - url?: string; - path?: string; - content?: string; - }): Promise; - click(selector: string, options: { - delay?: number; - button?: MouseButton; - clickCount?: number; - }): Promise; - focus(selector: string): Promise; - hover(selector: string): Promise; - select(selector: string, ...values: string[]): Promise; - tap(selector: string): Promise; - type(selector: string, text: string, options?: { - delay: number; - }): Promise; - waitForSelector(selector: string, options: WaitForSelectorOptions): Promise; - waitForXPath(xpath: string, options: WaitForSelectorOptions): Promise; - waitForFunction(pageFunction: Function | string, options?: { - polling?: string | number; - timeout?: number; - }, ...args: SerializableOrJSHandle[]): Promise; - title(): Promise; - private _waitForSelectorOrXPath; -} -declare class WaitTask { - _domWorld: DOMWorld; - _polling: string | number; - _timeout: number; - _predicateBody: string; - _args: SerializableOrJSHandle[]; - _runCount: number; - promise: Promise; - _resolve: (x: JSHandle) => void; - _reject: (x: Error) => void; - _timeoutTimer?: NodeJS.Timeout; - _terminated: boolean; - constructor(domWorld: DOMWorld, predicateBody: Function | string, predicateQueryHandlerBody: Function | string | undefined, title: string, polling: string | number, timeout: number, ...args: SerializableOrJSHandle[]); - terminate(error: Error): void; - rerun(): Promise; - _cleanup(): void; -} -export {}; -//# sourceMappingURL=DOMWorld.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map deleted file mode 100644 index cc6a070e792..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DOMWorld.d.ts","sourceRoot":"","sources":["../../../../src/common/DOMWorld.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAIH,OAAO,EAEL,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAUxB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,gBAAgB,CAAC,CAAgC;IACzD,OAAO,CAAC,eAAe,CAAC,CAAmC;IAE3D,OAAO,CAAC,uBAAuB,CAAC,CAAwC;IAExE,OAAO,CAAC,SAAS,CAAS;IAC1B;;OAEG;IACH,UAAU,gBAAuB;gBAG/B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe;IAQlC,KAAK,IAAI,KAAK;IAId,WAAW,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAa7C,WAAW,IAAI,OAAO;IAItB,OAAO,IAAI,IAAI;IAQf,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAQvC,cAAc,CAAC,WAAW,SAAS,QAAQ,GAAG,QAAQ,EAC1D,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,WAAW,CAAC;IAKjB,QAAQ,CAAC,CAAC,SAAS,UAAU,EACjC,YAAY,EAAE,CAAC,EACf,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAQhD,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAMlD,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC;IASnC,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAMhD,KAAK,CAAC,UAAU,EACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CACZ,OAAO,EAAE,OAAO,EAChB,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,EACrC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAKnC,MAAM,CAAC,UAAU,EACrB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,EACrC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAUnC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAM9C,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAW1B,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,CAAC;KAC5D,GACL,OAAO,CAAC,IAAI,CAAC;IA0BhB;;;;;;;;OAQG;IACG,YAAY,CAAC,OAAO,EAAE;QAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,aAAa,CAAC;IA0E1B;;;;;;;;;OASG;IACG,WAAW,CAAC,OAAO,EAAE;QACzB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoEpB,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACrE,OAAO,CAAC,IAAI,CAAC;IAOV,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQhE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOpC,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;IAOhB,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIhC,YAAY,CACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIhC,eAAe,CACb,YAAY,EAAE,QAAQ,GAAG,MAAM,EAC/B,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,EAC7D,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,QAAQ,CAAC;IAgBd,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;YAIhB,uBAAuB;CAyEtC;AAED,cAAM,QAAQ;IACZ,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,SAAS,SAAK;IACd,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IAC/B,WAAW,UAAS;gBAGlB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,QAAQ,GAAG,MAAM,EAChC,yBAAyB,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,EACxD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,GAAG,IAAI,EAAE,sBAAsB,EAAE;IAsDnC,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAMvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoD5B,QAAQ,IAAI,IAAI;CAIjB"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js deleted file mode 100644 index d0a17eae3c0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +++ /dev/null @@ -1,520 +0,0 @@ -"use strict"; -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DOMWorld = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const LifecycleWatcher_js_1 = require("./LifecycleWatcher.js"); -const Errors_js_1 = require("./Errors.js"); -const QueryHandler_js_1 = require("./QueryHandler.js"); -const environment_js_1 = require("../environment.js"); -/** - * @internal - */ -class DOMWorld { - constructor(frameManager, frame, timeoutSettings) { - this._documentPromise = null; - this._contextPromise = null; - this._contextResolveCallback = null; - this._detached = false; - /** - * internal - */ - this._waitTasks = new Set(); - this._frameManager = frameManager; - this._frame = frame; - this._timeoutSettings = timeoutSettings; - this._setContext(null); - } - frame() { - return this._frame; - } - _setContext(context) { - if (context) { - this._contextResolveCallback.call(null, context); - this._contextResolveCallback = null; - for (const waitTask of this._waitTasks) - waitTask.rerun(); - } - else { - this._documentPromise = null; - this._contextPromise = new Promise((fulfill) => { - this._contextResolveCallback = fulfill; - }); - } - } - _hasContext() { - return !this._contextResolveCallback; - } - _detach() { - this._detached = true; - for (const waitTask of this._waitTasks) - waitTask.terminate(new Error('waitForFunction failed: frame got detached.')); - } - executionContext() { - if (this._detached) - throw new Error(`Execution Context is not available in detached frame "${this._frame.url()}" (are you trying to evaluate?)`); - return this._contextPromise; - } - async evaluateHandle(pageFunction, ...args) { - const context = await this.executionContext(); - return context.evaluateHandle(pageFunction, ...args); - } - async evaluate(pageFunction, ...args) { - const context = await this.executionContext(); - return context.evaluate(pageFunction, ...args); - } - async $(selector) { - const document = await this._document(); - const value = await document.$(selector); - return value; - } - async _document() { - if (this._documentPromise) - return this._documentPromise; - this._documentPromise = this.executionContext().then(async (context) => { - const document = await context.evaluateHandle('document'); - return document.asElement(); - }); - return this._documentPromise; - } - async $x(expression) { - const document = await this._document(); - const value = await document.$x(expression); - return value; - } - async $eval(selector, pageFunction, ...args) { - const document = await this._document(); - return document.$eval(selector, pageFunction, ...args); - } - async $$eval(selector, pageFunction, ...args) { - const document = await this._document(); - const value = await document.$$eval(selector, pageFunction, ...args); - return value; - } - async $$(selector) { - const document = await this._document(); - const value = await document.$$(selector); - return value; - } - async content() { - return await this.evaluate(() => { - let retVal = ''; - if (document.doctype) - retVal = new XMLSerializer().serializeToString(document.doctype); - if (document.documentElement) - retVal += document.documentElement.outerHTML; - return retVal; - }); - } - async setContent(html, options = {}) { - const { waitUntil = ['load'], timeout = this._timeoutSettings.navigationTimeout(), } = options; - // We rely upon the fact that document.open() will reset frame lifecycle with "init" - // lifecycle event. @see https://crrev.com/608658 - await this.evaluate((html) => { - document.open(); - document.write(html); - document.close(); - }, html); - const watcher = new LifecycleWatcher_js_1.LifecycleWatcher(this._frameManager, this._frame, waitUntil, timeout); - const error = await Promise.race([ - watcher.timeoutOrTerminationPromise(), - watcher.lifecyclePromise(), - ]); - watcher.dispose(); - if (error) - throw error; - } - /** - * Adds a script tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - */ - async addScriptTag(options) { - const { url = null, path = null, content = null, type = '' } = options; - if (url !== null) { - try { - const context = await this.executionContext(); - return (await context.evaluateHandle(addScriptUrl, url, type)).asElement(); - } - catch (error) { - throw new Error(`Loading script from ${url} failed`); - } - } - if (path !== null) { - if (!environment_js_1.isNode) { - throw new Error('Cannot pass a filepath to addScriptTag in the browser environment.'); - } - // eslint-disable-next-line @typescript-eslint/no-var-requires - const fs = require('fs'); - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { promisify } = require('util'); - const readFileAsync = promisify(fs.readFile); - let contents = await readFileAsync(path, 'utf8'); - contents += '//# sourceURL=' + path.replace(/\n/g, ''); - const context = await this.executionContext(); - return (await context.evaluateHandle(addScriptContent, contents, type)).asElement(); - } - if (content !== null) { - const context = await this.executionContext(); - return (await context.evaluateHandle(addScriptContent, content, type)).asElement(); - } - throw new Error('Provide an object with a `url`, `path` or `content` property'); - async function addScriptUrl(url, type) { - const script = document.createElement('script'); - script.src = url; - if (type) - script.type = type; - const promise = new Promise((res, rej) => { - script.onload = res; - script.onerror = rej; - }); - document.head.appendChild(script); - await promise; - return script; - } - function addScriptContent(content, type = 'text/javascript') { - const script = document.createElement('script'); - script.type = type; - script.text = content; - let error = null; - script.onerror = (e) => (error = e); - document.head.appendChild(script); - if (error) - throw error; - return script; - } - } - /** - * Adds a style tag into the current context. - * - * @remarks - * - * You can pass a URL, filepath or string of contents. Note that when running Puppeteer - * in a browser environment you cannot pass a filepath and should use either - * `url` or `content`. - * - */ - async addStyleTag(options) { - const { url = null, path = null, content = null } = options; - if (url !== null) { - try { - const context = await this.executionContext(); - return (await context.evaluateHandle(addStyleUrl, url)).asElement(); - } - catch (error) { - throw new Error(`Loading style from ${url} failed`); - } - } - if (path !== null) { - if (!environment_js_1.isNode) { - throw new Error('Cannot pass a filepath to addStyleTag in the browser environment.'); - } - // eslint-disable-next-line @typescript-eslint/no-var-requires - const fs = require('fs'); - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { promisify } = require('util'); - const readFileAsync = promisify(fs.readFile); - let contents = await readFileAsync(path, 'utf8'); - contents += '/*# sourceURL=' + path.replace(/\n/g, '') + '*/'; - const context = await this.executionContext(); - return (await context.evaluateHandle(addStyleContent, contents)).asElement(); - } - if (content !== null) { - const context = await this.executionContext(); - return (await context.evaluateHandle(addStyleContent, content)).asElement(); - } - throw new Error('Provide an object with a `url`, `path` or `content` property'); - async function addStyleUrl(url) { - const link = document.createElement('link'); - link.rel = 'stylesheet'; - link.href = url; - const promise = new Promise((res, rej) => { - link.onload = res; - link.onerror = rej; - }); - document.head.appendChild(link); - await promise; - return link; - } - async function addStyleContent(content) { - const style = document.createElement('style'); - style.type = 'text/css'; - style.appendChild(document.createTextNode(content)); - const promise = new Promise((res, rej) => { - style.onload = res; - style.onerror = rej; - }); - document.head.appendChild(style); - await promise; - return style; - } - } - async click(selector, options) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.click(options); - await handle.dispose(); - } - async focus(selector) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.focus(); - await handle.dispose(); - } - async hover(selector) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.hover(); - await handle.dispose(); - } - async select(selector, ...values) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - const result = await handle.select(...values); - await handle.dispose(); - return result; - } - async tap(selector) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.tap(); - await handle.dispose(); - } - async type(selector, text, options) { - const handle = await this.$(selector); - assert_js_1.assert(handle, 'No node found for selector: ' + selector); - await handle.type(text, options); - await handle.dispose(); - } - waitForSelector(selector, options) { - return this._waitForSelectorOrXPath(selector, false, options); - } - waitForXPath(xpath, options) { - return this._waitForSelectorOrXPath(xpath, true, options); - } - waitForFunction(pageFunction, options = {}, ...args) { - const { polling = 'raf', timeout = this._timeoutSettings.timeout(), } = options; - return new WaitTask(this, pageFunction, undefined, 'function', polling, timeout, ...args).promise; - } - async title() { - return this.evaluate(() => document.title); - } - async _waitForSelectorOrXPath(selectorOrXPath, isXPath, options = {}) { - const { visible: waitForVisible = false, hidden: waitForHidden = false, timeout = this._timeoutSettings.timeout(), } = options; - const polling = waitForVisible || waitForHidden ? 'raf' : 'mutation'; - const title = `${isXPath ? 'XPath' : 'selector'} "${selectorOrXPath}"${waitForHidden ? ' to be hidden' : ''}`; - const { updatedSelector, queryHandler } = QueryHandler_js_1.getQueryHandlerAndSelector(selectorOrXPath); - const waitTask = new WaitTask(this, predicate, queryHandler.queryOne, title, polling, timeout, updatedSelector, isXPath, waitForVisible, waitForHidden); - const handle = await waitTask.promise; - if (!handle.asElement()) { - await handle.dispose(); - return null; - } - return handle.asElement(); - function predicate(selectorOrXPath, isXPath, waitForVisible, waitForHidden) { - const node = isXPath - ? document.evaluate(selectorOrXPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue - : predicateQueryHandler - ? predicateQueryHandler(document, selectorOrXPath) - : document.querySelector(selectorOrXPath); - if (!node) - return waitForHidden; - if (!waitForVisible && !waitForHidden) - return node; - const element = node.nodeType === Node.TEXT_NODE - ? node.parentElement - : node; - const style = window.getComputedStyle(element); - const isVisible = style && style.visibility !== 'hidden' && hasVisibleBoundingBox(); - const success = waitForVisible === isVisible || waitForHidden === !isVisible; - return success ? node : null; - function hasVisibleBoundingBox() { - const rect = element.getBoundingClientRect(); - return !!(rect.top || rect.bottom || rect.width || rect.height); - } - } - } -} -exports.DOMWorld = DOMWorld; -class WaitTask { - constructor(domWorld, predicateBody, predicateQueryHandlerBody, title, polling, timeout, ...args) { - this._runCount = 0; - this._terminated = false; - if (helper_js_1.helper.isString(polling)) - assert_js_1.assert(polling === 'raf' || polling === 'mutation', 'Unknown polling option: ' + polling); - else if (helper_js_1.helper.isNumber(polling)) - assert_js_1.assert(polling > 0, 'Cannot poll with non-positive interval: ' + polling); - else - throw new Error('Unknown polling options: ' + polling); - function getPredicateBody(predicateBody, predicateQueryHandlerBody) { - if (helper_js_1.helper.isString(predicateBody)) - return `return (${predicateBody});`; - if (predicateQueryHandlerBody) { - return ` - return (function wrapper(args) { - const predicateQueryHandler = ${predicateQueryHandlerBody}; - return (${predicateBody})(...args); - })(args);`; - } - return `return (${predicateBody})(...args);`; - } - this._domWorld = domWorld; - this._polling = polling; - this._timeout = timeout; - this._predicateBody = getPredicateBody(predicateBody, predicateQueryHandlerBody); - this._args = args; - this._runCount = 0; - domWorld._waitTasks.add(this); - this.promise = new Promise((resolve, reject) => { - this._resolve = resolve; - this._reject = reject; - }); - // Since page navigation requires us to re-install the pageScript, we should track - // timeout on our end. - if (timeout) { - const timeoutError = new Errors_js_1.TimeoutError(`waiting for ${title} failed: timeout ${timeout}ms exceeded`); - this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), timeout); - } - this.rerun(); - } - terminate(error) { - this._terminated = true; - this._reject(error); - this._cleanup(); - } - async rerun() { - const runCount = ++this._runCount; - /** @type {?JSHandle} */ - let success = null; - let error = null; - try { - success = await (await this._domWorld.executionContext()).evaluateHandle(waitForPredicatePageFunction, this._predicateBody, this._polling, this._timeout, ...this._args); - } - catch (error_) { - error = error_; - } - if (this._terminated || runCount !== this._runCount) { - if (success) - await success.dispose(); - return; - } - // Ignore timeouts in pageScript - we track timeouts ourselves. - // If the frame's execution context has already changed, `frame.evaluate` will - // throw an error - ignore this predicate run altogether. - if (!error && - (await this._domWorld.evaluate((s) => !s, success).catch(() => true))) { - await success.dispose(); - return; - } - // When the page is navigated, the promise is rejected. - // We will try again in the new execution context. - if (error && error.message.includes('Execution context was destroyed')) - return; - // We could have tried to evaluate in a context which was already - // destroyed. - if (error && - error.message.includes('Cannot find context with specified id')) - return; - if (error) - this._reject(error); - else - this._resolve(success); - this._cleanup(); - } - _cleanup() { - clearTimeout(this._timeoutTimer); - this._domWorld._waitTasks.delete(this); - } -} -async function waitForPredicatePageFunction(predicateBody, polling, timeout, ...args) { - const predicate = new Function('...args', predicateBody); - let timedOut = false; - if (timeout) - setTimeout(() => (timedOut = true), timeout); - if (polling === 'raf') - return await pollRaf(); - if (polling === 'mutation') - return await pollMutation(); - if (typeof polling === 'number') - return await pollInterval(polling); - /** - * @returns {!Promise<*>} - */ - async function pollMutation() { - const success = await predicate(...args); - if (success) - return Promise.resolve(success); - let fulfill; - const result = new Promise((x) => (fulfill = x)); - const observer = new MutationObserver(async () => { - if (timedOut) { - observer.disconnect(); - fulfill(); - } - const success = await predicate(...args); - if (success) { - observer.disconnect(); - fulfill(success); - } - }); - observer.observe(document, { - childList: true, - subtree: true, - attributes: true, - }); - return result; - } - async function pollRaf() { - let fulfill; - const result = new Promise((x) => (fulfill = x)); - await onRaf(); - return result; - async function onRaf() { - if (timedOut) { - fulfill(); - return; - } - const success = await predicate(...args); - if (success) - fulfill(success); - else - requestAnimationFrame(onRaf); - } - } - async function pollInterval(pollInterval) { - let fulfill; - const result = new Promise((x) => (fulfill = x)); - await onTimeout(); - return result; - async function onTimeout() { - if (timedOut) { - fulfill(); - return; - } - const success = await predicate(...args); - if (success) - fulfill(success); - else - setTimeout(onTimeout, pollInterval); - } - } -} diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts deleted file mode 100644 index 77b2e5bcd6f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * A debug function that can be used in any environment. - * - * @remarks - * - * If used in Node, it falls back to the - * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it - * uses `console.log`. - * - * @param prefix - this will be prefixed to each log. - * @returns a function that can be called to log to that debug channel. - * - * In Node, use the `DEBUG` environment variable to control logging: - * - * ``` - * DEBUG=* // logs all channels - * DEBUG=foo // logs the `foo` channel - * DEBUG=foo* // logs any channels starting with `foo` - * ``` - * - * In the browser, set `window.__PUPPETEER_DEBUG` to a string: - * - * ``` - * window.__PUPPETEER_DEBUG='*'; // logs all channels - * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel - * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` - * ``` - * - * @example - * ``` - * const log = debug('Page'); - * - * log('new page created') - * // logs "Page: new page created" - * ``` - */ -export declare const debug: (prefix: string) => (...args: unknown[]) => void; -//# sourceMappingURL=Debug.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map deleted file mode 100644 index 2f3bd79bec9..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Debug.d.ts","sourceRoot":"","sources":["../../../../src/common/Debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,KAAK,WAAY,MAAM,eAAc,OAAO,EAAE,KAAK,IA4B/D,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js deleted file mode 100644 index 6a01693c17d..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.debug = void 0; -const environment_js_1 = require("../environment.js"); -/** - * A debug function that can be used in any environment. - * - * @remarks - * - * If used in Node, it falls back to the - * {@link https://www.npmjs.com/package/debug | debug module}. In the browser it - * uses `console.log`. - * - * @param prefix - this will be prefixed to each log. - * @returns a function that can be called to log to that debug channel. - * - * In Node, use the `DEBUG` environment variable to control logging: - * - * ``` - * DEBUG=* // logs all channels - * DEBUG=foo // logs the `foo` channel - * DEBUG=foo* // logs any channels starting with `foo` - * ``` - * - * In the browser, set `window.__PUPPETEER_DEBUG` to a string: - * - * ``` - * window.__PUPPETEER_DEBUG='*'; // logs all channels - * window.__PUPPETEER_DEBUG='foo'; // logs the `foo` channel - * window.__PUPPETEER_DEBUG='foo*'; // logs any channels starting with `foo` - * ``` - * - * @example - * ``` - * const log = debug('Page'); - * - * log('new page created') - * // logs "Page: new page created" - * ``` - */ -exports.debug = (prefix) => { - if (environment_js_1.isNode) { - // eslint-disable-next-line @typescript-eslint/no-var-requires - return require('debug')(prefix); - } - return (...logArgs) => { - const debugLevel = globalThis.__PUPPETEER_DEBUG; - if (!debugLevel) - return; - const everythingShouldBeLogged = debugLevel === '*'; - const prefixMatchesDebugLevel = everythingShouldBeLogged || - /** - * If the debug level is `foo*`, that means we match any prefix that - * starts with `foo`. If the level is `foo`, we match only the prefix - * `foo`. - */ - (debugLevel.endsWith('*') - ? prefix.startsWith(debugLevel) - : prefix === debugLevel); - if (!prefixMatchesDebugLevel) - return; - // eslint-disable-next-line no-console - console.log(`${prefix}:`, ...logArgs); - }; -}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts deleted file mode 100644 index f74e0171162..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -interface Device { - name: string; - userAgent: string; - viewport: { - width: number; - height: number; - deviceScaleFactor: number; - isMobile: boolean; - hasTouch: boolean; - isLandscape: boolean; - }; -} -export declare type DevicesMap = { - [name: string]: Device; -}; -declare const devicesMap: DevicesMap; -export { devicesMap }; -//# sourceMappingURL=DeviceDescriptors.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map deleted file mode 100644 index 6215766fb6e..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DeviceDescriptors.d.ts","sourceRoot":"","sources":["../../../../src/common/DeviceDescriptors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,EAAE,MAAM,CAAC;QAC1B,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;CACH;AAg6BD,oBAAY,UAAU,GAAG;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,UAAe,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js deleted file mode 100644 index 60e7af7c142..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js +++ /dev/null @@ -1,876 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.devicesMap = void 0; -const devices = [ - { - name: 'Blackberry PlayBook', - userAgent: 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+', - viewport: { - width: 600, - height: 1024, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Blackberry PlayBook landscape', - userAgent: 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+', - viewport: { - width: 1024, - height: 600, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'BlackBerry Z30', - userAgent: 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'BlackBerry Z30 landscape', - userAgent: 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy Note 3', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy Note 3 landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy Note II', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy Note II landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy S III', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy S III landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Galaxy S5', - userAgent: 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Galaxy S5 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPad', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 768, - height: 1024, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPad landscape', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1024, - height: 768, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPad Mini', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 768, - height: 1024, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPad Mini landscape', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1024, - height: 768, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPad Pro', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1024, - height: 1366, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPad Pro landscape', - userAgent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1', - viewport: { - width: 1366, - height: 1024, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 4', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53', - viewport: { - width: 320, - height: 480, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 4 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53', - viewport: { - width: 480, - height: 320, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 5', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 320, - height: 568, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 5 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 568, - height: 320, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 6', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 667, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 6 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 667, - height: 375, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 6 Plus', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 414, - height: 736, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 6 Plus landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 736, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 7', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 667, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 7 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 667, - height: 375, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 7 Plus', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 414, - height: 736, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 7 Plus landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 736, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 8', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 667, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 8 landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 667, - height: 375, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone 8 Plus', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 414, - height: 736, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone 8 Plus landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 736, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone SE', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 320, - height: 568, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone SE landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1', - viewport: { - width: 568, - height: 320, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone X', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 375, - height: 812, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone X landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - viewport: { - width: 812, - height: 375, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'iPhone XR', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1', - viewport: { - width: 414, - height: 896, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'iPhone XR landscape', - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1', - viewport: { - width: 896, - height: 414, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'JioPhone 2', - userAgent: 'Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5', - viewport: { - width: 240, - height: 320, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'JioPhone 2 landscape', - userAgent: 'Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5', - viewport: { - width: 320, - height: 240, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Kindle Fire HDX', - userAgent: 'Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true', - viewport: { - width: 800, - height: 1280, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Kindle Fire HDX landscape', - userAgent: 'Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true', - viewport: { - width: 1280, - height: 800, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'LG Optimus L70', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 384, - height: 640, - deviceScaleFactor: 1.25, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'LG Optimus L70 landscape', - userAgent: 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 384, - deviceScaleFactor: 1.25, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Microsoft Lumia 550', - userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Microsoft Lumia 950', - userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 4, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Microsoft Lumia 950 landscape', - userAgent: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 4, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 10', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 800, - height: 1280, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 10 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 1280, - height: 800, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 4', - userAgent: 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 384, - height: 640, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 4 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 384, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 5', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 360, - height: 640, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 5 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 640, - height: 360, - deviceScaleFactor: 3, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 5X', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 412, - height: 732, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 5X landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 732, - height: 412, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 6', - userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 412, - height: 732, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 6 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 732, - height: 412, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 6P', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 412, - height: 732, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 6P landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 732, - height: 412, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nexus 7', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 600, - height: 960, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nexus 7 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Safari/537.36', - viewport: { - width: 960, - height: 600, - deviceScaleFactor: 2, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nokia Lumia 520', - userAgent: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)', - viewport: { - width: 320, - height: 533, - deviceScaleFactor: 1.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nokia Lumia 520 landscape', - userAgent: 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)', - viewport: { - width: 533, - height: 320, - deviceScaleFactor: 1.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Nokia N9', - userAgent: 'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13', - viewport: { - width: 480, - height: 854, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Nokia N9 landscape', - userAgent: 'Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13', - viewport: { - width: 854, - height: 480, - deviceScaleFactor: 1, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Pixel 2', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 411, - height: 731, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Pixel 2 landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 731, - height: 411, - deviceScaleFactor: 2.625, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, - { - name: 'Pixel 2 XL', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 411, - height: 823, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: false, - }, - }, - { - name: 'Pixel 2 XL landscape', - userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', - viewport: { - width: 823, - height: 411, - deviceScaleFactor: 3.5, - isMobile: true, - hasTouch: true, - isLandscape: true, - }, - }, -]; -const devicesMap = {}; -exports.devicesMap = devicesMap; -for (const device of devices) - devicesMap[device.name] = device; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts deleted file mode 100644 index 660e1d946b8..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; - -/** - * Dialog instances are dispatched by the {@link Page} via the `dialog` event. - * - * @remarks - * - * @example - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * page.on('dialog', async dialog => { - * console.log(dialog.message()); - * await dialog.dismiss(); - * await browser.close(); - * }); - * page.evaluate(() => alert('1')); - * })(); - * ``` - */ -export declare class Dialog { - private _client; - private _type; - private _message; - private _defaultValue; - private _handled; - /** - * @internal - */ - constructor(client: CDPSession, type: Protocol.Page.DialogType, message: string, defaultValue?: string); - /** - * @returns The type of the dialog. - */ - type(): Protocol.Page.DialogType; - /** - * @returns The message displayed in the dialog. - */ - message(): string; - /** - * @returns The default value of the prompt, or an empty string if the dialog - * is not a `prompt`. - */ - defaultValue(): string; - /** - * @param promptText - optional text that will be entered in the dialog - * prompt. Has no effect if the dialog's type is not `prompt`. - * - * @returns A promise that resolves when the dialog has been accepted. - */ - accept(promptText?: string): Promise; - /** - * @returns A promise which will resolve once the dialog has been dismissed - */ - dismiss(): Promise; -} -//# sourceMappingURL=Dialog.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map deleted file mode 100644 index d2fee6a7328..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/common/Dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBAED,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAC9B,OAAO,EAAE,MAAM,EACf,YAAY,SAAK;IAQnB;;OAEG;IACH,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU;IAIhC;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;OAKG;IACG,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js deleted file mode 100644 index 0013a0d1016..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Dialog = void 0; -const assert_js_1 = require("./assert.js"); -/** - * Dialog instances are dispatched by the {@link Page} via the `dialog` event. - * - * @remarks - * - * @example - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * page.on('dialog', async dialog => { - * console.log(dialog.message()); - * await dialog.dismiss(); - * await browser.close(); - * }); - * page.evaluate(() => alert('1')); - * })(); - * ``` - */ -class Dialog { - /** - * @internal - */ - constructor(client, type, message, defaultValue = '') { - this._handled = false; - this._client = client; - this._type = type; - this._message = message; - this._defaultValue = defaultValue; - } - /** - * @returns The type of the dialog. - */ - type() { - return this._type; - } - /** - * @returns The message displayed in the dialog. - */ - message() { - return this._message; - } - /** - * @returns The default value of the prompt, or an empty string if the dialog - * is not a `prompt`. - */ - defaultValue() { - return this._defaultValue; - } - /** - * @param promptText - optional text that will be entered in the dialog - * prompt. Has no effect if the dialog's type is not `prompt`. - * - * @returns A promise that resolves when the dialog has been accepted. - */ - async accept(promptText) { - assert_js_1.assert(!this._handled, 'Cannot accept dialog which is already handled!'); - this._handled = true; - await this._client.send('Page.handleJavaScriptDialog', { - accept: true, - promptText: promptText, - }); - } - /** - * @returns A promise which will resolve once the dialog has been dismissed - */ - async dismiss() { - assert_js_1.assert(!this._handled, 'Cannot dismiss dialog which is already handled!'); - this._handled = true; - await this._client.send('Page.handleJavaScriptDialog', { - accept: false, - }); - } -} -exports.Dialog = Dialog; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts deleted file mode 100644 index c9abdc158a4..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { CDPSession } from './Connection.js'; -import { Viewport } from './PuppeteerViewport.js'; -export declare class EmulationManager { - _client: CDPSession; - _emulatingMobile: boolean; - _hasTouch: boolean; - constructor(client: CDPSession); - emulateViewport(viewport: Viewport): Promise; -} -//# sourceMappingURL=EmulationManager.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map deleted file mode 100644 index 0cfbf8e6a60..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"EmulationManager.d.ts","sourceRoot":"","sources":["../../../../src/common/EmulationManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,qBAAa,gBAAgB;IAC3B,OAAO,EAAE,UAAU,CAAC;IACpB,gBAAgB,UAAS;IACzB,SAAS,UAAS;gBAEN,MAAM,EAAE,UAAU;IAIxB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CA6B5D"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js deleted file mode 100644 index c0914dbea0c..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EmulationManager = void 0; -class EmulationManager { - constructor(client) { - this._emulatingMobile = false; - this._hasTouch = false; - this._client = client; - } - async emulateViewport(viewport) { - const mobile = viewport.isMobile || false; - const width = viewport.width; - const height = viewport.height; - const deviceScaleFactor = viewport.deviceScaleFactor || 1; - const screenOrientation = viewport.isLandscape - ? { angle: 90, type: 'landscapePrimary' } - : { angle: 0, type: 'portraitPrimary' }; - const hasTouch = viewport.hasTouch || false; - await Promise.all([ - this._client.send('Emulation.setDeviceMetricsOverride', { - mobile, - width, - height, - deviceScaleFactor, - screenOrientation, - }), - this._client.send('Emulation.setTouchEmulationEnabled', { - enabled: hasTouch, - }), - ]); - const reloadNeeded = this._emulatingMobile !== mobile || this._hasTouch !== hasTouch; - this._emulatingMobile = mobile; - this._hasTouch = hasTouch; - return reloadNeeded; - } -} -exports.EmulationManager = EmulationManager; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts deleted file mode 100644 index a0b094b522a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -declare class CustomError extends Error { - constructor(message: string); -} -/** - * TimeoutError is emitted whenever certain operations are terminated due to timeout. - * - * @remarks - * - * Example operations are {@link Page.waitForSelector | page.waitForSelector} - * or {@link Puppeteer.launch | puppeteer.launch}. - * - * @public - */ -export declare class TimeoutError extends CustomError { -} -export declare type PuppeteerErrors = Record; -export declare const puppeteerErrors: PuppeteerErrors; -export {}; -//# sourceMappingURL=Errors.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map deleted file mode 100644 index 442a102c159..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../../../../src/common/Errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,EAAE,MAAM;CAK5B;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAa,SAAQ,WAAW;CAAG;AAEhD,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,WAAW,CAAC,CAAC;AAEjE,eAAO,MAAM,eAAe,EAAE,eAE7B,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js deleted file mode 100644 index 1ce3eb058e4..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -/** - * Copyright 2018 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.puppeteerErrors = exports.TimeoutError = void 0; -class CustomError extends Error { - constructor(message) { - super(message); - this.name = this.constructor.name; - Error.captureStackTrace(this, this.constructor); - } -} -/** - * TimeoutError is emitted whenever certain operations are terminated due to timeout. - * - * @remarks - * - * Example operations are {@link Page.waitForSelector | page.waitForSelector} - * or {@link Puppeteer.launch | puppeteer.launch}. - * - * @public - */ -class TimeoutError extends CustomError { -} -exports.TimeoutError = TimeoutError; -exports.puppeteerErrors = { - TimeoutError, -}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts deleted file mode 100644 index 46fbd894f6e..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { ElementHandle , JSHandle} from './JSHandle.js'; - -/** - * @public - */ -export declare type EvaluateFn = string | ((arg1: T, ...args: unknown[]) => unknown); -export declare type UnwrapPromiseLike = T extends PromiseLike ? U : T; -/** - * @public - */ -export declare type EvaluateFnReturnType = T extends (...args: unknown[]) => infer R ? R : unknown; -/** - * @public - */ -export declare type EvaluateHandleFn = string | ((...args: unknown[]) => unknown); -/** - * @public - */ -export declare type Serializable = number | string | boolean | null | BigInt | JSONArray | JSONObject; -/** - * @public - */ -export declare type JSONArray = Serializable[]; -/** - * @public - */ -export interface JSONObject { - [key: string]: Serializable; -} -/** - * @public - */ -export declare type SerializableOrJSHandle = Serializable | JSHandle; -/** - * Wraps a DOM element into an ElementHandle instance - * @public - **/ -export declare type WrapElementHandle = X extends Element ? ElementHandle : X; -/** - * Unwraps a DOM element out of an ElementHandle instance - * @public - **/ -export declare type UnwrapElementHandle = X extends ElementHandle ? E : X; -//# sourceMappingURL=EvalTypes.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map deleted file mode 100644 index cb2b74fe21d..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"EvalTypes.d.ts","sourceRoot":"","sources":["../../../../src/common/EvalTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExD;;GAEG;AACH,oBAAY,UAAU,CAAC,CAAC,GAAG,OAAO,IAC9B,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;AAE/C,oBAAY,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE1E;;GAEG;AACH,oBAAY,oBAAoB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,SAAS,CACjE,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,MAAM,CAAC,GACR,CAAC,GACD,OAAO,CAAC;AAEZ;;GAEG;AACH,oBAAY,gBAAgB,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;AAE1E;;GAEG;AACH,oBAAY,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,SAAS,GACT,UAAU,CAAC;AAEf;;GAEG;AACH,oBAAY,SAAS,GAAG,YAAY,EAAE,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B;AAED;;GAEG;AACH,oBAAY,sBAAsB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE7D;;;IAGI;AACJ,oBAAY,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAE5E;;;IAGI;AACJ,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts deleted file mode 100644 index fa24ddd3818..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { EventType, Handler } from '../../vendor/mitt/src/index.js'; -/** - * @internal - */ -export interface CommonEventEmitter { - on(event: EventType, handler: Handler): CommonEventEmitter; - off(event: EventType, handler: Handler): CommonEventEmitter; - addListener(event: EventType, handler: Handler): CommonEventEmitter; - removeListener(event: EventType, handler: Handler): CommonEventEmitter; - emit(event: EventType, eventData?: any): boolean; - once(event: EventType, handler: Handler): CommonEventEmitter; - listenerCount(event: string): number; - removeAllListeners(event?: EventType): CommonEventEmitter; -} -/** - * The EventEmitter class that many Puppeteer classes extend. - * - * @remarks - * - * This allows you to listen to events that Puppeteer classes fire and act - * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and - * {@link EventEmitter.off | off} to bind - * and unbind to event listeners. - * - * @public - */ -export declare class EventEmitter implements CommonEventEmitter { - private emitter; - private eventsMap; - /** - * @internal - */ - constructor(); - /** - * Bind an event listener to fire when an event occurs. - * @param event - the event type you'd like to listen to. Can be a string or symbol. - * @param handler - the function to be called when the event occurs. - * @returns `this` to enable you to chain calls. - */ - on(event: EventType, handler: Handler): EventEmitter; - /** - * Remove an event listener from firing. - * @param event - the event type you'd like to stop listening to. - * @param handler - the function that should be removed. - * @returns `this` to enable you to chain calls. - */ - off(event: EventType, handler: Handler): EventEmitter; - /** - * Remove an event listener. - * @deprecated please use `off` instead. - */ - removeListener(event: EventType, handler: Handler): EventEmitter; - /** - * Add an event listener. - * @deprecated please use `on` instead. - */ - addListener(event: EventType, handler: Handler): EventEmitter; - /** - * Emit an event and call any associated listeners. - * - * @param event - the event you'd like to emit - * @param eventData - any data you'd like to emit with the event - * @returns `true` if there are any listeners, `false` if there are not. - */ - emit(event: EventType, eventData?: any): boolean; - /** - * Like `on` but the listener will only be fired once and then it will be removed. - * @param event - the event you'd like to listen to - * @param handler - the handler function to run when the event occurs - * @returns `this` to enable you to chain calls. - */ - once(event: EventType, handler: Handler): EventEmitter; - /** - * Gets the number of listeners for a given event. - * - * @param event - the event to get the listener count for - * @returns the number of listeners bound to the given event - */ - listenerCount(event: EventType): number; - /** - * Removes all listeners. If given an event argument, it will remove only - * listeners for that event. - * @param event - the event to remove listeners for. - * @returns `this` to enable you to chain calls. - */ - removeAllListeners(event?: EventType): EventEmitter; - private eventListenersCount; -} -//# sourceMappingURL=EventEmitter.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map deleted file mode 100644 index fa7686c64c2..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/common/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAa,EAEX,SAAS,EACT,OAAO,EACR,MAAM,gCAAgC,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC3D,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAK5D,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACpE,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACvE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC7D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAErC,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,kBAAkB,CAAC;CAC3D;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,YAAW,kBAAkB;IACrD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,SAAS,CAAmC;IAEpD;;OAEG;;IAKH;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKpD;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKrD;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAKhE;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAK7D;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO;IAKhD;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY;IAStD;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAIvC;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY;IASnD,OAAO,CAAC,mBAAmB;CAG5B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js deleted file mode 100644 index 1e6d5345d5f..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js +++ /dev/null @@ -1,116 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EventEmitter = void 0; -const index_js_1 = __importDefault(require("../../vendor/mitt/src/index.js")); -/** - * The EventEmitter class that many Puppeteer classes extend. - * - * @remarks - * - * This allows you to listen to events that Puppeteer classes fire and act - * accordingly. Therefore you'll mostly use {@link EventEmitter.on | on} and - * {@link EventEmitter.off | off} to bind - * and unbind to event listeners. - * - * @public - */ -class EventEmitter { - /** - * @internal - */ - constructor() { - this.eventsMap = new Map(); - this.emitter = index_js_1.default(this.eventsMap); - } - /** - * Bind an event listener to fire when an event occurs. - * @param event - the event type you'd like to listen to. Can be a string or symbol. - * @param handler - the function to be called when the event occurs. - * @returns `this` to enable you to chain calls. - */ - on(event, handler) { - this.emitter.on(event, handler); - return this; - } - /** - * Remove an event listener from firing. - * @param event - the event type you'd like to stop listening to. - * @param handler - the function that should be removed. - * @returns `this` to enable you to chain calls. - */ - off(event, handler) { - this.emitter.off(event, handler); - return this; - } - /** - * Remove an event listener. - * @deprecated please use `off` instead. - */ - removeListener(event, handler) { - this.off(event, handler); - return this; - } - /** - * Add an event listener. - * @deprecated please use `on` instead. - */ - addListener(event, handler) { - this.on(event, handler); - return this; - } - /** - * Emit an event and call any associated listeners. - * - * @param event - the event you'd like to emit - * @param eventData - any data you'd like to emit with the event - * @returns `true` if there are any listeners, `false` if there are not. - */ - emit(event, eventData) { - this.emitter.emit(event, eventData); - return this.eventListenersCount(event) > 0; - } - /** - * Like `on` but the listener will only be fired once and then it will be removed. - * @param event - the event you'd like to listen to - * @param handler - the handler function to run when the event occurs - * @returns `this` to enable you to chain calls. - */ - once(event, handler) { - const onceHandler = (eventData) => { - handler(eventData); - this.off(event, onceHandler); - }; - return this.on(event, onceHandler); - } - /** - * Gets the number of listeners for a given event. - * - * @param event - the event to get the listener count for - * @returns the number of listeners bound to the given event - */ - listenerCount(event) { - return this.eventListenersCount(event); - } - /** - * Removes all listeners. If given an event argument, it will remove only - * listeners for that event. - * @param event - the event to remove listeners for. - * @returns `this` to enable you to chain calls. - */ - removeAllListeners(event) { - if (event) { - this.eventsMap.delete(event); - } - else { - this.eventsMap.clear(); - } - return this; - } - eventListenersCount(event) { - return this.eventsMap.has(event) ? this.eventsMap.get(event).length : 0; - } -} -exports.EventEmitter = EventEmitter; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts deleted file mode 100644 index d717c7464f9..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * IMPORTANT: we are mid-way through migrating away from this Events.ts file - * in favour of defining events next to the class that emits them. - * - * However we need to maintain this file for now because the legacy DocLint - * system relies on them. Be aware in the mean time if you make a change here - * you probably need to replicate it in the relevant class. For example if you - * add a new Page event, you should update the PageEmittedEvents enum in - * src/common/Page.ts. - * - * Chat to @jackfranklin if you're unsure. - */ -export declare const Events: { - readonly Page: { - readonly Close: "close"; - readonly Console: "console"; - readonly Dialog: "dialog"; - readonly DOMContentLoaded: "domcontentloaded"; - readonly Error: "error"; - readonly PageError: "pageerror"; - readonly Request: "request"; - readonly Response: "response"; - readonly RequestFailed: "requestfailed"; - readonly RequestFinished: "requestfinished"; - readonly FrameAttached: "frameattached"; - readonly FrameDetached: "framedetached"; - readonly FrameNavigated: "framenavigated"; - readonly Load: "load"; - readonly Metrics: "metrics"; - readonly Popup: "popup"; - readonly WorkerCreated: "workercreated"; - readonly WorkerDestroyed: "workerdestroyed"; - }; - readonly Browser: { - readonly TargetCreated: "targetcreated"; - readonly TargetDestroyed: "targetdestroyed"; - readonly TargetChanged: "targetchanged"; - readonly Disconnected: "disconnected"; - }; - readonly BrowserContext: { - readonly TargetCreated: "targetcreated"; - readonly TargetDestroyed: "targetdestroyed"; - readonly TargetChanged: "targetchanged"; - }; - readonly NetworkManager: { - readonly Request: symbol; - readonly Response: symbol; - readonly RequestFailed: symbol; - readonly RequestFinished: symbol; - }; - readonly FrameManager: { - readonly FrameAttached: symbol; - readonly FrameNavigated: symbol; - readonly FrameDetached: symbol; - readonly LifecycleEvent: symbol; - readonly FrameNavigatedWithinDocument: symbol; - readonly ExecutionContextCreated: symbol; - readonly ExecutionContextDestroyed: symbol; - }; - readonly Connection: { - readonly Disconnected: symbol; - }; - readonly CDPSession: { - readonly Disconnected: symbol; - }; -}; -//# sourceMappingURL=Events.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map deleted file mode 100644 index 0ef025a148a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Events.d.ts","sourceRoot":"","sources":["../../../../src/common/Events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmET,CAAC"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js deleted file mode 100644 index 106a3d5609a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -/** - * Copyright 2019 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Events = void 0; -/** - * IMPORTANT: we are mid-way through migrating away from this Events.ts file - * in favour of defining events next to the class that emits them. - * - * However we need to maintain this file for now because the legacy DocLint - * system relies on them. Be aware in the mean time if you make a change here - * you probably need to replicate it in the relevant class. For example if you - * add a new Page event, you should update the PageEmittedEvents enum in - * src/common/Page.ts. - * - * Chat to @jackfranklin if you're unsure. - */ -exports.Events = { - Page: { - Close: 'close', - Console: 'console', - Dialog: 'dialog', - DOMContentLoaded: 'domcontentloaded', - Error: 'error', - // Can't use just 'error' due to node.js special treatment of error events. - // @see https://nodejs.org/api/events.html#events_error_events - PageError: 'pageerror', - Request: 'request', - Response: 'response', - RequestFailed: 'requestfailed', - RequestFinished: 'requestfinished', - FrameAttached: 'frameattached', - FrameDetached: 'framedetached', - FrameNavigated: 'framenavigated', - Load: 'load', - Metrics: 'metrics', - Popup: 'popup', - WorkerCreated: 'workercreated', - WorkerDestroyed: 'workerdestroyed', - }, - Browser: { - TargetCreated: 'targetcreated', - TargetDestroyed: 'targetdestroyed', - TargetChanged: 'targetchanged', - Disconnected: 'disconnected', - }, - BrowserContext: { - TargetCreated: 'targetcreated', - TargetDestroyed: 'targetdestroyed', - TargetChanged: 'targetchanged', - }, - NetworkManager: { - Request: Symbol('Events.NetworkManager.Request'), - Response: Symbol('Events.NetworkManager.Response'), - RequestFailed: Symbol('Events.NetworkManager.RequestFailed'), - RequestFinished: Symbol('Events.NetworkManager.RequestFinished'), - }, - FrameManager: { - FrameAttached: Symbol('Events.FrameManager.FrameAttached'), - FrameNavigated: Symbol('Events.FrameManager.FrameNavigated'), - FrameDetached: Symbol('Events.FrameManager.FrameDetached'), - LifecycleEvent: Symbol('Events.FrameManager.LifecycleEvent'), - FrameNavigatedWithinDocument: Symbol('Events.FrameManager.FrameNavigatedWithinDocument'), - ExecutionContextCreated: Symbol('Events.FrameManager.ExecutionContextCreated'), - ExecutionContextDestroyed: Symbol('Events.FrameManager.ExecutionContextDestroyed'), - }, - Connection: { - Disconnected: Symbol('Events.Connection.Disconnected'), - }, - CDPSession: { - Disconnected: Symbol('Events.CDPSession.Disconnected'), - }, -}; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts deleted file mode 100644 index fa4e0be9562..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; -import { DOMWorld } from './DOMWorld.js'; -import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js'; -import { Frame } from './FrameManager.js'; -import { ElementHandle , JSHandle} from './JSHandle.js'; - -export declare const EVALUATION_SCRIPT_URL = "__puppeteer_evaluation_script__"; -/** - * This class represents a context for JavaScript execution. A [Page] might have - * many execution contexts: - * - each - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe | - * frame } has "default" execution context that is always created after frame is - * attached to DOM. This context is returned by the - * {@link frame.executionContext()} method. - * - {@link https://developer.chrome.com/extensions | Extension}'s content scripts - * create additional execution contexts. - * - * Besides pages, execution contexts can be found in - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | - * workers }. - * - * @public - */ -export declare class ExecutionContext { - /** - * @internal - */ - _client: CDPSession; - /** - * @internal - */ - _world: DOMWorld; - private _contextId; - /** - * @internal - */ - constructor(client: CDPSession, contextPayload: Protocol.Runtime.ExecutionContextDescription, world: DOMWorld); - /** - * @remarks - * - * Not every execution context is associated with a frame. For - * example, workers and extensions have execution contexts that are not - * associated with frames. - * - * @returns The frame associated with this execution context. - */ - frame(): Frame | null; - /** - * @remarks - * If the function passed to the `executionContext.evaluate` returns a - * Promise, then `executionContext.evaluate` would wait for the promise to - * resolve and return its value. If the function passed to the - * `executionContext.evaluate` returns a non-serializable value, then - * `executionContext.evaluate` resolves to `undefined`. DevTools Protocol also - * supports transferring some additional values that are not serializable by - * `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals. - * - * - * @example - * ```js - * const executionContext = await page.mainFrame().executionContext(); - * const result = await executionContext.evaluate(() => Promise.resolve(8 * 7))* ; - * console.log(result); // prints "56" - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * console.log(await executionContext.evaluate('1 + 2')); // prints "3" - * ``` - * - * @example - * {@link JSHandle} instances can be passed as arguments to the - * `executionContext.* evaluate`: - * ```js - * const oneHandle = await executionContext.evaluateHandle(() => 1); - * const twoHandle = await executionContext.evaluateHandle(() => 2); - * const result = await executionContext.evaluate( - * (a, b) => a + b, oneHandle, * twoHandle - * ); - * await oneHandle.dispose(); - * await twoHandle.dispose(); - * console.log(result); // prints '3'. - * ``` - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function. - */ - evaluate(pageFunction: Function | string, ...args: unknown[]): Promise; - /** - * @remarks - * The only difference between `executionContext.evaluate` and - * `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` - * returns an in-page object (a {@link JSHandle}). - * If the function passed to the `executionContext.evaluateHandle` returns a - * Promise, then `executionContext.evaluateHandle` would wait for the - * promise to resolve and return its value. - * - * @example - * ```js - * const context = await page.mainFrame().executionContext(); - * const aHandle = await context.evaluateHandle(() => Promise.resolve(self)); - * aHandle; // Handle for the global object. - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * // Handle for the '3' * object. - * const aHandle = await context.evaluateHandle('1 + 2'); - * ``` - * - * @example - * JSHandle instances can be passed as arguments - * to the `executionContext.* evaluateHandle`: - * - * ```js - * const aHandle = await context.evaluateHandle(() => document.body); - * const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle); - * console.log(await resultHandle.jsonValue()); // prints body's innerHTML - * await aHandle.dispose(); - * await resultHandle.dispose(); - * ``` - * - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function - * as an in-page object (a {@link JSHandle}). - */ - evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; - private _evaluateInternal; - /** - * This method iterates the JavaScript heap and finds all the objects with the - * given prototype. - * @remarks - * @example - * ```js - * // Create a Map object - * await page.evaluate(() => window.map = new Map()); - * // Get a handle to the Map object prototype - * const mapPrototype = await page.evaluateHandle(() => Map.prototype); - * // Query all map instances into an array - * const mapInstances = await page.queryObjects(mapPrototype); - * // Count amount of map objects in heap - * const count = await page.evaluate(maps => maps.length, mapInstances); - * await mapInstances.dispose(); - * await mapPrototype.dispose(); - * ``` - * - * @param prototypeHandle a handle to the object prototype - * - * @returns A handle to an array of objects with the given prototype. - */ - queryObjects(prototypeHandle: JSHandle): Promise; - /** - * @internal - */ - _adoptBackendNodeId(backendNodeId: Protocol.DOM.BackendNodeId): Promise; - /** - * @internal - */ - _adoptElementHandle(elementHandle: ElementHandle): Promise; -} -//# sourceMappingURL=ExecutionContext.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map deleted file mode 100644 index e53af2b64ec..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ExecutionContext.d.ts","sourceRoot":"","sources":["../../../../src/common/ExecutionContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAkB,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AAGvE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,OAAO,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,UAAU,CAAS;IAE3B;;OAEG;gBAED,MAAM,EAAE,UAAU,EAClB,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,2BAA2B,EAC5D,KAAK,EAAE,QAAQ;IAOjB;;;;;;;;OAQG;IACH,KAAK,IAAI,KAAK,GAAG,IAAI;IAIrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACG,QAAQ,CAAC,UAAU,SAAS,GAAG,EACnC,YAAY,EAAE,QAAQ,GAAG,MAAM,EAC/B,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,OAAO,CAAC,UAAU,CAAC;IAQtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACG,cAAc,CAAC,UAAU,SAAS,QAAQ,GAAG,aAAa,GAAG,QAAQ,EACzE,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAChC,OAAO,CAAC,UAAU,CAAC;YAIR,iBAAiB;IAuI/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,YAAY,CAAC,eAAe,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAYhE;;OAEG;IACG,mBAAmB,CACvB,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,GACxC,OAAO,CAAC,aAAa,CAAC;IAQzB;;OAEG;IACG,mBAAmB,CACvB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,aAAa,CAAC;CAW1B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js deleted file mode 100644 index d8195474667..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js +++ /dev/null @@ -1,317 +0,0 @@ -"use strict"; -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ExecutionContext = exports.EVALUATION_SCRIPT_URL = void 0; -const assert_js_1 = require("./assert.js"); -const helper_js_1 = require("./helper.js"); -const JSHandle_js_1 = require("./JSHandle.js"); -exports.EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__'; -const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m; -/** - * This class represents a context for JavaScript execution. A [Page] might have - * many execution contexts: - * - each - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe | - * frame } has "default" execution context that is always created after frame is - * attached to DOM. This context is returned by the - * {@link frame.executionContext()} method. - * - {@link https://developer.chrome.com/extensions | Extension}'s content scripts - * create additional execution contexts. - * - * Besides pages, execution contexts can be found in - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | - * workers }. - * - * @public - */ -class ExecutionContext { - /** - * @internal - */ - constructor(client, contextPayload, world) { - this._client = client; - this._world = world; - this._contextId = contextPayload.id; - } - /** - * @remarks - * - * Not every execution context is associated with a frame. For - * example, workers and extensions have execution contexts that are not - * associated with frames. - * - * @returns The frame associated with this execution context. - */ - frame() { - return this._world ? this._world.frame() : null; - } - /** - * @remarks - * If the function passed to the `executionContext.evaluate` returns a - * Promise, then `executionContext.evaluate` would wait for the promise to - * resolve and return its value. If the function passed to the - * `executionContext.evaluate` returns a non-serializable value, then - * `executionContext.evaluate` resolves to `undefined`. DevTools Protocol also - * supports transferring some additional values that are not serializable by - * `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals. - * - * - * @example - * ```js - * const executionContext = await page.mainFrame().executionContext(); - * const result = await executionContext.evaluate(() => Promise.resolve(8 * 7))* ; - * console.log(result); // prints "56" - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * console.log(await executionContext.evaluate('1 + 2')); // prints "3" - * ``` - * - * @example - * {@link JSHandle} instances can be passed as arguments to the - * `executionContext.* evaluate`: - * ```js - * const oneHandle = await executionContext.evaluateHandle(() => 1); - * const twoHandle = await executionContext.evaluateHandle(() => 2); - * const result = await executionContext.evaluate( - * (a, b) => a + b, oneHandle, * twoHandle - * ); - * await oneHandle.dispose(); - * await twoHandle.dispose(); - * console.log(result); // prints '3'. - * ``` - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function. - */ - async evaluate(pageFunction, ...args) { - return await this._evaluateInternal(true, pageFunction, ...args); - } - /** - * @remarks - * The only difference between `executionContext.evaluate` and - * `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` - * returns an in-page object (a {@link JSHandle}). - * If the function passed to the `executionContext.evaluateHandle` returns a - * Promise, then `executionContext.evaluateHandle` would wait for the - * promise to resolve and return its value. - * - * @example - * ```js - * const context = await page.mainFrame().executionContext(); - * const aHandle = await context.evaluateHandle(() => Promise.resolve(self)); - * aHandle; // Handle for the global object. - * ``` - * - * @example - * A string can also be passed in instead of a function. - * - * ```js - * // Handle for the '3' * object. - * const aHandle = await context.evaluateHandle('1 + 2'); - * ``` - * - * @example - * JSHandle instances can be passed as arguments - * to the `executionContext.* evaluateHandle`: - * - * ```js - * const aHandle = await context.evaluateHandle(() => document.body); - * const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle); - * console.log(await resultHandle.jsonValue()); // prints body's innerHTML - * await aHandle.dispose(); - * await resultHandle.dispose(); - * ``` - * - * @param pageFunction a function to be evaluated in the `executionContext` - * @param args argument to pass to the page function - * - * @returns A promise that resolves to the return value of the given function - * as an in-page object (a {@link JSHandle}). - */ - async evaluateHandle(pageFunction, ...args) { - return this._evaluateInternal(false, pageFunction, ...args); - } - async _evaluateInternal(returnByValue, pageFunction, ...args) { - const suffix = `//# sourceURL=${exports.EVALUATION_SCRIPT_URL}`; - if (helper_js_1.helper.isString(pageFunction)) { - const contextId = this._contextId; - const expression = pageFunction; - const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) - ? expression - : expression + '\n' + suffix; - const { exceptionDetails, result: remoteObject } = await this._client - .send('Runtime.evaluate', { - expression: expressionWithSourceUrl, - contextId, - returnByValue, - awaitPromise: true, - userGesture: true, - }) - .catch(rewriteError); - if (exceptionDetails) - throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); - return returnByValue - ? helper_js_1.helper.valueFromRemoteObject(remoteObject) - : JSHandle_js_1.createJSHandle(this, remoteObject); - } - if (typeof pageFunction !== 'function') - throw new Error(`Expected to get |string| or |function| as the first argument, but got "${pageFunction}" instead.`); - let functionText = pageFunction.toString(); - try { - new Function('(' + functionText + ')'); - } - catch (error) { - // This means we might have a function shorthand. Try another - // time prefixing 'function '. - if (functionText.startsWith('async ')) - functionText = - 'async function ' + functionText.substring('async '.length); - else - functionText = 'function ' + functionText; - try { - new Function('(' + functionText + ')'); - } - catch (error) { - // We tried hard to serialize, but there's a weird beast here. - throw new Error('Passed function is not well-serializable!'); - } - } - let callFunctionOnPromise; - try { - callFunctionOnPromise = this._client.send('Runtime.callFunctionOn', { - functionDeclaration: functionText + '\n' + suffix + '\n', - executionContextId: this._contextId, - arguments: args.map(convertArgument.bind(this)), - returnByValue, - awaitPromise: true, - userGesture: true, - }); - } - catch (error) { - if (error instanceof TypeError && - error.message.startsWith('Converting circular structure to JSON')) - error.message += ' Are you passing a nested JSHandle?'; - throw error; - } - const { exceptionDetails, result: remoteObject, } = await callFunctionOnPromise.catch(rewriteError); - if (exceptionDetails) - throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); - return returnByValue - ? helper_js_1.helper.valueFromRemoteObject(remoteObject) - : JSHandle_js_1.createJSHandle(this, remoteObject); - /** - * @param {*} arg - * @returns {*} - * @this {ExecutionContext} - */ - function convertArgument(arg) { - if (typeof arg === 'bigint') - // eslint-disable-line valid-typeof - return { unserializableValue: `${arg.toString()}n` }; - if (Object.is(arg, -0)) - return { unserializableValue: '-0' }; - if (Object.is(arg, Infinity)) - return { unserializableValue: 'Infinity' }; - if (Object.is(arg, -Infinity)) - return { unserializableValue: '-Infinity' }; - if (Object.is(arg, NaN)) - return { unserializableValue: 'NaN' }; - const objectHandle = arg && arg instanceof JSHandle_js_1.JSHandle ? arg : null; - if (objectHandle) { - if (objectHandle._context !== this) - throw new Error('JSHandles can be evaluated only in the context they were created!'); - if (objectHandle._disposed) - throw new Error('JSHandle is disposed!'); - if (objectHandle._remoteObject.unserializableValue) - return { - unserializableValue: objectHandle._remoteObject.unserializableValue, - }; - if (!objectHandle._remoteObject.objectId) - return { value: objectHandle._remoteObject.value }; - return { objectId: objectHandle._remoteObject.objectId }; - } - return { value: arg }; - } - function rewriteError(error) { - if (error.message.includes('Object reference chain is too long')) - return { result: { type: 'undefined' } }; - if (error.message.includes("Object couldn't be returned by value")) - return { result: { type: 'undefined' } }; - if (error.message.endsWith('Cannot find context with specified id') || - error.message.endsWith('Inspected target navigated or closed')) - throw new Error('Execution context was destroyed, most likely because of a navigation.'); - throw error; - } - } - /** - * This method iterates the JavaScript heap and finds all the objects with the - * given prototype. - * @remarks - * @example - * ```js - * // Create a Map object - * await page.evaluate(() => window.map = new Map()); - * // Get a handle to the Map object prototype - * const mapPrototype = await page.evaluateHandle(() => Map.prototype); - * // Query all map instances into an array - * const mapInstances = await page.queryObjects(mapPrototype); - * // Count amount of map objects in heap - * const count = await page.evaluate(maps => maps.length, mapInstances); - * await mapInstances.dispose(); - * await mapPrototype.dispose(); - * ``` - * - * @param prototypeHandle a handle to the object prototype - * - * @returns A handle to an array of objects with the given prototype. - */ - async queryObjects(prototypeHandle) { - assert_js_1.assert(!prototypeHandle._disposed, 'Prototype JSHandle is disposed!'); - assert_js_1.assert(prototypeHandle._remoteObject.objectId, 'Prototype JSHandle must not be referencing primitive value'); - const response = await this._client.send('Runtime.queryObjects', { - prototypeObjectId: prototypeHandle._remoteObject.objectId, - }); - return JSHandle_js_1.createJSHandle(this, response.objects); - } - /** - * @internal - */ - async _adoptBackendNodeId(backendNodeId) { - const { object } = await this._client.send('DOM.resolveNode', { - backendNodeId: backendNodeId, - executionContextId: this._contextId, - }); - return JSHandle_js_1.createJSHandle(this, object); - } - /** - * @internal - */ - async _adoptElementHandle(elementHandle) { - assert_js_1.assert(elementHandle.executionContext() !== this, 'Cannot adopt handle that already belongs to this execution context'); - assert_js_1.assert(this._world, 'Cannot adopt handle without DOMWorld'); - const nodeInfo = await this._client.send('DOM.describeNode', { - objectId: elementHandle._remoteObject.objectId, - }); - return this._adoptBackendNodeId(nodeInfo.node.backendNodeId); - } -} -exports.ExecutionContext = ExecutionContext; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts deleted file mode 100644 index 1f9fd3b13d8..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { ElementHandle } from './JSHandle.js'; - -/** - * File choosers let you react to the page requesting for a file. - * @remarks - * `FileChooser` objects are returned via the `page.waitForFileChooser` method. - * @example - * An example of using `FileChooser`: - * ```js - * const [fileChooser] = await Promise.all([ - * page.waitForFileChooser(), - * page.click('#upload-file-button'), // some button that triggers file selection - * ]); - * await fileChooser.accept(['/tmp/myfile.pdf']); - * ``` - * **NOTE** In browsers, only one file chooser can be opened at a time. - * All file choosers must be accepted or canceled. Not doing so will prevent - * subsequent file choosers from appearing. - */ -export declare class FileChooser { - private _element; - private _multiple; - private _handled; - /** - * @internal - */ - constructor(element: ElementHandle, event: Protocol.Page.FileChooserOpenedEvent); - /** - * Whether file chooser allow for {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} file selection. - */ - isMultiple(): boolean; - /** - * Accept the file chooser request with given paths. - * @param filePaths - If some of the `filePaths` are relative paths, - * then they are resolved relative to the {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. - */ - accept(filePaths: string[]): Promise; - /** - * Closes the file chooser without selecting any files. - */ - cancel(): Promise; -} -//# sourceMappingURL=FileChooser.d.ts.map \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map deleted file mode 100644 index 3305117b8d2..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"FileChooser.d.ts","sourceRoot":"","sources":["../../../../src/common/FileChooser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;gBAED,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,sBAAsB;IAM7C;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;OAIG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAO9B"} \ No newline at end of file diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js deleted file mode 100644 index 50b913f09c0..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -/** - * Copyright 2020 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FileChooser = void 0; -const assert_js_1 = require("./assert.js"); -/** - * File choosers let you react to the page requesting for a file. - * @remarks - * `FileChooser` objects are returned via the `page.waitForFileChooser` method. - * @example - * An example of using `FileChooser`: - * ```js - * const [fileChooser] = await Promise.all([ - * page.waitForFileChooser(), - * page.click('#upload-file-button'), // some button that triggers file selection - * ]); - * await fileChooser.accept(['/tmp/myfile.pdf']); - * ``` - * **NOTE** In browsers, only one file chooser can be opened at a time. - * All file choosers must be accepted or canceled. Not doing so will prevent - * subsequent file choosers from appearing. - */ -class FileChooser { - /** - * @internal - */ - constructor(element, event) { - this._handled = false; - this._element = element; - this._multiple = event.mode !== 'selectSingle'; - } - /** - * Whether file chooser allow for {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple} file selection. - */ - isMultiple() { - return this._multiple; - } - /** - * Accept the file chooser request with given paths. - * @param filePaths - If some of the `filePaths` are relative paths, - * then they are resolved relative to the {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}. - */ - async accept(filePaths) { - assert_js_1.assert(!this._handled, 'Cannot accept FileChooser which is already handled!'); - this._handled = true; - await this._element.uploadFile(...filePaths); - } - /** - * Closes the file chooser without selecting any files. - */ - async cancel() { - assert_js_1.assert(!this._handled, 'Cannot cancel FileChooser which is already handled!'); - this._handled = true; - } -} -exports.FileChooser = FileChooser; diff --git a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts b/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts deleted file mode 100644 index c108ae26d0a..00000000000 --- a/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Protocol } from 'devtools-protocol'; - -import { CDPSession } from './Connection.js'; -import { DOMWorld, WaitForSelectorOptions } from './DOMWorld.js'; -import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike , WrapElementHandle} from './EvalTypes.js'; -import { EventEmitter } from './EventEmitter.js'; -import { ExecutionContext } from './ExecutionContext.js'; -import { HTTPResponse } from './HTTPResponse.js'; -import { MouseButton } from './Input.js'; -import { ElementHandle , JSHandle} from './JSHandle.js'; -import { PuppeteerLifeCycleEvent } from './LifecycleWatcher.js'; -import { NetworkManager } from './NetworkManager.js'; -import { Page } from './Page.js'; -import { TimeoutSettings } from './TimeoutSettings.js'; - -/** - * We use symbols to prevent external parties listening to these events. - * They are internal to Puppeteer. - * - * @internal - */ -export declare const FrameManagerEmittedEvents: { - FrameAttached: symbol; - FrameNavigated: symbol; - FrameDetached: symbol; - LifecycleEvent: symbol; - FrameNavigatedWithinDocument: symbol; - ExecutionContextCreated: symbol; - ExecutionContextDestroyed: symbol; -}; -/** - * @internal - */ -export declare class FrameManager extends EventEmitter { - _client: CDPSession; - private _page; - private _networkManager; - _timeoutSettings: TimeoutSettings; - private _frames; - private _contextIdToContext; - private _isolatedWorlds; - private _mainFrame; - constructor(client: CDPSession, page: Page, ignoreHTTPSErrors: boolean, timeoutSettings: TimeoutSettings); - initialize(): Promise; - networkManager(): NetworkManager; - navigateFrame(frame: Frame, url: string, options?: { - referer?: string; - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - waitForFrameNavigation(frame: Frame, options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - _onLifecycleEvent(event: Protocol.Page.LifecycleEventEvent): void; - _onFrameStoppedLoading(frameId: string): void; - _handleFrameTree(frameTree: Protocol.Page.FrameTree): void; - page(): Page; - mainFrame(): Frame; - frames(): Frame[]; - frame(frameId: string): Frame | null; - _onFrameAttached(frameId: string, parentFrameId?: string): void; - _onFrameNavigated(framePayload: Protocol.Page.Frame): void; - _ensureIsolatedWorld(name: string): Promise; - _onFrameNavigatedWithinDocument(frameId: string, url: string): void; - _onFrameDetached(frameId: string): void; - _onExecutionContextCreated(contextPayload: Protocol.Runtime.ExecutionContextDescription): void; - private _onExecutionContextDestroyed; - private _onExecutionContextsCleared; - executionContextById(contextId: number): ExecutionContext; - private _removeFramesRecursively; -} -/** - * @public - */ -export interface FrameWaitForFunctionOptions { - /** - * An interval at which the `pageFunction` is executed, defaults to `raf`. If - * `polling` is a number, then it is treated as an interval in milliseconds at - * which the function would be executed. If `polling` is a string, then it can - * be one of the following values: - * - * - `raf` - to constantly execute `pageFunction` in `requestAnimationFrame` - * callback. This is the tightest polling mode which is suitable to observe - * styling changes. - * - * - `mutation` - to execute `pageFunction` on every DOM mutation. - */ - polling?: string | number; - /** - * Maximum time to wait in milliseconds. Defaults to `30000` (30 seconds). - * Pass `0` to disable the timeout. Puppeteer's default timeout can be changed - * using {@link Page.setDefaultTimeout}. - */ - timeout?: number; -} -/** - * @public - */ -export interface FrameAddScriptTagOptions { - /** - * the URL of the script to be added. - */ - url?: string; - /** - * The path to a JavaScript file to be injected into the frame. - * @remarks - * If `path` is a relative path, it is resolved relative to the current - * working directory (`process.cwd()` in Node.js). - */ - path?: string; - /** - * Raw JavaScript content to be injected into the frame. - */ - content?: string; - /** - * Set the script's `type`. Use `module` in order to load an ES2015 module. - */ - type?: string; -} -/** - * @public - */ -export interface FrameAddStyleTagOptions { - /** - * the URL of the CSS file to be added. - */ - url?: string; - /** - * The path to a CSS file to be injected into the frame. - * @remarks - * If `path` is a relative path, it is resolved relative to the current - * working directory (`process.cwd()` in Node.js). - */ - path?: string; - /** - * Raw CSS content to be injected into the frame. - */ - content?: string; -} -/** - * At every point of time, page exposes its current frame tree via the - * {@link Page.mainFrame | page.mainFrame} and - * {@link Frame.childFrames | frame.childFrames} methods. - * - * @remarks - * - * `Frame` object lifecycles are controlled by three events that are all - * dispatched on the page object: - * - * - {@link PageEmittedEvents.FrameAttached} - * - * - {@link PageEmittedEvents.FrameNavigated} - * - * - {@link PageEmittedEvents.FrameDetached} - * - * @Example - * An example of dumping frame tree: - * - * ```js - * const puppeteer = require('puppeteer'); - * - * (async () => { - * const browser = await puppeteer.launch(); - * const page = await browser.newPage(); - * await page.goto('https://www.google.com/chrome/browser/canary.html'); - * dumpFrameTree(page.mainFrame(), ''); - * await browser.close(); - * - * function dumpFrameTree(frame, indent) { - * console.log(indent + frame.url()); - * for (const child of frame.childFrames()) { - * dumpFrameTree(child, indent + ' '); - * } - * } - * })(); - * ``` - * - * @Example - * An example of getting text from an iframe element: - * - * ```js - * const frame = page.frames().find(frame => frame.name() === 'myframe'); - * const text = await frame.$eval('.selector', element => element.textContent); - * console.log(text); - * ``` - * - * @public - */ -export declare class Frame { - /** - * @internal - */ - _frameManager: FrameManager; - private _parentFrame?; - /** - * @internal - */ - _id: string; - private _url; - private _detached; - /** - * @internal - */ - _loaderId: string; - /** - * @internal - */ - _name?: string; - /** - * @internal - */ - _lifecycleEvents: Set; - /** - * @internal - */ - _mainWorld: DOMWorld; - /** - * @internal - */ - _secondaryWorld: DOMWorld; - /** - * @internal - */ - _childFrames: Set; - /** - * @internal - */ - constructor(frameManager: FrameManager, parentFrame: Frame | null, frameId: string); - /** - * @remarks - * - * `frame.goto` will throw an error if: - * - there's an SSL error (e.g. in case of self-signed certificates). - * - * - target URL is invalid. - * - * - the `timeout` is exceeded during navigation. - * - * - the remote server does not respond or is unreachable. - * - * - the main resource failed to load. - * - * `frame.goto` will not throw an error when any valid HTTP status code is - * returned by the remote server, including 404 "Not Found" and 500 "Internal - * Server Error". The status code for such responses can be retrieved by - * calling {@link HTTPResponse.status}. - * - * NOTE: `frame.goto` either throws an error or returns a main resource - * response. The only exceptions are navigation to `about:blank` or - * navigation to the same URL with a different hash, which would succeed and - * return `null`. - * - * NOTE: Headless mode doesn't support navigation to a PDF document. See - * the {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295 | upstream - * issue}. - * - * @param url - the URL to navigate the frame to. This should include the - * scheme, e.g. `https://`. - * @param options - navigation options. `waitUntil` is useful to define when - * the navigation should be considered successful - see the docs for - * {@link PuppeteerLifeCycleEvent} for more details. - * - * @returns A promise which resolves to the main resource response. In case of - * multiple redirects, the navigation will resolve with the response of the - * last redirect. - */ - goto(url: string, options?: { - referer?: string; - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * @remarks - * - * This resolves when the frame navigates to a new URL. It is useful for when - * you run code which will indirectly cause the frame to navigate. Consider - * this example: - * - * ```js - * const [response] = await Promise.all([ - * // The navigation promise resolves after navigation has finished - * frame.waitForNavigation(), - * // Clicking the link will indirectly cause a navigation - * frame.click('a.my-link'), - * ]); - * ``` - * - * Usage of the {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API} to change the URL is considered a navigation. - * - * @param options - options to configure when the navigation is consided finished. - * @returns a promise that resolves when the frame navigates to a new URL. - */ - waitForNavigation(options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * @returns a promise that resolves to the frame's default execution context. - */ - executionContext(): Promise; - /** - * @remarks - * - * The only difference between {@link Frame.evaluate} and - * `frame.evaluateHandle` is that `evaluateHandle` will return the value - * wrapped in an in-page object. - * - * This method behaves identically to {@link Page.evaluateHandle} except it's - * run within the context of the `frame`, rather than the entire page. - * - * @param pageFunction - a function that is run within the frame - * @param args - arguments to be passed to the pageFunction - */ - evaluateHandle(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise; - /** - * @remarks - * - * This method behaves identically to {@link Page.evaluate} except it's run - * within the context of the `frame`, rather than the entire page. - * - * @param pageFunction - a function that is run within the frame - * @param args - arguments to be passed to the pageFunction - */ - evaluate(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise>>; - /** - * This method queries the frame for the given selector. - * - * @param selector - a selector to query for. - * @returns A promise which resolves to an `ElementHandle` pointing at the - * element, or `null` if it was not found. - */ - $(selector: string): Promise; - /** - * This method evaluates the given XPath expression and returns the results. - * - * @param expression - the XPath expression to evaluate. - */ - $x(expression: string): Promise; - /** - * @remarks - * - * This method runs `document.querySelector` within - * the frame and passes it as the first argument to `pageFunction`. - * - * If `pageFunction` returns a Promise, then `frame.$eval` would wait for - * the promise to resolve and return its value. - * - * @example - * - * ```js - * const searchValue = await frame.$eval('#search', el => el.value); - * ``` - * - * @param selector - the selector to query for - * @param pageFunction - the function to be evaluated in the frame's context - * @param args - additional arguments to pass to `pageFuncton` - */ - $eval(selector: string, pageFunction: (element: Element, ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - /** - * @remarks - * - * This method runs `Array.from(document.querySelectorAll(selector))` within - * the frame and passes it as the first argument to `pageFunction`. - * - * If `pageFunction` returns a Promise, then `frame.$$eval` would wait for - * the promise to resolve and return its value. - * - * @example - * - * ```js - * const divsCounts = await frame.$$eval('div', divs => divs.length); - * ``` - * - * @param selector - the selector to query for - * @param pageFunction - the function to be evaluated in the frame's context - * @param args - additional arguments to pass to `pageFuncton` - */ - $$eval(selector: string, pageFunction: (elements: Element[], ...args: unknown[]) => ReturnType | Promise, ...args: SerializableOrJSHandle[]): Promise>; - /** - * This runs `document.querySelectorAll` in the frame and returns the result. - * - * @param selector - a selector to search for - * @returns An array of element handles pointing to the found frame elements. - */ - $$(selector: string): Promise; - /** - * @returns the full HTML contents of the frame, including the doctype. - */ - content(): Promise; - /** - * Set the content of the frame. - * - * @param html - HTML markup to assign to the page. - * @param options - options to configure how long before timing out and at - * what point to consider the content setting successful. - */ - setContent(html: string, options?: { - timeout?: number; - waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; - }): Promise; - /** - * @remarks - * - * If the name is empty, it returns the `id` attribute instead. - * - * Note: This value is calculated once when the frame is created, and will not - * update if the attribute is changed later. - * - * @returns the frame's `name` attribute as specified in the tag. - */ - name(): string; - /** - * @returns the frame's URL. - */ - url(): string; - /** - * @returns the parent `Frame`, if any. Detached and main frames return `null`. - */ - parentFrame(): Frame | null; - /** - * @returns an array of child frames. - */ - childFrames(): Frame[]; - /** - * @returns `true` if the frame has been detached, or `false` otherwise. - */ - isDetached(): boolean; - /** - * Adds a ` diff --git a/test/e2e/resources/application/service-worker.js b/test/e2e/resources/application/service-worker.js new file mode 100644 index 00000000000..1ee35a4b8f3 --- /dev/null +++ b/test/e2e/resources/application/service-worker.js @@ -0,0 +1,26 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// @ts-nocheck +const CACHE_NAME = 'cache-v1'; + +const urlsToCache = [ + '/test/e2e/resources/application/main.css', +]; + + +self.addEventListener('install', (event) => { + event.waitUntil(caches.open(CACHE_NAME).then(function(cache) { + return cache.addAll(urlsToCache); + })); +}); + +self.addEventListener('fetch', (event) => { + event.respondWith(caches.match(event.request).then(function(response) { + if (response) { + return response; + } + return fetch(event.request); + })); +}); From df2d5dbd06327ee042416b7f7c5f0aa67b28071d Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Fri, 30 Oct 2020 20:14:12 -0700 Subject: [PATCH 81/85] Update DevTools DEPS. Rolling build: https://chromium.googlesource.com/chromium/src/build/+log/5cdd7aa..079c81c Rolling third_party/depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools/+log/75ae629..9396c2b TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: I8e4fedfdb6bcb3358e4ea177be2fc5b352e22815 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512584 Reviewed-by: Devtools Autoroller Commit-Queue: Devtools Autoroller --- DEPS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dcdcdf0815e..b25588d90d7 100644 --- a/DEPS +++ b/DEPS @@ -6,13 +6,13 @@ use_relative_paths = True vars = { 'build_url': 'https://chromium.googlesource.com/chromium/src/build.git', - 'build_revision': '5cdd7aaa2284dff78df668505aa5e1f889f0fcf9', + 'build_revision': '079c81c472fc409441b091e8834aee34aa47aec6', 'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git', 'buildtools_revision': '98881a1297863de584fad20fb671e8c44ad1a7d0', 'depot_tools_url': 'https://chromium.googlesource.com/chromium/tools/depot_tools.git', - 'depot_tools_revision': '75ae629604112e6fe1169beccf7f76a687ca240f', + 'depot_tools_revision': '9396c2b0646a73f3cbe53b06424c53bddb8064d3', 'inspector_protocol_url': 'https://chromium.googlesource.com/deps/inspector_protocol', 'inspector_protocol_revision': '351a2b717e7cd0e59c3d81505c1a803673667dac', From af569c7b8893a54e104cae6b9701b106b57e719c Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Fri, 30 Oct 2020 23:07:40 -0700 Subject: [PATCH 82/85] Update DevTools Chromium DEPS. TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: I9b841843f47f8e03095142ff860d008a570c5486 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512585 Reviewed-by: Devtools Autoroller Commit-Queue: Devtools Autoroller --- DEPS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index b25588d90d7..d44ad810eb6 100644 --- a/DEPS +++ b/DEPS @@ -27,11 +27,11 @@ vars = { # Chromium build number for unit tests. It should be regularly updated to # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE - 'chromium_linux': '822535', + 'chromium_linux': '822942', # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE - 'chromium_win': '822527', + 'chromium_win': '822942', # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE - 'chromium_mac': '822526', + 'chromium_mac': '822938', } # Only these hosts are allowed for dependencies in this DEPS file. From 0ce179eb2f69dbc98cfec693643694ca48c23bec Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Sat, 31 Oct 2020 20:09:37 -0700 Subject: [PATCH 83/85] Update DevTools DEPS. Rolling build: https://chromium.googlesource.com/chromium/src/build/+log/079c81c..0dfb09a TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: If246b68ae99c652594b27f788ce4bd9809f66d35 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512587 Reviewed-by: Devtools Autoroller Commit-Queue: Devtools Autoroller --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index d44ad810eb6..d51455d53d2 100644 --- a/DEPS +++ b/DEPS @@ -6,7 +6,7 @@ use_relative_paths = True vars = { 'build_url': 'https://chromium.googlesource.com/chromium/src/build.git', - 'build_revision': '079c81c472fc409441b091e8834aee34aa47aec6', + 'build_revision': '0dfb09a43ba9545a60f1b466b87fb56e64279277', 'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git', 'buildtools_revision': '98881a1297863de584fad20fb671e8c44ad1a7d0', From 4d3c8cec996a90742b99ad871461df1f5b8d6327 Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Sat, 31 Oct 2020 23:09:49 -0700 Subject: [PATCH 84/85] Update DevTools Chromium DEPS. TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: I185f582c9ac1db3d73268073018f8ba754a2f812 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512588 Reviewed-by: Devtools Autoroller Commit-Queue: Devtools Autoroller --- DEPS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index d51455d53d2..3b549384c48 100644 --- a/DEPS +++ b/DEPS @@ -27,11 +27,11 @@ vars = { # Chromium build number for unit tests. It should be regularly updated to # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE - 'chromium_linux': '822942', + 'chromium_linux': '823001', # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE - 'chromium_win': '822942', + 'chromium_win': '822999', # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE - 'chromium_mac': '822938', + 'chromium_mac': '822999', } # Only these hosts are allowed for dependencies in this DEPS file. From 7c2505565a259d8af4994a0076348a9435524cf2 Mon Sep 17 00:00:00 2001 From: devtools-ci-autoroll-builder Date: Sun, 1 Nov 2020 04:04:13 -0800 Subject: [PATCH 85/85] Update DevTools DEPS. Rolling build: https://chromium.googlesource.com/chromium/src/build/+log/0dfb09a..e3b5e06 TBR=machenbach@chromium.org,liviurau@chromium.org Change-Id: I723f15384908fc0d88f657306ec721c8a03a109b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2512589 Reviewed-by: Devtools Autoroller Commit-Queue: Devtools Autoroller --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 3b549384c48..bfa934cb0ca 100644 --- a/DEPS +++ b/DEPS @@ -6,7 +6,7 @@ use_relative_paths = True vars = { 'build_url': 'https://chromium.googlesource.com/chromium/src/build.git', - 'build_revision': '0dfb09a43ba9545a60f1b466b87fb56e64279277', + 'build_revision': 'e3b5e06bae36be022a637de9ee5589cd87f4a094', 'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git', 'buildtools_revision': '98881a1297863de584fad20fb671e8c44ad1a7d0',