Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor scripts and realms and fix generator serialization #1013

Merged
merged 6 commits into from
Jul 12, 2023
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
1 change: 0 additions & 1 deletion src/bidiMapper/domains/context/browsingContextImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ export class BrowsingContextImpl {
params.context.auxData.type === 'isolated'
? params.context.name
: undefined,
this.#cdpTarget.cdpSessionId,
this.#cdpTarget.cdpClient,
this.#eventManager,
this.#logger
Expand Down
8 changes: 5 additions & 3 deletions src/bidiMapper/domains/context/browsingContextProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export class BrowsingContextProcessor {
params: Script.EvaluateParameters
): Promise<Script.EvaluateResult> {
const realm = await this.#getRealm(params.target);
return realm.scriptEvaluate(
return realm.evaluate(
params.expression,
params.awaitPromise,
params.resultOwnership ?? Script.ResultOwnership.None,
Expand All @@ -394,7 +394,7 @@ export class BrowsingContextProcessor {
browsingContextId: params.context,
type: params.type,
})
.map((realm: Realm) => realm.toBiDi());
.map((realm: Realm) => realm.realmInfo);
return {realms};
}

Expand All @@ -418,7 +418,9 @@ export class BrowsingContextProcessor {
params: Script.DisownParameters
): Promise<EmptyResult> {
const realm = await this.#getRealm(params.target);
await Promise.all(params.handles.map(async (h) => realm.disown(h)));
await Promise.all(
params.handles.map(async (handle) => realm.disown(handle))
);
return {};
}

Expand Down
2 changes: 1 addition & 1 deletion src/bidiMapper/domains/log/logManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class LogManager {
executionContextId: params.exceptionDetails.executionContextId,
});

// Try all the best to get the exception text.
// Try the best to get the exception text.
const textPromise = (async () => {
if (!params.exceptionDetails.exception) {
return params.exceptionDetails.text;
Expand Down
14 changes: 10 additions & 4 deletions src/bidiMapper/domains/script/channelProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*
*/

import {Protocol} from 'devtools-protocol';

import {ChromiumBidi, Script} from '../../../protocol/protocol.js';
import type {IEventManager} from '../events/EventManager.js';
import {uuidv4} from '../../../utils/uuid';
Expand Down Expand Up @@ -127,7 +129,8 @@ export class ChannelProxy {
expression: this.#createChannelProxyEvalStr(),
contextId: realm.executionContextId,
serializationOptions: {
serialization: 'idOnly',
serialization:
Protocol.Runtime.SerializationOptionsSerialization.IdOnly,
},
}
);
Expand Down Expand Up @@ -156,7 +159,8 @@ export class ChannelProxy {
arguments: [{objectId: channelHandle}],
executionContextId: realm.executionContextId,
serializationOptions: {
serialization: 'idOnly',
serialization:
Protocol.Runtime.SerializationOptionsSerialization.IdOnly,
},
}
);
Expand Down Expand Up @@ -189,7 +193,8 @@ export class ChannelProxy {
awaitPromise: true,
executionContextId: realm.executionContextId,
serializationOptions: {
serialization: 'deep',
serialization:
Protocol.Runtime.SerializationOptionsSerialization.Deep,
...(this.#properties.serializationOptions?.maxObjectDepth ===
undefined ||
this.#properties.serializationOptions.maxObjectDepth === null
Expand Down Expand Up @@ -260,7 +265,8 @@ export class ChannelProxy {
executionContextId: realm.executionContextId,
awaitPromise: true,
serializationOptions: {
serialization: 'idOnly',
serialization:
Protocol.Runtime.SerializationOptionsSerialization.IdOnly,
},
}
);
Expand Down
Loading