From d47c3d70a55b14575f643e54451eef45ca67513a Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 25 Jun 2021 15:44:47 -0400 Subject: [PATCH 01/17] Use new Web IDL buffer primitives See https://github.com/heycam/webidl/pull/987. --- index.bs | 84 ++++++++++++++++++++++---------------------------------- 1 file changed, 33 insertions(+), 51 deletions(-) diff --git a/index.bs b/index.bs index 22f6561d9..3367199f8 100644 --- a/index.bs +++ b/index.bs @@ -1145,17 +1145,14 @@ Methods 2. Let promise be a new Promise. - 3. If the operation IsDetachedBuffer - (described in [[!ECMASCRIPT]]) on {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}} is - false, execute the following steps: + 3. If {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}} + is [=BufferSource/detached=], execute the following steps: 1. Append promise to {{BaseAudioContext/[[pending promises]]}}. - 2. - Detach the {{BaseAudioContext/decodeAudioData(audioData, + 2. [=ArrayBuffer/Detach=] the {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}} {{ArrayBuffer}}. - This operation is described in [[!ECMASCRIPT]]. If this operations - throws, jump to the step 3. + If this operations throws, jump to the step 3. 3. Queue a decoding operation to be performed on another thread. @@ -2513,7 +2510,7 @@ Methods : getChannelData(channel) :: According to the rules described in acquire the content - either [=get a reference to the buffer source|get a reference to=] + either [=ArrayBufferView/write=] into or [=get a copy of the buffer source|get a copy of=] the bytes stored in {{[[internal data]]}} in a new {{Float32Array}} @@ -2550,14 +2547,12 @@ invoker. When an acquire the content operation occurs on an {{AudioBuffer}}, run the following steps: - 1. If the operation IsDetachedBuffer - on any of the {{AudioBuffer}}'s {{ArrayBuffer}}s return - `true`, abort these steps, and return a zero-length - channel data buffer to the invoker. + 1. If any of the {{AudioBuffer}}'s {{ArrayBuffer}}s are + [=BufferSource/detached=], return `true`, abort these steps, and + return a zero-length channel data buffer to the invoker. - 2. Detach - all {{ArrayBuffer}}s for arrays previously returned by - {{AudioBuffer/getChannelData()}} on this {{AudioBuffer}}. + 2. [=ArrayBuffer/Detach=] all {{ArrayBuffer}}s for arrays previously returned + by {{AudioBuffer/getChannelData()}} on this {{AudioBuffer}}. Note: Because {{AudioBuffer}} can only be created via {{BaseAudioContext/createBuffer()}} or via the {{AudioBuffer}} constructor, this @@ -3692,7 +3687,7 @@ Methods are also removed if the hold time occurs after {{AudioParam/cancelScheduledValues()/cancelTime!!argument}}. - For a {{AudioParam/setValueCurveAtTime()}}, let \(T_0\) and \(T_D\) be the corresponding + For a {{AudioParam/setValueCurveAtTime()}}, let \(T_0\) and \(T_D\) be the corresponding {{AudioParam/setValueCurveAtTime()/startTime!!argument}} and {{AudioParam/setValueCurveAtTime()/duration!!argument}}, respectively of this event. Then if {{AudioParam/cancelScheduledValues()/cancelTime!!argument}} is in the range \([T_0, T_0 + T_D]\), the event is @@ -4364,15 +4359,12 @@ Methods
: getByteFrequencyData(array) :: - Get a - - reference to the bytes held by the {{Uint8Array}} - passed as an argument. Copies the current frequency data to those - bytes. If the array has fewer elements than the {{frequencyBinCount}}, the - excess elements will be dropped. If the array has more elements than the - {{frequencyBinCount}}, the excess elements will be ignored. The most - recent {{AnalyserNode/fftSize}} frames are used in computing the frequency - data. + [=ArrayBufferView/Write=] the [=current frequency data=] into |array|. If + |array|'s [=BufferSource/byte length=] is less than {{frequencyBinCount}}, + the excess elements will be dropped. If |array|'s + [=BufferSource/byte length=] is greater than the {{frequencyBinCount}}, the + excess elements will be ignored. The most recent {{AnalyserNode/fftSize}} + frames are used in computing the frequency data. If another call to {{AnalyserNode/getByteFrequencyData()}} or {{AnalyserNode/getFloatFrequencyData()}} occurs within the same @@ -4409,15 +4401,12 @@ Methods : getByteTimeDomainData(array) :: - Get a - - reference to the bytes held by the {{Uint8Array}} - passed as an argument. Copies the current time-domain data - (waveform data) into those bytes. If the array has fewer elements than the - value of {{AnalyserNode/fftSize}}, the excess elements will be dropped. If - the array has more elements than {{AnalyserNode/fftSize}}, the excess - elements will be ignored. The most recent {{AnalyserNode/fftSize}} frames - are used in computing the byte data. + [=ArrayBufferView/Write=] the [=current time-domain data=] (waveform data) + into |array|. If |array|'s [=BufferSource/byte length=] is less than + {{AnalyserNode/fftSize}}, the excess elements will be dropped. If |array|'s + [=BufferSource/byte length=] is greater than the {{AnalyserNode/fftSize}}, + the excess elements will be ignored. The most recent + {{AnalyserNode/fftSize}} frames are used in computing the byte data. The values stored in the unsigned byte array are computed in the following way. Let \(x[k]\) be the time-domain data. Then @@ -4442,14 +4431,10 @@ Methods : getFloatFrequencyData(array) :: - Get a - - reference to the bytes held by the - {{Float32Array}} passed as an argument. Copies - the current frequency data into those bytes. If the array has - fewer elements than the {{frequencyBinCount}}, the excess elements will be - dropped. If the array has more elements than the {{frequencyBinCount}}, - the excess elements will be ignored. The most recent + [=ArrayBufferView/Write=] the [=current frequency data=] into |array|. If + |array| has fewer elements than the {{frequencyBinCount}}, the excess + elements will be dropped. If |array| has more elements than the + {{frequencyBinCount}}, the excess elements will be ignored. The most recent {{AnalyserNode/fftSize}} frames are used in computing the frequency data. If another call to {{AnalyserNode/getFloatFrequencyData()}} or @@ -4470,15 +4455,12 @@ Methods : getFloatTimeDomainData(array) :: - Get a - - reference to the bytes held by the - {{Float32Array}} passed as an argument. Copies the - current time-domain data (waveform data) into those bytes. If the - array has fewer elements than the value of {{AnalyserNode/fftSize}}, the - excess elements will be dropped. If the array has more elements than - {{AnalyserNode/fftSize}}, the excess elements will be ignored. The most - recent {{AnalyserNode/fftSize}} frames are returned (after downmixing). + [=ArrayBufferView/Write=] the [=current time-domain data=] (waveform data) + into |array|. If |array| has fewer elements than the value of + {{AnalyserNode/fftSize}}, the excess elements will be dropped. If |array| + has more elements than the value of {{AnalyserNode/fftSize}}, the excess + elements will be ignored. The most recent {{AnalyserNode/fftSize}} frames + are written (after downmixing).
 			array: This parameter is where the time-domain sample data will be copied.

