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

Unified Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 23702040: Send synchronous loads through the cache. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 7 years, 3 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
« no previous file with comments | « Source/core/xml/XSLTProcessorLibxslt.cpp ('k') | Source/web/ApplicationCacheHost.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/parser/XMLDocumentParser.cpp
diff --git a/Source/core/xml/parser/XMLDocumentParser.cpp b/Source/core/xml/parser/XMLDocumentParser.cpp
index 26f839d28cde255669a90781a13101210d401d3f..62884e066e0d2ba4737210f12b25d91c22430f14 100644
--- a/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "core/xml/parser/XMLDocumentParser.h"
+#include "FetchInitiatorTypeNames.h"
#include "HTMLNames.h"
#include "XMLNSNames.h"
#include "bindings/v8/ExceptionState.h"
@@ -50,6 +51,7 @@
#include "core/loader/ImageLoader.h"
#include "core/page/Frame.h"
#include "core/page/UseCounter.h"
+#include "core/platform/SharedBuffer.h"
#include "core/platform/network/ResourceError.h"
#include "core/platform/network/ResourceRequest.h"
#include "core/platform/network/ResourceResponse.h"
@@ -637,23 +639,27 @@ static void* openFunc(const char* uri)
if (!shouldAllowExternalLoad(url))
return &globalDescriptor;
- ResourceError error;
- ResourceResponse response;
+ KURL finalURL;
Vector<char> data;
-
{
ResourceFetcher* fetcher = XMLDocumentParserScope::currentFetcher;
XMLDocumentParserScope scope(0);
// FIXME: We should restore the original global error handler as well.
- if (fetcher->frame())
- fetcher->fetchSynchronously(url, AllowStoredCredentials, error, response, data);
+ if (fetcher->frame()) {
+ FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, ResourceFetcher::defaultResourceOptions());
+ ResourcePtr<Resource> resource = fetcher->fetchSynchronously(request);
+ if (resource && !resource->errorOccurred()) {
+ resource->resourceBuffer()->moveTo(data);
+ finalURL = resource->response().url();
+ }
+ }
}
// We have to check the URL again after the load to catch redirects.
// See <https://bugs.webkit.org/show_bug.cgi?id=21963>.
- if (!shouldAllowExternalLoad(response.url()))
+ if (!shouldAllowExternalLoad(finalURL))
return &globalDescriptor;
return new OffsetBuffer(data);
« no previous file with comments | « Source/core/xml/XSLTProcessorLibxslt.cpp ('k') | Source/web/ApplicationCacheHost.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698