Skip to content

Commit

Permalink
chore: move webkit to src/server/webkit (#3589)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Aug 23, 2020
1 parent 77f8031 commit 6a53b20
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ lib/
src/generated/*
src/server/chromium/protocol.ts
src/firefox/protocol.ts
src/webkit/protocol.ts
src/server/webkit/protocol.ts
/types/*
/index.d.ts
/electron-types.d.ts
Expand Down
2 changes: 1 addition & 1 deletion src/server/playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { Chromium } from './chromium/chromium';
import { WebKit } from './webkit';
import { WebKit } from './webkit/webkit';
import { Firefox } from './firefox';
import { selectors } from '../selectors';
import * as browserPaths from '../utils/browserPaths';
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions src/server/webkit.ts → src/server/webkit/webkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/

import { WKBrowser } from '../webkit/wkBrowser';
import { Env } from './processLauncher';
import { Env } from '../processLauncher';
import * as path from 'path';
import { kBrowserCloseMessageId } from '../webkit/wkConnection';
import { BrowserTypeBase } from './browserType';
import { ConnectionTransport } from '../transport';
import { BrowserOptions } from '../browser';
import { BrowserDescriptor } from '../utils/browserPaths';
import * as types from '../types';
import { kBrowserCloseMessageId } from './wkConnection';
import { BrowserTypeBase } from '../browserType';
import { ConnectionTransport } from '../../transport';
import { BrowserOptions } from '../../browser';
import { BrowserDescriptor } from '../../utils/browserPaths';
import * as types from '../../types';

export class WebKit extends BrowserTypeBase {
constructor(packagePath: string, browser: BrowserDescriptor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as accessibility from '../accessibility';
import * as accessibility from '../../accessibility';
import { WKSession } from './wkConnection';
import { Protocol } from './protocol';
import * as dom from '../dom';
import * as types from '../types';
import * as dom from '../../dom';
import * as types from '../../types';

export async function getAccessibilityTree(session: WKSession, needle?: dom.ElementHandle) {
const objectId = needle ? needle._objectId : undefined;
Expand Down
16 changes: 8 additions & 8 deletions src/webkit/wkBrowser.ts → src/server/webkit/wkBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* limitations under the License.
*/

import { Browser, BrowserOptions } from '../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../browserContext';
import { helper, RegisteredListener } from '../helper';
import { assert } from '../utils/utils';
import * as network from '../network';
import { Page, PageBinding } from '../page';
import { Browser, BrowserOptions } from '../../browser';
import { assertBrowserContextIsNotOwned, BrowserContext, validateBrowserContextOptions, verifyGeolocation } from '../../browserContext';
import { helper, RegisteredListener } from '../../helper';
import { assert } from '../../utils/utils';
import * as network from '../../network';
import { Page, PageBinding } from '../../page';
import * as path from 'path';
import { ConnectionTransport } from '../transport';
import * as types from '../types';
import { ConnectionTransport } from '../../transport';
import * as types from '../../types';
import { Protocol } from './protocol';
import { kPageProxyMessageReceived, PageProxyMessageReceivedPayload, WKConnection, WKSession } from './wkConnection';
import { WKPage } from './wkPage';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/

import { EventEmitter } from 'events';
import { assert } from '../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../transport';
import { assert } from '../../utils/utils';
import { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../../transport';
import { Protocol } from './protocol';
import { rewriteErrorMessage } from '../utils/stackTrace';
import { debugLogger } from '../utils/debugLogger';
import { rewriteErrorMessage } from '../../utils/stackTrace';
import { debugLogger } from '../../utils/debugLogger';

// WKPlaywright uses this special id to issue Browser.close command which we
// should ignore.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import { WKSession, isSwappedOutError } from './wkConnection';
import { Protocol } from './protocol';
import * as js from '../javascript';
import { parseEvaluationResultValue } from '../common/utilityScriptSerializers';
import * as sourceMap from '../utils/sourceMap';
import * as js from '../../javascript';
import { parseEvaluationResultValue } from '../../common/utilityScriptSerializers';
import * as sourceMap from '../../utils/sourceMap';

export class WKExecutionContext implements js.ExecutionContextDelegate {
private readonly _session: WKSession;
Expand Down
8 changes: 4 additions & 4 deletions src/webkit/wkInput.ts → src/server/webkit/wkInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

import * as input from '../input';
import * as types from '../types';
import { macEditingCommands } from '../macEditingCommands';
import * as input from '../../input';
import * as types from '../../types';
import { macEditingCommands } from '../../macEditingCommands';
import { WKSession } from './wkConnection';
import { isString } from '../utils/utils';
import { isString } from '../../utils/utils';

function toModifiersMask(modifiers: Set<types.KeyboardModifier>): number {
// From Source/WebKit/Shared/WebEvent.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

import * as frames from '../frames';
import * as network from '../network';
import * as types from '../types';
import * as frames from '../../frames';
import * as network from '../../network';
import * as types from '../../types';
import { Protocol } from './protocol';
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 } = {
'aborted': 'Cancellation',
Expand Down
24 changes: 12 additions & 12 deletions src/webkit/wkPage.ts → src/server/webkit/wkPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@
* limitations under the License.
*/

import { Screencast, BrowserContext } from '../browserContext';
import * as frames from '../frames';
import { helper, RegisteredListener } from '../helper';
import * as dom from '../dom';
import * as network from '../network';
import { Screencast, BrowserContext } from '../../browserContext';
import * as frames from '../../frames';
import { helper, RegisteredListener } from '../../helper';
import * as dom from '../../dom';
import * as network from '../../network';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import { WKInterceptableRequest } from './wkInterceptableRequest';
import { WKWorkers } from './wkWorkers';
import { Page, PageDelegate, PageBinding } from '../page';
import { Page, PageDelegate, PageBinding } from '../../page';
import { Protocol } from './protocol';
import * as dialog from '../dialog';
import * as dialog from '../../dialog';
import { RawMouseImpl, RawKeyboardImpl } from './wkInput';
import * as types from '../types';
import * as accessibility from '../accessibility';
import * as types from '../../types';
import * as accessibility from '../../accessibility';
import { getAccessibilityTree } from './wkAccessibility';
import { WKProvisionalPage } from './wkProvisionalPage';
import { WKBrowserContext } from './wkBrowser';
import { selectors } from '../selectors';
import { selectors } from '../../selectors';
import * as jpeg from 'jpeg-js';
import * as png from 'pngjs';
import { JSHandle } from '../javascript';
import { assert, debugAssert, headersArrayToObject } from '../utils/utils';
import { JSHandle } from '../../javascript';
import { assert, debugAssert, headersArrayToObject } from '../../utils/utils';

const UTILITY_WORLD_NAME = '__playwright_utility_world__';
const BINDING_CALL_MESSAGE = '__playwright_binding_call__';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import { WKSession } from './wkConnection';
import { WKPage } from './wkPage';
import { RegisteredListener, helper } from '../helper';
import { RegisteredListener, helper } from '../../helper';
import { Protocol } from './protocol';
import { assert } from '../utils/utils';
import { assert } from '../../utils/utils';

export class WKProvisionalPage {
readonly _session: WKSession;
Expand Down
6 changes: 3 additions & 3 deletions src/webkit/wkWorkers.ts → src/server/webkit/wkWorkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

import { helper, RegisteredListener } from '../helper';
import { Page, Worker } from '../page';
import { helper, RegisteredListener } from '../../helper';
import { Page, Worker } from '../../page';
import { Protocol } from './protocol';
import { WKSession } from './wkConnection';
import { WKExecutionContext } from './wkExecutionContext';
import * as types from '../types';
import * as types from '../../types';

export class WKWorkers {
private _sessionListeners: RegisteredListener[] = [];
Expand Down
2 changes: 2 additions & 0 deletions utils/check_deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ const DEPS = new Map([
['src/protocol/', ['src/protocol/', 'src/utils/']],
['src/install/', ['src/install/', 'src/utils/']],
['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']],
]);

Expand Down
2 changes: 1 addition & 1 deletion utils/protocol-types-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function generateChromiumProtocol(executablePath) {
}

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'));
await fs.promises.writeFile(outputPath, jsonToTS({domains: json}));
console.log(`Wrote protocol.ts for WebKit to ${path.relative(process.cwd(), outputPath)}`);
Expand Down

0 comments on commit 6a53b20

Please sign in to comment.