diff --git a/src/lib/libpthread.js b/src/lib/libpthread.js index badc551048420..9457ff807d29a 100644 --- a/src/lib/libpthread.js +++ b/src/lib/libpthread.js @@ -424,12 +424,16 @@ var LibraryPThread = { worker = new Worker(p.createScriptURL('ignored'), {{{ pthreadWorkerOptions }}}); } else #endif - // We need to generate the URL with import.meta.url as the base URL of the JS file - // instead of just using new URL(import.meta.url) because bundler's only recognize - // the first case in their bundling step. The latter ends up producing an invalid - // URL to import from the server (e.g., for webpack the file:// path). - // See https://github.com/webpack/webpack/issues/12638 - worker = new Worker(new URL('{{{ TARGET_JS_NAME }}}', import.meta.url), {{{ pthreadWorkerOptions }}}); +#if expectToReceiveOnModule('mainScriptUrlOrBlob') + if (Module['mainScriptUrlOrBlob']) { + var pthreadMainJs = Module['mainScriptUrlOrBlob']; + if (typeof pthreadMainJs != 'string') { + pthreadMainJs = URL.createObjectURL(pthreadMainJs); + } + worker = new Worker(new URL(pthreadMainJs, import.meta.url), {{{ pthreadWorkerOptions }}}); + } else +#endif + worker = new Worker(import.meta.url, {{{ pthreadWorkerOptions }}}); #else // EXPORT_ES6 var pthreadMainJs = _scriptName; #if expectToReceiveOnModule('mainScriptUrlOrBlob') diff --git a/test/third_party/googletest b/test/third_party/googletest index b514bdc898e29..4fb7039fda3f6 160000 --- a/test/third_party/googletest +++ b/test/third_party/googletest @@ -1 +1 @@ -Subproject commit b514bdc898e2951020cbdca1304b75f5950d1f59 +Subproject commit 4fb7039fda3f6588c7ca9664176f8c9e0a023b4a