-
Notifications
You must be signed in to change notification settings - Fork 534
Description
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).