chore: update chromium-bidi to 0.4.33 (#11284)

This commit is contained in:
Nikolay Vitkov 2023-10-31 15:29:37 +01:00 committed by GitHub
parent ce4e485d1b
commit b4b6fe2702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1342 additions and 1004 deletions

2269
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,8 @@ export async function connectBidiOverCdp(
const bidiServer = await BidiMapper.BidiServer.createAndStart( const bidiServer = await BidiMapper.BidiServer.createAndStart(
transportBiDi, transportBiDi,
cdpConnectionAdapter, cdpConnectionAdapter,
// TODO: most likely need a little bit of refactoring
cdpConnectionAdapter.browserClient(),
'', '',
undefined, undefined,
bidiServerLogger bidiServerLogger

View File

@ -55,6 +55,8 @@ export class ExposeableFunction<Args extends unknown[], Ret> {
Map<number, RemotePromiseCallbacks> Map<number, RemotePromiseCallbacks>
>(); >();
#preloadScriptId?: Bidi.Script.PreloadScript;
constructor( constructor(
frame: BidiFrame, frame: BidiFrame,
name: string, name: string,
@ -121,17 +123,26 @@ export class ExposeableFunction<Args extends unknown[], Ret> {
) )
); );
await connection.send('script.addPreloadScript', { const {result} = await connection.send('script.addPreloadScript', {
functionDeclaration, functionDeclaration,
arguments: channelArguments, arguments: channelArguments,
contexts: [this.#frame.page().mainFrame()._id],
}); });
this.#preloadScriptId = result.script;
await connection.send('script.callFunction', { await Promise.all(
functionDeclaration, this.#frame
arguments: channelArguments, .page()
awaitPromise: false, .frames()
target: this.#frame.mainRealm().realm.target, .map(async frame => {
}); return await connection.send('script.callFunction', {
functionDeclaration,
arguments: channelArguments,
awaitPromise: false,
target: frame.mainRealm().realm.target,
});
})
);
} }
#handleArgumentsMessage = async (params: Bidi.Script.MessageParameters) => { #handleArgumentsMessage = async (params: Bidi.Script.MessageParameters) => {
@ -277,4 +288,16 @@ export class ExposeableFunction<Args extends unknown[], Ret> {
} }
return {callbacks, remoteValue: data}; return {callbacks, remoteValue: data};
} }
[Symbol.dispose](): void {
void this[Symbol.asyncDispose]().catch(debugError);
}
async [Symbol.asyncDispose](): Promise<void> {
if (this.#preloadScriptId) {
await this.#connection.send('script.removePreloadScript', {
script: this.#preloadScriptId,
});
}
}
} }

View File

@ -746,7 +746,7 @@ export class BidiPage extends Page {
const expression = evaluationExpression(pageFunction, ...args); const expression = evaluationExpression(pageFunction, ...args);
const {result} = await this.#connection.send('script.addPreloadScript', { const {result} = await this.#connection.send('script.addPreloadScript', {
functionDeclaration: expression, functionDeclaration: expression,
// TODO: should change spec to accept browsingContext contexts: [this.mainFrame()._id],
}); });
return {identifier: result.script}; return {identifier: result.script};

View File

@ -83,12 +83,6 @@
"parameters": ["webDriverBiDi"], "parameters": ["webDriverBiDi"],
"expectations": ["FAIL"] "expectations": ["FAIL"]
}, },
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.removeScriptToEvaluateOnNewDocument *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{ {
"testIdPattern": "[fixtures.spec] *", "testIdPattern": "[fixtures.spec] *",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -599,6 +593,18 @@
"parameters": ["webDriverBiDi"], "parameters": ["webDriverBiDi"],
"expectations": ["PASS"] "expectations": ["PASS"]
}, },
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.removeScriptToEvaluateOnNewDocument *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[evaluation.spec] Evaluation specs Page.removeScriptToEvaluateOnNewDocument *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{ {
"testIdPattern": "[evaluation.spec] Evaluation specs Page.removeScriptToEvaluateOnNewDocument *", "testIdPattern": "[evaluation.spec] Evaluation specs Page.removeScriptToEvaluateOnNewDocument *",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -2609,12 +2615,6 @@
"parameters": ["cdp", "firefox"], "parameters": ["cdp", "firefox"],
"expectations": ["FAIL"] "expectations": ["FAIL"]
}, },
{
"testIdPattern": "[network.spec] network Network Events should support redirects",
"platforms": ["win32"],
"parameters": ["cdp", "chrome"],
"expectations": ["FAIL", "PASS"]
},
{ {
"testIdPattern": "[network.spec] network Page.authenticate should allow disable authentication", "testIdPattern": "[network.spec] network Page.authenticate should allow disable authentication",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -2765,6 +2765,12 @@
"parameters": ["firefox", "webDriverBiDi"], "parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL", "PASS"] "expectations": ["FAIL", "PASS"]
}, },
{
"testIdPattern": "[network.spec] network Response.fromCache should work",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{ {
"testIdPattern": "[network.spec] network Response.fromServiceWorker Response.fromServiceWorker", "testIdPattern": "[network.spec] network Response.fromServiceWorker Response.fromServiceWorker",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
@ -2831,12 +2837,6 @@
"parameters": ["chrome", "webDriverBiDi"], "parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"] "expectations": ["PASS"]
}, },
{
"testIdPattern": "[oopif.spec] OOPIF should provide access to elements",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{ {
"testIdPattern": "[oopif.spec] OOPIF should support evaluating in oop iframes", "testIdPattern": "[oopif.spec] OOPIF should support evaluating in oop iframes",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],