diff options
-rw-r--r-- | .github/workflows/ci.yml | 12 | ||||
-rw-r--r-- | .yarnrc | 2 | ||||
-rw-r--r-- | build/.cachesalt | 2 | ||||
-rw-r--r-- | cgmanifest.json | 8 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/main.js | 45 | ||||
-rw-r--r-- | src/vs/base/parts/sandbox/electron-browser/preload.js | 9 | ||||
-rw-r--r-- | src/vs/code/electron-main/app.ts | 2 | ||||
-rw-r--r-- | src/vs/platform/environment/node/userDataPath.d.ts | 2 | ||||
-rw-r--r-- | src/vs/platform/environment/node/userDataPath.js | 54 | ||||
-rw-r--r-- | src/vs/platform/issue/electron-main/issueMainService.ts | 2 | ||||
-rw-r--r-- | src/vs/platform/windows/electron-main/window.ts | 4 | ||||
-rw-r--r-- | test/smoke/src/main.ts | 2 | ||||
-rw-r--r-- | yarn.lock | 8 |
14 files changed, 83 insertions, 71 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f35e8a4cd93..d1c7501bfd1 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' }} @@ -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 013244143e8..3ceb6423cc5 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 ef37a43314a..adee4b3c0a5 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 8055c59769b..2baf8240c89 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 f91f7b731d1..9cf737e0649 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 cd852630bb6..9d58c50b093 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 c1fb8f8b407..9132e1dc40d 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 a3cd8b73b1b..4c9239fc953 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 b1c1fb26b5d..1f7196c33e1 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 22fd82a67f6..e55de7ea4c2 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 e0821ea0159..98e5e82af63 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 f4231463a88..17122480168 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 ec804292bbc..bc9595dae88 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" |