electron/spec-main/fixtures/apps/self-module-paths/renderer.js
Shelley Vohr af991123f1
fix: self.module.paths not working in web workers (#29955)
* fix: global.module.paths in workers

* spec: add a regression test
2021-07-05 08:48:46 +09:00

12 lines
393 B
JavaScript

const { ipcRenderer } = require('electron');
const worker = new Worker('worker.js');
worker.onmessage = (event) => {
const workerPaths = event.data.sort().toString();
const rendererPaths = self.module.paths.sort().toString();
const validModulePaths = workerPaths === rendererPaths && workerPaths !== 0;
ipcRenderer.invoke('module-paths', validModulePaths);
worker.terminate();
};