Skip to content

Commit

Permalink
electron - revert to Electron 4
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Sep 30, 2019
1 parent 78a6b2d commit da76f05
Show file tree
Hide file tree
Showing 26 changed files with 556 additions and 1,383 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 "6.0.9"
target "4.2.10"
runtime "electron"
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": "91f08db83c2ce8c722ddf0911ead8f7c473bedfa"
"commitHash": "c6a08e5368de4352903e702cde750b33239a50ab"
}
},
"licenseDetail": [
Expand Down Expand Up @@ -40,32 +40,32 @@
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
],
"isOnlyProductionDependency": true,
"version": "76.0.3809.146"
"version": "69.0.3497.128"
},
{
"component": {
"type": "git",
"git": {
"name": "nodejs",
"repositoryUrl": "https://github.com/nodejs/node",
"commitHash": "64219741218aa87e259cf8257596073b8e747f0a"
"commitHash": "8c70b2084ce5f76ea1e3b3c4ccdeee4483fe338b"
}
},
"isOnlyProductionDependency": true,
"version": "12.4.0"
"version": "10.11.0"
},
{
"component": {
"type": "git",
"git": {
"name": "electron",
"repositoryUrl": "https://github.com/electron/electron",
"commitHash": "407747b48c47cdeed156a73dde1c47609470c95a"
"commitHash": "4e4c7527c63fcf27dffaeb58bde996b8d859c0ed"
}
},
"isOnlyProductionDependency": true,
"license": "MIT",
"version": "6.0.9"
"version": "4.2.10"
},
{
"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 "12.4.0"
target "10.11.0"
runtime "node"
2 changes: 1 addition & 1 deletion resources/linux/code-url-handler.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Name=@@NAME_LONG@@ - URL Handler
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=@@EXEC@@ --no-sandbox --open-url %U
Exec=@@EXEC@@ --open-url %U
Icon=@@ICON@@
Type=Application
NoDisplay=true
Expand Down
4 changes: 2 additions & 2 deletions resources/linux/code.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Name=@@NAME_LONG@@
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=@@EXEC@@ --no-sandbox --unity-launch %F
Exec=@@EXEC@@ --unity-launch %F
Icon=@@ICON@@
Type=Application
StartupNotify=false
Expand All @@ -14,5 +14,5 @@ Keywords=vscode;

[Desktop Action new-empty-window]
Name=New Empty Window
Exec=@@EXEC@@ --no-sandbox --new-window %F
Exec=@@EXEC@@ --new-window %F
Icon=@@ICON@@
2 changes: 1 addition & 1 deletion scripts/test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
LINUX_NO_SANDBOX="--no-sandbox" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
LINUX_NO_SANDBOX=""
fi

cd $ROOT
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ else
cd $ROOT ; \
ELECTRON_ENABLE_LOGGING=1 \
"$CODE" \
test/electron/index.js --no-sandbox "$@" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
test/electron/index.js "$@"
fi
18 changes: 10 additions & 8 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ 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 @@ -37,16 +36,18 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
const originalResolveLookupPaths = Module._resolveLookupPaths;

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

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

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

// @ts-ignore
const originalResolveLookupPaths = Module._resolveLookupPaths;

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

const paths = newReturn ? result : result[1];
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 paths;
return result;
};
};
//#endregion
Expand Down
7 changes: 1 addition & 6 deletions 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, protocol } = require('electron');
const app = require('electron').app;

// Enable portable support
const portable = bootstrap.configurePortable();
Expand All @@ -33,11 +33,6 @@ 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 da76f05

Please sign in to comment.