(v7.x backport) url: updates to the WHATWG URL parser by TimothyGu · Pull Request #12507 · nodejs/node
added
c++
labels
TimothyGu
removed
the
lib / src
label
This commit implements the Web IDL USVString conversion, which mandates all unpaired Unicode surrogates be turned into U+FFFD REPLACEMENT CHARACTER. It also disallows Symbols to be used as USVString per spec. Certain functions call into C++ methods in the binding that use the Utf8Value class to access string arguments. Utf8Value already does the normalization using V8's String::Write, so in those cases, instead of doing the full USVString normalization, only a symbol check is done (`'' + val`, which uses ES's ToString, versus `String()` which has special provisions for symbols). PR-URL: nodejs#12507 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#12507 Reviewed-By: James M Snell <jasnell@gmail.com>
This step was never part of the URL Standard's host parser algorithm, and is rendered unnecessary after IDNA errors are no longer ignored. PR-URL: nodejs#12507 Refs: c2a302c "src: do not ignore IDNA conversion error" Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#12507 Reviewed-By: James M Snell <jasnell@gmail.com>
The entire `URLSearchParams` class is now fully spec-compliant. PR-URL: nodejs#12507 Fixes: nodejs#10821 Reviewed-By: James M Snell <jasnell@gmail.com>
The object is used as a structure, not as a map, which `StorageObject` was designed for. PR-URL: nodejs#12507 Reviewed-By: James M Snell <jasnell@gmail.com>
Provides a factory method to convert a native URL class
into a JS URL object.
```c++
Environment* env = ...
URL url("http://example.org/a/b/c?query#fragment");
MaybeLocal<Value> val = url.ToObject(env);
```
PR-URL: nodejs#12507
Reviewed-By: James M Snell <jasnell@gmail.com>
- Clarify port state - Remove scheme flag - Clarify URL_FLAG_TERMINATED PR-URL: nodejs#12507 Reviewed-By: James M Snell <jasnell@gmail.com>
This changes to the way path parsing for non-special URLs. It allows paths to be empty for non-special URLs and also takes that into account when serializing. PR-URL: nodejs#12507 Fixes: nodejs#11962 Refs: whatwg/url#213 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#12507 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
evanlucas pushed a commit that referenced this pull request
This commit implements the Web IDL USVString conversion, which mandates all unpaired Unicode surrogates be turned into U+FFFD REPLACEMENT CHARACTER. It also disallows Symbols to be used as USVString per spec. Certain functions call into C++ methods in the binding that use the Utf8Value class to access string arguments. Utf8Value already does the normalization using V8's String::Write, so in those cases, instead of doing the full USVString normalization, only a symbol check is done (`'' + val`, which uses ES's ToString, versus `String()` which has special provisions for symbols). PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
evanlucas pushed a commit that referenced this pull request
PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
evanlucas pushed a commit that referenced this pull request
The object is used as a structure, not as a map, which `StorageObject` was designed for. PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
Provides a factory method to convert a native URL class
into a JS URL object.
```c++
Environment* env = ...
URL url("http://example.org/a/b/c?query#fragment");
MaybeLocal<Value> val = url.ToObject(env);
```
PR-URL: #12507
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
- Clarify port state - Remove scheme flag - Clarify URL_FLAG_TERMINATED PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
This changes to the way path parsing for non-special URLs. It allows paths to be empty for non-special URLs and also takes that into account when serializing. PR-URL: #12507 Fixes: #11962 Refs: whatwg/url#213 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
evanlucas pushed a commit that referenced this pull request
evanlucas pushed a commit that referenced this pull request
- Use ordinary properties instead of symbols/getter redirection for internal object - Use template string literals - Remove unneeded custom inspection for internal objects - Remove unneeded OpaqueOrigin class - Remove unneeded type checks PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request
* reduce indentation * refactor URL inlined methods * prefer templates over macros * do not export ARG_* flags in url binding PR-URL: #12507 Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas added a commit that referenced this pull request
Notable changes:
* **crypto**:
- add randomFill and randomFillSync (Evan Lucas)
#10209
* **meta**: Added new collaborators
- add lucamaraschi to collaborators (Luca Maraschi)
#12538
- add DavidCai1993 to collaborators (David Cai)
#12435
- add jkrems to collaborators (Jan Krems)
#12427
- add AnnaMag to collaborators (AnnaMag)
#12414
* **process**:
- fix crash when Promise rejection is a Symbol (Cameron Little)
#11640
* **url**:
- make WHATWG URL more spec compliant (Timothy Gu)
#12507
* **v8**:
- fix stack overflow in recursive method (Ben Noordhuis)
#12460
- fix build errors with g++ 7 (Ben Noordhuis)
#12392
PR-URL: #12775
evanlucas added a commit that referenced this pull request
Notable changes:
* **crypto**:
- add randomFill and randomFillSync (Evan Lucas)
#10209
* **meta**: Added new collaborators
- add lucamaraschi to collaborators (Luca Maraschi)
#12538
- add DavidCai1993 to collaborators (David Cai)
#12435
- add jkrems to collaborators (Jan Krems)
#12427
- add AnnaMag to collaborators (AnnaMag)
#12414
* **process**:
- fix crash when Promise rejection is a Symbol (Cameron Little)
#11640
* **url**:
- make WHATWG URL more spec compliant (Timothy Gu)
#12507
* **v8**:
- fix stack overflow in recursive method (Ben Noordhuis)
#12460
- fix build errors with g++ 7 (Ben Noordhuis)
#12392
PR-URL: #12775
evanlucas added a commit that referenced this pull request
Notable changes:
* **crypto**:
- add randomFill and randomFillSync (Evan Lucas)
#10209
* **meta**: Added new collaborators
- add lucamaraschi to collaborators (Luca Maraschi)
#12538
- add DavidCai1993 to collaborators (David Cai)
#12435
- add jkrems to collaborators (Jan Krems)
#12427
- add AnnaMag to collaborators (AnnaMag)
#12414
* **process**:
- fix crash when Promise rejection is a Symbol (Cameron Little)
#11640
* **url**:
- make WHATWG URL more spec compliant (Timothy Gu)
#12507
* **v8**:
- fix stack overflow in recursive method (Ben Noordhuis)
#12460
- fix build errors with g++ 7 (Ben Noordhuis)
#12392
PR-URL: #12775
evanlucas added a commit that referenced this pull request
Notable changes:
* **crypto**:
- add randomFill and randomFillSync (Evan Lucas)
#10209
* **meta**: Added new collaborators
- add lucamaraschi to collaborators (Luca Maraschi)
#12538
- add DavidCai1993 to collaborators (David Cai)
#12435
- add jkrems to collaborators (Jan Krems)
#12427
- add AnnaMag to collaborators (AnnaMag)
#12414
* **process**:
- fix crash when Promise rejection is a Symbol (Cameron Little)
#11640
* **url**:
- make WHATWG URL more spec compliant (Timothy Gu)
#12507
* **v8**:
- fix stack overflow in recursive method (Ben Noordhuis)
#12460
- fix build errors with g++ 7 (Ben Noordhuis)
#12392
PR-URL: #12775
anchnk pushed a commit to anchnk/node that referenced this pull request
Notable changes:
* **crypto**:
- add randomFill and randomFillSync (Evan Lucas)
nodejs#10209
* **meta**: Added new collaborators
- add lucamaraschi to collaborators (Luca Maraschi)
nodejs#12538
- add DavidCai1993 to collaborators (David Cai)
nodejs#12435
- add jkrems to collaborators (Jan Krems)
nodejs#12427
- add AnnaMag to collaborators (AnnaMag)
nodejs#12414
* **process**:
- fix crash when Promise rejection is a Symbol (Cameron Little)
nodejs#11640
* **url**:
- make WHATWG URL more spec compliant (Timothy Gu)
nodejs#12507
* **v8**:
- fix stack overflow in recursive method (Ben Noordhuis)
nodejs#12460
- fix build errors with g++ 7 (Ben Noordhuis)
nodejs#12392
PR-URL: nodejs#12775