Title: [189043] trunk/Source/WebCore
- Revision
- 189043
- Author
- [email protected]
- Date
- 2015-08-27 12:10:29 -0700 (Thu, 27 Aug 2015)
Log Message
Decode redirected data URLs in web process
https://bugs.webkit.org/show_bug.cgi?id=148386
Reviewed by Zalan Bujtas.
Redirected data URLs still end up to networking layer for decoding. Handle them locally as well.
Covered by existing tests.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::~ResourceLoader):
(WebCore::ResourceLoader::finishNetworkLoad):
Factor to a function.
(WebCore::ResourceLoader::releaseResources):
(WebCore::ResourceLoader::willSendRequestInternal):
When receiving redirect to a data URL end the network load and decode it locally.
(WebCore::ResourceLoader::willSendRequest):
* loader/ResourceLoader.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (189042 => 189043)
--- trunk/Source/WebCore/ChangeLog 2015-08-27 18:45:30 UTC (rev 189042)
+++ trunk/Source/WebCore/ChangeLog 2015-08-27 19:10:29 UTC (rev 189043)
@@ -1,3 +1,28 @@
+2015-08-27 Antti Koivisto <[email protected]>
+
+ Decode redirected data URLs in web process
+ https://bugs.webkit.org/show_bug.cgi?id=148386
+
+ Reviewed by Zalan Bujtas.
+
+ Redirected data URLs still end up to networking layer for decoding. Handle them locally as well.
+
+ Covered by existing tests.
+
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::~ResourceLoader):
+ (WebCore::ResourceLoader::finishNetworkLoad):
+
+ Factor to a function.
+
+ (WebCore::ResourceLoader::releaseResources):
+ (WebCore::ResourceLoader::willSendRequestInternal):
+
+ When receiving redirect to a data URL end the network load and decode it locally.
+
+ (WebCore::ResourceLoader::willSendRequest):
+ * loader/ResourceLoader.h:
+
2015-08-27 Myles C. Maxfield <[email protected]>
[Cocoa] Generic font families do not consult with the user's preferred language
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (189042 => 189043)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-08-27 18:45:30 UTC (rev 189042)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2015-08-27 19:10:29 UTC (rev 189043)
@@ -81,6 +81,17 @@
ASSERT(m_reachedTerminalState);
}
+void ResourceLoader::finishNetworkLoad()
+{
+ platformStrategies()->loaderStrategy()->resourceLoadScheduler()->remove(this);
+
+ if (m_handle) {
+ ASSERT(m_handle->client() == this);
+ m_handle->clearClient();
+ m_handle = nullptr;
+ }
+}
+
void ResourceLoader::releaseResources()
{
ASSERT(!m_reachedTerminalState);
@@ -98,17 +109,10 @@
// the resources to prevent a double dealloc of WebView <rdar://problem/4372628>
m_reachedTerminalState = true;
- platformStrategies()->loaderStrategy()->resourceLoadScheduler()->remove(this);
+ finishNetworkLoad();
+
m_identifier = 0;
- if (m_handle) {
- // Clear out the ResourceHandle's client so that it doesn't try to call
- // us back after we release it, unless it has been replaced by someone else.
- if (m_handle->client() == this)
- m_handle->clearClient();
- m_handle = nullptr;
- }
-
m_resourceData = nullptr;
m_deferredRequest = ResourceRequest();
}
@@ -359,13 +363,23 @@
else
InspectorInstrumentation::willSendRequest(m_frame.get(), m_identifier, m_frame->loader().documentLoader(), request, redirectResponse);
- if (!redirectResponse.isNull())
+ bool isRedirect = !redirectResponse.isNull();
+ if (isRedirect)
platformStrategies()->loaderStrategy()->resourceLoadScheduler()->crossOriginRedirectReceived(this, request.url());
m_request = request;
- if (!redirectResponse.isNull() && !m_documentLoader->isCommitted())
- frameLoader()->client().dispatchDidReceiveServerRedirectForProvisionalLoad(m_request.url());
+ if (isRedirect) {
+ auto& redirectURL = request.url();
+ if (!m_documentLoader->isCommitted())
+ frameLoader()->client().dispatchDidReceiveServerRedirectForProvisionalLoad(redirectURL);
+
+ if (redirectURL.protocolIsData()) {
+ // Handle data URL decoding locally.
+ finishNetworkLoad();
+ loadDataURL();
+ }
+ }
}
void ResourceLoader::willSendRequest(ResourceRequest&& request, const ResourceResponse& redirectResponse, std::function<void(ResourceRequest&&)>&& callback)
Modified: trunk/Source/WebCore/loader/ResourceLoader.h (189042 => 189043)
--- trunk/Source/WebCore/loader/ResourceLoader.h 2015-08-27 18:45:30 UTC (rev 189042)
+++ trunk/Source/WebCore/loader/ResourceLoader.h 2015-08-27 19:10:29 UTC (rev 189043)
@@ -177,6 +177,7 @@
void addDataOrBuffer(const char*, unsigned, SharedBuffer*, DataPayloadType);
void loadDataURL();
+ void finishNetworkLoad();
// ResourceHandleClient
virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& redirectResponse) override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes