diff options
Diffstat (limited to 'WebCore/xml')
-rw-r--r-- | WebCore/xml/XMLHttpRequest.cpp | 94 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequest.h | 8 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequest.idl | 8 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp | 154 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequestProgressEventThrottle.h | 81 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequestUpload.idl | 8 | ||||
-rw-r--r-- | WebCore/xml/XSLStyleSheetLibxslt.cpp | 4 | ||||
-rw-r--r-- | WebCore/xml/XSLTProcessor.cpp | 5 | ||||
-rw-r--r-- | WebCore/xml/XSLTProcessorLibxslt.cpp | 3 | ||||
-rw-r--r-- | WebCore/xml/XSLTProcessorQt.cpp | 1 |
10 files changed, 337 insertions, 29 deletions
diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index 32818df..c95351f 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -24,8 +24,8 @@ #include "Blob.h" #include "Cache.h" -#include "CString.h" #include "CrossOriginAccessControl.h" +#include "DOMFormData.h" #include "DOMImplementation.h" #include "Document.h" #include "Event.h" @@ -33,6 +33,7 @@ #include "EventListener.h" #include "EventNames.h" #include "HTTPParsers.h" +#include "InspectorController.h" #include "InspectorTimelineAgent.h" #include "ResourceError.h" #include "ResourceRequest.h" @@ -44,6 +45,7 @@ #include "XMLHttpRequestProgressEvent.h" #include "XMLHttpRequestUpload.h" #include "markup.h" +#include <wtf/text/CString.h> #include <wtf/StdLibExtras.h> #include <wtf/RefCountedLeakCounter.h> @@ -127,6 +129,29 @@ static bool isSetCookieHeader(const AtomicString& name) return equalIgnoringCase(name, "set-cookie") || equalIgnoringCase(name, "set-cookie2"); } +static void setCharsetInMediaType(String& mediaType, const String& charsetValue) +{ + unsigned int pos = 0, len = 0; + + findCharsetInMediaType(mediaType, pos, len); + + if (!len) { + // When no charset found, append new charset. + mediaType.stripWhiteSpace(); + if (mediaType[mediaType.length() - 1] != ';') + mediaType.append(";"); + mediaType.append(" charset="); + mediaType.append(charsetValue); + } else { + // Found at least one existing charset, replace all occurrences with new charset. + while (len) { + mediaType.replace(pos, len, charsetValue); + unsigned int start = pos + charsetValue.length(); + findCharsetInMediaType(mediaType, pos, len, start); + } + } +} + static const XMLHttpRequestStaticData* staticData = 0; static const XMLHttpRequestStaticData* createXMLHttpRequestStaticData() @@ -157,6 +182,7 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context) , m_receivedLength(0) , m_lastSendLineNumber(0) , m_exceptionCode(0) + , m_progressEventThrottle(this) { initializeXMLHttpRequestStaticData(); #ifndef NDEBUG @@ -214,7 +240,7 @@ Document* XMLHttpRequest::responseXML() const // The W3C spec requires this. m_responseXML = 0; } else { - m_responseXML = document()->implementation()->createDocument(0); + m_responseXML = Document::create(0); m_responseXML->open(); m_responseXML->setURL(m_url); // FIXME: Set Last-Modified. @@ -258,7 +284,7 @@ void XMLHttpRequest::callReadyStateChangeListener() timelineAgent->willChangeXHRReadyState(m_url.string(), m_state); #endif - dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent)); + m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent); #if ENABLE(INSPECTOR) if (callTimelineAgentOnReadyStateChange && (timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext()))) @@ -273,7 +299,7 @@ void XMLHttpRequest::callReadyStateChangeListener() timelineAgent->willLoadXHR(m_url.string()); #endif - dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); + m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); #if ENABLE(INSPECTOR) if (callTimelineAgentOnLoad && (timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext()))) @@ -292,6 +318,11 @@ void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec) m_includeCredentials = value; } +void XMLHttpRequest::open(const String& method, const KURL& url, ExceptionCode& ec) +{ + open(method, url, true, ec); +} + void XMLHttpRequest::open(const String& method, const KURL& url, bool async, ExceptionCode& ec) { internalAbort(); @@ -425,6 +456,9 @@ void XMLHttpRequest::send(const String& body, ExceptionCode& ec) else #endif setRequestHeaderInternal("Content-Type", "application/xml"); + } else { + setCharsetInMediaType(contentType, "UTF-8"); + m_requestHeaders.set("Content-Type", contentType); } m_requestEntityBody = FormData::create(UTF8Encoding().encode(body.characters(), body.length(), EntitiesForUnencodables)); @@ -444,7 +478,30 @@ void XMLHttpRequest::send(Blob* body, ExceptionCode& ec) // FIXME: Should we set a Content-Type if one is not set. // FIXME: add support for uploading bundles. m_requestEntityBody = FormData::create(); +#if ENABLE(BLOB_SLICE) + m_requestEntityBody->appendFileRange(body->path(), body->start(), body->length(), body->modificationTime()); +#else m_requestEntityBody->appendFile(body->path(), false); +#endif + } + + createRequest(ec); +} + +void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) +{ + if (!initSend(ec)) + return; + + if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily()) { + m_requestEntityBody = FormData::createMultiPart(*body, document()); + + String contentType = getRequestHeader("Content-Type"); + if (contentType.isEmpty()) { + contentType = "multipart/form-data; boundary="; + contentType += m_requestEntityBody->boundary().data(); + setRequestHeaderInternal("Content-Type", contentType); + } } createRequest(ec); @@ -457,7 +514,7 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) // Also, only async requests support upload progress events. bool forcePreflight = false; if (m_async) { - dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); + m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); if (m_requestEntityBody && m_upload) { forcePreflight = m_upload->hasEventListeners(); m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); @@ -549,7 +606,7 @@ void XMLHttpRequest::abort() m_state = UNSENT; } - dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); + m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) @@ -603,7 +660,7 @@ void XMLHttpRequest::genericError() void XMLHttpRequest::networkError() { genericError(); - dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); + m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) @@ -615,7 +672,7 @@ void XMLHttpRequest::networkError() void XMLHttpRequest::abortError() { genericError(); - dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); + m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) @@ -651,7 +708,7 @@ static void reportUnsafeUsage(ScriptExecutionContext* context, const String& mes return; // FIXME: It's not good to report the bad usage without indicating what source line it came from. // We should pass additional parameters so we can tell the console where the mistake occurred. - context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); + context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); } void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec) @@ -841,9 +898,9 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier) if (m_decoder) m_responseText += m_decoder->flush(); - scriptExecutionContext()->resourceRetrievedByXMLHttpRequest(identifier, m_responseText); #if ENABLE(INSPECTOR) - scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + m_url + "\".", m_lastSendLineNumber, m_lastSendURL); + if (InspectorController* inspector = scriptExecutionContext()->inspectorController()) + inspector->resourceRetrievedByXMLHttpRequest(identifier, m_responseText); #endif bool hadLoader = m_loader; @@ -918,9 +975,8 @@ void XMLHttpRequest::didReceiveData(const char* data, int len) long long expectedLength = m_response.expectedContentLength(); m_receivedLength += len; - // FIXME: the spec requires that we dispatch the event according to the least - // frequent method between every 350ms (+/-200ms) and for every byte received. - dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength))); + bool lengthComputable = expectedLength && m_receivedLength <= expectedLength; + m_progressEventThrottle.dispatchProgressEvent(lengthComputable, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength)); if (m_state != LOADING) changeState(LOADING); @@ -935,6 +991,16 @@ bool XMLHttpRequest::canSuspend() const return !m_loader; } +void XMLHttpRequest::suspend() +{ + m_progressEventThrottle.suspend(); +} + +void XMLHttpRequest::resume() +{ + m_progressEventThrottle.resume(); +} + void XMLHttpRequest::stop() { internalAbort(); diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h index 2cea5c6..ca308cc 100644 --- a/WebCore/xml/XMLHttpRequest.h +++ b/WebCore/xml/XMLHttpRequest.h @@ -29,12 +29,14 @@ #include "ResourceResponse.h" #include "ScriptString.h" #include "ThreadableLoaderClient.h" +#include "XMLHttpRequestProgressEventThrottle.h" #include <wtf/OwnPtr.h> namespace WebCore { class Blob; class Document; +class DOMFormData; class ResourceRequest; class TextResourceDecoder; class ThreadableLoader; @@ -57,6 +59,8 @@ public: virtual void contextDestroyed(); virtual bool canSuspend() const; + virtual void suspend(); + virtual void resume(); virtual void stop(); virtual ScriptExecutionContext* scriptExecutionContext() const; @@ -66,6 +70,7 @@ public: State readyState() const; bool withCredentials() const { return m_includeCredentials; } void setWithCredentials(bool, ExceptionCode&); + void open(const String& method, const KURL&, ExceptionCode&); void open(const String& method, const KURL&, bool async, ExceptionCode&); void open(const String& method, const KURL&, bool async, const String& user, ExceptionCode&); void open(const String& method, const KURL&, bool async, const String& user, const String& password, ExceptionCode&); @@ -73,6 +78,7 @@ public: void send(Document*, ExceptionCode&); void send(const String&, ExceptionCode&); void send(Blob*, ExceptionCode&); + void send(DOMFormData*, ExceptionCode&); void abort(); void setRequestHeader(const AtomicString& name, const String& value, ExceptionCode&); void overrideMimeType(const String& override); @@ -184,6 +190,8 @@ private: ExceptionCode m_exceptionCode; EventTargetData m_eventTargetData; + + XMLHttpRequestProgressEventThrottle m_progressEventThrottle; }; } // namespace WebCore diff --git a/WebCore/xml/XMLHttpRequest.idl b/WebCore/xml/XMLHttpRequest.idl index 70cd58a..5a86fe5 100644 --- a/WebCore/xml/XMLHttpRequest.idl +++ b/WebCore/xml/XMLHttpRequest.idl @@ -91,12 +91,12 @@ module xml { [Custom] void overrideMimeType(in DOMString override); // EventTarget interface - [Custom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [Custom] void removeEventListener(in DOMString type, + [JSCCustom] void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture); + [JSCCustom] void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp b/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp new file mode 100644 index 0000000..0eb6398 --- /dev/null +++ b/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> + * All right reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "XMLHttpRequestProgressEventThrottle.h" + +#include "EventTarget.h" +#include "XMLHttpRequestProgressEvent.h" + +namespace WebCore { + +const double XMLHttpRequestProgressEventThrottle::minimumProgressEventDispatchingIntervalInSeconds = .05; // 50 ms per specification. + +XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(EventTarget* target) + : m_target(target) + , m_loaded(0) + , m_total(0) + , m_suspended(false) +{ + ASSERT(target); +} + +XMLHttpRequestProgressEventThrottle::~XMLHttpRequestProgressEventThrottle() +{ +} + +void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(bool lengthComputable, unsigned loaded, unsigned total) +{ + ASSERT(!suspended()); + if (!isActive()) { + // The timer is not active so the least frequent event for now is every byte. + // Just go ahead and dispatch the event. + + // We should not have any pending loaded & total information from a previous run. + ASSERT(!m_loaded); + ASSERT(!m_total); + + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total)); + startRepeating(minimumProgressEventDispatchingIntervalInSeconds); + return; + } + + // The timer is already active so minimumProgressEventDispatchingIntervalInSeconds is the least frequent event. + m_lengthComputable = lengthComputable; + m_loaded = loaded; + m_total = total; +} + +void XMLHttpRequestProgressEventThrottle::dispatchEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction) +{ + ASSERT(!suspended()); + // We should not have any pending events from a previous resume. + ASSERT(!m_pausedEvent); + + if (progressEventAction == FlushProgressEvent) + flushProgressEvent(); + + m_target->dispatchEvent(event); +} + +void XMLHttpRequestProgressEventThrottle::flushProgressEvent() +{ + if (!hasEventToDispatch()) + return; + + PassRefPtr<Event> event = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total); + m_loaded = 0; + m_total = 0; + + // We stop the timer as this is called when no more events are supposed to occur. + stop(); + + m_target->dispatchEvent(event); +} + +void XMLHttpRequestProgressEventThrottle::dispatchPausedEvent() +{ + ASSERT(!suspended()); + if (!m_pausedEvent) + return; + + m_target->dispatchEvent(m_pausedEvent); + m_pausedEvent = 0; +} + +void XMLHttpRequestProgressEventThrottle::fired() +{ + ASSERT(isActive()); + ASSERT(!suspended()); + ASSERT(!m_pausedEvent); + if (!hasEventToDispatch()) { + // No progress event was queued since the previous dispatch, we can safely stop the timer. + stop(); + return; + } + + m_target->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total)); + m_total = 0; + m_loaded = 0; +} + +bool XMLHttpRequestProgressEventThrottle::hasEventToDispatch() const +{ + return (m_total || m_loaded) && isActive(); +} + +void XMLHttpRequestProgressEventThrottle::suspend() +{ + ASSERT(!m_pausedEvent); + + m_suspended = true; + // If we have a progress event waiting to be dispatched, + // just queue it. + if (hasEventToDispatch()) { + m_pausedEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total); + m_total = 0; + m_loaded = 0; + } + stop(); +} + +void XMLHttpRequestProgressEventThrottle::resume() +{ + ASSERT(!m_loaded); + ASSERT(!m_total); + + m_suspended = false; + dispatchPausedEvent(); +} + +} // namespace WebCore diff --git a/WebCore/xml/XMLHttpRequestProgressEventThrottle.h b/WebCore/xml/XMLHttpRequestProgressEventThrottle.h new file mode 100644 index 0000000..f51aea1 --- /dev/null +++ b/WebCore/xml/XMLHttpRequestProgressEventThrottle.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2010 Julien Chaffraix <jchaffraix@webkit.org> + * All right reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef XMLHttpRequestProgressEventThrottle_h +#define XMLHttpRequestProgressEventThrottle_h + +#include "Timer.h" +#include "wtf/PassRefPtr.h" +#include "wtf/Vector.h" + +namespace WebCore { + +class Event; +class EventTarget; + +enum ProgressEventAction { + DoNotFlushProgressEvent, + FlushProgressEvent +}; + +// This implements the XHR2 progress event dispatching: "dispatch a progress event called progress +// about every 50ms or for every byte received, whichever is least frequent". +class XMLHttpRequestProgressEventThrottle : public TimerBase { +public: + XMLHttpRequestProgressEventThrottle(EventTarget*); + virtual ~XMLHttpRequestProgressEventThrottle(); + + void dispatchProgressEvent(bool lengthComputable, unsigned loaded, unsigned total); + void dispatchEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent); + + void suspend(); + void resume(); + + bool suspended() const { return m_suspended; } + +private: + static const double minimumProgressEventDispatchingIntervalInSeconds; + + virtual void fired(); + void dispatchPausedEvent(); + void flushProgressEvent(); + + bool hasEventToDispatch() const; + + // Weak pointer to our XMLHttpRequest object as it is the one holding us. + EventTarget* m_target; + + bool m_lengthComputable; + unsigned m_loaded; + unsigned m_total; + + bool m_suspended; + RefPtr<Event> m_pausedEvent; +}; + +} // namespace WebCore + +#endif // XMLHttpRequestProgressEventThrottle_h diff --git a/WebCore/xml/XMLHttpRequestUpload.idl b/WebCore/xml/XMLHttpRequestUpload.idl index ce392f3..a712a37 100644 --- a/WebCore/xml/XMLHttpRequestUpload.idl +++ b/WebCore/xml/XMLHttpRequestUpload.idl @@ -42,12 +42,12 @@ module xml { attribute EventListener onprogress; // EventTarget interface - [Custom] void addEventListener(in DOMString type, - in EventListener listener, - in boolean useCapture); - [Custom] void removeEventListener(in DOMString type, + [JSCCustom] void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture); + [JSCCustom] void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); boolean dispatchEvent(in Event evt) raises(EventException); }; diff --git a/WebCore/xml/XSLStyleSheetLibxslt.cpp b/WebCore/xml/XSLStyleSheetLibxslt.cpp index dbd806a..c3feca9 100644 --- a/WebCore/xml/XSLStyleSheetLibxslt.cpp +++ b/WebCore/xml/XSLStyleSheetLibxslt.cpp @@ -24,7 +24,6 @@ #if ENABLE(XSLT) -#include "CString.h" #include "Console.h" #include "DOMWindow.h" #include "DocLoader.h" @@ -37,6 +36,7 @@ #include "XSLImportRule.h" #include "XSLTProcessor.h" #include "loader.h" +#include <wtf/text/CString.h> #include <libxml/uri.h> #include <libxslt/xsltutils.h> @@ -154,6 +154,8 @@ bool XSLStyleSheet::parseString(const String& string, bool) int size = string.length() * sizeof(UChar); xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(buffer, size); + if (!ctxt) + return 0; if (m_parentStyleSheet) { // The XSL transform may leave the newly-transformed document diff --git a/WebCore/xml/XSLTProcessor.cpp b/WebCore/xml/XSLTProcessor.cpp index b182243..b530d52 100644 --- a/WebCore/xml/XSLTProcessor.cpp +++ b/WebCore/xml/XSLTProcessor.cpp @@ -41,7 +41,6 @@ #include "loader.h" #include "markup.h" #include <wtf/Assertions.h> -#include <wtf/Platform.h> #include <wtf/Vector.h> namespace WebCore { @@ -70,10 +69,10 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc RefPtr<Document> result; if (sourceMIMEType == "text/plain") { - result = ownerDocument->implementation()->createDocument(frame); + result = Document::create(frame); transformTextStringToXHTMLDocumentString(documentSource); } else - result = ownerDocument->implementation()->createDocument(sourceMIMEType, frame, false); + result = DOMImplementation::createDocument(sourceMIMEType, frame, false); // Before parsing, we need to save & detach the old document and get the new document // in place. We have to do this only if we're rendering the result document. diff --git a/WebCore/xml/XSLTProcessorLibxslt.cpp b/WebCore/xml/XSLTProcessorLibxslt.cpp index e2da3ed..a0ed450 100644 --- a/WebCore/xml/XSLTProcessorLibxslt.cpp +++ b/WebCore/xml/XSLTProcessorLibxslt.cpp @@ -27,7 +27,6 @@ #include "XSLTProcessor.h" #include "Console.h" -#include "CString.h" #include "DOMWindow.h" #include "DocLoader.h" #include "Frame.h" @@ -46,7 +45,7 @@ #include <libxslt/variables.h> #include <libxslt/xsltutils.h> #include <wtf/Assertions.h> -#include <wtf/Platform.h> +#include <wtf/text/CString.h> #include <wtf/Vector.h> #if PLATFORM(MAC) diff --git a/WebCore/xml/XSLTProcessorQt.cpp b/WebCore/xml/XSLTProcessorQt.cpp index 9ac3f5d..29dbacf 100644 --- a/WebCore/xml/XSLTProcessorQt.cpp +++ b/WebCore/xml/XSLTProcessorQt.cpp @@ -32,7 +32,6 @@ #include "loader.h" #include "markup.h" #include <wtf/Assertions.h> -#include <wtf/Platform.h> #include <wtf/Vector.h> #include <qabstractmessagehandler.h> |