Skip to content

URL: URL.revokeObjectURL accepts no parameters when 1 is required #50432

Closed

Description

@KhafraDev

Version

n/a

Platform

n/a

Subsystem

url

What steps will reproduce the bug?

URL.revokeObjectURL()

How often does it reproduce? Is there a required condition?

No response

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

this should throw a TypeError

What do you see instead?

undefined

Additional information

node/lib/internal/url.js

Lines 1106 to 1108 in 3c1b4b3

function revokeObjectURL(url) {
bindingBlob.revokeObjectURL(`${url}`);
}

a check is needed along the lines of

node/lib/internal/url.js

Lines 772 to 774 in 3c1b4b3

if (arguments.length === 0) {
throw new ERR_MISSING_ARGS('url');
}

Activity

  1. added
    good first issueIssues that are suitable for first-time contributors.
    whatwg-urlIssues and PRs related to the WHATWG URL implementation.
    on Oct 27, 2023
  2. anonrig commented on Oct 27, 2023

    @anonrig
    Member

    Why does it need to throw an error?

  3. targos commented on Oct 28, 2023

    @targos
    Member

    Because the parameter is not defined as optional.

  4. KhafraDev commented on Oct 28, 2023

    @KhafraDev
    MemberAuthor

    relevant part of the webidl spec:

    An argument is considered to be an optional argument if it is declared with the optional keyword. The final argument of a variadic operation is also considered to be an optional argument. Declaring an argument to be optional indicates that the argument value can be omitted when the operation is invoked. The final argument in an operation must not explicitly be declared to be optional if the operation is variadic.

    Optional arguments can also have a default value specified. If the argument’s identifier is followed by a U+003D (=) and a value (matching DefaultValue), then that gives the optional argument its default value. The implicitly optional final argument of a variadic operation must not have a default value specified. The default value is the value to be assumed when the operation is called with the corresponding argument omitted.

  5. KhafraDev commented on Oct 28, 2023

    @KhafraDev
    MemberAuthor

    from the webidl definition

    [Exposed=(Window,DedicatedWorker,SharedWorker)]
    partial interface URL {
      // ...
      static undefined revokeObjectURL(DOMString url);
    };

    there's a required param here

  6. added a commit that references this issue on Nov 26, 2023
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

    good first issueIssues that are suitable for first-time contributors.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