bug 1610296 - Rename TypedArray_base::ComputeLengthAndData to TypedArray_base::ComputeState; r=bzbarsky
authorEdgar Chen <echen@mozilla.com>
Thu, 23 Jan 2020 03:22:06 +0000
changeset 511577 7618404411ed0b17e8da0f0bae865c6d8db190ae
parent 511576 40e14b4368417494b6e0204f49e9293f1a268631
child 511578 b4b71625fcfdf225345a25dd37af50f8cd86b713
push id105889
push userechen@mozilla.com
push dateThu, 23 Jan 2020 22:50:58 +0000
treeherderautoland@7618404411ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1610296
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1610296 - Rename TypedArray_base::ComputeLengthAndData to TypedArray_base::ComputeState; r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D60514
dom/base/ChromeUtils.cpp
dom/base/Crypto.cpp
dom/base/DOMMatrix.cpp
dom/base/DOMParser.cpp
dom/base/nsDOMDataChannel.cpp
dom/bindings/TypedArray.h
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/ClientWebGLContext.cpp
dom/canvas/ImageBitmap.cpp
dom/canvas/ImageData.cpp
dom/canvas/WebGLTextureUpload.cpp
dom/canvas/WebGLTypes.h
dom/crypto/CryptoBuffer.cpp
dom/crypto/KeyAlgorithmProxy.h
dom/encoding/TextDecoder.cpp
dom/encoding/TextEncoder.cpp
dom/fetch/BodyExtractor.cpp
dom/fetch/FetchStreamReader.cpp
dom/file/MultipartBlobImpl.cpp
dom/gamepad/GamepadServiceTest.cpp
dom/indexedDB/IDBFileHandle.cpp
dom/media/eme/EMEUtils.cpp
dom/media/eme/MediaEncryptedEvent.cpp
dom/media/eme/MediaKeyMessageEvent.cpp
dom/media/mediasource/SourceBuffer.cpp
dom/media/webaudio/AnalyserNode.cpp
dom/media/webaudio/AudioBuffer.cpp
dom/media/webaudio/AudioContext.cpp
dom/media/webaudio/BiquadFilterNode.cpp
dom/media/webaudio/IIRFilterNode.cpp
dom/media/webaudio/WaveShaperNode.cpp
dom/midi/MIDIMessageEvent.cpp
dom/network/TCPSocket.cpp
dom/network/UDPSocket.cpp
dom/presentation/PresentationConnection.cpp
dom/prio/test/gtest/TestPrioEncoder.cpp
dom/push/PushUtil.cpp
dom/vr/VRServiceTest.cpp
dom/websocket/WebSocket.cpp
layout/style/FontFace.cpp
toolkit/components/extensions/webrequest/StreamFilter.cpp
--- a/dom/base/ChromeUtils.cpp
+++ b/dom/base/ChromeUtils.cpp
@@ -86,22 +86,22 @@ void ChromeUtils::NondeterministicGetWea
 void ChromeUtils::Base64URLEncode(GlobalObject& aGlobal,
                                   const ArrayBufferViewOrArrayBuffer& aSource,
                                   const Base64URLEncodeOptions& aOptions,
                                   nsACString& aResult, ErrorResult& aRv) {
   size_t length = 0;
   uint8_t* data = nullptr;
   if (aSource.IsArrayBuffer()) {
     const ArrayBuffer& buffer = aSource.GetAsArrayBuffer();
-    buffer.ComputeLengthAndData();
+    buffer.ComputeState();
     length = buffer.Length();
     data = buffer.Data();
   } else if (aSource.IsArrayBufferView()) {
     const ArrayBufferView& view = aSource.GetAsArrayBufferView();
-    view.ComputeLengthAndData();
+    view.ComputeState();
     length = view.Length();
     data = view.Data();
   } else {
     MOZ_CRASH("Uninitialized union: expected buffer or view");
   }
 
   auto paddingPolicy = aOptions.mPad ? Base64URLEncodePaddingPolicy::Include
                                      : Base64URLEncodePaddingPolicy::Omit;
--- a/dom/base/Crypto.cpp
+++ b/dom/base/Crypto.cpp
@@ -55,17 +55,17 @@ void Crypto::GetRandomValues(JSContext* 
     case js::Scalar::Int32:
     case js::Scalar::Uint32:
       break;
     default:
       aRv.Throw(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
       return;
   }
 
-  aArray.ComputeLengthAndData();
+  aArray.ComputeState();
   uint32_t dataLen = aArray.Length();
   if (dataLen == 0) {
     NS_WARNING("ArrayBufferView length is 0, cannot continue");
     aRetval.set(view);
     return;
   } else if (dataLen > 65536) {
     aRv.Throw(NS_ERROR_DOM_QUOTA_EXCEEDED_ERR);
     return;
--- a/dom/base/DOMMatrix.cpp
+++ b/dom/base/DOMMatrix.cpp
@@ -187,31 +187,31 @@ already_AddRefed<DOMMatrixReadOnly> DOMM
   RefPtr<DOMMatrixReadOnly> matrix =
       FromMatrix(aGlobal.GetAsSupports(), aMatrixInit, aRv);
   return matrix.forget();
 }
 
 already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromFloat32Array(
     const GlobalObject& aGlobal, const Float32Array& aArray32,
     ErrorResult& aRv) {
-  aArray32.ComputeLengthAndData();
+  aArray32.ComputeState();
 
   const int length = aArray32.Length();
   const bool is2D = length == 6;
   RefPtr<DOMMatrixReadOnly> obj =
       new DOMMatrixReadOnly(aGlobal.GetAsSupports(), is2D);
   SetDataInMatrix(obj, aArray32.Data(), length, aRv);
 
   return obj.forget();
 }
 
 already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromFloat64Array(
     const GlobalObject& aGlobal, const Float64Array& aArray64,
     ErrorResult& aRv) {
-  aArray64.ComputeLengthAndData();
+  aArray64.ComputeState();
 
   const int length = aArray64.Length();
   const bool is2D = length == 6;
   RefPtr<DOMMatrixReadOnly> obj =
       new DOMMatrixReadOnly(aGlobal.GetAsSupports(), is2D);
   SetDataInMatrix(obj, aArray64.Data(), length, aRv);
 
   return obj.forget();
@@ -635,30 +635,30 @@ already_AddRefed<DOMMatrix> DOMMatrix::F
   RefPtr<DOMMatrix> matrix =
       FromMatrix(aGlobal.GetAsSupports(), aMatrixInit, aRv);
   return matrix.forget();
 }
 
 already_AddRefed<DOMMatrix> DOMMatrix::FromFloat32Array(
     const GlobalObject& aGlobal, const Float32Array& aArray32,
     ErrorResult& aRv) {
-  aArray32.ComputeLengthAndData();
+  aArray32.ComputeState();
 
   const int length = aArray32.Length();
   const bool is2D = length == 6;
   RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
   SetDataInMatrix(obj, aArray32.Data(), length, aRv);
 
   return obj.forget();
 }
 
 already_AddRefed<DOMMatrix> DOMMatrix::FromFloat64Array(
     const GlobalObject& aGlobal, const Float64Array& aArray64,
     ErrorResult& aRv) {
-  aArray64.ComputeLengthAndData();
+  aArray64.ComputeState();
 
   const int length = aArray64.Length();
   const bool is2D = length == 6;
   RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
   SetDataInMatrix(obj, aArray64.Data(), length, aRv);
 
   return obj.forget();
 }
--- a/dom/base/DOMParser.cpp
+++ b/dom/base/DOMParser.cpp
@@ -114,17 +114,17 @@ already_AddRefed<Document> DOMParser::Pa
   RefPtr<Document> ret = ParseFromString(aStr, aType, aRv);
   mPrincipal = docPrincipal;
   return ret.forget();
 }
 
 already_AddRefed<Document> DOMParser::ParseFromBuffer(const Uint8Array& aBuf,
                                                       SupportedType aType,
                                                       ErrorResult& aRv) {
-  aBuf.ComputeLengthAndData();
+  aBuf.ComputeState();
   return ParseFromBuffer(MakeSpan(aBuf.Data(), aBuf.Length()), aType, aRv);
 }
 
 already_AddRefed<Document> DOMParser::ParseFromBuffer(Span<const uint8_t> aBuf,
                                                       SupportedType aType,
                                                       ErrorResult& aRv) {
   // The new stream holds a reference to the buffer
   nsCOMPtr<nsIInputStream> stream;
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -194,31 +194,31 @@ void nsDOMDataChannel::Send(Blob& aData,
   }
 
   Send(&aData, nullptr, true, aRv);
 }
 
 void nsDOMDataChannel::Send(const ArrayBuffer& aData, ErrorResult& aRv) {
   MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
 
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
 
   static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
 
   uint32_t len = aData.Length();
   char* data = reinterpret_cast<char*>(aData.Data());
 
   nsDependentCSubstring msgString(data, len);
   Send(nullptr, &msgString, true, aRv);
 }
 
 void nsDOMDataChannel::Send(const ArrayBufferView& aData, ErrorResult& aRv) {
   MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
 
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
 
   static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
 
   uint32_t len = aData.Length();
   char* data = reinterpret_cast<char*>(aData.Data());
 
   nsDependentCSubstring msgString(data, len);
   Send(nullptr, &msgString, true, aRv);
--- a/dom/bindings/TypedArray.h
+++ b/dom/bindings/TypedArray.h
@@ -114,17 +114,17 @@ struct TypedArray_base : public SpiderMo
     return mData;
   }
 
   inline uint32_t Length() const {
     MOZ_ASSERT(mComputed);
     return mLength;
   }
 
-  inline void ComputeLengthAndData() const {
+  inline void ComputeState() const {
     MOZ_ASSERT(inited());
     MOZ_ASSERT(!mComputed);
     GetLengthAndDataAndSharedness(mImplObj, &mLength, &mShared, &mData);
     mComputed = true;
   }
 
  private:
   TypedArray_base(const TypedArray_base&) = delete;
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -5196,17 +5196,17 @@ nsresult CanvasRenderingContext2D::PutIm
 
   dirtyRect.MoveBy(IntPoint(aX, aY));
   dirtyRect = IntRect(0, 0, mWidth, mHeight).Intersect(dirtyRect);
 
   if (dirtyRect.Width() <= 0 || dirtyRect.Height() <= 0) {
     return NS_OK;
   }
 
-  aArray->ComputeLengthAndData();
+  aArray->ComputeState();
 
   uint32_t dataLen = aArray->Length();
 
   uint32_t len = aW * aH * 4;
   if (dataLen != len) {
     return NS_ERROR_DOM_INVALID_STATE_ERR;
   }
 
--- a/dom/canvas/ClientWebGLContext.cpp
+++ b/dom/canvas/ClientWebGLContext.cpp
@@ -2611,17 +2611,17 @@ void ClientWebGLContext::BufferData(GLen
 
 void ClientWebGLContext::BufferData(
     GLenum target, const dom::Nullable<dom::ArrayBuffer>& maybeSrc,
     GLenum usage) {
   const FuncScope funcScope(*this, "bufferData");
   if (!ValidateNonNull("src", maybeSrc)) return;
   const auto& src = maybeSrc.Value();
 
-  src.ComputeLengthAndData();
+  src.ComputeState();
   const auto view = RawBuffer<const uint8_t>(src.Length(), src.Data());
 
   Run<RPROC(BufferData)>(target, view, usage);
 }
 
 void ClientWebGLContext::BufferData(GLenum target,
                                     const dom::ArrayBufferView& src,
                                     GLenum usage, GLuint srcElemOffset,
@@ -2639,17 +2639,17 @@ void ClientWebGLContext::BufferData(GLen
 }
 
 ////
 
 void ClientWebGLContext::BufferSubData(GLenum target,
                                        WebGLsizeiptr dstByteOffset,
                                        const dom::ArrayBuffer& src) {
   const FuncScope funcScope(*this, "bufferSubData");
-  src.ComputeLengthAndData();
+  src.ComputeState();
   Run<RPROC(BufferSubData)>(target, dstByteOffset,
                             RawBuffer<const uint8_t>(src.Length(), src.Data()));
 }
 
 void ClientWebGLContext::BufferSubData(GLenum target,
                                        WebGLsizeiptr dstByteOffset,
                                        const dom::ArrayBufferView& src,
                                        GLuint srcElemOffset,
@@ -5071,17 +5071,17 @@ static inline size_t SizeOfViewElem(cons
 
   return js::Scalar::byteSize(elemType);
 }
 
 bool ClientWebGLContext::ValidateArrayBufferView(
     const dom::ArrayBufferView& view, GLuint elemOffset,
     GLuint elemCountOverride, const GLenum errorEnum, uint8_t** const out_bytes,
     size_t* const out_byteLen) const {
-  view.ComputeLengthAndData();
+  view.ComputeState();
   uint8_t* const bytes = view.Data();
   const size_t byteLen = view.Length();
 
   const auto& elemSize = SizeOfViewElem(view);
 
   size_t elemCount = byteLen / elemSize;
   if (elemOffset > elemCount) {
     EnqueueError(errorEnum, "Invalid offset into ArrayBufferView.");
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -861,17 +861,17 @@ already_AddRefed<ImageBitmap> ImageBitma
 already_AddRefed<ImageBitmap> ImageBitmap::CreateInternal(
     nsIGlobalObject* aGlobal, ImageData& aImageData,
     const Maybe<IntRect>& aCropRect, ErrorResult& aRv) {
   // Copy data into SourceSurface.
   dom::Uint8ClampedArray array;
   DebugOnly<bool> inited = array.Init(aImageData.GetDataObject());
   MOZ_ASSERT(inited);
 
-  array.ComputeLengthAndData();
+  array.ComputeState();
   const SurfaceFormat FORMAT = SurfaceFormat::R8G8B8A8;
   // ImageData's underlying data is not alpha-premultiplied.
   const auto alphaType = gfxAlphaType::NonPremult;
   const uint32_t BYTES_PER_PIXEL = BytesPerPixel(FORMAT);
   const uint32_t imageWidth = aImageData.Width();
   const uint32_t imageHeight = aImageData.Height();
   const uint32_t imageStride = imageWidth * BYTES_PER_PIXEL;
   const uint32_t dataLength = array.Length();
--- a/dom/canvas/ImageData.cpp
+++ b/dom/canvas/ImageData.cpp
@@ -59,17 +59,17 @@ already_AddRefed<ImageData> ImageData::C
   return imageData.forget();
 }
 
 // static
 already_AddRefed<ImageData> ImageData::Constructor(
     const GlobalObject& aGlobal, const Uint8ClampedArray& aData,
     const uint32_t aWidth, const Optional<uint32_t>& aHeight,
     ErrorResult& aRv) {
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
 
   uint32_t length = aData.Length();
   if (length == 0 || length % 4) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return nullptr;
   }
   length /= 4;
   if (aWidth == 0) {
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -107,17 +107,17 @@ static UniquePtr<webgl::TexUnpackBlob> F
 }
 
 static UniquePtr<webgl::TexUnpackBlob> FromImageData(
     const WebGLContext* webgl, TexImageTarget target, uvec3 size,
     const dom::ImageData& imageData, dom::Uint8ClampedArray* scopedArr) {
   DebugOnly<bool> inited = scopedArr->Init(imageData.GetDataObject());
   MOZ_ASSERT(inited);
 
-  scopedArr->ComputeLengthAndData();
+  scopedArr->ComputeState();
   const DebugOnly<size_t> dataSize = scopedArr->Length();
   const void* const data = scopedArr->Data();
 
   const gfx::IntSize imageSize(imageData.Width(), imageData.Height());
   const size_t stride = imageSize.width * 4;
   const gfx::SurfaceFormat surfFormat = gfx::SurfaceFormat::R8G8B8A8;
 
   // WhatWG "HTML Living Standard" (30 October 2015):
--- a/dom/canvas/WebGLTypes.h
+++ b/dom/canvas/WebGLTypes.h
@@ -879,17 +879,17 @@ template <typename T>
 inline Range<T> MakeRange(RawBuffer<T>& from) {
   return {from.Data(), from.Length()};
 }
 
 // abv = ArrayBufferView
 template <typename T>
 inline auto MakeRangeAbv(const T& abv)
     -> Range<const typename T::element_type> {
-  abv.ComputeLengthAndData();
+  abv.ComputeState();
   return {abv.Data(), abv.Length()};
 }
 
 Maybe<Range<const uint8_t>> GetRangeFromView(const dom::ArrayBufferView& view,
                                              GLuint elemOffset,
                                              GLuint elemCountOverride);
 
 // -
--- a/dom/crypto/CryptoBuffer.cpp
+++ b/dom/crypto/CryptoBuffer.cpp
@@ -34,22 +34,22 @@ uint8_t* CryptoBuffer::Assign(const SECI
 }
 
 uint8_t* CryptoBuffer::Assign(const nsTArray<uint8_t>& aData) {
   return ReplaceElementsAt(0, Length(), aData.Elements(), aData.Length(),
                            fallible);
 }
 
 uint8_t* CryptoBuffer::Assign(const ArrayBuffer& aData) {
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
   return Assign(aData.Data(), aData.Length());
 }
 
 uint8_t* CryptoBuffer::Assign(const ArrayBufferView& aData) {
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
   return Assign(aData.Data(), aData.Length());
 }
 
 uint8_t* CryptoBuffer::Assign(const ArrayBufferViewOrArrayBuffer& aData) {
   if (aData.IsArrayBufferView()) {
     return Assign(aData.GetAsArrayBufferView());
   } else if (aData.IsArrayBuffer()) {
     return Assign(aData.GetAsArrayBuffer());
@@ -70,17 +70,17 @@ uint8_t* CryptoBuffer::Assign(const Owni
 
   // If your union is uninitialized, something's wrong
   MOZ_ASSERT(false);
   Clear();
   return nullptr;
 }
 
 uint8_t* CryptoBuffer::Assign(const Uint8Array& aArray) {
-  aArray.ComputeLengthAndData();
+  aArray.ComputeState();
   return Assign(aArray.Data(), aArray.Length());
 }
 
 uint8_t* CryptoBuffer::AppendSECItem(const SECItem* aItem) {
   MOZ_ASSERT(aItem);
   return AppendElements(aItem->data, aItem->len, fallible);
 }
 
--- a/dom/crypto/KeyAlgorithmProxy.h
+++ b/dom/crypto/KeyAlgorithmProxy.h
@@ -30,17 +30,17 @@ struct RsaHashedKeyAlgorithmStorage {
     if (!exponent) {
       return false;
     }
 
     aRsa.mName = mName;
     aRsa.mModulusLength = mModulusLength;
     aRsa.mHash.mName = mHash.mName;
     aRsa.mPublicExponent.Init(exponent);
-    aRsa.mPublicExponent.ComputeLengthAndData();
+    aRsa.mPublicExponent.ComputeState();
 
     return true;
   }
 };
 
 // This class encapuslates a KeyAlgorithm object, and adds several
 // methods that make WebCrypto operations simpler.
 struct KeyAlgorithmProxy {
--- a/dom/encoding/TextDecoder.cpp
+++ b/dom/encoding/TextDecoder.cpp
@@ -102,22 +102,22 @@ void TextDecoder::Decode(const Optional<
   if (!aBuffer.WasPassed()) {
     Decode(nullptr, aOptions.mStream, aOutDecodedString, aRv);
     return;
   }
   const ArrayBufferViewOrArrayBuffer& buf = aBuffer.Value();
   uint8_t* data;
   uint32_t length;
   if (buf.IsArrayBufferView()) {
-    buf.GetAsArrayBufferView().ComputeLengthAndData();
+    buf.GetAsArrayBufferView().ComputeState();
     data = buf.GetAsArrayBufferView().Data();
     length = buf.GetAsArrayBufferView().Length();
   } else {
     MOZ_ASSERT(buf.IsArrayBuffer());
-    buf.GetAsArrayBuffer().ComputeLengthAndData();
+    buf.GetAsArrayBuffer().ComputeState();
     data = buf.GetAsArrayBuffer().Data();
     length = buf.GetAsArrayBuffer().Length();
   }
   Decode(MakeSpan(data, length), aOptions.mStream, aOutDecodedString, aRv);
 }
 
 void TextDecoder::GetEncoding(nsAString& aEncoding) {
   CopyASCIItoUTF16(mEncoding, aEncoding);
--- a/dom/encoding/TextEncoder.cpp
+++ b/dom/encoding/TextEncoder.cpp
@@ -25,17 +25,17 @@ void TextEncoder::Encode(JSContext* aCx,
 
   aRetval.set(outView);
 }
 
 void TextEncoder::EncodeInto(JSContext* aCx, JS::Handle<JSString*> aSrc,
                              const Uint8Array& aDst,
                              TextEncoderEncodeIntoResult& aResult,
                              OOMReporter& aError) {
-  aDst.ComputeLengthAndData();
+  aDst.ComputeState();
   size_t read;
   size_t written;
   auto maybe = JS_EncodeStringToUTF8BufferPartial(
       aCx, aSrc, AsWritableChars(MakeSpan(aDst.Data(), aDst.Length())));
   if (!maybe) {
     aError.ReportOOM();
     return;
   }
--- a/dom/fetch/BodyExtractor.cpp
+++ b/dom/fetch/BodyExtractor.cpp
@@ -40,27 +40,27 @@ static nsresult GetBufferDataAsStream(
 
   return NS_OK;
 }
 
 template <>
 nsresult BodyExtractor<const ArrayBuffer>::GetAsStream(
     nsIInputStream** aResult, uint64_t* aContentLength,
     nsACString& aContentTypeWithCharset, nsACString& aCharset) const {
-  mBody->ComputeLengthAndData();
+  mBody->ComputeState();
   return GetBufferDataAsStream(mBody->Data(), mBody->Length(), aResult,
                                aContentLength, aContentTypeWithCharset,
                                aCharset);
 }
 
 template <>
 nsresult BodyExtractor<const ArrayBufferView>::GetAsStream(
     nsIInputStream** aResult, uint64_t* aContentLength,
     nsACString& aContentTypeWithCharset, nsACString& aCharset) const {
-  mBody->ComputeLengthAndData();
+  mBody->ComputeState();
   return GetBufferDataAsStream(mBody->Data(), mBody->Length(), aResult,
                                aContentLength, aContentTypeWithCharset,
                                aCharset);
 }
 
 template <>
 nsresult BodyExtractor<Document>::GetAsStream(
     nsIInputStream** aResult, uint64_t* aContentLength,
--- a/dom/fetch/FetchStreamReader.cpp
+++ b/dom/fetch/FetchStreamReader.cpp
@@ -256,17 +256,17 @@ void FetchStreamReader::ResolvedCallback
   RootedDictionary<FetchReadableStreamReadDataArray> value(aCx);
   if (!value.Init(aCx, aValue) || !value.mValue.WasPassed()) {
     JS_ClearPendingException(aCx);
     CloseAndRelease(aCx, NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
 
   Uint8Array& array = value.mValue.Value();
-  array.ComputeLengthAndData();
+  array.ComputeState();
   uint32_t len = array.Length();
 
   if (len == 0) {
     // If there is nothing to read, let's do another reading.
     OnOutputStreamReady(mPipeOut);
     return;
   }
 
--- a/dom/file/MultipartBlobImpl.cpp
+++ b/dom/file/MultipartBlobImpl.cpp
@@ -200,26 +200,26 @@ void MultipartBlobImpl::InitializeBlob(c
       aRv = blobSet.AppendString(data.GetAsUSVString(), aNativeEOL);
       if (aRv.Failed()) {
         return;
       }
     }
 
     else if (data.IsArrayBuffer()) {
       const ArrayBuffer& buffer = data.GetAsArrayBuffer();
-      buffer.ComputeLengthAndData();
+      buffer.ComputeState();
       aRv = blobSet.AppendVoidPtr(buffer.Data(), buffer.Length());
       if (aRv.Failed()) {
         return;
       }
     }
 
     else if (data.IsArrayBufferView()) {
       const ArrayBufferView& buffer = data.GetAsArrayBufferView();
-      buffer.ComputeLengthAndData();
+      buffer.ComputeState();
       aRv = blobSet.AppendVoidPtr(buffer.Data(), buffer.Length());
       if (aRv.Failed()) {
         return;
       }
     }
 
     else {
       MOZ_CRASH("Impossible blob data type.");
--- a/dom/gamepad/GamepadServiceTest.cpp
+++ b/dom/gamepad/GamepadServiceTest.cpp
@@ -180,60 +180,60 @@ void GamepadServiceTest::NewPoseMove(
 
   GamepadPoseState poseState;
   poseState.flags = GamepadCapabilityFlags::Cap_Orientation |
                     GamepadCapabilityFlags::Cap_Position |
                     GamepadCapabilityFlags::Cap_AngularAcceleration |
                     GamepadCapabilityFlags::Cap_LinearAcceleration;
   if (!aOrient.IsNull()) {
     const Float32Array& value = aOrient.Value();
-    value.ComputeLengthAndData();
+    value.ComputeState();
     MOZ_ASSERT(value.Length() == 4);
     poseState.orientation[0] = value.Data()[0];
     poseState.orientation[1] = value.Data()[1];
     poseState.orientation[2] = value.Data()[2];
     poseState.orientation[3] = value.Data()[3];
     poseState.isOrientationValid = true;
   }
   if (!aPos.IsNull()) {
     const Float32Array& value = aPos.Value();
-    value.ComputeLengthAndData();
+    value.ComputeState();
     MOZ_ASSERT(value.Length() == 3);
     poseState.position[0] = value.Data()[0];
     poseState.position[1] = value.Data()[1];
     poseState.position[2] = value.Data()[2];
     poseState.isPositionValid = true;
   }
   if (!aAngVelocity.IsNull()) {
     const Float32Array& value = aAngVelocity.Value();
-    value.ComputeLengthAndData();
+    value.ComputeState();
     MOZ_ASSERT(value.Length() == 3);
     poseState.angularVelocity[0] = value.Data()[0];
     poseState.angularVelocity[1] = value.Data()[1];
     poseState.angularVelocity[2] = value.Data()[2];
   }
   if (!aAngAcceleration.IsNull()) {
     const Float32Array& value = aAngAcceleration.Value();
-    value.ComputeLengthAndData();
+    value.ComputeState();
     MOZ_ASSERT(value.Length() == 3);
     poseState.angularAcceleration[0] = value.Data()[0];
     poseState.angularAcceleration[1] = value.Data()[1];
     poseState.angularAcceleration[2] = value.Data()[2];
   }
   if (!aLinVelocity.IsNull()) {
     const Float32Array& value = aLinVelocity.Value();
-    value.ComputeLengthAndData();
+    value.ComputeState();
     MOZ_ASSERT(value.Length() == 3);
     poseState.linearVelocity[0] = value.Data()[0];
     poseState.linearVelocity[1] = value.Data()[1];
     poseState.linearVelocity[2] = value.Data()[2];
   }
   if (!aLinAcceleration.IsNull()) {
     const Float32Array& value = aLinAcceleration.Value();
-    value.ComputeLengthAndData();
+    value.ComputeState();
     MOZ_ASSERT(value.Length() == 3);
     poseState.linearAcceleration[0] = value.Data()[0];
     poseState.linearAcceleration[1] = value.Data()[1];
     poseState.linearAcceleration[2] = value.Data()[2];
   }
 
   GamepadPoseInformation a(poseState);
   GamepadChangeEventBody body(a);
@@ -250,24 +250,24 @@ void GamepadServiceTest::NewTouch(uint32
   if (mShuttingDown) {
     return;
   }
 
   GamepadTouchState touchState;
   touchState.touchId = aTouchId;
   touchState.surfaceId = aSurfaceId;
   const Float32Array& value = aPos;
-  value.ComputeLengthAndData();
+  value.ComputeState();
   MOZ_ASSERT(value.Length() == 2);
   touchState.position[0] = value.Data()[0];
   touchState.position[1] = value.Data()[1];
 
   if (!aSurfDim.IsNull()) {
     const Float32Array& value = aSurfDim.Value();
-    value.ComputeLengthAndData();
+    value.ComputeState();
     MOZ_ASSERT(value.Length() == 2);
     touchState.surfaceDimensions[0] = value.Data()[0];
     touchState.surfaceDimensions[1] = value.Data()[1];
     touchState.isSurfaceDimensionsValid = true;
   }
 
   GamepadTouchInformation a(aTouchArrayIndex, touchState);
   GamepadChangeEventBody body(a);
--- a/dom/indexedDB/IDBFileHandle.cpp
+++ b/dom/indexedDB/IDBFileHandle.cpp
@@ -516,17 +516,17 @@ RefPtr<IDBFileRequest> IDBFileHandle::Wr
                                                     ErrorResult& aRv) {
   AssertIsOnOwningThread();
 
   // State checking for write or append
   if (!CheckStateForWriteOrAppend(aAppend, aRv)) {
     return nullptr;
   }
 
-  aValue.ComputeLengthAndData();
+  aValue.ComputeState();
 
   uint64_t dataLength = aValue.Length();
   ;
   if (!dataLength) {
     return nullptr;
   }
 
   const char* data = reinterpret_cast<const char*>(aValue.Data());
@@ -550,17 +550,17 @@ RefPtr<IDBFileRequest> IDBFileHandle::Wr
     const ArrayBufferView& aValue, bool aAppend, ErrorResult& aRv) {
   AssertIsOnOwningThread();
 
   // State checking for write or append
   if (!CheckStateForWriteOrAppend(aAppend, aRv)) {
     return nullptr;
   }
 
-  aValue.ComputeLengthAndData();
+  aValue.ComputeState();
 
   uint64_t dataLength = aValue.Length();
   ;
   if (!dataLength) {
     return nullptr;
   }
 
   const char* data = reinterpret_cast<const char*>(aValue.Data());
--- a/dom/media/eme/EMEUtils.cpp
+++ b/dom/media/eme/EMEUtils.cpp
@@ -20,22 +20,22 @@ LogModule* GetEMEVerboseLog() {
 }
 
 ArrayData GetArrayBufferViewOrArrayBufferData(
     const dom::ArrayBufferViewOrArrayBuffer& aBufferOrView) {
   MOZ_ASSERT(aBufferOrView.IsArrayBuffer() ||
              aBufferOrView.IsArrayBufferView());
   if (aBufferOrView.IsArrayBuffer()) {
     const dom::ArrayBuffer& buffer = aBufferOrView.GetAsArrayBuffer();
-    buffer.ComputeLengthAndData();
+    buffer.ComputeState();
     return ArrayData(buffer.Data(), buffer.Length());
   } else if (aBufferOrView.IsArrayBufferView()) {
     const dom::ArrayBufferView& bufferview =
         aBufferOrView.GetAsArrayBufferView();
-    bufferview.ComputeLengthAndData();
+    bufferview.ComputeState();
     return ArrayData(bufferview.Data(), bufferview.Length());
   }
   return ArrayData(nullptr, 0);
 }
 
 void CopyArrayBufferViewOrArrayBufferData(
     const dom::ArrayBufferViewOrArrayBuffer& aBufferOrView,
     nsTArray<uint8_t>& aOutData) {
--- a/dom/media/eme/MediaEncryptedEvent.cpp
+++ b/dom/media/eme/MediaEncryptedEvent.cpp
@@ -73,17 +73,17 @@ already_AddRefed<MediaEncryptedEvent> Me
     const MediaKeyNeededEventInit& aEventInitDict, ErrorResult& aRv) {
   nsCOMPtr<EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
   RefPtr<MediaEncryptedEvent> e = new MediaEncryptedEvent(owner);
   bool trusted = e->Init(owner);
   e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
   e->mInitDataType = aEventInitDict.mInitDataType;
   if (!aEventInitDict.mInitData.IsNull()) {
     const auto& a = aEventInitDict.mInitData.Value();
-    a.ComputeLengthAndData();
+    a.ComputeState();
     e->mInitData = ArrayBuffer::Create(aGlobal.Context(), a.Length(), a.Data());
     if (!e->mInitData) {
       aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
       return nullptr;
     }
   }
   e->SetTrusted(trusted);
   return e.forget();
--- a/dom/media/eme/MediaKeyMessageEvent.cpp
+++ b/dom/media/eme/MediaKeyMessageEvent.cpp
@@ -71,17 +71,17 @@ already_AddRefed<MediaKeyMessageEvent> M
 
 already_AddRefed<MediaKeyMessageEvent> MediaKeyMessageEvent::Constructor(
     const GlobalObject& aGlobal, const nsAString& aType,
     const MediaKeyMessageEventInit& aEventInitDict, ErrorResult& aRv) {
   nsCOMPtr<EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
   RefPtr<MediaKeyMessageEvent> e = new MediaKeyMessageEvent(owner);
   bool trusted = e->Init(owner);
   e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
-  aEventInitDict.mMessage.ComputeLengthAndData();
+  aEventInitDict.mMessage.ComputeState();
   e->mMessage =
       ArrayBuffer::Create(aGlobal.Context(), aEventInitDict.mMessage.Length(),
                           aEventInitDict.mMessage.Data());
   if (!e->mMessage) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
   e->mMessageType = aEventInitDict.mMessageType;
--- a/dom/media/mediasource/SourceBuffer.cpp
+++ b/dom/media/mediasource/SourceBuffer.cpp
@@ -166,47 +166,47 @@ void SourceBuffer::SetAppendWindowEnd(do
     return;
   }
   mCurrentAttributes.SetAppendWindowEnd(aAppendWindowEnd);
 }
 
 void SourceBuffer::AppendBuffer(const ArrayBuffer& aData, ErrorResult& aRv) {
   MOZ_ASSERT(NS_IsMainThread());
   MSE_API("AppendBuffer(ArrayBuffer)");
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
   DDLOG(DDLogCategory::API, "AppendBuffer", aData.Length());
   AppendData(aData.Data(), aData.Length(), aRv);
 }
 
 void SourceBuffer::AppendBuffer(const ArrayBufferView& aData,
                                 ErrorResult& aRv) {
   MOZ_ASSERT(NS_IsMainThread());
   MSE_API("AppendBuffer(ArrayBufferView)");
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
   DDLOG(DDLogCategory::API, "AppendBuffer", aData.Length());
   AppendData(aData.Data(), aData.Length(), aRv);
 }
 
 already_AddRefed<Promise> SourceBuffer::AppendBufferAsync(
     const ArrayBuffer& aData, ErrorResult& aRv) {
   MOZ_ASSERT(NS_IsMainThread());
 
   MSE_API("AppendBufferAsync(ArrayBuffer)");
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
   DDLOG(DDLogCategory::API, "AppendBufferAsync", aData.Length());
 
   return AppendDataAsync(aData.Data(), aData.Length(), aRv);
 }
 
 already_AddRefed<Promise> SourceBuffer::AppendBufferAsync(
     const ArrayBufferView& aData, ErrorResult& aRv) {
   MOZ_ASSERT(NS_IsMainThread());
 
   MSE_API("AppendBufferAsync(ArrayBufferView)");
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
   DDLOG(DDLogCategory::API, "AppendBufferAsync", aData.Length());
 
   return AppendDataAsync(aData.Data(), aData.Length(), aRv);
 }
 
 void SourceBuffer::Abort(ErrorResult& aRv) {
   MOZ_ASSERT(NS_IsMainThread());
   MSE_API("Abort()");
--- a/dom/media/webaudio/AnalyserNode.cpp
+++ b/dom/media/webaudio/AnalyserNode.cpp
@@ -199,17 +199,17 @@ void AnalyserNode::SetSmoothingTimeConst
 }
 
 void AnalyserNode::GetFloatFrequencyData(const Float32Array& aArray) {
   if (!FFTAnalysis()) {
     // Might fail to allocate memory
     return;
   }
 
-  aArray.ComputeLengthAndData();
+  aArray.ComputeState();
 
   float* buffer = aArray.Data();
   size_t length = std::min(size_t(aArray.Length()), mOutputBuffer.Length());
 
   for (size_t i = 0; i < length; ++i) {
     buffer[i] = WebAudioUtils::ConvertLinearToDecibels(
         mOutputBuffer[i], -std::numeric_limits<float>::infinity());
   }
@@ -218,43 +218,43 @@ void AnalyserNode::GetFloatFrequencyData
 void AnalyserNode::GetByteFrequencyData(const Uint8Array& aArray) {
   if (!FFTAnalysis()) {
     // Might fail to allocate memory
     return;
   }
 
   const double rangeScaleFactor = 1.0 / (mMaxDecibels - mMinDecibels);
 
-  aArray.ComputeLengthAndData();
+  aArray.ComputeState();
 
   unsigned char* buffer = aArray.Data();
   size_t length = std::min(size_t(aArray.Length()), mOutputBuffer.Length());
 
   for (size_t i = 0; i < length; ++i) {
     const double decibels =
         WebAudioUtils::ConvertLinearToDecibels(mOutputBuffer[i], mMinDecibels);
     // scale down the value to the range of [0, UCHAR_MAX]
     const double scaled = std::max(
         0.0, std::min(double(UCHAR_MAX),
                       UCHAR_MAX*(decibels - mMinDecibels) * rangeScaleFactor));
     buffer[i] = static_cast<unsigned char>(scaled);
   }
 }
 
 void AnalyserNode::GetFloatTimeDomainData(const Float32Array& aArray) {
-  aArray.ComputeLengthAndData();
+  aArray.ComputeState();
 
   float* buffer = aArray.Data();
   size_t length = std::min(aArray.Length(), FftSize());
 
   GetTimeDomainData(buffer, length);
 }
 
 void AnalyserNode::GetByteTimeDomainData(const Uint8Array& aArray) {
-  aArray.ComputeLengthAndData();
+  aArray.ComputeState();
 
   size_t length = std::min(aArray.Length(), FftSize());
 
   AlignedTArray<float> tmpBuffer;
   if (!tmpBuffer.SetLength(length, fallible)) {
     return;
   }
 
--- a/dom/media/webaudio/AudioBuffer.cpp
+++ b/dom/media/webaudio/AudioBuffer.cpp
@@ -295,17 +295,17 @@ bool AudioBuffer::RestoreJSChannelData(J
   mSharedChannels.SetNull(Length());
 
   return true;
 }
 
 void AudioBuffer::CopyFromChannel(const Float32Array& aDestination,
                                   uint32_t aChannelNumber,
                                   uint32_t aStartInChannel, ErrorResult& aRv) {
-  aDestination.ComputeLengthAndData();
+  aDestination.ComputeState();
 
   if (aChannelNumber >= NumberOfChannels() || aStartInChannel > Length()) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
   }
 
   uint32_t count = std::min(Length() - aStartInChannel, aDestination.Length());
   JS::AutoCheckCannotGC nogc;
@@ -335,17 +335,17 @@ void AudioBuffer::CopyFromChannel(const 
 
   PodZero(aDestination.Data(), count);
 }
 
 void AudioBuffer::CopyToChannel(JSContext* aJSContext,
                                 const Float32Array& aSource,
                                 uint32_t aChannelNumber,
                                 uint32_t aStartInChannel, ErrorResult& aRv) {
-  aSource.ComputeLengthAndData();
+  aSource.ComputeState();
 
   if (aChannelNumber >= NumberOfChannels() || aStartInChannel > Length()) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
   }
 
   if (!RestoreJSChannelData(aJSContext)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -495,18 +495,18 @@ already_AddRefed<IIRFilterNode> AudioCon
 already_AddRefed<OscillatorNode> AudioContext::CreateOscillator(
     ErrorResult& aRv) {
   return OscillatorNode::Create(*this, OscillatorOptions(), aRv);
 }
 
 already_AddRefed<PeriodicWave> AudioContext::CreatePeriodicWave(
     const Float32Array& aRealData, const Float32Array& aImagData,
     const PeriodicWaveConstraints& aConstraints, ErrorResult& aRv) {
-  aRealData.ComputeLengthAndData();
-  aImagData.ComputeLengthAndData();
+  aRealData.ComputeState();
+  aImagData.ComputeState();
 
   if (aRealData.Length() != aImagData.Length() || aRealData.Length() == 0) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return nullptr;
   }
 
   RefPtr<PeriodicWave> periodicWave = new PeriodicWave(
       this, aRealData.Data(), aImagData.Data(), aImagData.Length(),
@@ -597,17 +597,17 @@ already_AddRefed<Promise> AudioContext::
 
   JSAutoRealm ar(cx, obj);
 
   promise = Promise::Create(parentObject, aRv);
   if (aRv.Failed()) {
     return nullptr;
   }
 
-  aBuffer.ComputeLengthAndData();
+  aBuffer.ComputeState();
 
   if (!aBuffer.Data()) {
     // Throw if the buffer is detached
     aRv.ThrowTypeError<MSG_TYPEDARRAY_IS_DETACHED>(
         NS_LITERAL_STRING("Argument of AudioContext.decodeAudioData"));
     return nullptr;
   }
 
--- a/dom/media/webaudio/BiquadFilterNode.cpp
+++ b/dom/media/webaudio/BiquadFilterNode.cpp
@@ -298,19 +298,19 @@ void BiquadFilterNode::SetType(BiquadFil
   SendInt32ParameterToTrack(BiquadFilterNodeEngine::TYPE,
                             static_cast<int32_t>(aType));
 }
 
 void BiquadFilterNode::GetFrequencyResponse(const Float32Array& aFrequencyHz,
                                             const Float32Array& aMagResponse,
                                             const Float32Array& aPhaseResponse,
                                             ErrorResult& aRv) {
-  aFrequencyHz.ComputeLengthAndData();
-  aMagResponse.ComputeLengthAndData();
-  aPhaseResponse.ComputeLengthAndData();
+  aFrequencyHz.ComputeState();
+  aMagResponse.ComputeState();
+  aPhaseResponse.ComputeState();
 
   if (!(aFrequencyHz.Length() == aMagResponse.Length() &&
         aMagResponse.Length() == aPhaseResponse.Length())) {
     aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return;
   }
 
   uint32_t length = aFrequencyHz.Length();
--- a/dom/media/webaudio/IIRFilterNode.cpp
+++ b/dom/media/webaudio/IIRFilterNode.cpp
@@ -207,19 +207,19 @@ size_t IIRFilterNode::SizeOfIncludingThi
 JSObject* IIRFilterNode::WrapObject(JSContext* aCx,
                                     JS::Handle<JSObject*> aGivenProto) {
   return IIRFilterNode_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 void IIRFilterNode::GetFrequencyResponse(const Float32Array& aFrequencyHz,
                                          const Float32Array& aMagResponse,
                                          const Float32Array& aPhaseResponse) {
-  aFrequencyHz.ComputeLengthAndData();
-  aMagResponse.ComputeLengthAndData();
-  aPhaseResponse.ComputeLengthAndData();
+  aFrequencyHz.ComputeState();
+  aMagResponse.ComputeState();
+  aPhaseResponse.ComputeState();
 
   uint32_t length =
       std::min(std::min(aFrequencyHz.Length(), aMagResponse.Length()),
                aPhaseResponse.Length());
   if (!length) {
     return;
   }
 
--- a/dom/media/webaudio/WaveShaperNode.cpp
+++ b/dom/media/webaudio/WaveShaperNode.cpp
@@ -325,17 +325,17 @@ void WaveShaperNode::SetCurve(const Null
   WaveShaperNode_Binding::ClearCachedCurveValue(this);
 
   if (aCurve.IsNull()) {
     CleanCurveInternal();
     return;
   }
 
   const Float32Array& floats = aCurve.Value();
-  floats.ComputeLengthAndData();
+  floats.ComputeState();
 
   nsTArray<float> curve;
   uint32_t argLength = floats.Length();
   if (!curve.SetLength(argLength, fallible)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return;
   }
 
--- a/dom/midi/MIDIMessageEvent.cpp
+++ b/dom/midi/MIDIMessageEvent.cpp
@@ -71,17 +71,17 @@ already_AddRefed<MIDIMessageEvent> MIDIM
     const MIDIMessageEventInit& aEventInitDict, ErrorResult& aRv) {
   nsCOMPtr<EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
   RefPtr<MIDIMessageEvent> e = new MIDIMessageEvent(owner);
   bool trusted = e->Init(owner);
   e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
   // Set data for event. Timestamp will always be set to Now() (default for
   // event) using this constructor.
   const auto& a = aEventInitDict.mData.Value();
-  a.ComputeLengthAndData();
+  a.ComputeState();
   e->mData = Uint8Array::Create(aGlobal.Context(), owner, a.Length(), a.Data());
   if (NS_WARN_IF(!e->mData)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
   e->SetTrusted(trusted);
   mozilla::HoldJSObjects(e.get());
--- a/dom/network/TCPSocket.cpp
+++ b/dom/network/TCPSocket.cpp
@@ -753,17 +753,17 @@ bool TCPSocket::Send(JSContext* aCx, con
                      mozilla::ErrorResult& aRv) {
   if (mReadyState != TCPReadyState::Open) {
     aRv.Throw(NS_ERROR_FAILURE);
     return false;
   }
 
   nsCOMPtr<nsIArrayBufferInputStream> stream;
 
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
   uint32_t byteLength =
       aByteLength.WasPassed() ? aByteLength.Value() : aData.Length();
 
   if (mSocketBridgeChild) {
     nsresult rv = mSocketBridgeChild->SendSend(aData, aByteOffset, byteLength);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       aRv.Throw(rv);
       return false;
--- a/dom/network/UDPSocket.cpp
+++ b/dom/network/UDPSocket.cpp
@@ -340,22 +340,22 @@ bool UDPSocket::Send(const StringOrBlobO
       return false;
     }
 
     if (aData.IsString()) {
       NS_ConvertUTF16toUTF8 data(aData.GetAsString());
       aRv = strStream->SetData(data.BeginReading(), data.Length());
     } else if (aData.IsArrayBuffer()) {
       const ArrayBuffer& data = aData.GetAsArrayBuffer();
-      data.ComputeLengthAndData();
+      data.ComputeState();
       aRv = strStream->SetData(reinterpret_cast<const char*>(data.Data()),
                                data.Length());
     } else {
       const ArrayBufferView& data = aData.GetAsArrayBufferView();
-      data.ComputeLengthAndData();
+      data.ComputeState();
       aRv = strStream->SetData(reinterpret_cast<const char*>(data.Data()),
                                data.Length());
     }
 
     if (NS_WARN_IF(aRv.Failed())) {
       return false;
     }
 
--- a/dom/presentation/PresentationConnection.cpp
+++ b/dom/presentation/PresentationConnection.cpp
@@ -253,17 +253,17 @@ void PresentationConnection::Send(const 
   nsCOMPtr<nsIPresentationService> service =
       do_GetService(PRESENTATION_SERVICE_CONTRACTID);
   if (NS_WARN_IF(!service)) {
     AsyncCloseConnectionWithErrorMsg(
         NS_LITERAL_STRING("Unable to send message due to an internal error."));
     return;
   }
 
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
 
   static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
 
   uint32_t length = aData.Length();
   char* data = reinterpret_cast<char*>(aData.Data());
   nsDependentCSubstring msgString(data, length);
 
   nsresult rv = service->SendSessionBinaryMsg(mId, mRole, msgString);
@@ -287,17 +287,17 @@ void PresentationConnection::Send(const 
   nsCOMPtr<nsIPresentationService> service =
       do_GetService(PRESENTATION_SERVICE_CONTRACTID);
   if (NS_WARN_IF(!service)) {
     AsyncCloseConnectionWithErrorMsg(
         NS_LITERAL_STRING("Unable to send message due to an internal error."));
     return;
   }
 
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
 
   static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
 
   uint32_t length = aData.Length();
   char* data = reinterpret_cast<char*>(aData.Data());
   nsDependentCSubstring msgString(data, length);
 
   nsresult rv = service->SendSessionBinaryMsg(mId, mRole, msgString);
--- a/dom/prio/test/gtest/TestPrioEncoder.cpp
+++ b/dom/prio/test/gtest/TestPrioEncoder.cpp
@@ -193,18 +193,18 @@ TEST(PrioEncoder, VerifyFull)
       mozilla::dom::PrioEncoder::SetKeys(reinterpret_cast<const char*>(pkHexA),
                                          reinterpret_cast<const char*>(pkHexB));
   ASSERT_FALSE(rv.Failed());
 
   mozilla::dom::PrioEncoder::Encode(global, batchID, prioParams,
                                     prioEncodedData, rv);
   ASSERT_FALSE(rv.Failed());
 
-  prioEncodedData.mA.Value().ComputeLengthAndData();
-  prioEncodedData.mB.Value().ComputeLengthAndData();
+  prioEncodedData.mA.Value().ComputeState();
+  prioEncodedData.mB.Value().ComputeState();
 
   forServerA = prioEncodedData.mA.Value().Data();
   forServerB = prioEncodedData.mB.Value().Data();
   aLen = prioEncodedData.mA.Value().Length();
   bLen = prioEncodedData.mB.Value().Length();
 
   // II. VALIDATION PROTOCOL. (at servers)
   //
--- a/dom/push/PushUtil.cpp
+++ b/dom/push/PushUtil.cpp
@@ -8,26 +8,26 @@
 
 namespace mozilla {
 namespace dom {
 
 /* static */
 bool PushUtil::CopyArrayBufferToArray(const ArrayBuffer& aBuffer,
                                       nsTArray<uint8_t>& aArray) {
   MOZ_ASSERT(aArray.IsEmpty());
-  aBuffer.ComputeLengthAndData();
+  aBuffer.ComputeState();
   return aArray.SetCapacity(aBuffer.Length(), fallible) &&
          aArray.InsertElementsAt(0, aBuffer.Data(), aBuffer.Length(), fallible);
 }
 
 /* static */
 bool PushUtil::CopyArrayBufferViewToArray(const ArrayBufferView& aView,
                                           nsTArray<uint8_t>& aArray) {
   MOZ_ASSERT(aArray.IsEmpty());
-  aView.ComputeLengthAndData();
+  aView.ComputeState();
   return aArray.SetCapacity(aView.Length(), fallible) &&
          aArray.InsertElementsAt(0, aView.Data(), aView.Length(), fallible);
 }
 
 /* static */
 bool PushUtil::CopyBufferSourceToArray(
     const OwningArrayBufferViewOrArrayBuffer& aSource,
     nsTArray<uint8_t>& aArray) {
--- a/dom/vr/VRServiceTest.cpp
+++ b/dom/vr/VRServiceTest.cpp
@@ -29,17 +29,17 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEvent
 NS_IMPL_ADDREF_INHERITED(VRMockDisplay, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(VRMockDisplay, DOMEventTargetHelper)
 
 namespace {
 template <class T>
 bool ReadFloat32Array(T& aDestination, const Float32Array& aSource,
                       ErrorResult& aRv) {
   constexpr size_t length = std::extent<T>::value;
-  aSource.ComputeLengthAndData();
+  aSource.ComputeState();
   if (aSource.Length() != length) {
     aRv.Throw(NS_ERROR_INVALID_ARG);
     // We don't want to MOZ_ASSERT here, as that would cause the
     // browser to crash, making it difficult to debug the problem
     // in JS code calling this API.
     return false;
   }
   for (size_t i = 0; i < length; i++) {
--- a/dom/websocket/WebSocket.cpp
+++ b/dom/websocket/WebSocket.cpp
@@ -2242,31 +2242,31 @@ void WebSocket::Send(Blob& aData, ErrorR
   }
 
   Send(msgStream, EmptyCString(), msgLength, true, aRv);
 }
 
 void WebSocket::Send(const ArrayBuffer& aData, ErrorResult& aRv) {
   AssertIsOnTargetThread();
 
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
 
   static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
 
   uint32_t len = aData.Length();
   char* data = reinterpret_cast<char*>(aData.Data());
 
   nsDependentCSubstring msgString(data, len);
   Send(nullptr, msgString, len, true, aRv);
 }
 
 void WebSocket::Send(const ArrayBufferView& aData, ErrorResult& aRv) {
   AssertIsOnTargetThread();
 
-  aData.ComputeLengthAndData();
+  aData.ComputeState();
 
   static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required");
 
   uint32_t len = aData.Length();
   char* data = reinterpret_cast<char*>(aData.Data());
 
   nsDependentCSubstring msgString(data, len);
   Send(nullptr, msgString, len, true, aRv);
--- a/layout/style/FontFace.cpp
+++ b/layout/style/FontFace.cpp
@@ -49,17 +49,17 @@ void FontFaceBufferSource::TakeBuffer(ui
 }
 
 // -- Utility functions ------------------------------------------------------
 
 template <typename T>
 static void GetDataFrom(const T& aObject, uint8_t*& aBuffer,
                         uint32_t& aLength) {
   MOZ_ASSERT(!aBuffer);
-  aObject.ComputeLengthAndData();
+  aObject.ComputeState();
   // We use malloc here rather than a FallibleTArray or fallible
   // operator new[] since the gfxUserFontEntry will be calling free
   // on it.
   aBuffer = (uint8_t*)malloc(aObject.Length());
   if (!aBuffer) {
     return;
   }
   memcpy((void*)aBuffer, aObject.Data(), aObject.Length());
--- a/toolkit/components/extensions/webrequest/StreamFilter.cpp
+++ b/toolkit/components/extensions/webrequest/StreamFilter.cpp
@@ -127,17 +127,17 @@ bool StreamFilter::CheckAlive() {
 
 /*****************************************************************************
  * Binding methods
  *****************************************************************************/
 
 template <typename T>
 static inline bool ReadTypedArrayData(nsTArray<uint8_t>& aData, const T& aArray,
                                       ErrorResult& aRv) {
-  aArray.ComputeLengthAndData();
+  aArray.ComputeState();
   if (!aData.SetLength(aArray.Length(), fallible)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return false;
   }
   memcpy(aData.Elements(), aArray.Data(), aArray.Length());
   return true;
 }