[css-font-loading] replacing [[ReadyPromise]]

The spec says, when a font in the FontFaceSet begins loading, to replace 
[[ReadyPromise]] with a freshly created pending Promise object if 
[[ReadyPromise]] is already fulfilled.

First, I notice  that it says "fulfilled" rather than "settled". 
Although the spec never rejects [[ReadyPromise]], script could.  Is it 
worth making document.fonts.ready resilient to that?

Second, detecting if [[ReadyPromise]] holds a fulfilled promise is not 
really something you can do with the Promise API.  Well, you could do 
this (maybe?):

   var fulfilled = false;
   readyPromise.then(function() { fulfilled = true; });
   setTimeout(function() {
     if (fulfilled) {
       readyPromise = new Promise(...);
     }
   }, 0);

but I'm not really sure if this is an idiomatic use of Promises.

Received on Monday, 30 June 2014 02:06:01 UTC