Skip to content

Conversation

@deepak1556
Copy link
Member

@deepak1556 deepak1556 commented Mar 6, 2019

Description of Change

NODE_BUILTIN_MODULE_CONTEXT_AWARE and process.binding are removed in nodejs/node#25829. This change adopts the alternative available without any functionality change.

Relevant electron/node PR: electron/node#95

Checklist

Release Notes

Notes: no-notes

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 6, 2019
@deepak1556
Copy link
Member Author

deepak1556 commented Mar 6, 2019

Preferred explicit module registration over __attribute__((constructor)) macro, since the latter doesn't work well with static library config. Also having an explicit registration is better in combination with BUILDFLAG for some internal modules https://github.com/electron/electron/blob/master/atom/common/node_bindings.cc#L189-L197.

Copy link
Contributor

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, although it might still be nice if we could ultimately end up using public Node.js APIs for this

Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems too easy to be true so approving before something breaks 😆

@deepak1556
Copy link
Member Author

although it might still be nice if we could ultimately end up using public Node.js APIs for this

The public api ends up defining the module registrators with __attribute__((constructor)) which doesn't work with the static library that is built in electron https://github.com/electron/electron/blob/master/BUILD.gn#L321. If referencing the constructors in the executable is the solution, I would prefer the manual registration over it. Similar to nodejs/node#16565

@addaleax
Copy link
Contributor

addaleax commented Mar 6, 2019

@deepak1556 I think it might just be an issue of copying/inlinine NODE_MODULE_CONTEXT_AWARE_CPP() into the Electron source rather than relying on the macro from node_binding.h, and maybe switching NM_F_LINKED to node::ModuleFlags::kLinked once nodejs/node#26457 makes its way into your Node.js fork?

The layout of the node_module struct itself is guaranteed to remain stable during a major Node.js release, so I think that should be okay.

@deepak1556
Copy link
Member Author

Ah okay I misunderstood the public api switch then!

I think it might just be an issue of copying/inlinine NODE_MODULE_CONTEXT_AWARE_CPP() into the Electron source rather than relying on the macro from node_binding.h, and maybe switching NM_F_LINKED to node::ModuleFlags::kLinked
The layout of the node_module struct itself is guaranteed to remain stable during a major Node.js release

Yeah this should be good thing to do, given the guarantee. Thanks!

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Mar 7, 2019
NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are
removed in nodejs/node#25829. This changes
uses the alternative available without any functionality change.
@MarshallOfSound
Copy link
Member

The linux tests failed here with

[401:0307/234309.568071:FATAL:zygote_host_impl_linux.cc(116)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.

Which is confusing 🤔

cc @nornagon

@nornagon
Copy link
Contributor

nornagon commented Mar 8, 2019

afaict that's a flake. I don't know what's causing it, perhaps some change in circleci's internal architecture? I've tried rerunning the test, let's see how it goes.

@MarshallOfSound
Copy link
Member

@nornagon As part of the setuid PR will the setuid sandbox become usable by the tests? Would be good to see that flake disappear as a result of that work if it is actually a flake.

@nornagon
Copy link
Contributor

nornagon commented Mar 8, 2019

i'm a little worried about why it only happens sometimes, it shouldn't be flaky.

@MarshallOfSound
Copy link
Member

@nornagon If we're happy the flake isn't somehow caused by this PR I think we're good to merge it now

@nornagon
Copy link
Contributor

nornagon commented Mar 8, 2019

i'm pretty sure i've seen it in other PRs and i can't imagine this would cause such a flake so i'm pretty sure we're good to go.

@nornagon nornagon merged commit 5afb7dc into master Mar 8, 2019
@release-clerk
Copy link

release-clerk bot commented Mar 8, 2019

No Release Notes

@nornagon nornagon deleted the linked_binding branch March 8, 2019 18:30
nitsakh pushed a commit that referenced this pull request Mar 27, 2019
…17247)

* refactor: load electron builtin modules with process._linkedBinding

NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are
removed in nodejs/node#25829. This changes
uses the alternative available without any functionality change.

* chore: roll node
nitsakh pushed a commit that referenced this pull request Mar 28, 2019
…17247)

* refactor: load electron builtin modules with process._linkedBinding

NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are
removed in nodejs/node#25829. This changes
uses the alternative available without any functionality change.

* chore: roll node
@zcbenz
Copy link
Contributor

zcbenz commented Apr 10, 2019

/trop run backport-to 5-0-x

@trop
Copy link
Contributor

trop bot commented Apr 10, 2019

The backport process for this PR has been manually initiated,
sending your 1's and 0's to "5-0-x" here we go! :D

@trop
Copy link
Contributor

trop bot commented Apr 10, 2019

I was unable to backport this PR to "5-0-x" cleanly;
you will need to perform this backport manually.

zcbenz pushed a commit that referenced this pull request Apr 10, 2019
…17247)

* refactor: load electron builtin modules with process._linkedBinding

NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are
removed in nodejs/node#25829. This changes
uses the alternative available without any functionality change.

* chore: roll node
ckerr pushed a commit that referenced this pull request Apr 16, 2019
* fix: backport boringssl patches for node compat

* refactor: prevent node macros from overriding base (#17178)

* fix: backport boring ssl patch OPENSSL_clear_free

* refactor: load electron builtin modules with process._linkedBinding (#17247)

* refactor: load electron builtin modules with process._linkedBinding

NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are
removed in nodejs/node#25829. This changes
uses the alternative available without any functionality change.

* chore: roll node

* 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

* fix: process.binding => _linkedBinding in sandboxed isolated preload

* chore: update node dep sha

* fix: make original-fs work with streams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants