Skip to content

Conversation

@XadillaX
Copy link
Contributor

No description provided.

@github-actionsgithub-actionsbot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 21, 2021
Comment on lines +447 to +448
if(DOMException===undefined)
DOMException=internalBinding('messaging').DOMException;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(DOMException===undefined)
DOMException=internalBinding('messaging').DOMException;
DOMException??=internalBinding('messaging').DOMException;

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Why should we use ??=?

Copy link
Contributor

@aduh95aduh95Jun 21, 2021

Choose a reason for hiding this comment

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

I find ??= more readable and concise than the if statement, feel free to disagree and/or disregard.

letDOMException;
constlazyDOMException=hideStackFrames((message,name)=>{
if(DOMException===undefined)
DOMException=internalBinding('messaging').DOMException;
Copy link
Member

Choose a reason for hiding this comment

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

I think it's good to hoist this out of the crypto util and make it more universal in the code base, but I am wondering, why do we want to make this lazy?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably to avoid building the JS function until we're on the error path?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@XadillaX
Copy link
ContributorAuthor

Landed in 2de139b

XadillaX added a commit that referenced this pull request Jun 28, 2021
targos pushed a commit that referenced this pull request Jul 11, 2021
@targostargos mentioned this pull request Jul 13, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@XadillaX@nodejs-github-bot@joyeecheung@aduh95@targos