Correct handling of resizable ArrayBuffer?
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- HTML
- Sterne
- 118
- Forks
- 52
- Ø Merge
- 9 T. 16 Std.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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?
- Length 15, with 5 bytes from A, 10 bytes from B, allocation gets trimmed at the end of the copy
- Length 20, with 5 bytes from A, 10 bytes from B, and 5 zeroed bytes at the end?
- Length 20, with 5 bytes from A, 5 zeroed bytes, 10 bytes from B
- Error thrown because length changed?
- 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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das Issue nennt keine Repository-Dateien oder Tests. Kläre zunächst das erwartete Verhalten bei der Blob-Konstruktion, wenn ein Quell-TypedArray einen resizable ArrayBuffer verwendet und dieser während des Kopierens vergrößert oder verkleinert wird, und dokumentiere anschließend das gewählte Verhalten sowie, ob die Spezifikation einen Fehler oder ein anderes Ergebnis vorschreiben sollte.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- web-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Ruhig
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100