소스 검색

e2ee: avoid CORS issues with the worker bundle

dev1
Saúl Ibarra Corretgé 5 년 전
부모
커밋
f761413976
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8
    2
      modules/e2ee/E2EEContext.js

+ 8
- 2
modules/e2ee/E2EEContext.js 파일 보기

45
             baseUrl = `${ljm.src.substring(0, idx)}/`;
45
             baseUrl = `${ljm.src.substring(0, idx)}/`;
46
         }
46
         }
47
 
47
 
48
-        // Initialize the E2EE worker.
49
-        this._worker = new Worker(`${baseUrl}lib-jitsi-meet.e2ee-worker.js`, { name: 'E2EE Worker' });
48
+        // Initialize the E2EE worker. In order to avoid CORS issues, start the worker and have it
49
+        // synchronously load the JS.
50
+        const workerUrl = `${baseUrl}lib-jitsi-meet.e2ee-worker.js`;
51
+        const workerBlob
52
+            = new Blob([ `importScripts("${workerUrl}");` ], { type: 'application/javascript' });
53
+        const blobUrl = window.URL.createObjectURL(workerBlob);
54
+
55
+        this._worker = new Worker(blobUrl, { name: 'E2EE Worker' });
50
         this._worker.onerror = e => logger.onerror(e);
56
         this._worker.onerror = e => logger.onerror(e);
51
 
57
 
52
         // Initialize the salt and convert it once.
58
         // Initialize the salt and convert it once.

Loading…
취소
저장