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

(v7.x backport) url: updates to the WHATWG URL parser #12507

Merged
merged 21 commits into from
Apr 25, 2017

Commits on Apr 25, 2017

  1. url: extend URLSearchParams constructor

    PR-URL: nodejs#12507
    Fixes: nodejs#10635
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    71d3f94 View commit details
    Browse the repository at this point in the history
  2. doc: document URLSearchParams constructor

    PR-URL: nodejs#12507
    Ref: whatwg/url#175
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    c40a45f View commit details
    Browse the repository at this point in the history
  3. url: enforce valid UTF-8 in WHATWG parser

    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>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    b0fecbe View commit details
    Browse the repository at this point in the history
  4. url: prioritize toString when stringifying

    The ES addition operator calls the ToPrimitive() abstract operation
    without hint String, leading a subsequent OrdinaryToPrimitive() to call
    valueOf() first on an object rather than the desired toString().
    
    Instead, use template literals which directly call ToString() abstract
    operation, per Web IDL spec.
    
    PR-URL: nodejs#12507
    Fixes: b610a4d "url: enforce valid UTF-8 in WHATWG parser"
    Refs: nodejs@b610a4d#commitcomment-21200056
    Refs: https://tc39.github.io/ecma262/#sec-addition-operator-plus-runtime-semantics-evaluation
    Refs: https://tc39.github.io/ecma262/#sec-template-literals-runtime-semantics-evaluation
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    c3366a5 View commit details
    Browse the repository at this point in the history
  5. url: spec-compliant URLSearchParams serializer

    PR-URL: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    6b2cb6d View commit details
    Browse the repository at this point in the history
  6. src: remove explicit UTF-8 validity check in url

    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>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    7e7fd66 View commit details
    Browse the repository at this point in the history
  7. querystring: move isHexTable to internal

    PR-URL: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    4a94c2d View commit details
    Browse the repository at this point in the history
  8. url: spec-compliant URLSearchParams parser

    The entire `URLSearchParams` class is now fully spec-compliant.
    
    PR-URL: nodejs#12507
    Fixes: nodejs#10821
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    d86f0d7 View commit details
    Browse the repository at this point in the history
  9. url: use a class for WHATWG url[context]

    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>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    a2a3d6c View commit details
    Browse the repository at this point in the history
  10. url: add ToObject method to native URL class

    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>
    jasnell authored and TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    75ef213 View commit details
    Browse the repository at this point in the history
  11. src: WHATWG URL C++ parser cleanup

    - Clarify port state
    - Remove scheme flag
    - Clarify URL_FLAG_TERMINATED
    
    PR-URL: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    5b7b775 View commit details
    Browse the repository at this point in the history
  12. url: change path parsing for non-special URLs

    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>
    watilde authored and TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    d912e28 View commit details
    Browse the repository at this point in the history
  13. test: synchronize WPT url test data

    PR-URL: nodejs#12507
    Refs: web-platform-tests/wpt#4586
    Refs: nodejs#11887
    Reviewed-By: James M Snell <jasnell@gmail.com>
    watilde authored and TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    dceb12e View commit details
    Browse the repository at this point in the history
  14. url: error when domainTo*() is called w/o argument

    PR-URL: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    43faf56 View commit details
    Browse the repository at this point in the history
  15. url: avoid instanceof for WHATWG URL

    PR-URL: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    mscdex authored and TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    dafa600 View commit details
    Browse the repository at this point in the history
  16. url: trim leading slashes of file URL paths

    It should trim the slashes after the colon into three for file URL.
    
    PR-URL: nodejs#12507
    Refs: web-platform-tests/wpt#5195
    Fixes: nodejs#11188
    Reviewed-By: James M Snell <jasnell@gmail.com>
    watilde authored and TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    68cf850 View commit details
    Browse the repository at this point in the history
  17. url: remove javascript URL special case

    PR-URL: nodejs#12507
    Fixes: nodejs#11485
    Reviewed-By: James M Snell <jasnell@gmail.com>
    watilde authored and TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    752097c View commit details
    Browse the repository at this point in the history
  18. url: disallow invalid IPv4 in IPv6 parser

    PR-URL: nodejs#12507
    Fixes: nodejs#10655
    Reviewed-By: James M Snell <jasnell@gmail.com>
    watilde authored and TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    f484cfd View commit details
    Browse the repository at this point in the history
  19. url: clean up WHATWG URL origin generation

    - 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: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    9288b73 View commit details
    Browse the repository at this point in the history
  20. url: improve WHATWG URL inspection

    PR-URL: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    8f702ef View commit details
    Browse the repository at this point in the history
  21. src: clean up WHATWG WG parser

    * reduce indentation
    * refactor URL inlined methods
    * prefer templates over macros
    * do not export ARG_* flags in url binding
    
    PR-URL: nodejs#12507
    Reviewed-By: James M Snell <jasnell@gmail.com>
    TimothyGu committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    473bd5e View commit details
    Browse the repository at this point in the history