Skip to content

Incorrect tests: createdynfn-html-close-comment-(body|params).js #2095

@iamstolis

Description

@iamstolis

test/annexB/built-ins/Function/createdynfn-html-close-comment-body.js and test/annexB/built-ins/Function/createdynfn-html-close-comment-params.js i.e. Function("-->"); and Function("-->", ""); are supposed to test HTML-like comments and their parsing is expected to pass. Unfortunately, they are incorrect because --> is not a valid comment. Note that HTMLCloseComment can be either part of SingleLineHTMLCloseComment or MultiLineComment. So it has to be preceeded by LineTerminatorSequence (to be SingleLineHTMLCloseComment) or by */ (to have a chance to be MultiLineComment). Hence, --> cannot be parsed as Comment and the mentioned tests should result in SyntaxError instead.

Side note: It seems that major JavaScript engines share my opinion regarding createdynfn-html-close-comment-params.js test, i.e., all of them fail it. The only reason that some major JavaScript engines pass createdynfn-html-close-comment-body.js test is IMHO the fact that they tend to parse Function("params","body") as function anonymous(params\n) {\nbody\n}, i.e., add an artificial line terminator before the body (which turns the body of the form --> into a valid comment effectively).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions