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

Unified Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.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 and applied senorblanco+haraken feedbac Created 5 years, 2 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/web/ServiceWorkerGlobalScopeProxy.cpp
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index ea9b057028b267d383a5113b4d4beeacf4ebd5bc..a3f55103c80fd50c879e71b6b82537caa545a4d8 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -157,8 +157,13 @@ void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
{
ASSERT(m_workerGlobalScope);
WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::Push, eventID);
- RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, PushMessageData::create(data), observer));
- m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer);
+ NonThrowableExceptionState exceptionState;
+ PushMessageData* messageData = PushMessageData::create(data, exceptionState);
+ // Fail silently by dropping the event when the allocation of PushMessageData fails (out of memory), which results in an exception
+ if (!exceptionState.hadException()) {
+ RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, messageData, observer));
+ m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer);
+ }
}
void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePortConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString& origin, WebServicePortID portID)

Powered by Google App Engine
This is Rietveld 408576698