[webkit-dev] Protect promise capabilities from being vended again

Xabier Rodríguez Calvar calvaris at igalia.com
Thu Nov 12 11:00:14 PST 2015


	Hello,

When you create a promise capability, there's nothing preventing you
from calling again @resolve and @reject on the capability to vend the
promise twice. In the case of the Streams implementation to create
capabilities are are already vended, we do it as { @promise: @Promise.@
resolve } or @reject and those capability objects don't have the
@resolve and @reject slots so calling them would obviously fail.

Vending a promise twice means probably an issue in the algorithm that
you are implementing and if it were properly designed that shouldn't
happen. Software and specs can have bugs though and we could end up
hitting those unexpected cases.

For that I think we could change the internal promise capabilities to
use the newly added @assert when they are vended twice and also add two
functions to create those vended capabilities in a single call.

Any comments?

-- 
Xabier Rodríguez Calvar
Software Engineer
IGALIA http://www.igalia.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20151112/6db83d97/attachment.sig>


More information about the webkit-dev mailing list