Skip to content

url: move process.binding('url') to internalBinding - #22204

Closed
starkwang wants to merge 2 commits into
nodejs:masterfrom
starkwang:url-internal-binding
Closed

url: move process.binding('url') to internalBinding#22204
starkwang wants to merge 2 commits into
nodejs:masterfrom
starkwang:url-internal-binding

Conversation

@starkwang

@starkwangstarkwang commented Aug 9, 2018

Copy link
Copy Markdown
Contributor

Refs: #22160

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Aug 9, 2018
@starkwang

Copy link
Copy Markdown
ContributorAuthor

@maclover7

Copy link
Copy Markdown
Contributor

@maclover7

maclover7 commented Aug 9, 2018

Copy link
Copy Markdown
Contributor

Hmm, here's looks like gulp@3.9.1is failing on an Ubuntu 16.04 machine (I double checked the git sha and that process.binding('url') threw an error to make sure things were recompiled properly):

 internal/url.js:1441
setURLConstructor(constructUrl);
^
TypeError: setURLConstructor is not a function
at internal/url.js:1441:1
at req_ (/home/iojs/build/workspace/citgm-smoker/nodes/ubuntu1604-64/citgm_tmp/92109405-f794-4108-8120-36349a9efdfa/gulp/node_modules/natives/index.js:137:5)
at require (/home/iojs/build/workspace/citgm-smoker/nodes/ubuntu1604-64/citgm_tmp/92109405-f794-4108-8120-36349a9efdfa/gulp/node_modules/natives/index.js:110:12)
at fs.js:57:28
at req_ (/home/iojs/build/workspace/citgm-smoker/nodes/ubuntu1604-64/citgm_tmp/92109405-f794-4108-8120-36349a9efdfa/gulp/node_modules/natives/index.js:137:5)
at Object.req [as require] (/home/iojs/build/workspace/citgm-smoker/nodes/ubuntu1604-64/citgm_tmp/92109405-f794-4108-8120-36349a9efdfa/gulp/node_modules/natives/index.js:54:10)
at Object.<anonymous> (/home/iojs/build/workspace/citgm-smoker/nodes/ubuntu1604-64/citgm_tmp/92109405-f794-4108-8120-36349a9efdfa/gulp/node_modules/graceful-fs/fs.js:1:99)

edit: is also failing on Debian 8 x64, Debian 8 x86, Debian 9, and Fedora 26

@devsnekdevsnek added the semver-major PRs that contain breaking changes and should be released in the next major version. label Aug 9, 2018
@jasnell

Copy link
Copy Markdown
Member

The failure in gulp makes sense given it's dependency on natives, which uses process.binding() or {} as a fallback. Generally speaking, anything that depends on natives is going to be broken by the transition away from process.binding(), which is one of the fundamental problems we're going to have moving forward with this transition.

@jasnelljasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one should not land yet because of the natives failure. It is unfortunate, but we should hold off a bit on process.binding() changes that impact the fs module directly.

@devsnek

Copy link
Copy Markdown
Member

@jasnell this is okay with #22269 right?

@jasnell

Copy link
Copy Markdown
Member

Potentially yes. We should still be careful.

@jdaltonjdalton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Holding removals until migration is ironed out

@jasnell

Copy link
Copy Markdown
Member

@starkwang ... when you get a moment, can you rebase this on master then apply the following patch that will be required for this to proceed:

Author: James M Snell <jasnell@gmail.com>
Date: Tue Aug 14 19:36:25 2018 -0700
[Squash] add `process.binding('url')` to fallthrough whitelist
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 08daeb1915..ffae6e4cd9 100644
--- a/lib/internal/bootstrap/node.js+++ b/lib/internal/bootstrap/node.js@@ -327,7 +327,7 @@
// that are whitelisted for access via process.binding()... this is used
// to provide a transition path for modules that are being moved over to
// internalBinding.
- const internalBindingWhitelist = new SafeSet(['uv']);+ const internalBindingWhitelist = new SafeSet(['uv', 'url']);
process.binding = function binding(name) {
return internalBindingWhitelist.has(name) ?
internalBinding(name) :
diff --git a/test/parallel/test-process-binding-internalbinding-whitelist.js b/test/parallel/test-process-binding-internalbinding-whitelist.js
index ece967a0b7..cc0119917d 100644
--- a/test/parallel/test-process-binding-internalbinding-whitelist.js+++ b/test/parallel/test-process-binding-internalbinding-whitelist.js@@ -7,3 +7,4 @@ const assert = require('assert');
// Assert that whitelisted internalBinding modules are accessible via
// process.binding().
assert(process.binding('uv'));
+assert(process.binding('url'));

@starkwang
starkwangforce-pushed the url-internal-binding branch from a820ce5 to a27fc75CompareAugust 15, 2018 15:30
@starkwang

Copy link
Copy Markdown
ContributorAuthor

The branch has been rebased on master and applied the patch.

@starkwang

Copy link
Copy Markdown
ContributorAuthor

Umm... I can't open a new CI for this because it is blocked by nodejs/build#1442.

@jasnell

Copy link
Copy Markdown
Member

Yep, no worries... once the release happens the CI will be unrestricted again.

@starkwang

Copy link
Copy Markdown
ContributorAuthor

@starkwang

Copy link
Copy Markdown
ContributorAuthor

Rebased branch to resolve conflicts.

@jasnell

Copy link
Copy Markdown
Member

@jasnell

Copy link
Copy Markdown
Member

Ugh, another unrelated CI failure... resuming: https://ci.nodejs.org/job/node-test-pull-request/16621/

@BridgeAR

Copy link
Copy Markdown
Member

This needs a rebase.

@starkwang

Copy link
Copy Markdown
ContributorAuthor

Rebased and opened a new CI: https://ci.nodejs.org/job/node-test-pull-request/17058/

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 6, 2018
@starkwang

Copy link
Copy Markdown
ContributorAuthor

Landed in e917a23.

starkwang added a commit that referenced this pull request Sep 7, 2018
PR-URL: #22204
Refs: #22160
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.semver-majorPRs that contain breaking changes and should be released in the next major version.whatwg-urlIssues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@starkwang@nodejs-github-bot@maclover7@jasnell@devsnek@BridgeAR@jdalton@apapirovski@TimothyGu@trivikr