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

Unified Diff: Source/core/xml/XSLTProcessorLibxslt.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/XMLHttpRequest.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XSLTProcessorLibxslt.cpp
diff --git a/Source/core/xml/XSLTProcessorLibxslt.cpp b/Source/core/xml/XSLTProcessorLibxslt.cpp
index 4ab991faba6d153492431070627731917c9db947..30b315111996643eda237645ab76aa05910c3a75 100644
--- a/Source/core/xml/XSLTProcessorLibxslt.cpp
+++ b/Source/core/xml/XSLTProcessorLibxslt.cpp
@@ -23,13 +23,16 @@
#include "config.h"
#include "core/xml/XSLTProcessor.h"
+#include "FetchInitiatorTypeNames.h"
#include "core/dom/Document.h"
#include "core/dom/TransformSource.h"
#include "core/editing/markup.h"
+#include "core/fetch/Resource.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/page/Frame.h"
#include "core/page/Page.h"
#include "core/page/PageConsole.h"
+#include "core/platform/SharedBuffer.h"
#include "core/platform/network/ResourceError.h"
#include "core/platform/network/ResourceRequest.h"
#include "core/platform/network/ResourceResponse.h"
@@ -97,20 +100,13 @@ static xmlDocPtr docLoaderFunc(const xmlChar* uri,
xmlChar* base = xmlNodeGetBase(context->document->doc, context->node);
KURL url(KURL(ParsedURLString, reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri));
xmlFree(base);
- ResourceError error;
- ResourceResponse response;
- Vector<char> data;
-
- bool requestAllowed = globalResourceFetcher->frame() && globalResourceFetcher->document()->securityOrigin()->canRequest(url);
- if (requestAllowed) {
- globalResourceFetcher->fetchSynchronously(url, AllowStoredCredentials, error, response, data);
- requestAllowed = globalResourceFetcher->document()->securityOrigin()->canRequest(response.url());
- }
- if (!requestAllowed) {
- data.clear();
- globalResourceFetcher->printAccessDeniedMessage(url);
- }
+ ResourceLoaderOptions fetchOptions(ResourceFetcher::defaultResourceOptions());
+ fetchOptions.requestOriginPolicy = RestrictToSameOrigin;
+ FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, fetchOptions);
+ ResourcePtr<Resource> resource = globalResourceFetcher->fetchSynchronously(request);
+ if (!resource || !globalProcessor)
+ return 0;
PageConsole* console = 0;
Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame();
@@ -121,7 +117,8 @@ static xmlDocPtr docLoaderFunc(const xmlChar* uri,
// We don't specify an encoding here. Neither Gecko nor WinIE respects
// the encoding specified in the HTTP headers.
- xmlDocPtr doc = xmlReadMemory(data.data(), data.size(), (const char*)uri, 0, options);
+ SharedBuffer* data = resource->resourceBuffer();
+ xmlDocPtr doc = data ? xmlReadMemory(data->data(), data->size(), (const char*)uri, 0, options) : 0;
xmlSetStructuredErrorFunc(0, 0);
xmlSetGenericErrorFunc(0, 0);
« no previous file with comments | « Source/core/xml/XMLHttpRequest.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698