- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Tue, 29 Apr 2014 14:07:09 -0400
- To: "Mark S. Miller" <erights@google.com>, Brandon Jones <bajones@google.com>
- CC: Brendan Eich <brendan@secure.meer.net>, public-webapps <public-webapps@w3.org>
On 4/29/14, 1:46 PM, Mark S. Miller wrote: > How would either make GC observable? Consider the following code: navigator.getGamepads()[0].foo = 5; var intervals = 0; var id = setInterval(function() { ++intervals; if (navigator.getGamepads()[0].foo != 5) { alert("What happened after " + intervals + " intervals?"); clearInterval(id); } }, 1000); In Chrome's current implementation, where getGamepads() returns a new object each time getGamepads()[0] is a new object each time this will consistently alert "What happened after 1 intervals?". In Firefox's current implementation this will not alert at all unless the set of connected gamepads changes. In an implementation which brokenly GCed and lazily recreated the JS reflections of Gamepad objects, the alert could happen after some random number of intervals, depending on GC timing. Does that help? -Boris
Received on Tuesday, 29 April 2014 18:07:46 UTC