Re: New functionality in PR - priority

On 5/24/15 4:15 PM, Eric Rescorla wrote:
> On Sun, May 24, 2015 at 6:41 AM, Jan-Ivar Bruaroey <jib@mozilla.com 
> <mailto:jib@mozilla.com>> wrote:
>
>     Keep in mind that JavaScript is essentially a bunch of callbacks,
>     none of which are allowed to take any appreciable amount of time,
>     or indeed even observe the passage of time.
>
>
> I don't understand this claim. Content JS can chew up huge amounts of 
> time, though of course
> eventually the browser will start to complain about the thread being 
> stalled.
>
> As far as observe the passage of time, consider the following code:
> var d1;
> var d2;
>
> d1 = new Date();
> d2 = new Date();
>
> while (d2.getTime() == d1.getTime()){
>   d2 = new Date();
> }
>
> alert("d1=" + d1.getTime() + " d2=" + d2.getTime());
>
> Is it your claim that the loop never terminates?

It does terminate, as it looks like you can observe the machine clock (I 
guess it'd be hard to time things accurately otherwise).

But AFAIK you can't observe much else. Try observing video.currentTime 
of a gum stream: http://jsfiddle.net/r79L3j05

I tried in Chrome and Firefox and video.currentTime doesn't observably 
advance while JS is executing.

.: Jan-Ivar :.

Received on Monday, 25 May 2015 02:19:32 UTC