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

Unified Diff: third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month 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/modules/push_messaging/PushMessageData.cpp
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
index 00b41011c1a4a635e19d3bd5bc174438560672a7..9f9549f9f61594a09a0b0ffb3262275010a64898 100644
--- a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
+++ b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
@@ -56,7 +56,14 @@ PushMessageData::~PushMessageData()
PassRefPtr<DOMArrayBuffer> PushMessageData::arrayBuffer() const
{
- return DOMArrayBuffer::create(m_data.data(), m_data.size());
+ // TODO(junov): crbug.com/536816
+ // Use createOrNull instead of deprecatedCreateOrCrash. Requires
+ // defining behavior for when allocation fails. ECMAScript spec says
+ // allocation failure should throw a RangeError exception, but the
+ // spec for PushMessageData.arrayBuffer() does not state that
+ // such exceptions should be re-thrown. So for now, we just crash.
+ RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::deprecatedCreateOrCrash(m_data.data(), m_data.size());
+ return buffer.release();
}
Blob* PushMessageData::blob() const

Powered by Google App Engine
This is Rietveld 408576698