chromium-bidi
Version:
An implementation of the WebDriver BiDi protocol for Chromium implemented as a JavaScript layer translating between BiDi and CDP, running inside a Chrome tab.
65 lines • 2.28 kB
JavaScript
/**
* Copyright 2025 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 { InvalidWebExtensionException, UnsupportedOperationException, NoSuchWebExtensionException, } from '../../../protocol/protocol.js';
/**
* Responsible for handling the `webModule` module.
*/
export class WebExtensionProcessor {
constructor(browserCdpClient) {
this.
}
async install(params) {
switch (params.extensionData.type) {
case 'archivePath':
case 'base64':
throw new UnsupportedOperationException('Archived and Base64 extensions are not supported');
case 'path':
break;
}
try {
const response = await this.
path: params.extensionData.path,
});
return {
extension: response.id,
};
}
catch (err) {
if (err.message.startsWith('invalid web extension')) {
throw new InvalidWebExtensionException(err.message);
}
throw err;
}
}
async uninstall(params) {
try {
await this.
id: params.extension,
});
return {};
}
catch (err) {
if (err.message ===
'Uninstall failed. Reason: could not find extension.') {
throw new NoSuchWebExtensionException('no such web extension');
}
throw err;
}
}
}
//# sourceMappingURL=WebExtensionProcessor.js.map