diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f35e8a4cd93f0..d1c7501bfd115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,8 +109,8 @@ jobs: uses: actions/cache@v2 with: path: "**/node_modules" - key: ${{ runner.os }}-cacheNodeModules13-${{ steps.nodeModulesCacheKey.outputs.value }} - restore-keys: ${{ runner.os }}-cacheNodeModules13- + key: ${{ runner.os }}-cacheNodeModules14-${{ steps.nodeModulesCacheKey.outputs.value }} + restore-keys: ${{ runner.os }}-cacheNodeModules14- - name: Get yarn cache directory path id: yarnCacheDirPath if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} @@ -165,8 +165,8 @@ jobs: uses: actions/cache@v2 with: path: "**/node_modules" - key: ${{ runner.os }}-cacheNodeModules13-${{ steps.nodeModulesCacheKey.outputs.value }} - restore-keys: ${{ runner.os }}-cacheNodeModules13- + key: ${{ runner.os }}-cacheNodeModules14-${{ steps.nodeModulesCacheKey.outputs.value }} + restore-keys: ${{ runner.os }}-cacheNodeModules14- - name: Get yarn cache directory path id: yarnCacheDirPath if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} @@ -218,8 +218,8 @@ jobs: uses: actions/cache@v2 with: path: "**/node_modules" - key: ${{ runner.os }}-cacheNodeModules13-${{ steps.nodeModulesCacheKey.outputs.value }} - restore-keys: ${{ runner.os }}-cacheNodeModules13- + key: ${{ runner.os }}-cacheNodeModules14-${{ steps.nodeModulesCacheKey.outputs.value }} + restore-keys: ${{ runner.os }}-cacheNodeModules14- - name: Get yarn cache directory path id: yarnCacheDirPath if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} diff --git a/.yarnrc b/.yarnrc index b2b326324a638..ac09cae4c7f8c 100644 --- a/.yarnrc +++ b/.yarnrc @@ -1,3 +1,3 @@ disturl "https://electronjs.org/headers" -target "12.0.13" +target "13.1.6" runtime "electron" diff --git a/build/.cachesalt b/build/.cachesalt index 013244143e8f2..3ceb6423cc563 100644 --- a/build/.cachesalt +++ b/build/.cachesalt @@ -1 +1 @@ -2021-04-07T03:52:18.011Z +2021-05-26T10:17:08.678Z diff --git a/cgmanifest.json b/cgmanifest.json index ef37a43314a88..adee4b3c0a5ec 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "chromium", "repositoryUrl": "https://chromium.googlesource.com/chromium/src", - "commitHash": "cd7a46bf02a768a1aabf9443f6ee469bc6e28e7c" + "commitHash": "7a7e35991d61ce564ed3641222da2c4ed7a65535" } }, "licenseDetail": [ @@ -40,7 +40,7 @@ "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ], "isOnlyProductionDependency": true, - "version": "89.0.4389.128" + "version": "91.0.4472.124" }, { "component": { @@ -60,12 +60,12 @@ "git": { "name": "electron", "repositoryUrl": "https://github.com/electron/electron", - "commitHash": "14ae30aa9b2619358298b525acd398446b385151" + "commitHash": "ddc44e1af4fa6bf0c4c05f3dd48270ef308bc470" } }, "isOnlyProductionDependency": true, "license": "MIT", - "version": "12.0.13" + "version": "13.1.6" }, { "component": { diff --git a/package.json b/package.json index 8055c59769bd2..2baf8240c893a 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "cssnano": "^4.1.11", "debounce": "^1.0.0", "deemon": "^1.4.0", - "electron": "12.0.13", + "electron": "13.1.6", "eslint": "6.8.0", "eslint-plugin-jsdoc": "^19.1.0", "event-stream": "3.3.4", diff --git a/src/main.js b/src/main.js index f91f7b731d1bd..9cf737e0649cb 100644 --- a/src/main.js +++ b/src/main.js @@ -48,7 +48,18 @@ const argvConfig = configureCommandlineSwitchesSync(args); // Configure crash reporter perf.mark('code/willStartCrashReporter'); -configureCrashReporter(); +// If a crash-reporter-directory is specified we store the crash reports +// in the specified directory and don't upload them to the crash server. +// +// Appcenter crash reporting is enabled if +// * enable-crash-reporter runtime argument is set to 'true' +// * --disable-crash-reporter command line parameter is not set +// +// Disable crash reporting in all other cases. +if (args['crash-reporter-directory'] || + (argvConfig['enable-crash-reporter'] && !args['disable-crash-reporter'])) { + configureCrashReporter(); +} perf.mark('code/didStartCrashReporter'); // Set logs path before app 'ready' event if running portable @@ -321,8 +332,6 @@ function getArgvConfigPath() { function configureCrashReporter() { - // If a crash-reporter-directory is specified we store the crash reports - // in the specified directory and don't upload them to the crash server. let crashReporterDirectory = args['crash-reporter-directory']; let submitURL = ''; if (crashReporterDirectory) { @@ -351,11 +360,7 @@ function configureCrashReporter() { // Otherwise we configure the crash reporter from product.json else { const appCenter = product.appCenter; - // Disable Appcenter crash reporting if - // * --crash-reporter-directory is specified - // * enable-crash-reporter runtime argument is set to 'false' - // * --disable-crash-reporter command line parameter is set - if (appCenter && argvConfig['enable-crash-reporter'] && !args['disable-crash-reporter']) { + if (appCenter) { const isWindows = (process.platform === 'win32'); const isLinux = (process.platform === 'linux'); const isDarwin = (process.platform === 'darwin'); @@ -410,13 +415,23 @@ function configureCrashReporter() { // Start crash reporter for all processes const productName = (product.crashReporter ? product.crashReporter.productName : undefined) || product.nameShort; const companyName = (product.crashReporter ? product.crashReporter.companyName : undefined) || 'Microsoft'; - crashReporter.start({ - companyName: companyName, - productName: process.env['VSCODE_DEV'] ? `${productName} Dev` : productName, - submitURL, - uploadToServer: !crashReporterDirectory, - compress: true - }); + if (process.env['VSCODE_DEV']) { + crashReporter.start({ + companyName: companyName, + productName: `${productName} Dev`, + submitURL, + uploadToServer: false, + compress: true + }); + } else { + crashReporter.start({ + companyName: companyName, + productName: productName, + submitURL, + uploadToServer: !crashReporterDirectory, + compress: true + }); + } } /** diff --git a/src/vs/base/parts/sandbox/electron-browser/preload.js b/src/vs/base/parts/sandbox/electron-browser/preload.js index cd852630bb675..9d58c50b093d0 100644 --- a/src/vs/base/parts/sandbox/electron-browser/preload.js +++ b/src/vs/base/parts/sandbox/electron-browser/preload.js @@ -342,18 +342,13 @@ // Use `contextBridge` APIs to expose globals to VSCode // only if context isolation is enabled, otherwise just // add to the DOM global. - let useContextBridge = process.argv.includes('--context-isolation'); - if (useContextBridge) { + if (process.contextIsolated) { try { contextBridge.exposeInMainWorld('vscode', globals); } catch (error) { console.error(error); - - useContextBridge = false; } - } - - if (!useContextBridge) { + } else { // @ts-ignore window.vscode = globals; } diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index c1fb8f8b40770..9132e1dc40d47 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -124,7 +124,7 @@ export class CodeApplication extends Disposable { // !!! DO NOT CHANGE without consulting the documentation !!! // - const isUrlFromWebview = (requestingUrl: string) => requestingUrl.startsWith(`${Schemas.vscodeWebview}://`); + const isUrlFromWebview = (requestingUrl: string | undefined) => requestingUrl?.startsWith(`${Schemas.vscodeWebview}://`); session.defaultSession.setPermissionRequestHandler((_webContents, permission /* 'media' | 'geolocation' | 'notifications' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' */, callback, details) => { if (isUrlFromWebview(details.requestingUrl)) { diff --git a/src/vs/platform/environment/node/userDataPath.d.ts b/src/vs/platform/environment/node/userDataPath.d.ts index a3cd8b73b1b7a..4c9239fc9535a 100644 --- a/src/vs/platform/environment/node/userDataPath.d.ts +++ b/src/vs/platform/environment/node/userDataPath.d.ts @@ -8,7 +8,7 @@ import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; /** * Returns the user data path to use with some rules: * - respect portable mode - * - respect --user-data-dir CLI argument * - respect VSCODE_APPDATA environment variable + * - respect --user-data-dir CLI argument */ export function getUserDataPath(args: NativeParsedArgs): string; diff --git a/src/vs/platform/environment/node/userDataPath.js b/src/vs/platform/environment/node/userDataPath.js index b1c1fb26b5dbc..1f7196c33e162 100644 --- a/src/vs/platform/environment/node/userDataPath.js +++ b/src/vs/platform/environment/node/userDataPath.js @@ -54,38 +54,42 @@ return path.join(portablePath, 'user-data'); } - // 2. Support explicit --user-data-dir + // 2. Support global VSCODE_APPDATA environment variable + let appDataPath = process.env['VSCODE_APPDATA']; + if (appDataPath) { + return path.join(appDataPath, productName); + } + + // With Electron>=13 --user-data-dir switch will be propagated to + // all processes https://github.com/electron/electron/blob/1897b14af36a02e9aa7e4d814159303441548251/shell/browser/electron_browser_client.cc#L546-L553 + // Check VSCODE_PORTABLE and VSCODE_APPDATA before this case to get correct values. + // 3. Support explicit --user-data-dir const cliPath = cliArgs['user-data-dir']; if (cliPath) { return cliPath; } - // 3. Support global VSCODE_APPDATA environment variable - let appDataPath = process.env['VSCODE_APPDATA']; - // 4. Otherwise check per platform - if (!appDataPath) { - switch (process.platform) { - case 'win32': - appDataPath = process.env['APPDATA']; - if (!appDataPath) { - const userProfile = process.env['USERPROFILE']; - if (typeof userProfile !== 'string') { - throw new Error('Windows: Unexpected undefined %USERPROFILE% environment variable'); - } - - appDataPath = path.join(userProfile, 'AppData', 'Roaming'); + switch (process.platform) { + case 'win32': + appDataPath = process.env['APPDATA']; + if (!appDataPath) { + const userProfile = process.env['USERPROFILE']; + if (typeof userProfile !== 'string') { + throw new Error('Windows: Unexpected undefined %USERPROFILE% environment variable'); } - break; - case 'darwin': - appDataPath = path.join(os.homedir(), 'Library', 'Application Support'); - break; - case 'linux': - appDataPath = process.env['XDG_CONFIG_HOME'] || path.join(os.homedir(), '.config'); - break; - default: - throw new Error('Platform not supported'); - } + + appDataPath = path.join(userProfile, 'AppData', 'Roaming'); + } + break; + case 'darwin': + appDataPath = path.join(os.homedir(), 'Library', 'Application Support'); + break; + case 'linux': + appDataPath = process.env['XDG_CONFIG_HOME'] || path.join(os.homedir(), '.config'); + break; + default: + throw new Error('Platform not supported'); } return path.join(appDataPath, productName); diff --git a/src/vs/platform/issue/electron-main/issueMainService.ts b/src/vs/platform/issue/electron-main/issueMainService.ts index 22fd82a67f67a..e55de7ea4c214 100644 --- a/src/vs/platform/issue/electron-main/issueMainService.ts +++ b/src/vs/platform/issue/electron-main/issueMainService.ts @@ -316,7 +316,7 @@ export class IssueMainService implements ICommonIssueService { backgroundColor: options.backgroundColor || IssueMainService.DEFAULT_BACKGROUND_COLOR, webPreferences: { preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath, - additionalArguments: [`--vscode-window-config=${ipcObjectUrl.resource.toString()}`, '--context-isolation' /* TODO@bpasero: Use process.contextIsolateed when 13-x-y is adopted (https://github.com/electron/electron/pull/28030) */], + additionalArguments: [`--vscode-window-config=${ipcObjectUrl.resource.toString()}`], v8CacheOptions: browserCodeLoadingCacheStrategy, enableWebSQL: false, spellcheck: false, diff --git a/src/vs/platform/windows/electron-main/window.ts b/src/vs/platform/windows/electron-main/window.ts index e0821ea0159f9..98e5e82af633c 100644 --- a/src/vs/platform/windows/electron-main/window.ts +++ b/src/vs/platform/windows/electron-main/window.ts @@ -186,9 +186,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { title: this.productService.nameLong, webPreferences: { preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath, - additionalArguments: this.environmentMainService.sandbox ? - [`--vscode-window-config=${this.configObjectUrl.resource.toString()}`, '--context-isolation' /* TODO@bpasero: Use process.contextIsolateed when 13-x-y is adopted (https://github.com/electron/electron/pull/28030) */] : - [`--vscode-window-config=${this.configObjectUrl.resource.toString()}`], + additionalArguments: [`--vscode-window-config=${this.configObjectUrl.resource.toString()}`], v8CacheOptions: browserCodeLoadingCacheStrategy, enableWebSQL: false, spellcheck: false, diff --git a/test/smoke/src/main.ts b/test/smoke/src/main.ts index f4231463a887e..1712248016860 100644 --- a/test/smoke/src/main.ts +++ b/test/smoke/src/main.ts @@ -36,7 +36,7 @@ import { setup as setupDataMultirootTests } from './areas/multiroot/multiroot.te import { setup as setupDataLocalizationTests } from './areas/workbench/localization.test'; import { setup as setupLaunchTests } from './areas/workbench/launch.test'; -const tmpDir = tmp.dirSync({ prefix: 't' }) as { name: string; removeCallback: Function; }; +const tmpDir = tmp.dirSync({ name: 't' }) as { name: string; removeCallback: Function; }; const testDataPath = tmpDir.name; process.once('exit', () => { try { diff --git a/yarn.lock b/yarn.lock index ec804292bbc69..bc9595dae88e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3039,10 +3039,10 @@ electron-to-chromium@^1.3.723: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.737.tgz#196f2e9656f4f3c31930750e1899c091b72d36b5" integrity sha512-P/B84AgUSQXaum7a8m11HUsYL8tj9h/Pt5f7Hg7Ty6bm5DxlFq+e5+ouHUoNQMsKDJ7u4yGfI8mOErCmSH9wyg== -electron@12.0.13: - version "12.0.13" - resolved "https://registry.yarnpkg.com/electron/-/electron-12.0.13.tgz#f1c7f3d8b25078d7622ed900cc8f2aa4731a5e0a" - integrity sha512-2yx102mhqgyaTVH+GCet4hURKOIuI27DcVdlval5T3eOEZMOHNrCbi8/8PZ7MqMfB5PIxJ+grS5S00/n5Zcu2Q== +electron@13.1.6: + version "13.1.6" + resolved "https://registry.yarnpkg.com/electron/-/electron-13.1.6.tgz#6ecaf969255d62ce82cc0b5c948bf26e7dfb489b" + integrity sha512-XiB55/JTaQpDFQrD9pulYnOGwaWeMyRIub5ispvoE2bWBvM5zVMLptwMLb0m3KTMrfSkzhedZvOu7fwYvR7L7Q== dependencies: "@electron/get" "^1.0.1" "@types/node" "^14.6.2"