Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2730943002: XMLHttpRequest: return null upon failing responseArrayBuffer allocation. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ac589d60c61b03d9f7a850e9d48cac0cc22ec765..729c190d317c3c8c8419714dce85c97c36885a23 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2605,10 +2605,12 @@ bool Internals::cursorUpdatePending() const {
DOMArrayBuffer* Internals::serializeObject(
PassRefPtr<SerializedScriptValue> value) const {
String stringValue = value->toWireString();
- DOMArrayBuffer* buffer =
- DOMArrayBuffer::createUninitialized(stringValue.length(), sizeof(UChar));
- stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0,
- stringValue.length());
+ DOMArrayBuffer* buffer = DOMArrayBuffer::createUninitializedOrNull(
+ stringValue.length(), sizeof(UChar));
+ if (buffer) {
+ stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0,
+ stringValue.length());
+ }
return buffer;
}

Powered by Google App Engine
This is Rietveld 408576698