Correct handling of resizable ArrayBuffer?

オープン
#219 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
静か
技術スタック
javascript
領域
web-dev

調査の方向性

この issue では、リポジトリのファイルやテストが指定されていません。まず、ソース TypedArray が resizable ArrayBuffer を使用しており、コピー中にそのサイズが変更された場合の Blob 構築時に期待される動作を明らかにし、次に選択した動作と、仕様でエラーまたは別の結果を要求すべきかどうかを文書化してください。

索引モデルが issue の本文から書いたものです。

説明

Given const b = new Blob([A, B]), where A is a TypedArray with a resizable ArrayBuffer, what is the expected behavior?

Chrome/Firefox currently both throw an error if any of the source ArrayBuffer instances are resizable; other runtimes do not.

There is an issue here if A is resized while the Blob is being constructed and the data is being copied. This can happen, for instance, if B has a getter for it's length that causes A to be resized and the implementation uses a flow like...

let total = 0;
for (const chunk of chunks) {
  total += chunk.length;  // B could resize A as a side effect here
}
const dest = allocate(total);
for (const chunk of chunks) {
  copy chunk into dest
}

Let's suppose that A and B both initially have length 10, but B's length getter resizes A to 5... what should the result be?

  1. Length 15, with 5 bytes from A, 10 bytes from B, allocation gets trimmed at the end of the copy
  2. Length 20, with 5 bytes from A, 10 bytes from B, and 5 zeroed bytes at the end?
  3. Length 20, with 5 bytes from A, 5 zeroed bytes, 10 bytes from B
  4. Error thrown because length changed?
  5. Something else?

What if A is resized larger? Is the result just truncated?

Should the spec for Blob explicitly make Chrome/Firefox's behavior of throwing immediately on resizable ArrayBuffer's standard? etc.

/cc @guybedford

主要言語
HTML
スター
118
フォーク
52
平均マージ
9日 16時間
マージ済み PR(30日)
1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

w3c/FileAPI のほかの issue

w3c/FileAPI の issue をすべて見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。