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: make URLSearchParams properties spec-compliant #11057

Closed
wants to merge 3 commits into from

Conversation

TimothyGu
Copy link
Member

Define URLSearchParams methods as enumerable, writable, configurable, as have already been done to URL in #10408. Also adjust the @@toStringTag variable, as done to URL in #10906.

Fixes: #10799

Benchmark (no significant differences)
                                                              improvement confidence   p.value
 url/url-searchparams-parse.js n=100000 type="encodelast"          0.96 %            0.5252137
 url/url-searchparams-parse.js n=100000 type="encodemany"         -1.82 %            0.1068003
 url/url-searchparams-parse.js n=100000 type="manypairs"          -0.32 %            0.5695471
 url/url-searchparams-parse.js n=100000 type="multicharsep"       -0.65 %            0.4697857
 url/url-searchparams-parse.js n=100000 type="multivalue"         -1.08 %            0.4232083
 url/url-searchparams-parse.js n=100000 type="multivaluemany"     -1.11 %            0.1315487
 url/url-searchparams-parse.js n=100000 type="noencode"            0.19 %            0.8053736
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 Jan 28, 2017
@TimothyGu
Copy link
Member Author

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM with green CI

@TimothyGu
Copy link
Member Author

@TimothyGu
Copy link
Member Author

@joyeecheung, just requested a review from you as you are the author of #10408

@@ -647,6 +647,35 @@ function getObjectFromParams(array) {
return obj;
}

// Mainly to mitigate func-name-matching ESLint rule
function defineIDLClass(proto, classStr, obj) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if there is a possibility/necessity to generate these stuff from an IDL file, like what browsers do, if there will be more convergence with Web APIs in Node core (console, crypto, streams, etc.) Not that this is what this PR should deal with though(and this is just to mitigate func-name-matching anyway, not full-on generation), just a thought.

Also the name is a little bit too general, could be something like defineIDLData or defineIDLValues, since it's about properties that need to be defined with value.

Copy link
Member

Choose a reason for hiding this comment

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

That would likely be a bit overkill at the moment. This is the only IDL defined API we have currently. Eventually if we go down that road more then we can consider this.

value: obj[key]
});
}
for (const key of Object.getOwnPropertySymbols(obj)) {
Copy link
Member

Choose a reason for hiding this comment

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

Would be easier to read if s/key/symbol/, or just separate the two mixins(take operations and symbols as arguments instead of one obj)

jasnell pushed a commit that referenced this pull request Jan 31, 2017
PR-URL: #11057
Fixes: #10799
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@jasnell
Copy link
Member

jasnell commented Jan 31, 2017

Landed in 90c2ac7

@jasnell jasnell closed this Jan 31, 2017
evanlucas pushed a commit that referenced this pull request Jan 31, 2017
PR-URL: #11057
Fixes: #10799
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@TimothyGu TimothyGu deleted the urlsearchparams-props branch January 31, 2017 23:17
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.

url: make URLSearchParams properties spec-compliant
4 participants