diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2017-11-08 18:45:40 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-11-08 16:15:23 +0000 |
commit | fdafce4d3a4670e315c161a9ec79ae6203742d1d (patch) | |
tree | fcf0919d276404cf769e2fb5c0479e3ff780d60f | |
parent | 1cc2ffbaaa177340bb6f2b0b14ac267a3f24b116 (diff) |
Handle std::bad_alloc exception in resolveBlobUrl
Original commit:
https://github.com/annulen/webkit/commit/3e4b4a4eb1e8ac6d0feb4efa8341212519547296
Change-Id: I335512455c25a8555370eb4ed484d2fdfbf383d4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | Source/WebCore/platform/network/qt/ResourceRequestQt.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp index 2719f1db6..66756b95d 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -100,13 +100,23 @@ static QUrl resolveBlobUrl(const KURL& url) dataUri.append(QLatin1String(base64.data(), base64.size())); return QUrl(dataUri); } + +QUrl convertBlobToDataUrl(const QUrl& url) +{ + QT_TRY { + return resolveBlobUrl(url); + } QT_CATCH(const std::bad_alloc &) { + qWarning("Failed to convert blob data to base64: not enough memory"); + } + return QUrl(); +} #endif static QUrl toQUrl(const KURL& url) { #if ENABLE(BLOB) if (url.protocolIs("blob")) - return resolveBlobUrl(url); + return convertBlobToDataUrl(url); #endif return url; } |