-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ImageBitmap transferable #444
Conversation
Regarding the content security model: the algorithm for transferring an ImageBitmap simply copies the value of the origin-clean flag. So no tainting happens when the ImageBitmap is tranferred to a cross-origin script. I am pretty sure this is the right thing to do, but I wanted to point this out because it is a bit tricky and I would like to make sure the security implications are considered by those who review this. |
</ul> | ||
|
||
<div w-nodev> | ||
|
||
<p>The following IDL block formalizes this:</p> | ||
|
||
<pre class="idl">typedef (<span>ArrayBuffer</span> or <span>CanvasProxy</span> or <span>MessagePort</span>) <dfn>Transferable</dfn>;</pre> | ||
<pre class="idl">typedef (<span>ArrayBuffer</span> or <span>CanvasProxy</span> or | ||
<span>MessagePort</span> or <span>ImageBitmap</span>) <dfn>Transferable</dfn>;</pre> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match other multiline typedefs this should look more like
typedef (ArrayBuffer or
CanvasProxy or
MessagePort or
ImageBitmap) Transferable;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you are here if you could fix a mistake I made and correct <span>ArrayBuffer</span>
to <span data-x="idl-ArrayBuffer">ArrayBuffer</span>
that would be lovely <3.
Reviewed, and looks good apart from editorial things. The newest build script (do a git pull in your html-build directory) gives better error output, which can help with some things. |
New patch. |
or <span>CanvasProxy</span> | ||
or <span>MessagePort</span> | ||
or <span>ImageBitmap</span>) <dfn>Transferable</dfn>; | ||
</pre> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we try to avoid putting <pre>
and </pre>
on distinct lines. There's a bit of subtlety there display-wise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ImageBitmap objects can already be sent using postMessage(), but this requires a duplication of the bitmap data in memory, which is inefficient and often unnecessary. This change is a pre-requisite for the OffscreenCanvas proposal, which relies on ImageBitmaps as an efficient means of transferring bitmap data to and from Workers. See: https://wiki.whatwg.org/wiki/OffscreenCanvas
Committed as 334f9ed. Sorry for not linking the PR, I had the mistaken impression this was rebased. |
ImageBitmap objects can already be sent using postMessage(), but this
requires a duplication of the bitmap data in memory, which is
inefficient and often unnecessary. This change is a pre-requisite
for the OffscreenCanvas proposal, which relies on ImageBitmaps as
an efficient means of transferring bitmap data to and from Workers.
See: https://wiki.whatwg.org/wiki/OffscreenCanvas