Skip to content

Commit

Permalink
chore: Update to Electron 6.x (#75802)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 authored and bpasero committed Sep 13, 2019
1 parent 64980ea commit 029e992
Show file tree
Hide file tree
Showing 17 changed files with 1,408 additions and 573 deletions.
2 changes: 1 addition & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
disturl "https://atom.io/download/electron"
target "4.2.10"
target "6.0.9"
runtime "electron"
2 changes: 1 addition & 1 deletion build/azure-pipelines/linux/product-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ steps:

- script: |
set -e
DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests"
DISPLAY=:10 ./scripts/test.sh --build --tfs --no-sandbox "Unit Tests"
displayName: Run unit tests
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

Expand Down
2 changes: 1 addition & 1 deletion build/npm/preinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ if (!/yarn\.js$|yarnpkg$/.test(process.env['npm_execpath'])) {
if (err) {
console.error('');
process.exit(1);
}
}
12 changes: 6 additions & 6 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"git": {
"name": "chromium",
"repositoryUrl": "https://chromium.googlesource.com/chromium/src",
"commitHash": "c6a08e5368de4352903e702cde750b33239a50ab"
"commitHash": "91f08db83c2ce8c722ddf0911ead8f7c473bedfa"
}
},
"licenseDetail": [
Expand Down Expand Up @@ -40,32 +40,32 @@
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
],
"isOnlyProductionDependency": true,
"version": "69.0.3497.128"
"version": "76.0.3809.146"
},
{
"component": {
"type": "git",
"git": {
"name": "nodejs",
"repositoryUrl": "https://github.com/nodejs/node",
"commitHash": "8c70b2084ce5f76ea1e3b3c4ccdeee4483fe338b"
"commitHash": "64219741218aa87e259cf8257596073b8e747f0a"
}
},
"isOnlyProductionDependency": true,
"version": "10.11.0"
"version": "12.4.0"
},
{
"component": {
"type": "git",
"git": {
"name": "electron",
"repositoryUrl": "https://github.com/electron/electron",
"commitHash": "4e4c7527c63fcf27dffaeb58bde996b8d859c0ed"
"commitHash": "407747b48c47cdeed156a73dde1c47609470c95a"
}
},
"isOnlyProductionDependency": true,
"license": "MIT",
"version": "4.2.10"
"version": "6.0.9"
},
{
"component": {
Expand Down
2 changes: 1 addition & 1 deletion remote/.yarnrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
disturl "http://nodejs.org/dist"
target "10.11.0"
target "12.4.0"
runtime "node"
13 changes: 7 additions & 6 deletions scripts/test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
LINUX_NO_SANDBOX="--no-sandbox" # workaround Electron 6 issue on Linux when running tests in container
fi

cd $ROOT
Expand All @@ -33,16 +34,16 @@ else
fi

# Integration tests in AMD
./scripts/test.sh --runGlob **/*.integrationTest.js "$@"
./scripts/test.sh $LINUX_NO_SANDBOX --runGlob **/*.integrationTest.js "$@"

# Tests in the extension host
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/markdown-language-features/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/markdown-language-features/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR

mkdir -p $ROOT/extensions/emmet/test-fixtures
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
rm -rf $ROOT/extensions/emmet/test-fixtures

# Remote Integration Tests
Expand Down
18 changes: 8 additions & 10 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ process.on('SIGPIPE', () => {
//#endregion

//#region Add support for redirecting the loading of node modules

exports.injectNodeModuleLookupPath = function (injectPath) {
if (!injectPath) {
throw new Error('Missing injectPath');
Expand All @@ -36,18 +37,16 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
const originalResolveLookupPaths = Module._resolveLookupPaths;

// @ts-ignore
Module._resolveLookupPaths = function (moduleName, parent, newReturn) {
const result = originalResolveLookupPaths(moduleName, parent, newReturn);

const paths = newReturn ? result : result[1];
Module._resolveLookupPaths = function (moduleName, parent) {
const paths = originalResolveLookupPaths(moduleName, parent);
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === nodeModulesPath) {
paths.splice(i, 0, injectPath);
break;
}
}

return result;
return paths;
};
};
//#endregion
Expand All @@ -71,19 +70,18 @@ exports.enableASARSupport = function (nodeModulesPath) {

// @ts-ignore
const originalResolveLookupPaths = Module._resolveLookupPaths;
// @ts-ignore
Module._resolveLookupPaths = function (request, parent, newReturn) {
const result = originalResolveLookupPaths(request, parent, newReturn);

const paths = newReturn ? result : result[1];
// @ts-ignore
Module._resolveLookupPaths = function (request, parent) {
const paths = originalResolveLookupPaths(request, parent);
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === NODE_MODULES_PATH) {
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
break;
}
}

return result;
return paths;
};
};
//#endregion
Expand Down
7 changes: 6 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const paths = require('./paths');
// @ts-ignore
const product = require('../product.json');
// @ts-ignore
const app = require('electron').app;
const { app, protocol } = require('electron');

// Enable portable support
const portable = bootstrap.configurePortable();
Expand All @@ -33,6 +33,11 @@ app.setPath('userData', userDataPath);
// Update cwd based on environment and platform
setCurrentWorkingDirectory();

// Register custom schemes with privileges
protocol.registerSchemesAsPrivileged([
{ scheme: 'vscode-resource', privileges: { secure: true, supportFetchAPI: true, corsEnabled: true } }
]);

// Global app listeners
registerListeners();

Expand Down
Loading

0 comments on commit 029e992

Please sign in to comment.