[HtmlUnit] [htmlunit:bugs] #1966 setTimeout/setInterval() does not honour [param1, param2, ...] argument

RBRi via HtmlUnit-develop <[email protected]>
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID </p/htmlunit/bugs/1966/77fc5fe7d6e56595731f4b771d3ac9d0c2d315c8.bugs@htmlunit.p.sourceforge.net>
- **status**: accepted --> closed
- **Comment**:

Hi  Atsushi,
many thanks for your detailed error report and the patch. Have implemented this now (similar to your impl). BTW there was already a test case for this marked as NYI.

Sorry for the long delay but i was busy with the FF60 update (and my real work also). If FF60 is ready i will post a new release.

Again thanks for the report and for using HtmlUnit.



---

** [bugs:#1966] setTimeout/setInterval() does not honour [param1, param2, ...] argument**

**Status:** closed
**Group:** 2.31
**Created:** Tue Jun 05, 2018 02:47 PM UTC by Atsushi Nakagawa
**Last Updated:** Fri Jun 29, 2018 05:39 PM UTC
**Owner:** RBRi


## Problem in brief

HtmlUnit  2.31's `window.setTimeout()` and `window.setInterval()` do not honour the `[param1, param2, ...]` part of their respective definitions[1][2]:

```
var timeoutID = scope.setTimeout(function[, delay[, param1, param2, ...]]);
var intervalID = scope.setInterval(func, delay[, param1, param2, ...]);
```

[1] https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
[2] https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval

To be precise, it appears to be implementing this *"`language`"* parameter instead[3][4].

[3] https://sourceforge.net/p/htmlunit/code/15299/tree/trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java#l493
[4] https://sourceforge.net/p/htmlunit/code/15299/tree/trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java#l1500

This *`language`* parameter appears to be an outdated parameter from MSIE's DHTML era.  Other than that I've found find very little documentation[5][6][7].

[5] [https://msdn.microsoft.com/en-us/ie/ms536749(v=vs.94)](https://msdn.microsoft.com/en-us/ie/ms536749(v=vs.94))
[6] https://msdn.microsoft.com/ja-jp/library/cc428172.aspx
[7] https://blogs.msdn.microsoft.com/irenak/2007/03/20/sysk-310-the-difference-between-setinterval-and-settimeout/

## Code to reproduce

```html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function test() {
	setTimeout(function (x, y) {
		console.log("setTimeout(x = " + x + ", y = " + y + ")")
	}, 1, "abc", 123)

	var intervalID = setInterval(function (x, y) {
		console.log("setInterval(x = " + x + ", y = " + y + ")")
		clearInterval(intervalID)
	}, 1, "def", 456)
}

</script>
</head>
<body>
<input type="button" onclick="test()" value="test"/>
</body>
</html>
```

Major browsers, including IE 11, prints:

```
setTimeout(x = abc, y = 123)
setInterval(x = def, y = 456)
```

HtmlUnit 2.31 prints:

```
setTimeout(x = undefined, y = undefined)
setInterval(x = undefined, y = undefined)
```


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/htmlunit/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.