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

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

Issue 2730943002: XMLHttpRequest: return null upon failing responseArrayBuffer allocation. (Closed)
Patch Set: mirror updated spec, and return |null| for failed allocs Created 3 years, 9 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 c74a35d0eff8cccb30dd255013b8b8bc0f089c24..4223b2a14350c9bf098e350b0ea173382663c157 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2644,10 +2644,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;
}
« no previous file with comments | « third_party/WebKit/Source/core/mojo/MojoHandle.cpp ('k') | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698