Title: [156330] trunk
- Revision
- 156330
- Author
- [email protected]
- Date
- 2013-09-24 07:16:20 -0700 (Tue, 24 Sep 2013)
Log Message
[Qt] Crash when trying to download blob url
https://bugs.webkit.org/show_bug.cgi?id=121681
Reviewed by Simon Hausmann.
Source/WebCore:
Resolve any blob URLs before creating a QUrl.
* platform/network/qt/ResourceRequestQt.cpp:
(WebCore::appendBlobResolved):
(WebCore::resolveBlobUrl):
(WebCore::ResourceRequest::toNetworkRequest):
Source/WebKit/qt:
Do not crash if a download was triggered on a resource WebCore handles internally.
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::convertMainResourceLoadToDownload):
LayoutTests:
Unskip two tests that downloads blob URLs. Note the two tests do not use the download attribute feature.
* platform/qt/TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (156329 => 156330)
--- trunk/LayoutTests/ChangeLog 2013-09-24 14:10:38 UTC (rev 156329)
+++ trunk/LayoutTests/ChangeLog 2013-09-24 14:16:20 UTC (rev 156330)
@@ -1,3 +1,14 @@
+2013-09-24 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] Crash when trying to download blob url
+ https://bugs.webkit.org/show_bug.cgi?id=121681
+
+ Reviewed by Simon Hausmann.
+
+ Unskip two tests that downloads blob URLs. Note the two tests do not use the download attribute feature.
+
+ * platform/qt/TestExpectations:
+
2013-09-24 Andrei Parvu <[email protected]>
[CSS Background] repeat: round should round the number of tiles to the nearest natural number
Modified: trunk/LayoutTests/platform/qt/TestExpectations (156329 => 156330)
--- trunk/LayoutTests/platform/qt/TestExpectations 2013-09-24 14:10:38 UTC (rev 156329)
+++ trunk/LayoutTests/platform/qt/TestExpectations 2013-09-24 14:16:20 UTC (rev 156330)
@@ -417,10 +417,8 @@
fast/events/platform-wheelevent-paging-y-in-scrolling-page.html
# Tests that require ENABLE(DOWNLOAD_ATTRIBUTE).
-fast/dom/HTMLAnchorElement/anchor-nodownload.html
fast/dom/HTMLAnchorElement/anchor-download.html
fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
-fast/dom/HTMLAnchorElement/anchor-download-unset.html
# Require ENABLE(CUSTOM_ELEMENTS) support
webkit.org/b/110735 fast/dom/custom [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (156329 => 156330)
--- trunk/Source/WebCore/ChangeLog 2013-09-24 14:10:38 UTC (rev 156329)
+++ trunk/Source/WebCore/ChangeLog 2013-09-24 14:16:20 UTC (rev 156330)
@@ -1,3 +1,17 @@
+2013-09-24 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] Crash when trying to download blob url
+ https://bugs.webkit.org/show_bug.cgi?id=121681
+
+ Reviewed by Simon Hausmann.
+
+ Resolve any blob URLs before creating a QUrl.
+
+ * platform/network/qt/ResourceRequestQt.cpp:
+ (WebCore::appendBlobResolved):
+ (WebCore::resolveBlobUrl):
+ (WebCore::ResourceRequest::toNetworkRequest):
+
2013-09-23 Antti Koivisto <[email protected]>
Move more style change code from RenderObject to RenderElement
Modified: trunk/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp (156329 => 156330)
--- trunk/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp 2013-09-24 14:10:38 UTC (rev 156329)
+++ trunk/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp 2013-09-24 14:16:20 UTC (rev 156330)
@@ -18,6 +18,9 @@
*/
#include "config.h"
+#include "BlobData.h"
+#include "BlobRegistryImpl.h"
+#include "BlobStorageData.h"
#include "NetworkingContext.h"
#include "ResourceRequest.h"
#include "ThirdPartyCookiesQt.h"
@@ -40,10 +43,56 @@
return 6 * (1 + 3 + 2);
}
+static void appendBlobResolved(QByteArray& data, const QUrl& url, QString* contentType = 0)
+{
+ RefPtr<BlobStorageData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
+ if (!blobData)
+ return;
+
+ if (contentType)
+ *contentType = blobData->contentType();
+
+ BlobDataItemList::const_iterator it = blobData->items().begin();
+ const BlobDataItemList::const_iterator itend = blobData->items().end();
+ for (; it != itend; ++it) {
+ const BlobDataItem& blobItem = *it;
+ if (blobItem.type == BlobDataItem::Data)
+ data.append(blobItem.data->data() + static_cast<int>(blobItem.offset), static_cast<int>(blobItem.length));
+ else if (blobItem.type == BlobDataItem::Blob)
+ appendBlobResolved(data, blobItem.url);
+ else if (blobItem.type == BlobDataItem::File) {
+ // File types are not allowed here, so just ignore it.
+ } else
+ ASSERT_NOT_REACHED();
+ }
+}
+
+static void resolveBlobUrl(const QUrl& url, QUrl& resolvedUrl)
+{
+ RefPtr<BlobStorageData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
+ if (!blobData)
+ return;
+
+ QByteArray data;
+ QString contentType;
+ appendBlobResolved(data, url, &contentType);
+
+ QString dataUri(QStringLiteral("data:"));
+ dataUri.append(contentType);
+ dataUri.append(QStringLiteral(";base64,"));
+ dataUri.append(QString::fromLatin1(data.toBase64()));
+ resolvedUrl = QUrl(dataUri);
+}
+
QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const
{
QNetworkRequest request;
- request.setUrl(url());
+ QUrl newurl = url();
+
+ if (newurl.scheme() == QLatin1String("blob"))
+ resolveBlobUrl(url(), newurl);
+
+ request.setUrl(newurl);
request.setOriginatingObject(context ? context->originatingObject() : 0);
const HTTPHeaderMap &headers = httpHeaderFields();
Modified: trunk/Source/WebKit/qt/ChangeLog (156329 => 156330)
--- trunk/Source/WebKit/qt/ChangeLog 2013-09-24 14:10:38 UTC (rev 156329)
+++ trunk/Source/WebKit/qt/ChangeLog 2013-09-24 14:16:20 UTC (rev 156330)
@@ -1,5 +1,17 @@
2013-09-24 Allan Sandfeld Jensen <[email protected]>
+ [Qt] Crash when trying to download blob url
+ https://bugs.webkit.org/show_bug.cgi?id=121681
+
+ Reviewed by Simon Hausmann.
+
+ Do not crash if a download was triggered on a resource WebCore handles internally.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::convertMainResourceLoadToDownload):
+
+2013-09-24 Allan Sandfeld Jensen <[email protected]>
+
[Qt] RepaintRequested signal sometimes not emitted
https://bugs.webkit.org/show_bug.cgi?id=121790
Modified: trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp (156329 => 156330)
--- trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp 2013-09-24 14:10:38 UTC (rev 156329)
+++ trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp 2013-09-24 14:16:20 UTC (rev 156330)
@@ -982,12 +982,17 @@
return loader.release();
}
-void FrameLoaderClientQt::convertMainResourceLoadToDownload(WebCore::DocumentLoader* documentLoader, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&)
+void FrameLoaderClientQt::convertMainResourceLoadToDownload(WebCore::DocumentLoader* documentLoader, const WebCore::ResourceRequest& request, const WebCore::ResourceResponse&)
{
if (!m_webFrame)
return;
QNetworkReplyHandler* handler = documentLoader->mainResourceLoader()->handle()->getInternal()->m_job;
+ if (!handler) {
+ qWarning("Attempted to download unsupported URL %s", request.url().string().characters8());
+ return;
+ }
+
QNetworkReply* reply = handler->release();
if (reply) {
if (m_webFrame->pageAdapter->forwardUnsupportedContent)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes