@webex/plugin-meetings 3.13.0-next.5 → 3.13.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +17 -1
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/common/wasm-loader.js +174 -0
- package/dist/common/wasm-loader.js.map +1 -0
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/e2ee/E2eeManager.js +91 -0
- package/dist/e2ee/E2eeManager.js.map +1 -0
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meetings/index.js +20 -0
- package/dist/meetings/index.js.map +1 -1
- package/dist/types/common/wasm-loader.d.ts +55 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/e2ee/E2eeManager.d.ts +23 -0
- package/dist/types/meetings/index.d.ts +4 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +1 -1
- package/src/common/wasm-loader.ts +124 -0
- package/src/config.ts +1 -0
- package/src/e2ee/E2eeManager.ts +58 -0
- package/src/meetings/ai-docs/meetings-spec.md +2 -0
- package/src/meetings/index.ts +18 -0
- package/test/unit/spec/common/wasm-loader.ts +171 -0
- package/test/unit/spec/e2ee/E2eeManager.ts +82 -0
- package/test/unit/spec/meetings/index.js +20 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* An emscripten MODULARIZE factory — the default export of a generated `*.js` WASM loader. Calling
|
|
6
|
+
* it instantiates the module; `locateFile` lets us point the loader at the `.wasm` binary URL.
|
|
7
|
+
*/
|
|
8
|
+
export type EmscriptenModuleFactory<TModule = unknown> = (moduleOverrides?: {
|
|
9
|
+
locateFile?: (path: string) => string;
|
|
10
|
+
}) => Promise<TModule>;
|
|
11
|
+
type ModuleImporter = (jsUrl: string) => Promise<{
|
|
12
|
+
default: EmscriptenModuleFactory;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Loads and caches emscripten WebAssembly modules, each uniquely identified by its `.wasm` URL
|
|
16
|
+
* (the `.js` loader URL is derived by replacing the `.wasm` suffix). A single instance can load
|
|
17
|
+
* multiple distinct modules; each URL is loaded at most once and cached. Instantiated once per
|
|
18
|
+
* session so slow loads can be warmed ahead of when they're needed.
|
|
19
|
+
*/
|
|
20
|
+
export default class WasmLoader {
|
|
21
|
+
private readonly importModule;
|
|
22
|
+
private readonly modules;
|
|
23
|
+
/**
|
|
24
|
+
* @param {Object} [options]
|
|
25
|
+
* @param {Function} [options.importModule] - Override the dynamic import (used by tests).
|
|
26
|
+
*/
|
|
27
|
+
constructor({ importModule }?: {
|
|
28
|
+
importModule?: ModuleImporter;
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} wasmUrl
|
|
32
|
+
* @returns {boolean} whether the module for the given URL has finished loading and is cached.
|
|
33
|
+
*/
|
|
34
|
+
isLoaded(wasmUrl: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Warms the cache for the given module URL. Safe to call repeatedly; concurrent calls share a
|
|
37
|
+
* single load.
|
|
38
|
+
* @param {string} wasmUrl
|
|
39
|
+
* @returns {Promise<void>}
|
|
40
|
+
*/
|
|
41
|
+
preload(wasmUrl: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the cached module for the given URL, loading it if necessary.
|
|
44
|
+
* @param {string} wasmUrl
|
|
45
|
+
* @returns {Promise<TModule>}
|
|
46
|
+
*/
|
|
47
|
+
get<TModule = unknown>(wasmUrl: string): Promise<TModule>;
|
|
48
|
+
/**
|
|
49
|
+
* @param {string} wasmUrl
|
|
50
|
+
* @param {CachedModule} cached
|
|
51
|
+
* @returns {Promise<unknown>}
|
|
52
|
+
*/
|
|
53
|
+
private load;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
package/dist/types/config.d.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import WasmLoader from '../common/wasm-loader';
|
|
5
|
+
/**
|
|
6
|
+
* Owns E2EE resource preloading for a Meetings plugin session. The per-meeting controller is added
|
|
7
|
+
* in the follow-up integration change; this first step keeps the slow WASM load off the join path.
|
|
8
|
+
*/
|
|
9
|
+
export default class E2eeManager {
|
|
10
|
+
private readonly webex;
|
|
11
|
+
private readonly wasmLoader;
|
|
12
|
+
private readonly assetLoader;
|
|
13
|
+
constructor({ webex, wasmLoader }: {
|
|
14
|
+
webex: any;
|
|
15
|
+
wasmLoader: WasmLoader;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Warms the E2EE WASM module when configured and supported. Callers should not await this from
|
|
19
|
+
* registration; a loading failure must not prevent the client from registering for meetings.
|
|
20
|
+
* @returns {Promise<void>}
|
|
21
|
+
*/
|
|
22
|
+
preload(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -5,6 +5,8 @@ import { WebexPlugin } from '@webex/webex-core';
|
|
|
5
5
|
import { DeviceRegistrationOptions } from '@webex/internal-plugin-device';
|
|
6
6
|
import * as mediaHelpersModule from '@webex/media-helpers';
|
|
7
7
|
import 'webrtc-adapter';
|
|
8
|
+
import WasmLoader from '../common/wasm-loader';
|
|
9
|
+
import E2eeManager from '../e2ee/E2eeManager';
|
|
8
10
|
import { LOCUSEVENT, DESTINATION_TYPE } from '../constants';
|
|
9
11
|
import { CallStateForMetrics } from '../meeting';
|
|
10
12
|
import Reachability from '../reachability';
|
|
@@ -104,6 +106,8 @@ export default class Meetings extends WebexPlugin {
|
|
|
104
106
|
breakoutLocusForHandleLater: any;
|
|
105
107
|
namespace: string;
|
|
106
108
|
registrationStatus: MeetingRegistrationStatus;
|
|
109
|
+
wasmLoader?: WasmLoader;
|
|
110
|
+
e2eeManager?: E2eeManager;
|
|
107
111
|
/**
|
|
108
112
|
* Emits a metric describing how well this browser runs WebAssembly, used to spot browsers
|
|
109
113
|
* where real-time WASM effects (e.g. background noise removal) run poorly.
|
package/dist/webinar/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import LoggerProxy from './logs/logger-proxy';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* An emscripten MODULARIZE factory — the default export of a generated `*.js` WASM loader. Calling
|
|
9
|
+
* it instantiates the module; `locateFile` lets us point the loader at the `.wasm` binary URL.
|
|
10
|
+
*/
|
|
11
|
+
export type EmscriptenModuleFactory<TModule = unknown> = (moduleOverrides?: {
|
|
12
|
+
locateFile?: (path: string) => string;
|
|
13
|
+
}) => Promise<TModule>;
|
|
14
|
+
|
|
15
|
+
type ModuleImporter = (jsUrl: string) => Promise<{default: EmscriptenModuleFactory}>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Natively imports an emscripten loader served at runtime.
|
|
19
|
+
*
|
|
20
|
+
* This must stay a real `import()`: babel.config.js excludes `transform-dynamic-import` for this
|
|
21
|
+
* file so Babel doesn't rewrite it to `require()`, and `webpackIgnore` stops consumers' webpack
|
|
22
|
+
* from trying to bundle it. The URL is resolved against the document because a native `import()`
|
|
23
|
+
* would otherwise resolve relative paths against the SDK bundle's URL.
|
|
24
|
+
* @param {string} jsUrl - URL of the emscripten loader module (e.g. '/assets/plugin-meetings/e2ee.js').
|
|
25
|
+
* @returns {Promise<{default: EmscriptenModuleFactory}>}
|
|
26
|
+
*/
|
|
27
|
+
const nativeImport: ModuleImporter = (jsUrl) =>
|
|
28
|
+
import(/* webpackIgnore: true */ new URL(jsUrl, document.baseURI).href);
|
|
29
|
+
|
|
30
|
+
interface CachedModule {
|
|
31
|
+
instance: unknown | null;
|
|
32
|
+
loadPromise: Promise<unknown> | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Loads and caches emscripten WebAssembly modules, each uniquely identified by its `.wasm` URL
|
|
37
|
+
* (the `.js` loader URL is derived by replacing the `.wasm` suffix). A single instance can load
|
|
38
|
+
* multiple distinct modules; each URL is loaded at most once and cached. Instantiated once per
|
|
39
|
+
* session so slow loads can be warmed ahead of when they're needed.
|
|
40
|
+
*/
|
|
41
|
+
export default class WasmLoader {
|
|
42
|
+
private readonly importModule: ModuleImporter;
|
|
43
|
+
|
|
44
|
+
private readonly modules = new Map<string, CachedModule>();
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {Object} [options]
|
|
48
|
+
* @param {Function} [options.importModule] - Override the dynamic import (used by tests).
|
|
49
|
+
*/
|
|
50
|
+
constructor({importModule}: {importModule?: ModuleImporter} = {}) {
|
|
51
|
+
this.importModule = importModule || nativeImport;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {string} wasmUrl
|
|
56
|
+
* @returns {boolean} whether the module for the given URL has finished loading and is cached.
|
|
57
|
+
*/
|
|
58
|
+
isLoaded(wasmUrl: string): boolean {
|
|
59
|
+
const cached = this.modules.get(wasmUrl);
|
|
60
|
+
|
|
61
|
+
return !!cached && cached.instance !== null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Warms the cache for the given module URL. Safe to call repeatedly; concurrent calls share a
|
|
66
|
+
* single load.
|
|
67
|
+
* @param {string} wasmUrl
|
|
68
|
+
* @returns {Promise<void>}
|
|
69
|
+
*/
|
|
70
|
+
async preload(wasmUrl: string): Promise<void> {
|
|
71
|
+
await this.get(wasmUrl);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns the cached module for the given URL, loading it if necessary.
|
|
76
|
+
* @param {string} wasmUrl
|
|
77
|
+
* @returns {Promise<TModule>}
|
|
78
|
+
*/
|
|
79
|
+
get<TModule = unknown>(wasmUrl: string): Promise<TModule> {
|
|
80
|
+
let cached = this.modules.get(wasmUrl);
|
|
81
|
+
|
|
82
|
+
if (!cached) {
|
|
83
|
+
cached = {instance: null, loadPromise: null};
|
|
84
|
+
this.modules.set(wasmUrl, cached);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (cached.instance !== null) {
|
|
88
|
+
return Promise.resolve(cached.instance as TModule);
|
|
89
|
+
}
|
|
90
|
+
if (!cached.loadPromise) {
|
|
91
|
+
cached.loadPromise = this.load(wasmUrl, cached);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return cached.loadPromise as Promise<TModule>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @param {string} wasmUrl
|
|
99
|
+
* @param {CachedModule} cached
|
|
100
|
+
* @returns {Promise<unknown>}
|
|
101
|
+
*/
|
|
102
|
+
private async load(wasmUrl: string, cached: CachedModule): Promise<unknown> {
|
|
103
|
+
const jsUrl = wasmUrl.replace(/\.wasm(?=[?#]|$)/, '.js');
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
const {default: factory} = await this.importModule(jsUrl);
|
|
107
|
+
const instance = await factory({
|
|
108
|
+
locateFile: (path: string) => (path.endsWith('.wasm') ? wasmUrl : path),
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
cached.instance = instance;
|
|
112
|
+
|
|
113
|
+
return instance;
|
|
114
|
+
} catch (error) {
|
|
115
|
+
// Reset so a failed load can be retried on the next get().
|
|
116
|
+
cached.loadPromise = null;
|
|
117
|
+
LoggerProxy.logger.error(
|
|
118
|
+
`WasmLoader#load --> failed to load WASM module ${wasmUrl}: ${error}`
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
throw new Error(`Failed to load WASM module ${wasmUrl}: ${error}`, {cause: error});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -84,6 +84,7 @@ export default {
|
|
|
84
84
|
receiveTranscription: false,
|
|
85
85
|
enableExtmap: false,
|
|
86
86
|
enableAutomaticLLM: false,
|
|
87
|
+
enableE2ee: false,
|
|
87
88
|
assetsBaseUrl: getUmdAssetsBaseUrl('plugin-meetings', SDK_VERSION, PACKAGE_VERSION),
|
|
88
89
|
installedOrgID: undefined,
|
|
89
90
|
multipartSitePrefixList: ['.my.', '.mydmz.', '.mybts.', '.mydev.', '.myats2.', '.myats.'],
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
|
|
6
|
+
// @ts-ignore - StaticAssetLoader is exported from webex-core's JavaScript entry point.
|
|
7
|
+
import {StaticAssetLoader} from '@webex/webex-core';
|
|
8
|
+
|
|
9
|
+
import LoggerProxy from '../common/logs/logger-proxy';
|
|
10
|
+
import WasmLoader from '../common/wasm-loader';
|
|
11
|
+
|
|
12
|
+
/* The WASM module that contains the libe2ee + mlspp libraries with a WebE2EE wrapper around them, required for joining MLS group for E2EE meetings.
|
|
13
|
+
* The version is in the filename as it is important that JS-SDK implementation of MLS class matches the WASM module version.
|
|
14
|
+
*/
|
|
15
|
+
const E2EE_WASM_ASSET = 'e2ee-0.0.1.wasm';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Owns E2EE resource preloading for a Meetings plugin session. The per-meeting controller is added
|
|
19
|
+
* in the follow-up integration change; this first step keeps the slow WASM load off the join path.
|
|
20
|
+
*/
|
|
21
|
+
export default class E2eeManager {
|
|
22
|
+
private readonly webex: any;
|
|
23
|
+
|
|
24
|
+
private readonly wasmLoader: WasmLoader;
|
|
25
|
+
|
|
26
|
+
private readonly assetLoader: StaticAssetLoader;
|
|
27
|
+
|
|
28
|
+
constructor({webex, wasmLoader}: {webex: any; wasmLoader: WasmLoader}) {
|
|
29
|
+
this.webex = webex;
|
|
30
|
+
this.wasmLoader = wasmLoader;
|
|
31
|
+
this.assetLoader = new StaticAssetLoader(
|
|
32
|
+
{baseUrl: webex.config.meetings.assetsBaseUrl},
|
|
33
|
+
{parent: webex}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Warms the E2EE WASM module when configured and supported. Callers should not await this from
|
|
39
|
+
* registration; a loading failure must not prevent the client from registering for meetings.
|
|
40
|
+
* @returns {Promise<void>}
|
|
41
|
+
*/
|
|
42
|
+
async preload(): Promise<void> {
|
|
43
|
+
const enabled = !!this.webex?.config?.meetings?.enableE2ee;
|
|
44
|
+
const supported = WebCapabilities.supportsWasm() === CapabilityState.CAPABLE;
|
|
45
|
+
|
|
46
|
+
if (!enabled || !supported) {
|
|
47
|
+
LoggerProxy.logger.info('e2ee: E2eeManager#preload --> E2EE disabled or unsupported');
|
|
48
|
+
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const wasmUrl = this.assetLoader.getUrl(E2EE_WASM_ASSET);
|
|
53
|
+
|
|
54
|
+
LoggerProxy.logger.info('e2ee: E2eeManager#preload --> preloading WASM module');
|
|
55
|
+
await this.wasmLoader.preload(wasmUrl);
|
|
56
|
+
LoggerProxy.logger.info('e2ee: E2eeManager#preload --> WASM module preloaded');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -115,6 +115,7 @@ Webex core host, device and Mercury plugins, meeting-info services, Meeting cons
|
|
|
115
115
|
| `MEETINGS-R-003` | `executeRegistrationStep()` marks a step `true` whenever its supplied promise resolves and rethrows a rejection without resetting other flags. `fetchUserPreferredWebexSite()` catches its own failures and resolves, while the `startReachability` registration callback catches that gather rejection and resolves; those two steps are therefore marked successful even when their underlying work failed. `unregister()` removes Locus, ROAP, and `ONLINE` Mercury listeners plus device state, but leaves the `OFFLINE` listener installed. | Registration status records wrapper settlement, not necessarily underlying site/reachability success; other rejected steps preserve partial progress until the next `register()` reset, and the residual `OFFLINE` listener must stay visible as a teardown gap. | `src/meetings/index.ts` | `test/unit/spec/meetings/index.js` | characterize absorbed site/reachability failures, partial status after a non-absorbed rejection, and the surviving `OFFLINE` callback | PRESENT |
|
|
116
116
|
| `MEETINGS-R-004` | `register()` starts site, geo, reachability, device-registration, and H.264 work together through `Promise.all`; Mercury connect is chained after device registration. Each wrapper-resolved step updates its own status, including the failure-absorbing site and reachability wrappers. `syncMeetings()` runs later from the Mercury `ONLINE` handler installed by `listenForEvents()`. | Registration readiness and active-meeting synchronization are distinct phases, and preserving wrapper-level settlement and actual concurrency prevents callers from depending on a nonexistent success definition or serial order. | `src/meetings/index.ts`, `src/meetings/meetings.types.ts` | `test/unit/spec/meetings/index.js` | none | PRESENT |
|
|
117
117
|
| `MEETINGS-R-007` | `emitWasmRuntimePerformance(correlationId)` is a `once()`-wrapped private probe that runs `WasmRuntimeProbe.check()` and reports `WASM_RUNTIME_PERFORMANCE` (`js_sdk_wasm_runtime_performance`) with `status`, `capability`, `reason`, the destructured measurements `divRatio`, `sqrtRatio`, `addNsPerOp`, `addMedianMs`, `divMedianMs`, `sqrtMedianMs`, and `correlation_id`. Each measurement defaults to `null` when `result.measurements` is absent or omits it. Both a probe rejection and a metric-submission rejection are caught and logged only. | The probe is diagnostic: it exists to find browsers where real-time WASM effects run poorly, so it must never be able to fail meeting creation. Explicit `null` defaults keep the metric schema fixed-width so the fields stay comparable across browsers that report partial measurements, and `once()` keeps one sample per plugin instance rather than one per meeting. | `src/meetings/index.ts`, `src/metrics/constants.ts` | `test/unit/spec/meetings/index.js` | none | PRESENT |
|
|
118
|
+
| `MEETINGS-R-008` | Meetings owns one shared `WasmLoader`; after successful registration it starts E2EE WASM preloading when `meetings.enableE2ee` is true and WebAssembly is supported. Preload is fire-and-forget, so a preload rejection is logged and does not change registration success. | Keep module initialization off the meeting join path while preserving registration behavior when the optional asset is unavailable. | `src/meetings/index.ts`, `src/common/wasm-loader.ts`, `src/e2ee/E2eeManager.ts` | `test/unit/spec/meetings/index.js`, `test/unit/spec/common/wasm-loader.ts`, `test/unit/spec/e2ee/E2eeManager.ts` | Actual E2EE assets are supplied separately. | PRESENT |
|
|
118
119
|
| `MEETINGS-R-005` | Mercury/Locus events resolve an existing meeting by supported keys before creating or routing a new object. | Stable meeting identity prevents duplicate Meeting objects and misrouted realtime updates. | `src/meetings/index.ts`, `src/meetings/collection.ts` | `test/unit/spec/meetings/index.js`, `test/unit/spec/meetings/collection.js` | none | PRESENT |
|
|
119
120
|
| `MEETINGS-R-006` | Reachability, geo hints, site preferences, PMR, and active-meeting queries delegate to their current request/controller boundaries. | Central plugin access must preserve host credentials, service discovery, and established response/error behavior. | `src/meetings/index.ts`, `src/meetings/request.ts` | `test/unit/spec/meetings/request.js` | none | PRESENT |
|
|
120
121
|
|
|
@@ -289,6 +290,7 @@ Use the current mirrored suites: `test/unit/spec/meetings/collection.js`, `test/
|
|
|
289
290
|
| `MEETINGS-R-005` | `test/unit/spec/meetings/index.js`, `test/unit/spec/meetings/collection.js` | verify alternate-key collision cases |
|
|
290
291
|
| `MEETINGS-R-006` | `test/unit/spec/meetings/request.js` | none |
|
|
291
292
|
| `MEETINGS-R-007` | `test/unit/spec/meetings/index.js` | covered for the full-measurements payload, the `null` defaults when measurements are absent, and the swallowed probe rejection |
|
|
293
|
+
| `MEETINGS-R-008` | `test/unit/spec/meetings/index.js`, `test/unit/spec/common/wasm-loader.ts`, `test/unit/spec/e2ee/E2eeManager.ts` | cover configured asset URL, config/capability gating, module caching/retry, and registration resilience |
|
|
292
294
|
|
|
293
295
|
## Traceability
|
|
294
296
|
|
package/src/meetings/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ import LoggerRequest from '../common/logs/request';
|
|
|
21
21
|
import Trigger from '../common/events/trigger-proxy';
|
|
22
22
|
import Media from '../media';
|
|
23
23
|
import MeetingUtil from '../meeting/util';
|
|
24
|
+
import WasmLoader from '../common/wasm-loader';
|
|
25
|
+
import E2eeManager from '../e2ee/E2eeManager';
|
|
24
26
|
import {
|
|
25
27
|
MEETINGS,
|
|
26
28
|
EVENTS,
|
|
@@ -210,6 +212,8 @@ export default class Meetings extends WebexPlugin {
|
|
|
210
212
|
breakoutLocusForHandleLater: any;
|
|
211
213
|
namespace = MEETINGS;
|
|
212
214
|
registrationStatus: MeetingRegistrationStatus;
|
|
215
|
+
wasmLoader?: WasmLoader;
|
|
216
|
+
e2eeManager?: E2eeManager;
|
|
213
217
|
|
|
214
218
|
/**
|
|
215
219
|
* Emits a metric describing how well this browser runs WebAssembly, used to spot browsers
|
|
@@ -348,6 +352,9 @@ export default class Meetings extends WebexPlugin {
|
|
|
348
352
|
getUserMedia: Media.getUserMedia,
|
|
349
353
|
};
|
|
350
354
|
|
|
355
|
+
// Shared runtime cache for WASM modules used by meetings.
|
|
356
|
+
this.wasmLoader = new WasmLoader();
|
|
357
|
+
|
|
351
358
|
this.onReady();
|
|
352
359
|
}
|
|
353
360
|
|
|
@@ -808,6 +815,10 @@ export default class Meetings extends WebexPlugin {
|
|
|
808
815
|
mediaLogger = new MediaLogger();
|
|
809
816
|
setLogger(mediaLogger);
|
|
810
817
|
|
|
818
|
+
// Construct after READY because the manager uses the initialized webex client and config.
|
|
819
|
+
// @ts-ignore
|
|
820
|
+
this.e2eeManager = new E2eeManager({webex: this.webex, wasmLoader: this.wasmLoader});
|
|
821
|
+
|
|
811
822
|
/**
|
|
812
823
|
* The MeetingInfo object to interact with server
|
|
813
824
|
* @instance
|
|
@@ -1125,6 +1136,13 @@ export default class Meetings extends WebexPlugin {
|
|
|
1125
1136
|
);
|
|
1126
1137
|
this.registered = true;
|
|
1127
1138
|
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETINGS_REGISTRATION_SUCCESS);
|
|
1139
|
+
|
|
1140
|
+
// Preload is best-effort and must not delay or fail Meetings registration.
|
|
1141
|
+
this.e2eeManager?.preload().catch((error) => {
|
|
1142
|
+
LoggerProxy.logger.warn(
|
|
1143
|
+
`Meetings:index#register --> E2EE preload failed: ${error?.message || error}`
|
|
1144
|
+
);
|
|
1145
|
+
});
|
|
1128
1146
|
})
|
|
1129
1147
|
.catch((error) => {
|
|
1130
1148
|
LoggerProxy.logger.error(
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import 'jsdom-global/register';
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import sinon from 'sinon';
|
|
7
|
+
import WasmLoader from '@webex/plugin-meetings/src/common/wasm-loader';
|
|
8
|
+
|
|
9
|
+
describe('plugin-meetings', () => {
|
|
10
|
+
describe('WasmLoader', () => {
|
|
11
|
+
const WASM_URL = '/assets/e2ee.wasm';
|
|
12
|
+
const OTHER_WASM_URL = '/assets/other.wasm';
|
|
13
|
+
|
|
14
|
+
let factory;
|
|
15
|
+
let importModule;
|
|
16
|
+
let moduleInstance;
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
moduleInstance = {name: 'e2ee-module'};
|
|
20
|
+
factory = sinon.stub().resolves(moduleInstance);
|
|
21
|
+
importModule = sinon.stub().resolves({default: factory});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
sinon.restore();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('get', () => {
|
|
29
|
+
it('derives the .js loader url from the .wasm url and points locateFile at the .wasm binary', async () => {
|
|
30
|
+
const loader = new WasmLoader({importModule});
|
|
31
|
+
|
|
32
|
+
const result = await loader.get(WASM_URL);
|
|
33
|
+
|
|
34
|
+
assert.calledOnceWithExactly(importModule, '/assets/e2ee.js');
|
|
35
|
+
assert.calledOnce(factory);
|
|
36
|
+
const {locateFile} = factory.firstCall.args[0];
|
|
37
|
+
assert.equal(locateFile('e2ee.wasm'), WASM_URL);
|
|
38
|
+
assert.equal(locateFile('e2ee.worker.js'), 'e2ee.worker.js');
|
|
39
|
+
assert.strictEqual(result, moduleInstance);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
wasmUrl: 'https://cdn.example.com/x.wasm-assets/e2ee-0.0.1.wasm',
|
|
45
|
+
jsUrl: 'https://cdn.example.com/x.wasm-assets/e2ee-0.0.1.js',
|
|
46
|
+
},
|
|
47
|
+
{wasmUrl: '/assets/e2ee.wasm?v=1', jsUrl: '/assets/e2ee.js?v=1'},
|
|
48
|
+
{wasmUrl: '/assets/e2ee.wasm#hash', jsUrl: '/assets/e2ee.js#hash'},
|
|
49
|
+
].forEach(({wasmUrl, jsUrl}) => {
|
|
50
|
+
it(`imports ${jsUrl} for ${wasmUrl}, replacing only the .wasm suffix`, async () => {
|
|
51
|
+
const loader = new WasmLoader({importModule});
|
|
52
|
+
|
|
53
|
+
await loader.get(wasmUrl);
|
|
54
|
+
|
|
55
|
+
assert.calledOnceWithExactly(importModule, jsUrl);
|
|
56
|
+
assert.equal(factory.firstCall.args[0].locateFile('e2ee.wasm'), wasmUrl);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('loads each url only once and returns the cached instance on subsequent calls', async () => {
|
|
61
|
+
const loader = new WasmLoader({importModule});
|
|
62
|
+
|
|
63
|
+
const first = await loader.get(WASM_URL);
|
|
64
|
+
const second = await loader.get(WASM_URL);
|
|
65
|
+
|
|
66
|
+
assert.calledOnce(importModule);
|
|
67
|
+
assert.calledOnce(factory);
|
|
68
|
+
assert.strictEqual(first, second);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('shares a single load across concurrent calls for the same url', async () => {
|
|
72
|
+
const loader = new WasmLoader({importModule});
|
|
73
|
+
|
|
74
|
+
const [first, second] = await Promise.all([loader.get(WASM_URL), loader.get(WASM_URL)]);
|
|
75
|
+
|
|
76
|
+
assert.calledOnce(importModule);
|
|
77
|
+
assert.strictEqual(first, second);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('loads distinct urls independently', async () => {
|
|
81
|
+
const otherInstance = {name: 'other-module'};
|
|
82
|
+
importModule
|
|
83
|
+
.withArgs('/assets/e2ee.js')
|
|
84
|
+
.resolves({default: factory})
|
|
85
|
+
.withArgs('/assets/other.js')
|
|
86
|
+
.resolves({default: sinon.stub().resolves(otherInstance)});
|
|
87
|
+
const loader = new WasmLoader({importModule});
|
|
88
|
+
|
|
89
|
+
const e2ee = await loader.get(WASM_URL);
|
|
90
|
+
const other = await loader.get(OTHER_WASM_URL);
|
|
91
|
+
|
|
92
|
+
assert.calledTwice(importModule);
|
|
93
|
+
assert.calledWith(importModule, '/assets/e2ee.js');
|
|
94
|
+
assert.calledWith(importModule, '/assets/other.js');
|
|
95
|
+
assert.strictEqual(e2ee, moduleInstance);
|
|
96
|
+
assert.strictEqual(other, otherInstance);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('resets so a failed load can be retried, then rejects', async () => {
|
|
100
|
+
const error = new Error('network down');
|
|
101
|
+
importModule.onFirstCall().rejects(error).onSecondCall().resolves({default: factory});
|
|
102
|
+
const loader = new WasmLoader({importModule});
|
|
103
|
+
|
|
104
|
+
await assert.isRejected(
|
|
105
|
+
loader.get(WASM_URL),
|
|
106
|
+
/Failed to load WASM module \/assets\/e2ee\.wasm/
|
|
107
|
+
);
|
|
108
|
+
assert.isFalse(loader.isLoaded(WASM_URL));
|
|
109
|
+
|
|
110
|
+
const result = await loader.get(WASM_URL);
|
|
111
|
+
|
|
112
|
+
assert.calledTwice(importModule);
|
|
113
|
+
assert.strictEqual(result, moduleInstance);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('preserves the underlying error as the cause when the factory fails', async () => {
|
|
117
|
+
const error = new Error('instantiate failed');
|
|
118
|
+
factory.rejects(error);
|
|
119
|
+
const loader = new WasmLoader({importModule});
|
|
120
|
+
|
|
121
|
+
const rejection = await loader.get(WASM_URL).catch((e) => e);
|
|
122
|
+
|
|
123
|
+
assert.equal(
|
|
124
|
+
rejection.message,
|
|
125
|
+
'Failed to load WASM module /assets/e2ee.wasm: Error: instantiate failed'
|
|
126
|
+
);
|
|
127
|
+
assert.strictEqual(rejection.cause, error);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe('preload', () => {
|
|
132
|
+
it('warms the cache for the given url', async () => {
|
|
133
|
+
const loader = new WasmLoader({importModule});
|
|
134
|
+
|
|
135
|
+
await loader.preload(WASM_URL);
|
|
136
|
+
|
|
137
|
+
assert.calledOnceWithExactly(importModule, '/assets/e2ee.js');
|
|
138
|
+
assert.isTrue(loader.isLoaded(WASM_URL));
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe('isLoaded', () => {
|
|
143
|
+
it('is false for an unknown url', () => {
|
|
144
|
+
const loader = new WasmLoader({importModule});
|
|
145
|
+
|
|
146
|
+
assert.isFalse(loader.isLoaded(WASM_URL));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('is false while loading is in flight and true once resolved', async () => {
|
|
150
|
+
const loader = new WasmLoader({importModule});
|
|
151
|
+
|
|
152
|
+
const pending = loader.get(WASM_URL);
|
|
153
|
+
|
|
154
|
+
assert.isFalse(loader.isLoaded(WASM_URL));
|
|
155
|
+
|
|
156
|
+
await pending;
|
|
157
|
+
|
|
158
|
+
assert.isTrue(loader.isLoaded(WASM_URL));
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('tracks each url independently', async () => {
|
|
162
|
+
const loader = new WasmLoader({importModule});
|
|
163
|
+
|
|
164
|
+
await loader.get(WASM_URL);
|
|
165
|
+
|
|
166
|
+
assert.isTrue(loader.isLoaded(WASM_URL));
|
|
167
|
+
assert.isFalse(loader.isLoaded(OTHER_WASM_URL));
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import 'jsdom-global/register';
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import sinon from 'sinon';
|
|
7
|
+
import E2eeManager from '@webex/plugin-meetings/src/e2ee/E2eeManager';
|
|
8
|
+
import WasmLoader from '@webex/plugin-meetings/src/common/wasm-loader';
|
|
9
|
+
import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
|
|
10
|
+
|
|
11
|
+
describe('plugin-meetings', () => {
|
|
12
|
+
describe('E2eeManager', () => {
|
|
13
|
+
let supportsWasmStub;
|
|
14
|
+
|
|
15
|
+
const makeWebex = (enableE2ee?: boolean, assetsBaseUrl = '/assets/plugin-meetings/') => ({
|
|
16
|
+
config: {meetings: {enableE2ee, assetsBaseUrl}},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const makeWasmLoader = () => {
|
|
20
|
+
const wasmLoader = sinon.createStubInstance(WasmLoader);
|
|
21
|
+
wasmLoader.preload.resolves();
|
|
22
|
+
|
|
23
|
+
return wasmLoader;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
supportsWasmStub = sinon
|
|
28
|
+
.stub(WebCapabilities, 'supportsWasm')
|
|
29
|
+
.returns(CapabilityState.CAPABLE);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
sinon.restore();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('preload', () => {
|
|
37
|
+
it('preloads the module from the configured assets directory when enabled and supported', async () => {
|
|
38
|
+
const wasmLoader = makeWasmLoader();
|
|
39
|
+
const manager = new E2eeManager({
|
|
40
|
+
webex: makeWebex(true, 'https://cdn.example.com/sdk/meetings/'),
|
|
41
|
+
wasmLoader,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
await manager.preload();
|
|
45
|
+
|
|
46
|
+
assert.calledOnceWithExactly(
|
|
47
|
+
wasmLoader.preload,
|
|
48
|
+
'https://cdn.example.com/sdk/meetings/e2ee-0.0.1.wasm'
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('does not preload when the feature is disabled', async () => {
|
|
53
|
+
const wasmLoader = makeWasmLoader();
|
|
54
|
+
const manager = new E2eeManager({webex: makeWebex(false), wasmLoader});
|
|
55
|
+
|
|
56
|
+
await manager.preload();
|
|
57
|
+
|
|
58
|
+
assert.notCalled(wasmLoader.preload);
|
|
59
|
+
assert.calledOnce(supportsWasmStub);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('does not preload when WebAssembly is unsupported', async () => {
|
|
63
|
+
supportsWasmStub.returns(CapabilityState.NOT_CAPABLE);
|
|
64
|
+
const wasmLoader = makeWasmLoader();
|
|
65
|
+
const manager = new E2eeManager({webex: makeWebex(true), wasmLoader});
|
|
66
|
+
|
|
67
|
+
await manager.preload();
|
|
68
|
+
|
|
69
|
+
assert.notCalled(wasmLoader.preload);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('propagates preload errors for the registration caller to handle', async () => {
|
|
73
|
+
const error = new Error('asset load failed');
|
|
74
|
+
const wasmLoader = makeWasmLoader();
|
|
75
|
+
wasmLoader.preload.rejects(error);
|
|
76
|
+
const manager = new E2eeManager({webex: makeWebex(true), wasmLoader});
|
|
77
|
+
|
|
78
|
+
await assert.isRejected(manager.preload(), /asset load failed/);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|