Skip to content

Commit a94acda

Browse files
Merge branch 'main' into autofill_trigger
2 parents f12ee56 + 8c8b0a6 commit a94acda

File tree

16 files changed

+109
-90
lines changed

16 files changed

+109
-90
lines changed

.browser

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
chrome@141.0.7381.0
1+
chrome@142.0.7397.0

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "8.0.0"
2+
".": "8.1.0"
33
}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [8.1.0](https://github.com/GoogleChromeLabs/chromium-bidi/compare/chromium-bidi-v8.0.0...chromium-bidi-v8.1.0) (2025-09-03)
6+
7+
8+
### Features
9+
10+
* do not dispose request until all the collectors are gone ([#3669](https://github.com/GoogleChromeLabs/chromium-bidi/issues/3669)) ([909176c](https://github.com/GoogleChromeLabs/chromium-bidi/commit/909176cb4bbc763524ae8efb6458ed005f5a9487))
11+
12+
13+
### Bug Fixes
14+
15+
* support network.getData on OOPiF ([#3674](https://github.com/GoogleChromeLabs/chromium-bidi/issues/3674)) ([403dc7c](https://github.com/GoogleChromeLabs/chromium-bidi/commit/403dc7cacf59aecede1e68e6fae61b6edeaacdaa))
16+
517
## [8.0.0](https://github.com/GoogleChromeLabs/chromium-bidi/compare/chromium-bidi-v7.3.2...chromium-bidi-v8.0.0) (2025-08-13)
618

719

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chromium-bidi",
3-
"version": "8.0.0",
3+
"version": "8.1.0",
44
"description": "An implementation of the WebDriver BiDi protocol for Chromium implemented as a JavaScript layer translating between BiDi and CDP, running inside a Chrome tab.",
55
"scripts": {
66
"build": "wireit",
@@ -197,7 +197,7 @@
197197
"chai": "4.5.0",
198198
"chai-as-promised": "7.1.2",
199199
"debug": "4.4.1",
200-
"devtools-protocol": "0.0.1507524",
200+
"devtools-protocol": "0.0.1511308",
201201
"eslint": "9.31.0",
202202
"eslint-config-prettier": "10.1.8",
203203
"eslint-import-resolver-typescript": "4.4.4",

src/bidiMapper/modules/cdp/CdpTarget.ts

Lines changed: 53 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -201,67 +201,59 @@ export class CdpTarget {
201201
* Enables all the required CDP domains and unblocks the target.
202202
*/
203203
async #unblock() {
204-
try {
205-
await Promise.all([
206-
this.#cdpClient.sendCommand('Page.enable', {
207-
enableFileChooserOpenedEvent: true,
208-
}),
209-
...(this.#ignoreFileDialog()
210-
? []
211-
: [
212-
this.#cdpClient.sendCommand(
213-
'Page.setInterceptFileChooserDialog',
214-
{
215-
enabled: true,
216-
// The intercepted dialog should be canceled.
217-
cancel: true,
218-
},
219-
),
220-
]),
221-
// There can be some existing frames in the target, if reconnecting to an
222-
// existing browser instance, e.g. via Puppeteer. Need to restore the browsing
223-
// contexts for the frames to correctly handle further events, like
224-
// `Runtime.executionContextCreated`.
225-
// It's important to schedule this task together with enabling domains commands to
226-
// prepare the tree before the events (e.g. Runtime.executionContextCreated) start
227-
// coming.
228-
// https://github.com/GoogleChromeLabs/chromium-bidi/issues/2282
229-
this.#cdpClient
230-
.sendCommand('Page.getFrameTree')
231-
.then((frameTree) =>
232-
this.#restoreFrameTreeState(frameTree.frameTree),
233-
),
234-
this.#cdpClient.sendCommand('Runtime.enable'),
235-
this.#cdpClient.sendCommand('Page.setLifecycleEventsEnabled', {
236-
enabled: true,
237-
}),
238-
// Enabling CDP Network domain is required for navigation detection:
239-
// https://github.com/GoogleChromeLabs/chromium-bidi/issues/2856.
240-
this.#cdpClient
241-
.sendCommand('Network.enable')
242-
.then(() => this.toggleNetworkIfNeeded()),
243-
this.#cdpClient.sendCommand('Target.setAutoAttach', {
244-
autoAttach: true,
245-
waitForDebuggerOnStart: true,
246-
flatten: true,
247-
}),
248-
this.#updateWindowId(),
249-
this.#setUserContextConfig(),
250-
this.#initAndEvaluatePreloadScripts(),
251-
this.#cdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
252-
// Resume tab execution as well if it was paused by the debugger.
253-
this.#parentCdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
254-
this.toggleDeviceAccessIfNeeded(),
255-
]);
256-
} catch (error: any) {
257-
this.#logger?.(LogType.debugError, 'Failed to unblock target', error);
258-
// The target might have been closed before the initialization finished.
259-
if (!this.#cdpClient.isCloseError(error)) {
260-
this.#unblocked.resolve({
261-
kind: 'error',
262-
error,
263-
});
264-
return;
204+
const results = await Promise.allSettled([
205+
this.#cdpClient.sendCommand('Page.enable', {
206+
enableFileChooserOpenedEvent: true,
207+
}),
208+
...(this.#ignoreFileDialog()
209+
? []
210+
: [
211+
this.#cdpClient.sendCommand('Page.setInterceptFileChooserDialog', {
212+
enabled: true,
213+
// The intercepted dialog should be canceled.
214+
cancel: true,
215+
}),
216+
]),
217+
// There can be some existing frames in the target, if reconnecting to an
218+
// existing browser instance, e.g. via Puppeteer. Need to restore the browsing
219+
// contexts for the frames to correctly handle further events, like
220+
// `Runtime.executionContextCreated`.
221+
// It's important to schedule this task together with enabling domains commands to
222+
// prepare the tree before the events (e.g. Runtime.executionContextCreated) start
223+
// coming.
224+
// https://github.com/GoogleChromeLabs/chromium-bidi/issues/2282
225+
this.#cdpClient
226+
.sendCommand('Page.getFrameTree')
227+
.then((frameTree) => this.#restoreFrameTreeState(frameTree.frameTree)),
228+
this.#cdpClient.sendCommand('Runtime.enable'),
229+
this.#cdpClient.sendCommand('Page.setLifecycleEventsEnabled', {
230+
enabled: true,
231+
}),
232+
// Enabling CDP Network domain is required for navigation detection:
233+
// https://github.com/GoogleChromeLabs/chromium-bidi/issues/2856.
234+
this.#cdpClient
235+
.sendCommand('Network.enable')
236+
.then(() => this.toggleNetworkIfNeeded()),
237+
this.#cdpClient.sendCommand('Target.setAutoAttach', {
238+
autoAttach: true,
239+
waitForDebuggerOnStart: true,
240+
flatten: true,
241+
}),
242+
this.#updateWindowId(),
243+
this.#setUserContextConfig(),
244+
this.#initAndEvaluatePreloadScripts(),
245+
this.#cdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
246+
// Resume tab execution as well if it was paused by the debugger.
247+
this.#parentCdpClient.sendCommand('Runtime.runIfWaitingForDebugger'),
248+
this.toggleDeviceAccessIfNeeded(),
249+
]);
250+
for (const result of results) {
251+
if (result instanceof Error) {
252+
this.#logger?.(
253+
LogType.debugError,
254+
'Error happened when configuring a new target',
255+
result,
256+
);
265257
}
266258
}
267259

