diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/xml/XSLTProcessorLibxslt.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/xml/XSLTProcessorLibxslt.cpp')
-rw-r--r-- | Source/WebCore/xml/XSLTProcessorLibxslt.cpp | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/Source/WebCore/xml/XSLTProcessorLibxslt.cpp b/Source/WebCore/xml/XSLTProcessorLibxslt.cpp index 8a184c305..80931181f 100644 --- a/Source/WebCore/xml/XSLTProcessorLibxslt.cpp +++ b/Source/WebCore/xml/XSLTProcessorLibxslt.cpp @@ -30,7 +30,7 @@ #include "Document.h" #include "Frame.h" #include "Page.h" -#include "PageConsoleClient.h" +#include "PageConsole.h" #include "ResourceError.h" #include "ResourceRequest.h" #include "ResourceResponse.h" @@ -40,7 +40,6 @@ #include "XSLTExtensions.h" #include "XSLTUnicodeSort.h" #include "markup.h" -#include <JavaScriptCore/Profile.h> #include <libxslt/imports.h> #include <libxslt/security.h> #include <libxslt/variables.h> @@ -50,7 +49,7 @@ #include <wtf/text/StringBuffer.h> #include <wtf/unicode/UTF8.h> -#if OS(DARWIN) && !PLATFORM(EFL) && !PLATFORM(GTK) +#if PLATFORM(MAC) #include "SoftLinking.h" SOFT_LINK_LIBRARY(libxslt); @@ -80,32 +79,32 @@ void XSLTProcessor::genericErrorFunc(void*, const char*, ...) void XSLTProcessor::parseErrorFunc(void* userData, xmlError* error) { - PageConsoleClient* console = static_cast<PageConsoleClient*>(userData); + PageConsole* console = static_cast<PageConsole*>(userData); if (!console) return; MessageLevel level; switch (error->level) { case XML_ERR_NONE: - level = MessageLevel::Debug; + level = DebugMessageLevel; break; case XML_ERR_WARNING: - level = MessageLevel::Warning; + level = WarningMessageLevel; break; case XML_ERR_ERROR: case XML_ERR_FATAL: default: - level = MessageLevel::Error; + level = ErrorMessageLevel; break; } // xmlError->int2 is the column number of the error or 0 if N/A. - console->addMessage(MessageSource::XML, level, error->message, error->file, error->line, error->int2); + console->addMessage(XMLMessageSource, level, error->message, error->file, error->line, error->int2); } // FIXME: There seems to be no way to control the ctxt pointer for loading here, thus we have globals. -static XSLTProcessor* globalProcessor = nullptr; -static CachedResourceLoader* globalCachedResourceLoader = nullptr; +static XSLTProcessor* globalProcessor = 0; +static CachedResourceLoader* globalCachedResourceLoader = 0; static xmlDocPtr docLoaderFunc(const xmlChar* uri, xmlDictPtr, int options, @@ -124,23 +123,19 @@ static xmlDocPtr docLoaderFunc(const xmlChar* uri, ResourceError error; ResourceResponse response; - RefPtr<SharedBuffer> data; + Vector<char> data; bool requestAllowed = globalCachedResourceLoader->frame() && globalCachedResourceLoader->document()->securityOrigin()->canRequest(url); if (requestAllowed) { globalCachedResourceLoader->frame()->loader().loadResourceSynchronously(url, AllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, error, response, data); - if (error.isNull()) - requestAllowed = globalCachedResourceLoader->document()->securityOrigin()->canRequest(response.url()); - else if (data) - data = nullptr; + requestAllowed = globalCachedResourceLoader->document()->securityOrigin()->canRequest(response.url()); } if (!requestAllowed) { - if (data) - data = nullptr; + data.clear(); globalCachedResourceLoader->printAccessDeniedMessage(url); } - PageConsoleClient* console = nullptr; + PageConsole* console = 0; Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame(); if (frame && frame->page()) console = &frame->page()->console(); @@ -149,7 +144,7 @@ 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() : nullptr, data ? data->size() : 0, (const char*)uri, 0, options); + xmlDocPtr doc = xmlReadMemory(data.data(), data.size(), (const char*)uri, 0, options); xmlSetStructuredErrorFunc(0, 0); xmlSetGenericErrorFunc(0, 0); @@ -197,7 +192,7 @@ static int writeToStringBuilder(void* context, const char* buffer, int len) static bool saveResultToString(xmlDocPtr resultDoc, xsltStylesheetPtr sheet, String& resultString) { - xmlOutputBufferPtr outputBuf = xmlAllocOutputBuffer(nullptr); + xmlOutputBufferPtr outputBuf = xmlAllocOutputBuffer(0); if (!outputBuf) return false; @@ -226,12 +221,13 @@ static const char** xsltParamArrayFromParameterMap(XSLTProcessor::ParameterMap& const char** parameterArray = (const char**)fastMalloc(((parameters.size() * 2) + 1) * sizeof(char*)); + XSLTProcessor::ParameterMap::iterator end = parameters.end(); unsigned index = 0; - for (auto& parameter : parameters) { - parameterArray[index++] = fastStrDup(parameter.key.utf8().data()); - parameterArray[index++] = fastStrDup(parameter.value.utf8().data()); + for (XSLTProcessor::ParameterMap::iterator it = parameters.begin(); it != end; ++it) { + parameterArray[index++] = fastStrDup(it->key.utf8().data()); + parameterArray[index++] = fastStrDup(it->value.utf8().data()); } - parameterArray[index] = nullptr; + parameterArray[index] = 0; return parameterArray; } @@ -272,7 +268,7 @@ static inline xmlDocPtr xmlDocPtrFromNode(Node& sourceNode, bool& shouldDelete) Ref<Document> ownerDocument(sourceNode.document()); bool sourceIsDocument = (&sourceNode == &ownerDocument.get()); - xmlDocPtr sourceDoc = nullptr; + xmlDocPtr sourceDoc = 0; if (sourceIsDocument && ownerDocument->transformSource()) sourceDoc = (xmlDocPtr)ownerDocument->transformSource()->platformSource(); if (!sourceDoc) { @@ -289,7 +285,7 @@ static inline String resultMIMEType(xmlDocPtr resultDoc, xsltStylesheetPtr sheet // HTML (create an HTML document), XML (create an XML document), // and text (wrap in a <pre> and create an XML document). - const xmlChar* resultType = nullptr; + const xmlChar* resultType = 0; XSLT_GET_IMPORT_PTR(resultType, sheet, method); if (!resultType && resultDoc->type == XML_HTML_DOCUMENT_NODE) resultType = (const xmlChar*)"html"; @@ -306,11 +302,11 @@ bool XSLTProcessor::transformToString(Node& sourceNode, String& mimeType, String { Ref<Document> ownerDocument(sourceNode.document()); - setXSLTLoadCallBack(docLoaderFunc, this, &ownerDocument->cachedResourceLoader()); + setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->cachedResourceLoader()); xsltStylesheetPtr sheet = xsltStylesheetPointer(m_stylesheet, m_stylesheetRootNode.get()); if (!sheet) { - setXSLTLoadCallBack(nullptr, nullptr, nullptr); - m_stylesheet = nullptr; + setXSLTLoadCallBack(0, 0, 0); + m_stylesheet = 0; return false; } m_stylesheet->clearDocuments(); @@ -369,7 +365,7 @@ bool XSLTProcessor::transformToString(Node& sourceNode, String& mimeType, String sheet->method = origMethod; setXSLTLoadCallBack(0, 0, 0); xsltFreeStylesheet(sheet); - m_stylesheet = nullptr; + m_stylesheet = 0; return success; } |