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 a7c18c2036d87cdca8c8e8720a8d28609da1d9c7..e2d4b00af1d16e3e0594238864f8f427ec9846eb 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(); |
} |