src/bidiMapper/modules/cdp/CdpTargetManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ export class CdpTargetManager {
263263
case 'worker': {
264264
const realm = this.#realmStorage.findRealm({
265265
cdpSessionId: parentSessionCdpClient.sessionId,
266+
sandbox: null, // Non-sandboxed realms.
266267
});
267268
// If there is no browsing context, this worker is already terminated.
268269
if (!realm) {

src/bidiMapper/modules/network/NetworkRequest.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -908,17 +908,13 @@ export class NetworkRequest {
908908
this.#response.extraInfo = undefined;
909909
}
910910

911-
const headers = [
912-
...bidiNetworkHeadersFromCdpNetworkHeaders(this.#response.info?.headers),
913-
...bidiNetworkHeadersFromCdpNetworkHeaders(
914-
this.#response.extraInfo?.headers,
915-
),
916-
// TODO: Verify how to dedupe these
917-
// ...bidiNetworkHeadersFromCdpNetworkHeadersEntries(
918-
// this.#response.paused?.responseHeaders
919-
// ),
920-
];
921-
911+
// TODO: Also this.#response.paused?.responseHeaders have to be merged here.
912+
const cdpHeaders = this.#response.info?.headers ?? {};
913+
const cdpRawHeaders = this.#response.extraInfo?.headers ?? {};
914+
for (const [key, value] of Object.entries(cdpRawHeaders)) {
915+
cdpHeaders[key] = value;
916+
}
917+
const headers = bidiNetworkHeadersFromCdpNetworkHeaders(cdpHeaders);
922918
const authChallenges = this.#authChallenges;
923919

924920
const response: Network.ResponseData = {

src/bidiMapper/modules/script/RealmStorage.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ interface RealmFilter {
3131
executionContextId?: Protocol.Runtime.ExecutionContextId;
3232
origin?: string;
3333
type?: Script.RealmType;
34-
sandbox?: string;
34+
// null indicates no sandbox.
35+
sandbox?: string | null;
3536
cdpSessionId?: Protocol.Target.SessionID;
3637
isHidden?: boolean;
3738
}
@@ -59,6 +60,8 @@ export class RealmStorage {
5960

6061
/** Finds all realms that match the given filter. */
6162
findRealms(filter: RealmFilter): Realm[] {
63+
const sandboxFilterValue =
64+
filter.sandbox === null ? undefined : filter.sandbox;
6265
return Array.from(this.#realmMap.values()).filter((realm) => {
6366
if (filter.realmId !== undefined && filter.realmId !== realm.realmId) {
6467
return false;
@@ -73,7 +76,8 @@ export class RealmStorage {
7376
}
7477
if (
7578
filter.sandbox !== undefined &&
76-
(!(realm instanceof WindowRealm) || filter.sandbox !== realm.sandbox)
79+
(!(realm instanceof WindowRealm) ||
80+
sandboxFilterValue !== realm.sandbox)
7781
) {
7882
return false;
7983
}
@@ -106,11 +110,7 @@ export class RealmStorage {
106110
}
107111

108112
findRealm(filter: RealmFilter): Realm | undefined {
109-
const maybeRealms = this.findRealms(filter);
110-
if (maybeRealms.length !== 1) {
111-
return undefined;
112-
}
113-
return maybeRealms[0];
113+
return this.findRealms(filter)[0];
114114
}
115115

116116
/** Gets the only realm that matches the given filter, if any, otherwise throws. */

wpt

Submodule wpt updated 649 files

0 commit comments

Comments
 (0)