Bug 1079844 - Change various non-js/ files/tests/etc. to refer to detaching of ArrayBuffers rather than neutering. (DOM references to "neutering" of DOM things remain as neutering.) r=bz

This commit is contained in:
Jeff Walden 2016-01-25 18:10:22 -08:00
parent 15aa119c65
commit c86cd2047c
13 changed files with 29 additions and 29 deletions

View File

@ -95,7 +95,7 @@ function runTests() {
// task: throw exception: general: source is a null
WORKER_TASKS.tasks.push(new TaskWithCrop("testException", 0, 0, "createImageBitmap should throw with null source", null, 0, 0, 0, 0));
// task: throw exception: ImageData: an ImageData object whose data is data attribute has been neutered
// task: throw exception: ImageData: an ImageData object whose data attribute is backed by a detached buffer
var neuturedImageData = function getNeuturedImageData(imageData) {
worker.postMessage(imageData.data.buffer, [imageData.data.buffer]);
return imageData;

View File

@ -151,7 +151,7 @@ AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannel
const float* sourceData = nullptr;
if (channelArray) {
if (JS_GetTypedArrayLength(channelArray) != mLength) {
// The array was probably neutered
// The array's buffer was detached.
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}
@ -196,7 +196,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
JS::AutoCheckCannotGC nogc;
JSObject* channelArray = mJSChannels[aChannelNumber];
if (JS_GetTypedArrayLength(channelArray) != mLength) {
// The array was probably neutered
// The array's buffer was detached.
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}
@ -233,18 +233,18 @@ AudioBuffer::GetChannelData(JSContext* aJSContext, uint32_t aChannel,
already_AddRefed<ThreadSharedFloatArrayBufferList>
AudioBuffer::StealJSArrayDataIntoSharedChannels(JSContext* aJSContext)
{
// "1. If any of the AudioBuffer's ArrayBuffer have been neutered, abort
// "1. If any of the AudioBuffer's ArrayBuffer have been detached, abort
// these steps, and return a zero-length channel data buffers to the
// invoker."
for (uint32_t i = 0; i < mJSChannels.Length(); ++i) {
JSObject* channelArray = mJSChannels[i];
if (!channelArray || mLength != JS_GetTypedArrayLength(channelArray)) {
// Either empty buffer or one of the arrays was probably neutered
// Either empty buffer or one of the arrays' buffers was detached.
return nullptr;
}
}
// "2. Neuter all ArrayBuffers for arrays previously returned by
// "2. Detach all ArrayBuffers for arrays previously returned by
// getChannelData on this AudioBuffer."
// "3. Retain the underlying data buffers from those ArrayBuffers and return
// references to them to the invoker."

View File

@ -27,8 +27,8 @@ class AudioContext;
/**
* An AudioBuffer keeps its data either in the mJSChannels objects, which
* are Float32Arrays, or in mSharedChannels if the mJSChannels objects have
* been neutered.
* are Float32Arrays, or in mSharedChannels if the mJSChannels objects' buffers
* are detached.
*/
class AudioBuffer final : public nsWrapperCache
{
@ -122,7 +122,7 @@ protected:
nsAutoTArray<JS::Heap<JSObject*>, 2> mJSChannels;
// mSharedChannels aggregates the data from mJSChannels. This is non-null
// if and only if the mJSChannels are neutered.
// if and only if the mJSChannels' buffers are detached.
RefPtr<ThreadSharedFloatArrayBufferList> mSharedChannels;
uint32_t mLength;

View File

@ -575,7 +575,7 @@ AudioContext::DecodeAudioData(const ArrayBuffer& aBuffer,
return nullptr;
}
// Neuter the array buffer
// Detach the array buffer
size_t length = aBuffer.Length();
JS::RootedObject obj(cx, aBuffer.Obj());

View File

@ -8,7 +8,7 @@ support-files =
audio-mono-expected.wav
audio-quad.wav
audio.ogv
audioBufferSourceNodeNeutered_worker.js
audioBufferSourceNodeDetached_worker.js
corsServer.sjs
invalid.txt
layouttest-glue.js
@ -39,7 +39,7 @@ support-files =
[test_audioBufferSourceNodeLoop.html]
[test_audioBufferSourceNodeLoopStartEnd.html]
[test_audioBufferSourceNodeLoopStartEndSame.html]
[test_audioBufferSourceNodeNeutered.html]
[test_audioBufferSourceNodeDetached.html]
skip-if = (toolkit == 'android' && (processor == 'x86' || debug)) || os == 'win' # bug 1127845, bug 1138468
[test_audioBufferSourceNodeNoStart.html]
[test_audioBufferSourceNodeNullBuffer.html]

View File

@ -65,8 +65,8 @@ addLoadEvent(function() {
}
}
// Now, neuter the array buffer
var worker = new Worker("audioBufferSourceNodeNeutered_worker.js");
// Now, detach the array buffer
var worker = new Worker("audioBufferSourceNodeDetached_worker.js");
var data = buffer.getChannelData(0).buffer;
worker.postMessage(data, [data]);
SpecialPowers.gc();

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test AudioBufferSourceNode when an AudioBuffer's getChanneData array is neutered</title>
<title>Test AudioBufferSourceNode when an AudioBuffer's getChanneData buffer is detached</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
@ -22,7 +22,7 @@ function createGarbage() {
return sum;
}
var worker = new Worker("audioBufferSourceNodeNeutered_worker.js");
var worker = new Worker("audioBufferSourceNodeDetached_worker.js");
var gTest = {
length: 2048,
@ -34,7 +34,7 @@ var gTest = {
data[i] = (i%100)/100 - 0.5;
}
// Neuter the buffer now
// Detach the buffer now
var data = buffer.getChannelData(0).buffer;
worker.postMessage(data, [data]);
// Create garbage and GC to replace the buffer data with garbage

View File

@ -311,8 +311,8 @@ function runResampling(test, response, callback) {
}
function runTest(test, response, callback) {
// We need to copy the array here, because decodeAudioData is going to neuter
// the array.
// We need to copy the array here, because decodeAudioData will detach the
// array's buffer.
var compressedAudio = response.slice(0);
var expectCallback = false;
var cx = new OfflineAudioContext(test.numberOfChannels || 1,

View File

@ -37,8 +37,8 @@ function testFunc(target, origin) {
var cd = new ArrayBuffer(1);
target.postMessage([ab, cd], origin, [ab]);
is(ab.byteLength, 0, "ab should be neutered");
is(cd.byteLength, 1, "cd should not be neutered");
is(ab.byteLength, 0, "ab should be detached");
is(cd.byteLength, 1, "cd should not be detached");
onmessage = function(e) {
is(e.data[0].byteLength, 1, "ab should be transfered");

View File

@ -8,7 +8,7 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
function neuter(ab)
function detachArrayBuffer(ab)
{
var w = new Worker("data:application/javascript,");
w.postMessage(ab, [ab]);
@ -34,7 +34,7 @@ function test()
is(sis.read(1), "a", "should read 'a' after init");
neuter(ab);
detachArrayBuffer(ab);
SpecialPowers.forceGC();
SpecialPowers.forceGC();
@ -47,7 +47,7 @@ function test()
catch (e)
{
ok(e.result === Cr.NS_BASE_STREAM_CLOSED,
"neutering underneath an input stream should close it");
"detaching underneath an input stream should close it");
}
}

View File

@ -68,12 +68,12 @@ add_task(function* test_transfer_args() {
for (let i = 0; i < 4; ++i) {
array[i] = i;
}
Assert.equal(array.buffer.byteLength, 4, "The buffer is not neutered yet");
Assert.equal(array.buffer.byteLength, 4, "The buffer is not detached yet");
let result = (yield worker.post("bounce", [array.buffer], [], [array.buffer]))[0];
// Check that the buffer has been sent
Assert.equal(array.buffer.byteLength, 0, "The buffer has been neutered");
Assert.equal(array.buffer.byteLength, 0, "The buffer has been detached");
// Check that the result is correct
Assert.equal(result.byteLength, 4, "The result has the right size");
@ -89,13 +89,13 @@ add_task(function* test_transfer_with_meta() {
for (let i = 0; i < 4; ++i) {
array[i] = i;
}
Assert.equal(array.buffer.byteLength, 4, "The buffer is not neutered yet");
Assert.equal(array.buffer.byteLength, 4, "The buffer is not detached yet");
let message = new BasePromiseWorker.Meta(array, {transfers: [array.buffer]});
let result = (yield worker.post("bounce", [message]))[0];
// Check that the buffer has been sent
Assert.equal(array.buffer.byteLength, 0, "The buffer has been neutered");
Assert.equal(array.buffer.byteLength, 0, "The buffer has been detached");
// Check that the result is correct
Assert.equal(result.toString(), "[object Uint8Array]", "The result appears to be a Typed Array");

View File

@ -603,7 +603,7 @@ this.PageThumbsStorage = {
*
* @param {string} aURL The url for which to store a thumbnail.
* @param {ArrayBuffer} aData The data to store in the thumbnail, as
* an ArrayBuffer. This array buffer is neutered and cannot be
* an ArrayBuffer. This array buffer will be detached and cannot be
* reused after the copy.
* @param {boolean} aNoOverwrite If true and the thumbnail's file already
* exists, the file will not be overwritten.