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

Re: Updated spec examples with Futures

From: Ryan Sleevi <sleevi@google.com>
Date: Fri, 26 Apr 2013 16:32:06 -0700
Message-ID: <CACvaWvag_qwj2uwCmh=gtMKtjWrCuAOZSerxjL=QTSqjeEZ-sw@mail.gmail.com>
To: Aymeric Vitte <vitteaymeric@gmail.com>
Cc: Alex Russell <slightlyoff@google.com>, "public-webcrypto@w3.org" <public-webcrypto@w3.org>
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
Received on Friday, 26 April 2013 23:32:33 UTC

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