chore: rename the world (3)
This commit is contained in:
parent
b20e87d9d0
commit
c7d205d416
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import * as chromium from './chromium/api';
|
||||
import * as firefox from './firefox/api';
|
||||
import * as webkit from './webkit/api';
|
||||
import * as chromium from './chromium/crApi';
|
||||
import * as firefox from './firefox/ffApi';
|
||||
import * as webkit from './webkit/wkApi';
|
||||
|
||||
export const Chromium = chromium;
|
||||
export const Firefox = firefox;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
export { BrowserContext } from '../browserContext';
|
||||
export { ConsoleMessage } from '../console';
|
||||
export { Dialog } from '../dialog';
|
||||
export { ElementHandle } from '../dom';
|
||||
|
|
@ -9,14 +10,15 @@ export { Frame } from '../frames';
|
|||
export { Keyboard, Mouse } from '../input';
|
||||
export { JSHandle } from '../javascript';
|
||||
export { Request, Response } from '../network';
|
||||
export { BrowserContext } from '../browserContext';
|
||||
export { Page } from '../page';
|
||||
|
||||
export { CRSession as CDPSession } from './crConnection';
|
||||
export { CRTarget as Target } from './crTarget';
|
||||
export { CRAccessibility as Accessibility } from './features/crAccessibility';
|
||||
export { CRCoverage as Coverage } from './features/crCoverage';
|
||||
export { CRInterception as Interception } from './features/crInterception';
|
||||
export { CROverrides as Overrides } from './features/crOverrides';
|
||||
export { CRPdf as PDF } from './features/crPdf';
|
||||
export { CRPermissions as Permissions } from './features/crPermissions';
|
||||
export { Worker, CRWorkers as Workers } from './features/crWorkers';
|
||||
export { Page } from '../page';
|
||||
export { CRTarget as Target } from './crTarget';
|
||||
export { CRWorker as Worker, CRWorkers as Workers } from './features/crWorkers';
|
||||
|
||||
|
|
@ -29,9 +29,9 @@ import * as browser from '../browser';
|
|||
import * as network from '../network';
|
||||
import { CRPermissions } from './features/crPermissions';
|
||||
import { CROverrides } from './features/crOverrides';
|
||||
import { Worker } from './features/crWorkers';
|
||||
import { CRWorker } from './features/crWorkers';
|
||||
import { ConnectionTransport } from '../transport';
|
||||
import { readProtocolStream } from './protocolHelper';
|
||||
import { readProtocolStream } from './crProtocolHelper';
|
||||
|
||||
export class CRBrowser extends EventEmitter implements browser.Browser {
|
||||
_connection: CRConnection;
|
||||
|
|
@ -230,7 +230,7 @@ export class CRBrowser extends EventEmitter implements browser.Browser {
|
|||
return [...this._targets.values()].find(t => t.type() === 'browser');
|
||||
}
|
||||
|
||||
serviceWorker(target: CRTarget): Promise<Worker | null> {
|
||||
serviceWorker(target: CRTarget): Promise<CRWorker | null> {
|
||||
return target._worker();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
import { CRSession } from './crConnection';
|
||||
import { helper } from '../helper';
|
||||
import { valueFromRemoteObject, getExceptionMessage, releaseObject } from './protocolHelper';
|
||||
import { valueFromRemoteObject, getExceptionMessage, releaseObject } from './crProtocolHelper';
|
||||
import { Protocol } from './protocol';
|
||||
import * as js from '../javascript';
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { CRNetworkManager } from './crNetworkManager';
|
|||
import { Page } from '../page';
|
||||
import { Protocol } from './protocol';
|
||||
import { Events } from '../events';
|
||||
import { toConsoleMessageLocation, exceptionToError, releaseObject } from './protocolHelper';
|
||||
import { toConsoleMessageLocation, exceptionToError, releaseObject } from './crProtocolHelper';
|
||||
import * as dialog from '../dialog';
|
||||
import { PageDelegate } from '../page';
|
||||
import { RawMouseImpl, RawKeyboardImpl } from './crInput';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { CRBrowser } from './crBrowser';
|
|||
import { BrowserContext } from '../browserContext';
|
||||
import { CRSession, CRSessionEvents } from './crConnection';
|
||||
import { Events } from '../events';
|
||||
import { Worker } from './features/crWorkers';
|
||||
import { CRWorker } from './features/crWorkers';
|
||||
import { Page } from '../page';
|
||||
import { Protocol } from './protocol';
|
||||
import { debugError } from '../helper';
|
||||
|
|
@ -35,7 +35,7 @@ export class CRTarget {
|
|||
private _sessionFactory: () => Promise<CRSession>;
|
||||
private _pagePromise: Promise<Page> | null = null;
|
||||
private _frameManager: CRFrameManager | null = null;
|
||||
private _workerPromise: Promise<Worker> | null = null;
|
||||
private _workerPromise: Promise<CRWorker> | null = null;
|
||||
_initializedPromise: Promise<boolean>;
|
||||
_initializedCallback: (value?: unknown) => void;
|
||||
_isInitialized: boolean;
|
||||
|
|
@ -98,13 +98,13 @@ export class CRTarget {
|
|||
return this._pagePromise;
|
||||
}
|
||||
|
||||
async _worker(): Promise<Worker | null> {
|
||||
async _worker(): Promise<CRWorker | null> {
|
||||
if (this._targetInfo.type !== 'service_worker' && this._targetInfo.type !== 'shared_worker')
|
||||
return null;
|
||||
if (!this._workerPromise) {
|
||||
// TODO(einbinder): Make workers send their console logs.
|
||||
this._workerPromise = this._sessionFactory()
|
||||
.then(client => new Worker(client, this._targetInfo.url, () => { } /* consoleAPICalled */, () => { } /* exceptionThrown */));
|
||||
.then(client => new CRWorker(client, this._targetInfo.url, () => { } /* consoleAPICalled */, () => { } /* exceptionThrown */));
|
||||
}
|
||||
return this._workerPromise;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
import { BrowserContext } from '../../browserContext';
|
||||
import { CRFrameManager } from '../crFrameManager';
|
||||
import { Page } from '../api';
|
||||
import { Page } from '../crApi';
|
||||
|
||||
export class CROverrides {
|
||||
private _context: BrowserContext;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
import { assert, helper } from '../../helper';
|
||||
import { CRSession } from '../crConnection';
|
||||
import { readProtocolStream } from '../protocolHelper';
|
||||
import { readProtocolStream } from '../crProtocolHelper';
|
||||
|
||||
type PDFOptions = {
|
||||
scale?: number,
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ import * as types from '../../types';
|
|||
import * as js from '../../javascript';
|
||||
import * as console from '../../console';
|
||||
import { CRExecutionContext } from '../crExecutionContext';
|
||||
import { toConsoleMessageLocation, exceptionToError } from '../protocolHelper';
|
||||
import { toConsoleMessageLocation, exceptionToError } from '../crProtocolHelper';
|
||||
|
||||
type AddToConsoleCallback = (type: string, args: js.JSHandle[], location: console.ConsoleMessageLocation) => void;
|
||||
type HandleExceptionCallback = (error: Error) => void;
|
||||
|
||||
export class CRWorkers extends EventEmitter {
|
||||
private _workers = new Map<string, Worker>();
|
||||
private _workers = new Map<string, CRWorker>();
|
||||
|
||||
constructor(client: CRSession, addToConsole: AddToConsoleCallback, handleException: HandleExceptionCallback) {
|
||||
super();
|
||||
|
|
@ -39,7 +39,7 @@ export class CRWorkers extends EventEmitter {
|
|||
if (event.targetInfo.type !== 'worker')
|
||||
return;
|
||||
const session = CRConnection.fromSession(client).session(event.sessionId);
|
||||
const worker = new Worker(session, event.targetInfo.url, addToConsole, handleException);
|
||||
const worker = new CRWorker(session, event.targetInfo.url, addToConsole, handleException);
|
||||
this._workers.set(event.sessionId, worker);
|
||||
this.emit(Events.Workers.WorkerCreated, worker);
|
||||
});
|
||||
|
|
@ -52,12 +52,12 @@ export class CRWorkers extends EventEmitter {
|
|||
});
|
||||
}
|
||||
|
||||
list(): Worker[] {
|
||||
list(): CRWorker[] {
|
||||
return Array.from(this._workers.values());
|
||||
}
|
||||
}
|
||||
|
||||
export class Worker extends EventEmitter {
|
||||
export class CRWorker extends EventEmitter {
|
||||
private _client: CRSession;
|
||||
private _url: string;
|
||||
private _executionContextPromise: Promise<js.ExecutionContext>;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
export { TimeoutError } from '../errors';
|
||||
export { Keyboard, Mouse } from '../input';
|
||||
export { BrowserContext } from '../browserContext';
|
||||
export { ConsoleMessage } from '../console';
|
||||
export { Dialog } from '../dialog';
|
||||
export { JSHandle } from '../javascript';
|
||||
export { ElementHandle } from '../dom';
|
||||
export { TimeoutError } from '../errors';
|
||||
export { Frame } from '../frames';
|
||||
export { Keyboard, Mouse } from '../input';
|
||||
export { JSHandle } from '../javascript';
|
||||
export { Request, Response } from '../network';
|
||||
export { Page } from '../page';
|
||||
|
||||
export { FFAccessibility as Accessibility } from './features/ffAccessibility';
|
||||
export { FFInterception as Interception } from './features/ffInterception';
|
||||
export { FFPermissions as Permissions } from './features/ffPermissions';
|
||||
export { Frame } from '../frames';
|
||||
export { Request, Response } from '../network';
|
||||
export { Page } from '../page';
|
||||
export { ConsoleMessage } from '../console';
|
||||
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
export { TimeoutError } from '../errors';
|
||||
export { BrowserContext } from '../browserContext';
|
||||
export { JSHandle } from '../javascript';
|
||||
export { ConsoleMessage } from '../console';
|
||||
export { Dialog } from '../dialog';
|
||||
export { ElementHandle } from '../dom';
|
||||
export { TimeoutError } from '../errors';
|
||||
export { Frame } from '../frames';
|
||||
export { Mouse, Keyboard } from '../input';
|
||||
export { Keyboard, Mouse } from '../input';
|
||||
export { JSHandle } from '../javascript';
|
||||
export { Request, Response } from '../network';
|
||||
export { Page } from '../page';
|
||||
export { Dialog } from '../dialog';
|
||||
export { ConsoleMessage } from '../console';
|
||||
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
import { WKTargetSession, isSwappedOutError } from './wkConnection';
|
||||
import { helper } from '../helper';
|
||||
import { valueFromRemoteObject, releaseObject } from './protocolHelper';
|
||||
import { valueFromRemoteObject, releaseObject } from './wkProtocolHelper';
|
||||
import { Protocol } from './protocol';
|
||||
import * as js from '../javascript';
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
|
|||
return valueFromRemoteObject(response.result);
|
||||
}).catch(rewriteError);
|
||||
|
||||
function unserializableToString(arg) {
|
||||
function unserializableToString(arg: any) {
|
||||
if (Object.is(arg, -0))
|
||||
return '-0';
|
||||
if (Object.is(arg, Infinity))
|
||||
|
|
@ -161,7 +161,7 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
|
|||
throw new Error('Unsupported value: ' + arg + ' (' + (typeof arg) + ')');
|
||||
}
|
||||
|
||||
function isUnserializable(arg) {
|
||||
function isUnserializable(arg: any) {
|
||||
if (typeof arg === 'bigint')
|
||||
return true;
|
||||
if (Object.is(arg, -0))
|
||||
|
|
@ -180,11 +180,7 @@ export class WKExecutionContext implements js.ExecutionContextDelegate {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Error} error
|
||||
* @return {!Protocol.Runtime.evaluateReturnValue}
|
||||
*/
|
||||
function rewriteError(error) {
|
||||
function rewriteError(error: Error): Protocol.Runtime.evaluateReturnValue {
|
||||
if (error.message.includes('Object couldn\'t be returned by value'))
|
||||
return {result: {type: 'undefined'}};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue