W3C home > Mailing lists > Public > public-webcrypto@w3.org > April 2013

Re: Updated spec examples with Futures

From: Aymeric Vitte <vitteaymeric@gmail.com>
Date: Sat, 27 Apr 2013 20:43:07 +0200
Message-ID: <517C1C3B.2050308@gmail.com>
To: Ryan Sleevi <sleevi@google.com>
CC: Alex Russell <slightlyoff@google.com>, "public-webcrypto@w3.org" <public-webcrypto@w3.org>

Le 27/04/2013 01:32, Ryan Sleevi a écrit :
> On Fri, Apr 26, 2013 at 4:23 PM, Aymeric Vitte <vitteaymeric@gmail.com> wrote:
>> Le 25/04/2013 17:02, Ryan Sleevi a écrit :
>>
>>> As mentioned before, no.
>>>
>>>> var h=window.crypto.digest("sha1");
>>>> var res1=h.process(stream1);
>>>> res1.finish().done(
>>>>      function() {
>>>>          console.log(this.result); //result 1
>>>>      }
>>>> );
>>>> var res2=res1.process(stream2);
>>>> res2.finish().done(
>>>>      function() {
>>>>          console.log(this.result); //result 1+2
>>>>      }
>>>> );
>>>>
>> OK, waiting to see the new spec, here the question is not if I can do this
>> or not, I can, but this will not produce the correct result
>>
> No. It will not do what you want.
>
> Once a future is resolved (res1), which is what will happen when the
> .finish() is sucessfully called, you will no longer be able to call
> .process() on it further.
>
> You don't need to wait for any spec update - this is inherent from
> http://dom.spec.whatwg.org/#futures

I know that when a Future is resolved you can not use it any longer, but 
does not res1.finish produce a new Future different from res1? Unless I 
misread Futures, that's not very clear. Now, if the different Futures 
are using the same underlying material (ie as specified in the spec), 
then the example will not work, that's what I mean by "waiting to see 
the spec".

Regards,

-- 
jCore
Email :  avitte@jcore.fr
iAnonym : http://www.ianonym.com
node-Tor : https://www.github.com/Ayms/node-Tor
GitHub : https://www.github.com/Ayms
Web :    www.jcore.fr
Webble : www.webble.it
Extract Widget Mobile : www.extractwidget.com
BlimpMe! : www.blimpme.com
Received on Saturday, 27 April 2013 18:40:57 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:17:16 UTC