diff options
author | Benjamin Pasero <benjamin.pasero@microsoft.com> | 2021-03-31 10:42:41 +0300 |
---|---|---|
committer | Benjamin Pasero <benjamin.pasero@microsoft.com> | 2021-03-31 10:42:47 +0300 |
commit | d35df4a3efedcdfbda2c0275c3215697902a3ef9 (patch) | |
tree | 132ba84b7f19a65cda7d866227335c2bd90bca35 /src/bootstrap-window.js | |
parent | 45f061b9c82669b4a274a73f50b5f00097fe0165 (diff) |
window - use IPC to transport window config and drop URL query param (#120096)
Diffstat (limited to 'src/bootstrap-window.js')
-rw-r--r-- | src/bootstrap-window.js | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/bootstrap-window.js b/src/bootstrap-window.js index 04b54a97d91..a87f4fbf69a 100644 --- a/src/bootstrap-window.js +++ b/src/bootstrap-window.js @@ -25,19 +25,21 @@ const preloadGlobals = globals(); const webFrame = preloadGlobals.webFrame; const safeProcess = preloadGlobals.process; - const configuration = parseWindowConfiguration(); const useCustomProtocol = safeProcess.sandboxed || typeof safeProcess.env['ENABLE_VSCODE_BROWSER_CODE_LOADING'] === 'string'; // Start to resolve process.env before anything gets load // so that we can run loading and resolving in parallel - const whenEnvResolved = safeProcess.resolveEnv(configuration.userEnv); + const whenEnvResolved = safeProcess.resolveEnv(); /** * @param {string[]} modulePaths * @param {(result: unknown, configuration: object) => Promise<unknown> | undefined} resultCallback * @param {{ forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean, canModifyDOM?: (config: object) => void, beforeLoaderConfig?: (config: object, loaderConfig: object) => void, beforeRequire?: () => void }=} options */ - function load(modulePaths, resultCallback, options) { + async function load(modulePaths, resultCallback, options) { + performance.mark('code/willWaitForWindowConfig'); + const configuration = await preloadGlobals.context.configuration; + performance.mark('code/didWaitForWindowConfig'); // Apply zoom level early before even building the // window DOM elements to avoid UI flicker. We always @@ -181,30 +183,6 @@ } /** - * Parses the contents of the window condiguration that - * is passed into the URL from the `electron-main` side. - * - * @returns {{ - * isInitialStartup?: boolean, - * zoomLevel?: number, - * extensionDevelopmentPath?: string[], - * extensionTestsPath?: string, - * userEnv?: { [key: string]: string | undefined }, - * appRoot: string, - * nodeCachedDataDir?: string - * }} - */ - function parseWindowConfiguration() { - const rawConfiguration = (window.location.search || '').split(/[?&]/) - .filter(function (param) { return !!param; }) - .map(function (param) { return param.split('='); }) - .filter(function (param) { return param.length === 2; }) - .reduce(function (r, param) { r[param[0]] = decodeURIComponent(param[1]); return r; }, {}); - - return JSON.parse(rawConfiguration['config'] || '{}') || {}; - } - - /** * @param {boolean | undefined} disallowReloadKeybinding * @returns {() => void} */ |