Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions docs/src/api/class-browsercontext.md
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,6 @@ Name of the function on the window object.

Callback function that will be called in the Playwright's context.

### option: BrowserContext.exposeBinding.handle
* since: v1.8
* deprecated: This option will be removed in the future.
- `handle` <[boolean]>

Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
supported. When passing by value, multiple arguments are supported.

## async method: BrowserContext.exposeFunction
* since: v1.8
- returns: <[Disposable]>
Expand Down
16 changes: 0 additions & 16 deletions docs/src/api/class-browsertype.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ Additional HTTP headers to be sent with web socket connect request. Optional.
Slows down Playwright operations by the specified amount of milliseconds. Useful so that you
can see what is going on. Defaults to 0.

### option: BrowserType.connect.logger
* since: v1.14
* langs: js
* deprecated: The logs received by the logger are incomplete. Please use tracing instead.
- `logger` <[Logger]>

Logger sink for Playwright logging. Optional.

### option: BrowserType.connect.timeout
* since: v1.10
- `timeout` <[float]>
Expand Down Expand Up @@ -218,14 +210,6 @@ Additional HTTP headers to be sent with connect request. Optional.
Tells Playwright that it runs on the same host as the CDP server. It will enable certain optimizations that rely upon
the file system being the same between Playwright and the Browser.

### option: BrowserType.connectOverCDP.logger
* since: v1.14
* langs: js
* deprecated: The logs received by the logger are incomplete. Please use tracing instead.
- `logger` <[Logger]>

Logger sink for Playwright logging. Optional.

### option: BrowserType.connectOverCDP.slowMo
* since: v1.11
- `slowMo` <[float]>
Expand Down
8 changes: 0 additions & 8 deletions docs/src/api/class-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -1833,14 +1833,6 @@ Name of the function on the window object.

Callback function that will be called in the Playwright's context.

### option: Page.exposeBinding.handle
* since: v1.8
* deprecated: This option will be removed in the future.
- `handle` <[boolean]>

Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
supported. When passing by value, multiple arguments are supported.

## async method: Page.exposeFunction
* since: v1.8
- returns: <[Disposable]>
Expand Down
14 changes: 0 additions & 14 deletions docs/src/api/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,18 +751,6 @@ Emulates `'prefers-contrast'` media feature, supported values are `'no-preferenc

Logger sink for Playwright logging.

## context-option-videospath
* langs: js
* deprecated: Use [`option: recordVideo`] instead.
- `videosPath` <[path]>

## context-option-videosize
* langs: js
* deprecated: Use [`option: recordVideo`] instead.
- `videoSize` <[Object]>
- `width` <[int]> Video frame width.
- `height` <[int]> Video frame height.

## context-option-recordhar
* langs: js
- `recordHar` <[Object]>
Expand Down Expand Up @@ -1066,8 +1054,6 @@ between the same pixel in compared images, between zero (strict) and one (lax),
- %%-context-option-contrast-%%
- %%-context-option-contrast-csharp-python-%%
- %%-context-option-logger-%%
- %%-context-option-videospath-%%
- %%-context-option-videosize-%%
- %%-context-option-recordhar-%%
- %%-context-option-recordhar-path-%%
- %%-context-option-recordhar-omit-content-%%
Expand Down
33 changes: 8 additions & 25 deletions packages/injected/src/bindingsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ import type { SerializedValue } from '@isomorphic/utilityScriptSerializers';
export type BindingPayload = {
name: string;
seq: number;
serializedArgs?: SerializedValue[],
serializedArgs: SerializedValue[],
};

type BindingData = {
callbacks: Map<number, { resolve: (value: any) => void, reject: (error: Error) => void }>;
lastSeq: number;
handles: Map<number, any>;
removed: boolean;
};

Expand All @@ -41,34 +40,25 @@ export class BindingsController {
this._globalBindingName = globalBindingName;
}

addBinding(bindingName: string, needsHandle: boolean) {
addBinding(bindingName: string) {
const data: BindingData = {
callbacks: new Map(),
lastSeq: 0,
handles: new Map(),
removed: false,
};
this._bindings.set(bindingName, data);
(this._global as any)[bindingName] = (...args: any[]) => {
if (data.removed)
throw new Error(`binding "${bindingName}" has been removed`);
if (needsHandle && args.slice(1).some(arg => arg !== undefined))
throw new Error(`exposeBindingHandle supports a single argument, ${args.length} received`);
const seq = ++data.lastSeq;
const promise = new Promise((resolve, reject) => data.callbacks.set(seq, { resolve, reject }));
let payload: BindingPayload;
if (needsHandle) {
data.handles.set(seq, args[0]);
payload = { name: bindingName, seq };
} else {
const serializedArgs = [];
for (let i = 0; i < args.length; i++) {
serializedArgs[i] = serializeAsCallArgument(args[i], v => {
return { fallThrough: v };
});
}
payload = { name: bindingName, seq, serializedArgs };
const serializedArgs = [];
for (let i = 0; i < args.length; i++) {
serializedArgs[i] = serializeAsCallArgument(args[i], v => {
return { fallThrough: v };
});
}
const payload: BindingPayload = { name: bindingName, seq, serializedArgs };
(this._global as any)[this._globalBindingName](JSON.stringify(payload));
return promise;
};
Expand All @@ -82,13 +72,6 @@ export class BindingsController {
delete (this._global as any)[bindingName];
}

takeBindingHandle(arg: { name: string, seq: number }) {
const handles = this._bindings.get(arg.name)!.handles;
const handle = handles.get(arg.seq);
handles.delete(arg.seq);
return handle;
}

deliverBindingResult(arg: { name: string, seq: number, result?: any, error?: any }) {
const callbacks = this._bindings.get(arg.name)!.callbacks;
if ('error' in arg)
Expand Down
Loading
Loading