GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: avoid prototype access in binding templates by joyeecheung · Pull Request #47913 · nodejs/node

Conversation

@joyeecheung

@joyeecheung joyeecheung commented May 8, 2023

Copy link
Copy Markdown
Member

This patch makes the binding templates ObjectTemplates, since we don't actually need the constructor function. This also avoids setting the properties on prototype, and instead initializes them directly on the object template.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot

nodejs-github-bot commented May 8, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup
  • @nodejs/url
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels May 8, 2023
@nodejs-github-bot

nodejs-github-bot commented May 8, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/51695/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung
joyeecheung requested a review from legendecas May 8, 2023 12:50
@github-actions github-actions Bot mentioned this pull request May 9, 2023
CI Reliability 2023-05-09 nodejs/reliability#560
Open
29 tasks
legendecas
legendecas approved these changes May 9, 2023
View reviewed changes
@github-actions github-actions Bot mentioned this pull request May 10, 2023
CI Reliability 2023-05-10 nodejs/reliability#561
Open
25 tasks
jasnell
jasnell approved these changes May 10, 2023
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented May 10, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/51743/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request May 11, 2023
CI Reliability 2023-05-11 nodejs/reliability#562
Open
24 tasks
@joyeecheung joyeecheung added the commit-queue PRs queued for automated landing through the Commit Queue. label May 11, 2023
@nodejs-github-bot nodejs-github-bot added commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels May 11, 2023
@nodejs-github-bot

nodejs-github-bot commented May 11, 2023

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/47913
✔  Done loading data for nodejs/node/pull/47913
----------------------------------- PR info ------------------------------------
Title      src: avoid prototype access in binding templates (#47913)
Author     Joyee Cheung  (@joyeecheung)
Branch     joyeecheung:binding -> nodejs:main
Labels     c++, lib / src, needs-ci
Commits    1
 - src: avoid prototype access in binding templates
Committers 1
 - Joyee Cheung 
PR-URL: https://github.com/nodejs/node/pull/47913
Reviewed-By: Chengzhong Wu 
Reviewed-By: James M Snell 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/47913
Reviewed-By: Chengzhong Wu 
Reviewed-By: James M Snell 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Mon, 08 May 2023 03:16:57 GMT
   ✔  Approvals: 2
   ✔  - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/47913#pullrequestreview-1418106668
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/47913#pullrequestreview-1419744904
   ✘  Last GitHub CI failed
   ℹ  Last Full PR CI on 2023-05-10T11:42:30Z: https://ci.nodejs.org/job/node-test-pull-request/51743/
- Querying data for job/node-test-pull-request/51743/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/4948851579
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax

addaleax commented May 11, 2023

Copy link
Copy Markdown
Member

I think what would be nice for the PR description/commit message is a motivation for why this change is right, not just what it does.

anonrig reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request May 12, 2023
CI Reliability 2023-05-12 nodejs/reliability#563
Open
23 tasks
@joyeecheung

joyeecheung commented May 12, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I think what would be nice for the PR description/commit message is a motivation for why this change is right, not just what it does.

Do you have any suggestions? I am not sure how to formulate the motivation (because falling back to prototype lookup for these is unnecessary and a bit awkward?). It's like when you define a module.exports you don't do this weird dance:

function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;

and just do

module.exports = { property: ... };
legendecas reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung

joyeecheung commented May 18, 2023

Copy link
Copy Markdown
Member Author

Ping @addaleax Do you have any specific suggestions about the commit message? Or should I just use that example above to explain it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax

addaleax commented May 19, 2023

Copy link
Copy Markdown
Member

@joyeecheung No strong preferences, just wanted to make sure that it’s just a simplification of the code and otherwise doesn’t really change anything

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@legendecas

legendecas commented May 22, 2023

Copy link
Copy Markdown
Member

Yeah, I believe this is a simplification of the code.

The cpp format linter is complaining. A re-format might be needed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung
src: avoid prototype access in binding templates
be2d7ed
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.

Previously the initialization was similar to:

```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```

Now it's similar to:

```
module.exports = { property: ... };
```
@joyeecheung
joyeecheung force-pushed the binding branch 2 times, most recently from 084dfdd to be2d7ed Compare May 23, 2023 14:30
@nodejs-github-bot

nodejs-github-bot commented May 23, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/51934/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented May 23, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/51939/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request May 24, 2023
CI Reliability 2023-05-24 nodejs/reliability#575
Open
19 tasks
@nodejs-github-bot

nodejs-github-bot commented May 24, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/51946/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung added a commit that referenced this pull request May 24, 2023
@joyeecheung
src: avoid prototype access in binding templates
c0365fd
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.

Previously the initialization was similar to:

```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```

Now it's similar to:

```
module.exports = { property: ... };
```

PR-URL: #47913
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@joyeecheung

joyeecheung commented May 24, 2023

Copy link
Copy Markdown
Member Author

Landed in c0365fd with the commit message fixed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung joyeecheung closed this May 24, 2023
This was referenced May 25, 2023
CI Reliability 2023-05-25 nodejs/reliability#576
Open
CI Reliability 2023-05-26 nodejs/reliability#577
Open
CI Reliability 2023-05-27 nodejs/reliability#578
Open
CI Reliability 2023-05-28 nodejs/reliability#579
Open
CI Reliability 2023-05-29 nodejs/reliability#580
Open
CI Reliability 2023-05-30 nodejs/reliability#581
Open
targos pushed a commit that referenced this pull request May 30, 2023
@joyeecheung @targos
src: avoid prototype access in binding templates
b25e704
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.

Previously the initialization was similar to:

```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```

Now it's similar to:

```
module.exports = { property: ... };
```

PR-URL: #47913
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@github-actions github-actions Bot mentioned this pull request May 31, 2023
CI Reliability 2023-05-31 nodejs/reliability#582
Open
22 tasks
@targos targos mentioned this pull request Jun 4, 2023
v20.3.0 release proposal #48332
Merged
@danielleadams danielleadams added the backport-requested-v18.x label Jun 30, 2023
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@joyeecheung @Ceres6
src: avoid prototype access in binding templates
a276ff9
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.

Previously the initialization was similar to:

```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```

Now it's similar to:

```
module.exports = { property: ... };
```

PR-URL: nodejs#47913
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@joyeecheung @Ceres6
src: avoid prototype access in binding templates
f094ecb
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.

Previously the initialization was similar to:

```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```

Now it's similar to:

```
module.exports = { property: ... };
```

PR-URL: nodejs#47913
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@legendecas legendecas legendecas approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@joyeecheung @nodejs-github-bot @addaleax @legendecas @jasnell @danielleadams
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.