[Bug 29388] Attribute to prevent calls to function passing TypedArray w/ backing SharedArrayBuffer

# bugzilla at jessica.w3.org (a year ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=29388

Boris Zbarsky bzbarsky@mit.edu changed:

       What    |Removed                     |Added

             CC|                            |bzbarsky@mit.edu,
               |                            |lhansen@mozilla.com
          Flags|                            |needinfo?(lhansen@mozilla.c
               |                            |om)

--- Comment #1 from Boris Zbarsky bzbarsky@mit.edu ---

Lars, how does this sound?

Contact us to advertise here
# bugzilla at jessica.w3.org (a year ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=29388

Domenic Denicola d@domenic.me changed:

       What    |Removed                     |Added

             CC|                            |d@domenic.me

--- Comment #2 from Domenic Denicola d@domenic.me ---

Opt-in makes a lot of sense to me. It seems most natural to opt in on a per-argument basis.

  • ArrayBuffer -> (ArrayBuffer or SharedArrayBuffer)
  • Int8Array -> [AllowShared] Int8Array, etc.
  • ArrayBufferView -> [AllowShared] ArrayBufferView

There should then be some sort of requirement that specs which opt in to this have their processing models for the typed array/array buffer argument more well defined than they are currently. Specs are generally not very precise about when or if they do copies, transfers, moves, etc. IDL tries to enforce more precision with:

At the specification prose level, IDL buffer source types are simply references to objects. To inspect or manipulate the bytes inside the buffer, specification prose MUST first either get a reference to the bytes held by the buffer source or get a copy of the bytes held by the buffer source. With a reference to the buffer source’s bytes, specification prose can get or set individual byte values using that reference.

But for APIs that accept SAB I'd expect extreme precision, possibly with branching paths depending on SAB or not (e.g. "get a reference to the bytes held by the buffer source" for SAB and "get a copy of the bytes held by the buffer source" for AB).

# bugzilla at jessica.w3.org (a year ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=29388

Anne annevk@annevk.nl changed:

       What    |Removed                     |Added

             CC|                            |annevk@annevk.nl

--- Comment #3 from Anne annevk@annevk.nl ---

See bug 28798 for the suggestion to use new IDL syntax to indicate whether to use by-reference or copy the input. I think we should fix that together with this bug to make things a bit simpler and more obvious.

# bugzilla at jessica.w3.org (a year ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=29388

Lars T Hansen lhansen@mozilla.com changed:

       What    |Removed                     |Added

          Flags|needinfo?(lhansen@mozilla.c |
               |om)                         |

--- Comment #4 from Lars T Hansen lhansen@mozilla.com ---

I'm for it, a similar solution was suggested at Mozilla, see bugzilla.mozilla.org/show_bug.cgi?id=1231687.

Also a big +1 to Domenic's remark about increasing the precision level when shared memory might be involved, of course.

# bugzilla at jessica.w3.org (a year ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=29388

--- Comment #5 from Lars T Hansen lhansen@mozilla.com ---

Also related discussion here: lars-t-hansen/ecmascript_sharedmem#38

# bugzilla at jessica.w3.org (6 months ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=29388

--- Comment #6 from Boris Zbarsky bzbarsky@mit.edu ---

I would argue this should be handled via new types, not extended attributes. See bugzilla.mozilla.org/show_bug.cgi?id=1231687#c11 and following comments.

Want more features?

Request early access to our private beta of readable email premium.