From: RBRi <rb...@us...> - 2018-06-29 19:53:51
|
- **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 htm...@li... 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. |