first commit
This commit is contained in:
26
node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/browser/BrowserProcessor.d.ts
generated
vendored
Normal file
26
node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/browser/BrowserProcessor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { type EmptyResult, type Browser } from '../../../protocol/protocol.js';
|
||||
import type { CdpClient } from '../../BidiMapper.js';
|
||||
export declare class BrowserProcessor {
|
||||
#private;
|
||||
constructor(browserCdpClient: CdpClient);
|
||||
close(): EmptyResult;
|
||||
createUserContext(): Promise<Browser.CreateUserContextResult>;
|
||||
removeUserContext(userContext: Browser.UserContext): Promise<EmptyResult>;
|
||||
getUserContexts(): Promise<Browser.GetUserContextsResult>;
|
||||
}
|
||||
73
node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/browser/BrowserProcessor.js
generated
vendored
Normal file
73
node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/browser/BrowserProcessor.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BrowserProcessor = void 0;
|
||||
const protocol_js_1 = require("../../../protocol/protocol.js");
|
||||
class BrowserProcessor {
|
||||
#browserCdpClient;
|
||||
constructor(browserCdpClient) {
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
}
|
||||
close() {
|
||||
// Ensure that it is put at the end of the event loop.
|
||||
// This way we send back the response before closing the tab.
|
||||
setTimeout(() => this.#browserCdpClient.sendCommand('Browser.close'), 0);
|
||||
return {};
|
||||
}
|
||||
async createUserContext() {
|
||||
const context = await this.#browserCdpClient.sendCommand('Target.createBrowserContext');
|
||||
return {
|
||||
userContext: context.browserContextId,
|
||||
};
|
||||
}
|
||||
async removeUserContext(userContext) {
|
||||
if (userContext === 'default') {
|
||||
throw new protocol_js_1.InvalidArgumentException('`default` user context cannot be removed');
|
||||
}
|
||||
try {
|
||||
await this.#browserCdpClient.sendCommand('Target.disposeBrowserContext', {
|
||||
browserContextId: userContext,
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/protocol/target_handler.cc;l=1424;drc=c686e8f4fd379312469fe018f5c390e9c8f20d0d
|
||||
if (err.message.startsWith('Failed to find context with id')) {
|
||||
throw new protocol_js_1.NoSuchUserContextException(err.message);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
async getUserContexts() {
|
||||
const result = await this.#browserCdpClient.sendCommand('Target.getBrowserContexts');
|
||||
return {
|
||||
userContexts: [
|
||||
{
|
||||
userContext: 'default',
|
||||
},
|
||||
...result.browserContextIds.map((id) => {
|
||||
return {
|
||||
userContext: id,
|
||||
};
|
||||
}),
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.BrowserProcessor = BrowserProcessor;
|
||||
//# sourceMappingURL=BrowserProcessor.js.map
|
||||
1
node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/browser/BrowserProcessor.js.map
generated
vendored
Normal file
1
node_modules/chromium-bidi/lib/cjs/bidiMapper/domains/browser/BrowserProcessor.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BrowserProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/browser/BrowserProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+DAKuC;AAGvC,MAAa,gBAAgB;IAClB,iBAAiB,CAAY;IAEtC,YAAY,gBAA2B;QACrC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,KAAK;QACH,sDAAsD;QACtD,6DAA6D;QAC7D,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CACtD,6BAA6B,CAC9B,CAAC;QACF,OAAO;YACL,WAAW,EAAE,OAAO,CAAC,gBAAgB;SACtC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,WAAgC;QAEhC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,sCAAwB,CAChC,0CAA0C,CAC3C,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,8BAA8B,EAAE;gBACvE,gBAAgB,EAAE,WAAW;aAC9B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,E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