[v14.x backport] util: fix module inspection & instanceof check during inspect#37100
[v14.x backport] util: fix module inspection & instanceof check during inspect#37100Pezmc wants to merge 2 commits intonodejs:v14.x-stagingfrom
Conversation
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#36151 PR-URL: nodejs#36178 Fixes: nodejs#35730 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#35730 PR-URL: nodejs#36178 Fixes: nodejs#36151 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
54da1e1 to
a38c661
Compare
|
I don't have the Jekins permissions to schedule a node-test-pull-request CI job for this PR (37100)
|
|
Would appreciate a review from someone more familiar with this area (cc @nodejs/modules?) |
ljharb
left a comment
There was a problem hiding this comment.
LGTM; i'll make similar changes in object-inspect.
| function isInstanceof(object, proto) { | ||
| try { | ||
| return object instanceof proto; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
why is the try/catch needed? are we worried about someone defining a Symbol.hasInstance method that can throw?
There was a problem hiding this comment.
ah, didn't realize this was a backport PR. turns out instanceof can indeed throw when the RHS is not a function, or when it's a non-constructible function (like an arrow function or a concise method)
98f6155 to
9ff73fc
Compare
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#36151 PR-URL: nodejs#36178 Fixes: nodejs#35730 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#35730 PR-URL: nodejs#36178 Fixes: nodejs#36151 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
@BethGriggs I tried rebasing onto the latest $ git fetch upstream v14.x-staging
From https://github.com/nodejs/node
* branch v14.x-staging -> FETCH_HEAD
$ git checkout --track upstream/v14.x-staging
Updating files: 100% (14760/14760), done.
Branch 'v14.x-staging' set up to track remote branch 'v14.x-staging' from 'upstream'.
Switched to a new branch 'v14.x-staging'
$ git pull
Already up to date.
$ git checkout backport-36178-to-v14.x
Switched to branch 'backport-36178-to-v14.x'
$ git rebase v14.x-staging
Successfully rebased and updated refs/heads/backport-36178-to-v14.x.
$ git checkout -B backport-36178-to-v14.x-test
Switched to a new branch 'backport-36178-to-v14.x-test'
$ git push |
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#36151 PR-URL: nodejs#36178 Fixes: nodejs#35730 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#35730 PR-URL: nodejs#36178 Fixes: nodejs#36151 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Ah yes, that commit was backed out of staging as there was an npm version mismatch (ref: #37107 (comment)). We need to reland the npm update in a new PR. For this PR, I think you could either rebase against The good news is that the delay in fixing the npm update means we can probably squeeze this into v14.15.5 (#37074) |
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#36151 PR-URL: nodejs#36178 Fixes: nodejs#35730 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Backport-PR-URL: nodejs#37100 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Fixes: nodejs#35730 PR-URL: nodejs#36178 Fixes: nodejs#36151 Refs: nodejs#35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
a38c661 to
ce8caa4
Compare
|
Re-rebased and manually dropped that commit, this PR should be good to go @BethGriggs! |
|
Accidental close, please ignore! |
|
@BethGriggs Anything I can do to help get this into v14.15.5? |
|
@Pezmc, I'll aim to integrate this into the v14.15.5 proposal - i'm still waiting on some other patches so haven't started updating the proposal yet. Nothing more to do on your side 🙂 |
|
Would appreciate a review on this before landing (maybe @nodejs/modules)? |
BethGriggs
left a comment
There was a problem hiding this comment.
Backport LGTM comparing with #36178
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Backport-PR-URL: #37100 PR-URL: #36178 Fixes: #35730 Fixes: #36151 Refs: #35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Backport-PR-URL: #37100 PR-URL: #36178 Fixes: #35730 Fixes: #36151 Refs: #35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 408c7a65f3...f206505 (v14.x-staging). Thanks @Pezmc |
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Backport-PR-URL: #37100 PR-URL: #36178 Fixes: #35730 Fixes: #36151 Refs: #35754 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in https://github.com/nodejs/node/releases/tag/v14.15.5! 💃 |
Backports #36178 from @BridgeAR, tagged as semver‑patch, to 14.x as per comment from @ExE-Boss
14.x is currently impacted by the bug fixed in #36178, which was originally released to 15.x in https://github.com/nodejs/node/releases/tag/v15.5.0
I followed the guide from https://github.com/nodejs/node/blob/master/doc/guides/backporting-to-release-lines.md