Skip to content

URL.canParse() should throw an error #47505

Description

@zloirock

Version

19.9.0

Platform

All

Subsystem

URL

What is the expected behavior? Why is that the expected behavior?

URL.canParse() // => TypeError: at least 1 argument required, but 0 present.

What do you see instead?

URL.canParse() // => false

Additional information

See the signature https://url.spec.whatwg.org/#url-class

Activity

  1. jazelly commented on Apr 11, 2023

    @jazelly
  2. zloirock commented on Apr 11, 2023

    @zloirock
    Author

    @jazelly the type conversion / validation works correctly, so this comment is not related to this issue.

  3. benjamingr commented on Apr 11, 2023

    @benjamingr
    Member

    Yeah passing no argument is different from passing something that gets coerced

  4. jazelly commented on Apr 11, 2023

    @jazelly
    Member

    Thanks for clarifying. Can I give this a try.

  5. added
    invalidIssues and PRs that are invalid.
    whatwg-urlIssues and PRs related to the WHATWG URL implementation.
    on Apr 11, 2023
  6. anonrig commented on Apr 11, 2023

    @anonrig
    Member

    We are strictly following the whatwg spec. If you think we should throw an error, you should recommend adding a test to web platform tests.

  7. zloirock commented on Apr 11, 2023

    @zloirock
    Author

    If you think we should throw an error, you should recommend adding a test to web platform tests.

    Feel free to create a PR.

    We are strictly following the whatwg spec.

    Since it's still an issue - it seems not - at least you're misinterpreting Web IDL - and it's not the first similar case #41450.

  8. anonrig commented on Apr 11, 2023

    @anonrig
    Member

    Since it's still an issue - it seems not - at least you're misinterpreting Web IDL

    I think you're right, but we have to wait for a web-platform test.

  9. KhafraDev commented on Apr 11, 2023

    @KhafraDev
    Member

    @anonrig a wpt is unlikely to be added because it's an issue with webidl.

    edit: I guess there might be tests in the idlharness, but I'm pretty sure the url tests are updated.

  10. targos commented on Apr 11, 2023

    @targos
    Member

    I don't think we should block bug fixes on WPT. We can add (and already have) our own tests.

  11. aduh95 commented on Apr 13, 2023

    @aduh95
    Contributor

    Fixed by a07caf3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    whatwg-urlIssues and PRs related to the WHATWG URL implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions