mirror of
https://github.com/electron/electron.git
synced 2026-01-27 00:09:09 -05:00
feat: upgrade to Node 12 (#17838)
* fix: add boringssl backport to support node upgrade * fix: Update node_includes.h, add DCHECK macros * fix: Update node Debug Options parser usage * fix: Fix asar setup * fix: using v8Util in isolated context * fix: make "process" available in preload scripts * fix: use proper options parser and remove setting of _breakFirstLine _breakFirstLine was being set on the process, but that has changed in node 12 and so is no longer needed. Node will handle it properly when --inspect-brk is provided * chore: update node dep sha * fix: process.binding => _linkedBinding in sandboxed isolated preload * fix: make original-fs work with streams * build: override node module version * fix: use _linkedBinding in content_script/init.js * chore: update node ref in DEPS * build: node_module_version should be 73
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
const asar = process.binding('atom_common_asar')
|
||||
const asar = process._linkedBinding('atom_common_asar')
|
||||
const assert = require('assert')
|
||||
const { Buffer } = require('buffer')
|
||||
const childProcess = require('child_process')
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
/* global source, require */
|
||||
|
||||
// Expose fs module without asar support.
|
||||
// NB: Node's 'fs' and 'internal/fs/streams' have a lazy-loaded circular
|
||||
// dependency. So to expose the unmodified Node 'fs' functionality here,
|
||||
// we have to copy both 'fs' *and* 'internal/fs/streams' and modify the
|
||||
// copies to depend on each other instead of on our asarified 'fs' code.
|
||||
source['original-fs'].replace("require('internal/fs/streams')", "require('original-fs/streams')")
|
||||
source['original-fs/streams'].replace("require('fs')", "require('original-fs')")
|
||||
/* global require */
|
||||
|
||||
// Monkey-patch the fs module.
|
||||
require('electron/js2c/asar').wrapFsWithAsar(require('fs'))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
|
||||
process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess.binding, 'renderer')
|
||||
process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess._linkedBinding, 'renderer')
|
||||
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* global nodeProcess, isolatedWorld */
|
||||
|
||||
process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess.binding, 'renderer')
|
||||
process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess._linkedBinding, 'renderer')
|
||||
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
|
||||
@@ -4,6 +4,24 @@ import * as path from 'path'
|
||||
|
||||
const Module = require('module')
|
||||
|
||||
// Make sure globals like "process" and "global" are always available in preload
|
||||
// scripts even after they are deleted in "loaded" script.
|
||||
//
|
||||
// Note 1: We rely on a Node patch to actually pass "process" and "global" and
|
||||
// other arguments to the wrapper.
|
||||
//
|
||||
// Note 2: Node introduced a new code path to use native code to wrap module
|
||||
// code, which does not work with this hack. However by modifying the
|
||||
// "Module.wrapper" we can force Node to use the old code path to wrap module
|
||||
// code with JavaScript.
|
||||
Module.wrapper = [
|
||||
'(function (exports, require, module, __filename, __dirname, process, global, Buffer) { ' +
|
||||
// By running the code in a new closure, it would be possible for the module
|
||||
// code to override "process" and "Buffer" with local variables.
|
||||
'return function (exports, require, module, __filename, __dirname) { ',
|
||||
'\n}.call(this, exports, require, module, __filename, __dirname); });'
|
||||
]
|
||||
|
||||
// We modified the original process.argv to let node.js load the
|
||||
// init.js, we need to restore it here.
|
||||
process.argv.splice(1, 1)
|
||||
|
||||
Reference in New Issue
Block a user