From eb99a782ff563ca3f6ed400ab700e3ab41f2243b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 28 Sep 2022 17:58:15 +0200 Subject: [PATCH] fix https://github.com/microsoft/vscode/issues/161394 (#162213) --- src/vs/base/browser/defaultWorkerFactory.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/vs/base/browser/defaultWorkerFactory.ts b/src/vs/base/browser/defaultWorkerFactory.ts index 9d2a34494be..87103de1a54 100644 --- a/src/vs/base/browser/defaultWorkerFactory.ts +++ b/src/vs/base/browser/defaultWorkerFactory.ts @@ -43,11 +43,20 @@ export function getWorkerBootstrapUrl(scriptPath: string, label: string): string return URL.createObjectURL(blob); } - const result = new URL(scriptPath); - COI.addSearchParam(result.searchParams, true, true); - result.hash = label; - return result.href; + const start = scriptPath.lastIndexOf('?'); + const end = scriptPath.lastIndexOf('#', start); + const params = start > 0 + ? new URLSearchParams(scriptPath.substring(start + 1, ~end ? end : undefined)) + : new URLSearchParams(); + COI.addSearchParam(params, true, true); + const search = params.toString(); + + if (!search) { + return `${scriptPath}#${label}`; + } else { + return `${scriptPath}?${params.toString()}#${label}`; + } } // ESM-comment-end