[heycam/webidl] Idea for [AllowShared] (handling SharedArrayBuffer safely) (#638)

We'll likely soon have a model for enabling SharedArrayBuffer in all browsers again (see https://github.com/whatwg/html/issues/4175 for details). The way this works is somewhat opt-in via an internal slot on agent clusters (e.g., [[AllowHighResolutionTimers]] or some such). SharedArrayBuffer would always be present, but messaging it to a dedicated worker would not work unless that flag is set.

Since it's always available there might be APIs that can take a SharedArrayBuffer and do something "safe" with them (i.e., something that does not create a timer). However, given the potentially unsafe nature it would be nice to be able to easily find and vet those.

One problem is that currently you can bypass [AllowShared] with `any` and `object`. Perhaps we should revisit that?

Then, bypassing [[AllowHighResolutionTimers]] on the IDL layer should perhaps require a name with clearer intent, e.g., [UnsafeAllowShared].

So I was thinking, perhaps we keep [AllowShared], but also require it for `any` and `object`, and make it branch on the encompassing agent's agent cluster's [[AllowHighResolutionTimers]]. And then [UnsafeAllowShared] would not.

cc @arturjanc @cdumez @csreis @linclark @lukewagner @mystor @rniwa @domenic @bzbarsky 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/638

Received on Tuesday, 5 February 2019 11:23:08 UTC