Index: third_party/WebKit/Source/core/testing/Internals.cpp |
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp |
index d124861ed419e3e543b309228fa97fa55e802566..5456e4d07f8eb4a704b37e214b609eba3766c512 100644 |
--- a/third_party/WebKit/Source/core/testing/Internals.cpp |
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp |
@@ -2127,10 +2127,16 @@ bool Internals::cursorUpdatePending() const |
return frame()->eventHandler().cursorUpdatePending(); |
} |
+void Internals::fakeOutOfMemoryForNextArrayBufferAllocation() const |
+{ |
+ WTF::ArrayBufferContents::fakeOutOfMemoryForNextArrayBufferAllocationForTesting(); |
+} |
+ |
PassRefPtr<DOMArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const |
{ |
String stringValue = value->toWireString(); |
- RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createUninitialized(stringValue.length(), sizeof(UChar)); |
+ RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::createUninitializedOrNull(stringValue.length(), sizeof(UChar)); |
+ RELEASE_ASSERT(buffer); // Crash here means out of memory. |
stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0, stringValue.length()); |
return buffer.release(); |
} |