From 6d338f67631cb23d86c6a0f2a33a6dcb0e9ab103 Mon Sep 17 00:00:00 2001
From: Raymond Toy 
Date: Mon, 28 Jun 2021 14:59:51 -0700
Subject: [PATCH 02/17] Fix #2361: Use new Web IDL buffer primitives

Updates spec to use new Web IDL buffer primitives.  The changes are
marked as candidate corrections, but we use several correction
amendments to make it easy to see what the new and old text will be.
Using just one makes it super-hard to figure out what controls the
text, and the text sometimes doesn't always clearly show what's
deleted and what's inserted because the links are colored correctly,
and struck-through text doesn't strike through links.  (A bikeshed
issue?)
---
 index.bs | 105 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 89 insertions(+), 16 deletions(-)

diff --git a/index.bs b/index.bs
index 3367199f8..362a458bb 100644
--- a/index.bs
+++ b/index.bs
@@ -1136,6 +1136,13 @@ Methods
 		is via its promise return value, the callback parameters are
 		provided for legacy reasons.
 
+		
+ Candidate Correction + Issue 2361-1. + + Use new Web IDL buffer primitives +
+
When decodeAudioData is called, the following steps MUST be performed on the control @@ -1145,14 +1152,17 @@ Methods 2. Let promise be a new Promise. - 3. If {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}} - is [=BufferSource/detached=], execute the following steps: + 3. If + the operation IsDetachedBuffer (described in [[!ECMASCRIPT]]) on + {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}} + is false, {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}} is [=BufferSource/detached=], execute the following steps: 1. Append promise to {{BaseAudioContext/[[pending promises]]}}. - 2. [=ArrayBuffer/Detach=] the {{BaseAudioContext/decodeAudioData(audioData, - successCallback, errorCallback)/audioData!!argument}} {{ArrayBuffer}}. - If this operations throws, jump to the step 3. + 2. Detach[=ArrayBuffer/Detach=] + the {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}} {{ArrayBuffer}}. + This operation is described in [[!ECMASCRIPT]]. + If this operations throws, jump to the step 3. 3. Queue a decoding operation to be performed on another thread. @@ -2509,8 +2519,14 @@ Methods : getChannelData(channel) :: +
+ Candidate Correction + Issue 2361-2. + + Use new Web IDL buffer primitives +
According to the rules described in acquire the content - either [=ArrayBufferView/write=] into + either [=get a reference to the buffer source|get a reference to=][=ArrayBufferView/write=] into or [=get a copy of the buffer source|get a copy of=] the bytes stored in {{[[internal data]]}} in a new {{Float32Array}} @@ -2547,11 +2563,19 @@ invoker. When an acquire the content operation occurs on an {{AudioBuffer}}, run the following steps: - 1. If any of the {{AudioBuffer}}'s {{ArrayBuffer}}s are - [=BufferSource/detached=], return `true`, abort these steps, and +
+ Candidate Correction + Issue 2361-3. + + Use new Web IDL buffer primitives +
+ + 1. If the operation IsDetachedBuffer + on any of the {{AudioBuffer}}'s {{ArrayBuffer}}sany of the {{AudioBuffer}}'s {{ArrayBuffer}}s are + [=BufferSource/detached=], return `true`, abort these steps, and return a zero-length channel data buffer to the invoker. - 2. [=ArrayBuffer/Detach=] all {{ArrayBuffer}}s for arrays previously returned + 2. Detach[=ArrayBuffer/Detach=] all {{ArrayBuffer}}s for arrays previously returned by {{AudioBuffer/getChannelData()}} on this {{AudioBuffer}}. Note: Because {{AudioBuffer}} can only be created via @@ -4359,10 +4383,23 @@ Methods
: getByteFrequencyData(array) :: +
+ Candidate Correction + Issue 2361-4. + + Use new Web IDL buffer primitives +
+ Get a + + reference to the bytes held by the {{Uint8Array}} + passed as an argument. Copies the current frequency data to those + bytes. If the array has fewer elements than the {{frequencyBinCount}}, the + excess elements will be dropped. If the array has more elements than the + {{frequencyBinCount}} [=ArrayBufferView/Write=] the [=current frequency data=] into |array|. If |array|'s [=BufferSource/byte length=] is less than {{frequencyBinCount}}, the excess elements will be dropped. If |array|'s - [=BufferSource/byte length=] is greater than the {{frequencyBinCount}}, the + [=BufferSource/byte length=] is greater than the {{frequencyBinCount}}, the excess elements will be ignored. The most recent {{AnalyserNode/fftSize}} frames are used in computing the frequency data. @@ -4401,10 +4438,22 @@ Methods : getByteTimeDomainData(array) :: - [=ArrayBufferView/Write=] the [=current time-domain data=] (waveform data) +
+ Candidate Correction + Issue 2361-5. + + Use new Web IDL buffer primitives +
+ Get a + + reference to the bytes held by the {{Uint8Array}} + passed as an argument. Copies the current time-domain data + (waveform data) into those bytes. If the array has fewer elements than the + value of {{AnalyserNode/fftSize}}, the excess elements will be dropped. If + the array has more elements than {{AnalyserNode/fftSize}},[=ArrayBufferView/Write=] the [=current time-domain data=] (waveform data) into |array|. If |array|'s [=BufferSource/byte length=] is less than {{AnalyserNode/fftSize}}, the excess elements will be dropped. If |array|'s - [=BufferSource/byte length=] is greater than the {{AnalyserNode/fftSize}}, + [=BufferSource/byte length=] is greater than the {{AnalyserNode/fftSize}}, the excess elements will be ignored. The most recent {{AnalyserNode/fftSize}} frames are used in computing the byte data. @@ -4431,10 +4480,21 @@ Methods : getFloatFrequencyData(array) :: - [=ArrayBufferView/Write=] the [=current frequency data=] into |array|. If +
+ Candidate Correction + Issue 2361-6. + + Use new Web IDL buffer primitives +
+ Get a + + reference to the bytes held by the + {{Float32Array}} passed as an argument. Copies + the current frequency data into those bytes. If the array has + fewer elements than the {{frequencyBinCount}},[=ArrayBufferView/Write=] the [=current frequency data=] into |array|. If |array| has fewer elements than the {{frequencyBinCount}}, the excess elements will be dropped. If |array| has more elements than the - {{frequencyBinCount}}, the excess elements will be ignored. The most recent + {{frequencyBinCount}}, the excess elements will be ignored. The most recent {{AnalyserNode/fftSize}} frames are used in computing the frequency data. If another call to {{AnalyserNode/getFloatFrequencyData()}} or @@ -4455,10 +4515,23 @@ Methods : getFloatTimeDomainData(array) :: - [=ArrayBufferView/Write=] the [=current time-domain data=] (waveform data) +
+ Candidate Correction + Issue 2361-7. + + Use new Web IDL buffer primitives +
+ Get a + + reference to the bytes held by the + {{Float32Array}} passed as an argument. Copies the + current time-domain data (waveform data) into those bytes. If the + array has fewer elements than the value of {{AnalyserNode/fftSize}}, the + excess elements will be dropped. If the array has more elements than + {{AnalyserNode/fftSize}},[=ArrayBufferView/Write=] the [=current time-domain data=] (waveform data) into |array|. If |array| has fewer elements than the value of {{AnalyserNode/fftSize}}, the excess elements will be dropped. If |array| - has more elements than the value of {{AnalyserNode/fftSize}}, the excess + has more elements than the value of {{AnalyserNode/fftSize}}, the excess elements will be ignored. The most recent {{AnalyserNode/fftSize}} frames are written (after downmixing). From 2b6c92bc440f408b91fd49d9fb4f24a38f403f62 Mon Sep 17 00:00:00 2001 From: Raymond Toy Date: Fri, 2 Jul 2021 08:10:51 -0700 Subject: [PATCH 03/17] Remove link that no longer exists --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 362a458bb..dc429436d 100644 --- a/index.bs +++ b/index.bs @@ -2526,7 +2526,7 @@ Methods Use new Web IDL buffer primitives
According to the rules described in acquire the content - either [=get a reference to the buffer source|get a reference to=][=ArrayBufferView/write=] into + either get a reference to[=ArrayBufferView/write=] into or [=get a copy of the buffer source|get a copy of=] the bytes stored in {{[[internal data]]}} in a new {{Float32Array}} From 7f8317946160bfe559cf09c0ce7cffc87a62205d Mon Sep 17 00:00:00 2001 From: Raymond Toy Date: Fri, 2 Jul 2021 08:21:46 -0700 Subject: [PATCH 04/17] Update changelog --- index.bs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.bs b/index.bs index cca0c78bf..24d688921 100644 --- a/index.bs +++ b/index.bs @@ -12735,6 +12735,11 @@ class Vec3 {

Change Log

+

+ Candidate Changes since Recommendation of 17 Jun 2021 +

+ * PR 2361: Use new Web IDL buffer primitives +

Since Proposed Recommendation of 6 May 2021

From f02977048488b0f20f44c05e77b06a00bbc30a78 Mon Sep 17 00:00:00 2001 From: Raymond Toy Date: Fri, 2 Jul 2021 09:55:38 -0700 Subject: [PATCH 05/17] Add script to create list of corrections for a change --- amendments.js | 14 ++++++++++++++ index.bs | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 amendments.js diff --git a/amendments.js b/amendments.js new file mode 100644 index 000000000..377845416 --- /dev/null +++ b/amendments.js @@ -0,0 +1,14 @@ +function ListAmendments(prefix, label, divID) { + let nodes = document.querySelectorAll(`*[id^="${prefix}"]`); + let div = document.getElementById(divID); + + let text = '
    '; + let index = 1; + nodes.forEach(x => { + text += `
  • ${label} ${index}
  • `; + ++index; + }); + text += '
'; + + div.innerHTML = text; +} diff --git a/index.bs b/index.bs index 24d688921..8d57f451a 100644 --- a/index.bs +++ b/index.bs @@ -97,6 +97,8 @@ window.addEventListener("DOMContentLoaded", function () { }); }); +