chore: move webkit to src/server/webkit (#3589)
This commit is contained in:
parent
77f803140a
commit
6a53b205e5
|
|
@ -8,7 +8,7 @@ lib/
|
||||||
src/generated/*
|
src/generated/*
|
||||||
src/server/chromium/protocol.ts
|
src/server/chromium/protocol.ts
|
||||||
src/firefox/protocol.ts
|
src/firefox/protocol.ts
|
||||||
src/webkit/protocol.ts
|
src/server/webkit/protocol.ts
|
||||||
/types/*
|
/types/*
|
||||||
/index.d.ts
|
/index.d.ts
|
||||||
/electron-types.d.ts
|
/electron-types.d.ts
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Chromium } from './chromium/chromium';
|
import { Chromium } from './chromium/chromium';
|
||||||
import { WebKit } from './webkit';
|
import { WebKit } from './webkit/webkit';
|
||||||
import { Firefox } from './firefox';
|
import { Firefox } from './firefox';
|
||||||
import { selectors } from '../selectors';
|
import { selectors } from '../selectors';
|
||||||
import * as browserPaths from '../utils/browserPaths';
|
import * as browserPaths from '../utils/browserPaths';
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { WKBrowser } from '../webkit/wkBrowser';
|
import { WKBrowser } from '../webkit/wkBrowser';
|
||||||
import { Env } from './processLauncher';
|
import { Env } from '../processLauncher';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { kBrowserCloseMessageId } from '../webkit/wkConnection';
|
import { kBrowserCloseMessageId } from './wkConnection';
|
||||||
import { BrowserTypeBase } from './browserType';
|
import { BrowserTypeBase } from '../browserType';
|
||||||
import { ConnectionTransport } from '../transport';
|
import { ConnectionTransport } from '../../transport';
|
||||||
import { BrowserOptions } from '../browser';
|
import { BrowserOptions } from '../../browser';
|
||||||
import { BrowserDescriptor } from '../utils/browserPaths';
|
import { BrowserDescriptor } from '../../utils/browserPaths';
|
||||||
import * as types from '../types';
|
import * as types from '../../types';
|
||||||
|
|
||||||
export class WebKit extends BrowserTypeBase {
|
export class WebKit extends BrowserTypeBase {
|
||||||
constructor(packagePath: string, browser: BrowserDescriptor) {
|
constructor(packagePath: string, browser: BrowserDescriptor) {
|
||||||
|
|
@ -13,11 +13,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import * as accessibility from '../accessibility';
|
import * as accessibility from '../../accessibility';
|
||||||
import { WKSession } from './wkConnection';
|
import { WKSession } from './wkConnection';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import * as dom from '../dom';
|
import * as dom from '../../dom';
|
||||||
import * as types from '../types';
|
import * as types from '../../types';
|
||||||
|
|
||||||
export async function getAccessibilityTree(session: WKSession, needle?: dom.ElementHandle) {
|
export async function getAccessibilityTree(session: WKSession, needle?: dom.ElementHandle) {
|
||||||
const objectId = needle ? needle._objectId : undefined;
|
const objectId = needle ? needle._objectId : undefined;
|
||||||
|
|
@ -15,15 +15,15 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Browser, BrowserOptions } from '../browser';
|
import { Browser, BrowserOptions } from '../../browser';
|
||||||
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
|
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
|
||||||
import { helper, RegisteredListener } from '../helper';
|
import { helper, RegisteredListener } from '../../helper';
|
||||||
import { assert } from '../utils/utils';
|
import { assert } from '../../utils/utils';
|
||||||
import * as network from '../network';
|
import * as network from '../../network';
|
||||||
import { Page, PageBinding } from '../page';
|
import { Page, PageBinding } from '../../page';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { ConnectionTransport } from '../transport';
|
import { ConnectionTransport } from '../../transport';
|
||||||
import * as types from '../types';
|
import * as types from '../../types';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import { kPageProxyMessageReceived, PageProxyMessageReceivedPayload, WKConnection, WKSession } from './wkConnection';
|
import { kPageProxyMessageReceived, PageProxyMessageReceivedPayload, WKConnection, WKSession } from './wkConnection';
|
||||||
import { WKPage } from './wkPage';
|
import { WKPage } from './wkPage';
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { assert } from '../utils/utils';
|
import { assert } from '../../utils/utils';
|
||||||
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
|
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import { rewriteErrorMessage } from '../utils/stackTrace';
|
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
||||||
import { debugLogger } from '../utils/debugLogger';
|
import { debugLogger } from '../../utils/debugLogger';
|
||||||
|
|
||||||
// WKPlaywright uses this special id to issue Browser.close command which we
|
// WKPlaywright uses this special id to issue Browser.close command which we
|
||||||
// should ignore.
|
// should ignore.
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
|
|
||||||
import { WKSession, isSwappedOutError } from './wkConnection';
|
import { WKSession, isSwappedOutError } from './wkConnection';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import * as js from '../javascript';
|
import * as js from '../../javascript';
|
||||||
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
|
import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
|
||||||
import * as sourceMap from '../utils/sourceMap';
|
import * as sourceMap from '../../utils/sourceMap';
|
||||||
|
|
||||||
export class WKExecutionContext implements js.ExecutionContextDelegate {
|
export class WKExecutionContext implements js.ExecutionContextDelegate {
|
||||||
private readonly _session: WKSession;
|
private readonly _session: WKSession;
|
||||||
|
|
@ -15,11 +15,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as input from '../input';
|
import * as input from '../../input';
|
||||||
import * as types from '../types';
|
import * as types from '../../types';
|
||||||
import { macEditingCommands } from '../macEditingCommands';
|
import { macEditingCommands } from '../../macEditingCommands';
|
||||||
import { WKSession } from './wkConnection';
|
import { WKSession } from './wkConnection';
|
||||||
import { isString } from '../utils/utils';
|
import { isString } from '../../utils/utils';
|
||||||
|
|
||||||
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
|
function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
|
||||||
// From Source/WebKit/Shared/WebEvent.h
|
// From Source/WebKit/Shared/WebEvent.h
|
||||||
|
|
@ -15,12 +15,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as frames from '../frames';
|
import * as frames from '../../frames';
|
||||||
import * as network from '../network';
|
import * as network from '../../network';
|
||||||
import * as types from '../types';
|
import * as types from '../../types';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import { WKSession } from './wkConnection';
|
import { WKSession } from './wkConnection';
|
||||||
import { assert, headersObjectToArray, headersArrayToObject } from '../utils/utils';
|
import { assert, headersObjectToArray, headersArrayToObject } from '../../utils/utils';
|
||||||
|
|
||||||
const errorReasons: { [reason: string]: Protocol.Network.ResourceErrorType } = {
|
const errorReasons: { [reason: string]: Protocol.Network.ResourceErrorType } = {
|
||||||
'aborted': 'Cancellation',
|
'aborted': 'Cancellation',
|
||||||
|
|
@ -15,29 +15,29 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Screencast, BrowserContext } from '../browserContext';
|
import { Screencast, BrowserContext } from '../../browserContext';
|
||||||
import * as frames from '../frames';
|
import * as frames from '../../frames';
|
||||||
import { helper, RegisteredListener } from '../helper';
|
import { helper, RegisteredListener } from '../../helper';
|
||||||
import * as dom from '../dom';
|
import * as dom from '../../dom';
|
||||||
import * as network from '../network';
|
import * as network from '../../network';
|
||||||
import { WKSession } from './wkConnection';
|
import { WKSession } from './wkConnection';
|
||||||
import { WKExecutionContext } from './wkExecutionContext';
|
import { WKExecutionContext } from './wkExecutionContext';
|
||||||
import { WKInterceptableRequest } from './wkInterceptableRequest';
|
import { WKInterceptableRequest } from './wkInterceptableRequest';
|
||||||
import { WKWorkers } from './wkWorkers';
|
import { WKWorkers } from './wkWorkers';
|
||||||
import { Page, PageDelegate, PageBinding } from '../page';
|
import { Page, PageDelegate, PageBinding } from '../../page';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import * as dialog from '../dialog';
|
import * as dialog from '../../dialog';
|
||||||
import { RawMouseImpl, RawKeyboardImpl } from './wkInput';
|
import { RawMouseImpl, RawKeyboardImpl } from './wkInput';
|
||||||
import * as types from '../types';
|
import * as types from '../../types';
|
||||||
import * as accessibility from '../accessibility';
|
import * as accessibility from '../../accessibility';
|
||||||
import { getAccessibilityTree } from './wkAccessibility';
|
import { getAccessibilityTree } from './wkAccessibility';
|
||||||
import { WKProvisionalPage } from './wkProvisionalPage';
|
import { WKProvisionalPage } from './wkProvisionalPage';
|
||||||
import { WKBrowserContext } from './wkBrowser';
|
import { WKBrowserContext } from './wkBrowser';
|
||||||
import { selectors } from '../selectors';
|
import { selectors } from '../../selectors';
|
||||||
import * as jpeg from 'jpeg-js';
|
import * as jpeg from 'jpeg-js';
|
||||||
import * as png from 'pngjs';
|
import * as png from 'pngjs';
|
||||||
import { JSHandle } from '../javascript';
|
import { JSHandle } from '../../javascript';
|
||||||
import { assert, debugAssert, headersArrayToObject } from '../utils/utils';
|
import { assert, debugAssert, headersArrayToObject } from '../../utils/utils';
|
||||||
|
|
||||||
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
|
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
|
||||||
const BINDING_CALL_MESSAGE = '__playwright_binding_call__';
|
const BINDING_CALL_MESSAGE = '__playwright_binding_call__';
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
import { WKSession } from './wkConnection';
|
import { WKSession } from './wkConnection';
|
||||||
import { WKPage } from './wkPage';
|
import { WKPage } from './wkPage';
|
||||||
import { RegisteredListener, helper } from '../helper';
|
import { RegisteredListener, helper } from '../../helper';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import { assert } from '../utils/utils';
|
import { assert } from '../../utils/utils';
|
||||||
|
|
||||||
export class WKProvisionalPage {
|
export class WKProvisionalPage {
|
||||||
readonly _session: WKSession;
|
readonly _session: WKSession;
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { helper, RegisteredListener } from '../helper';
|
import { helper, RegisteredListener } from '../../helper';
|
||||||
import { Page, Worker } from '../page';
|
import { Page, Worker } from '../../page';
|
||||||
import { Protocol } from './protocol';
|
import { Protocol } from './protocol';
|
||||||
import { WKSession } from './wkConnection';
|
import { WKSession } from './wkConnection';
|
||||||
import { WKExecutionContext } from './wkExecutionContext';
|
import { WKExecutionContext } from './wkExecutionContext';
|
||||||
import * as types from '../types';
|
import * as types from '../../types';
|
||||||
|
|
||||||
export class WKWorkers {
|
export class WKWorkers {
|
||||||
private _sessionListeners: RegisteredListener[] = [];
|
private _sessionListeners: RegisteredListener[] = [];
|
||||||
|
|
@ -75,6 +75,8 @@ const DEPS = new Map([
|
||||||
['src/protocol/', ['src/protocol/', 'src/utils/']],
|
['src/protocol/', ['src/protocol/', 'src/utils/']],
|
||||||
['src/install/', ['src/install/', 'src/utils/']],
|
['src/install/', ['src/install/', 'src/utils/']],
|
||||||
['src/server/chromium/', ['src/server/chromium/', 'src/utils/', 'src/', 'src/common/', 'src/server/']],
|
['src/server/chromium/', ['src/server/chromium/', 'src/utils/', 'src/', 'src/common/', 'src/server/']],
|
||||||
|
['src/server/electron/', ['src/server/electron/', 'src/server/chromium/', 'src/utils/', 'src/', 'src/server/']],
|
||||||
|
['src/server/webkit/', ['src/server/webkit/', 'src/utils/', 'src/', 'src/common/', 'src/server/']],
|
||||||
['src/client/', ['src/client/', 'src/utils/', 'src/protocol/', 'src/server/chromium/protocol.ts']],
|
['src/client/', ['src/client/', 'src/utils/', 'src/protocol/', 'src/server/chromium/protocol.ts']],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ async function generateChromiumProtocol(executablePath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateWebKitProtocol(folderPath) {
|
async function generateWebKitProtocol(folderPath) {
|
||||||
const outputPath = path.join(__dirname, '..', '..', 'src', 'webkit', 'protocol.ts');
|
const outputPath = path.join(__dirname, '..', '..', 'src', 'server', 'webkit', 'protocol.ts');
|
||||||
const json = JSON.parse(await fs.promises.readFile(path.join(folderPath, '..', 'protocol.json'), 'utf8'));
|
const json = JSON.parse(await fs.promises.readFile(path.join(folderPath, '..', 'protocol.json'), 'utf8'));
|
||||||
await fs.promises.writeFile(outputPath, jsonToTS({domains: json}));
|
await fs.promises.writeFile(outputPath, jsonToTS({domains: json}));
|
||||||
console.log(`Wrote protocol.ts for WebKit to ${path.relative(process.cwd(), outputPath)}`);
|
console.log(`Wrote protocol.ts for WebKit to ${path.relative(process.cwd(), outputPath)}`);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue