Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url: stricter domainTo*() argument checking #12134

Closed
wants to merge 1 commit into from

Conversation

TimothyGu
Copy link
Member

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

url

@nodejs-github-bot nodejs-github-bot added dont-land-on-v4.x whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Mar 30, 2017
@@ -1308,11 +1308,17 @@ function originFor(url, base) {
}

function domainToASCII(domain) {
if (arguments.length < 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change these to checks against domain explicitly. No need to introduce arguments for no reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

That would be against the semantics used by other WHATWG URL interface methods. Why the aversion to arguments in this case? arguments.length is perfectly fine and optimizable by V8.

Copy link
Member

Choose a reason for hiding this comment

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

Since url.host = undefined actually sets the domain to "undefined"...it makes sense for domainTo* too so arguments.length is needed

@TimothyGu TimothyGu dismissed cjihrig’s stale review April 3, 2017 23:51

Rationale for arguments.length has been explained.

@TimothyGu
Copy link
Member Author

jasnell pushed a commit that referenced this pull request Apr 4, 2017
PR-URL: #12134
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Apr 4, 2017

Landed in c4469c4

@jasnell jasnell closed this Apr 4, 2017
@TimothyGu TimothyGu deleted the url-domainto-noarg branch April 4, 2017 18:21
@jasnell jasnell mentioned this pull request Apr 4, 2017
@italoacasas
Copy link
Contributor

cc @TimothyGu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
whatwg-url Issues and PRs related to the WHATWG URL implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants