Skip to content

[Regression 2.6x?] DateTimeFormat.format() missing and other weirdness #529

@duonglaiquang

Description

@duonglaiquang

Problem in brief

Attempts to call the JS method DateTimeFormat.format() in HtmlUnit 2.66 now throws TypeError: Cannot find function format in object [object DateTimeFormat] where as in a much older 2.52 it ran as expected.

This commit released in HtmlUnit 2.64 may have unintentionally removed it by removing the RecursiveFunctionObject.call() override.

Reproducing

Here's an example HTML to reproduce:

<!DOCTYPE html>
<html>
<head>
<script>

let dateFormat = Intl.DateTimeFormat();
console.log(dateFormat.format(new Date(2022, 11, 19))) // throws TypeError
console.log(dateFormat instanceof Intl.DateTimeFormat) // returns false instead of true

</script>
</head>
<body>
</body>
</html>
 

More details

Locally restoring RecursiveFunctionObject.call() had the effect of making the test above run as expected.

Metadata

Metadata

Assignees

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