* The BiDi `webExtension.ExtensionData` for `extension`. A directory only resolves on the * machine running the browser, so unless the session runs on a driver service this client * started (see Symbols.localDriverService) it is uploaded first; an archive or base64 * bytes travel inline.
(driver, extension)
| 137 | * @return {!Promise<import('../bidi/generated/webextension').WebExtensionExtensionData>} |
| 138 | */ |
| 139 | async function extensionData(driver, extension) { |
| 140 | checkExtensionArg(extension) |
| 141 | const stats = await statOrNull(extension) |
| 142 | if (stats?.isDirectory()) { |
| 143 | const dir = path.resolve(extension) |
| 144 | const local = driver.getExecutor()[Symbols.localDriverService] === true |
| 145 | return { type: 'path', path: local ? dir : await uploadDirectory(driver, dir) } |
| 146 | } |
| 147 | return { type: 'base64', value: await encodeExtension(extension) } |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Uploads `dir` to the remote end and returns the path it was unpacked to there. |
no test coverage detected