From 2697ae50402a713965cf075054cc309378959a0c Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Mar 2020 08:39:32 +0100 Subject: [PATCH] web - guard against creating workbench more than once --- src/vs/workbench/workbench.web.api.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vs/workbench/workbench.web.api.ts b/src/vs/workbench/workbench.web.api.ts index 9f18e7bf59d..8aa59dc7659 100644 --- a/src/vs/workbench/workbench.web.api.ts +++ b/src/vs/workbench/workbench.web.api.ts @@ -230,8 +230,17 @@ interface IWorkbenchConstructionOptions { * @param domElement the container to create the workbench in * @param options for setting up the workbench */ +let created = false; async function create(domElement: HTMLElement, options: IWorkbenchConstructionOptions): Promise { + // Assert that the workbench is not created more than once. We currently + // do not support this and require a full context switch to clean-up. + if (created) { + throw new Error('Unable to create the VSCode workbench more than once.'); + } else { + created = true; + } + // Startup workbench await main(domElement, options); -- GitLab