Skip to content

Commit

Permalink
refactor: only use context id
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed May 3, 2024
1 parent 8fde760 commit 2ad2537
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions packages/puppeteer-core/src/cdp/ExecutionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export class ExecutionContext implements Disposable {
_client: CDPSession;
_world: IsolatedWorld;
_contextId: number;
_contextName?: string;

// Set of bindings that have been registered in the current context.
#contextBindings = new Set<string>();
Expand All @@ -59,9 +58,6 @@ export class ExecutionContext implements Disposable {
this._client = client;
this._world = world;
this._contextId = contextPayload.id;
if (contextPayload.name) {
this._contextName = contextPayload.name;
}
client.on('Runtime.bindingCalled', this.#onBindingCalled);
}

Expand All @@ -75,18 +71,10 @@ export class ExecutionContext implements Disposable {

using _ = await this.#mutex.acquire();
try {
await this._client.send(
'Runtime.addBinding',
this._contextName
? {
name,
executionContextName: this._contextName,
}
: {
name,
executionContextId: this._contextId,
}
);
await this._client.send('Runtime.addBinding', {
name,
executionContextId: this._contextId,
});

await this.evaluate(addPageBinding, 'internal', name);

Expand Down

0 comments on commit 2ad2537

Please sign in to comment.