[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

barraclough at apple.com barraclough at apple.com
Wed Dec 22 14:35:26 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e84cf7bc048f35e1eddda11f4d205b2d22d61ab0
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 13 20:10:37 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=43987
    Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
    to construct their internal result string.  Remove ScriptString (this is now
    redundant).
    
    Reviewed by Oliver Hunt.
    
    WebCore:
    
    * WebCore.xcodeproj/project.pbxproj:
    * bindings/js/JSDOMBinding.cpp:
    (WebCore::jsOwnedStringOrNull):
    * bindings/js/JSDOMBinding.h:
    * bindings/js/JSXMLHttpRequestCustom.cpp:
    (WebCore::JSXMLHttpRequest::responseText):
    * bindings/js/ScriptCallFrame.cpp:
    (WebCore::ScriptCallFrame::ScriptCallFrame):
    * bindings/js/ScriptCallFrame.h:
    (WebCore::ScriptCallFrame::functionName):
    * bindings/js/ScriptCallStack.h:
    * bindings/js/ScriptFunctionCall.cpp:
    * bindings/js/ScriptFunctionCall.h:
    * bindings/js/ScriptString.h: Removed.
    * dom/ScriptExecutionContext.h:
    * fileapi/FileReader.cpp:
    (WebCore::FileReader::FileReader):
    (WebCore::FileReader::abort):
    (WebCore::FileReader::didReceiveData):
    (WebCore::FileReader::result):
    (WebCore::FileReader::convertToText):
    (WebCore::FileReader::convertToDataURL):
    * fileapi/FileReader.h:
    * fileapi/FileReaderSync.cpp:
    (WebCore::FileReaderSyncLoader::FileReaderSyncLoader):
    (WebCore::FileReaderSyncLoader::didReceiveData):
    (WebCore::FileReaderSync::readAsBinaryString):
    (WebCore::FileReaderSync::readAsText):
    (WebCore::FileReaderSync::readAsDataURL):
    (WebCore::FileReaderSync::read):
    (WebCore::FileReaderSync::convertToText):
    * fileapi/FileReaderSync.h:
    (WebCore::FileReaderSync::readAsText):
    (WebCore::FileReaderSync::FileReaderSync):
    * inspector/InspectorController.cpp:
    (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest):
    (WebCore::InspectorController::scriptImported):
    * inspector/InspectorController.h:
    * inspector/InspectorResource.cpp:
    (WebCore::InspectorResource::setOverrideContent):
    * inspector/InspectorResource.h:
    * loader/FrameLoader.cpp:
    * loader/FrameLoader.h:
    * loader/FrameLoaderClient.h:
    * loader/ResourceLoadNotifier.h:
    * workers/WorkerScriptLoader.h:
    * xml/XMLHttpRequest.cpp:
    (WebCore::XMLHttpRequest::XMLHttpRequest):
    (WebCore::XMLHttpRequest::responseText):
    (WebCore::XMLHttpRequest::responseXML):
    (WebCore::XMLHttpRequest::abort):
    (WebCore::XMLHttpRequest::clearResponse):
    (WebCore::XMLHttpRequest::dropProtection):
    (WebCore::XMLHttpRequest::didFinishLoading):
    (WebCore::XMLHttpRequest::didReceiveData):
    * xml/XMLHttpRequest.h:
    
    WebKit/efl:
    
    * WebCoreSupport/FrameLoaderClientEfl.cpp:
    (WebCore::FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest):
    * WebCoreSupport/FrameLoaderClientEfl.h:
    
    WebKit/mac:
    
    * WebCoreSupport/WebFrameLoaderClient.mm:
    
    WebKit/qt:
    
    * WebCoreSupport/FrameLoaderClientQt.cpp:
    
    WebKit/win:
    
    * WebCoreSupport/WebFrameLoaderClient.cpp:
    
    WebKit/wx:
    
    * WebKitSupport/FrameLoaderClientWx.cpp:
    
    WebKit2:
    
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest):
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69688 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3bf8ac5..4b0ef3c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,72 @@
 
         Reviewed by Oliver Hunt.
 
+        https://bugs.webkit.org/show_bug.cgi?id=43987
+        Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
+        to construct their internal result string.  Remove ScriptString (this is now
+        redundant).
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::jsOwnedStringOrNull):
+        * bindings/js/JSDOMBinding.h:
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::responseText):
+        * bindings/js/ScriptCallFrame.cpp:
+        (WebCore::ScriptCallFrame::ScriptCallFrame):
+        * bindings/js/ScriptCallFrame.h:
+        (WebCore::ScriptCallFrame::functionName):
+        * bindings/js/ScriptCallStack.h:
+        * bindings/js/ScriptFunctionCall.cpp:
+        * bindings/js/ScriptFunctionCall.h:
+        * bindings/js/ScriptString.h: Removed.
+        * dom/ScriptExecutionContext.h:
+        * fileapi/FileReader.cpp:
+        (WebCore::FileReader::FileReader):
+        (WebCore::FileReader::abort):
+        (WebCore::FileReader::didReceiveData):
+        (WebCore::FileReader::result):
+        (WebCore::FileReader::convertToText):
+        (WebCore::FileReader::convertToDataURL):
+        * fileapi/FileReader.h:
+        * fileapi/FileReaderSync.cpp:
+        (WebCore::FileReaderSyncLoader::FileReaderSyncLoader):
+        (WebCore::FileReaderSyncLoader::didReceiveData):
+        (WebCore::FileReaderSync::readAsBinaryString):
+        (WebCore::FileReaderSync::readAsText):
+        (WebCore::FileReaderSync::readAsDataURL):
+        (WebCore::FileReaderSync::read):
+        (WebCore::FileReaderSync::convertToText):
+        * fileapi/FileReaderSync.h:
+        (WebCore::FileReaderSync::readAsText):
+        (WebCore::FileReaderSync::FileReaderSync):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest):
+        (WebCore::InspectorController::scriptImported):
+        * inspector/InspectorController.h:
+        * inspector/InspectorResource.cpp:
+        (WebCore::InspectorResource::setOverrideContent):
+        * inspector/InspectorResource.h:
+        * loader/FrameLoader.cpp:
+        * loader/FrameLoader.h:
+        * loader/FrameLoaderClient.h:
+        * loader/ResourceLoadNotifier.h:
+        * workers/WorkerScriptLoader.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::XMLHttpRequest):
+        (WebCore::XMLHttpRequest::responseText):
+        (WebCore::XMLHttpRequest::responseXML):
+        (WebCore::XMLHttpRequest::abort):
+        (WebCore::XMLHttpRequest::clearResponse):
+        (WebCore::XMLHttpRequest::dropProtection):
+        (WebCore::XMLHttpRequest::didFinishLoading):
+        (WebCore::XMLHttpRequest::didReceiveData):
+        * xml/XMLHttpRequest.h:
+
+2010-10-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
         Bug 43987 - Downloading using XHR is much slower than before
 
         * svg/SVGPathStringBuilder.cpp:
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index ba79725..a41de85 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -876,7 +876,6 @@
 		416E75BF0EDF8FD700360E1D /* ScriptCallStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */; };
 		416E75CB0EDF90C700360E1D /* ScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */; };
 		416E75CC0EDF90C700360E1D /* ScriptCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */; };
-		416F45F00ED7B311008215B6 /* ScriptString.h in Headers */ = {isa = PBXBuildFile; fileRef = 416F45EF0ED7B311008215B6 /* ScriptString.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */ = {isa = PBXBuildFile; fileRef = 41885B9111B6FDA6003383BB /* FormSubmission.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41885B9211B6FDA6003383BB /* FormSubmission.cpp */; };
 		418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */; };
@@ -6899,7 +6898,6 @@
 		416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStack.cpp; sourceTree = "<group>"; };
 		416E75C90EDF90C700360E1D /* ScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallFrame.h; sourceTree = "<group>"; };
 		416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallFrame.cpp; sourceTree = "<group>"; };
-		416F45EF0ED7B311008215B6 /* ScriptString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptString.h; sourceTree = "<group>"; };
 		41885B9111B6FDA6003383BB /* FormSubmission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormSubmission.h; sourceTree = "<group>"; };
 		41885B9211B6FDA6003383BB /* FormSubmission.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormSubmission.cpp; sourceTree = "<group>"; };
 		418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorker.cpp; sourceTree = "<group>"; };
@@ -16748,7 +16746,6 @@
 				CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */,
 				4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */,
 				41C760B00EDE03D300C1655F /* ScriptState.h */,
-				416F45EF0ED7B311008215B6 /* ScriptString.h */,
 				934CC0DF0ED39D6F00A658F2 /* ScriptValue.cpp */,
 				934CC0E00ED39D6F00A658F2 /* ScriptValue.h */,
 				228C284410D82500009D0D0E /* ScriptWrappable.h */,
@@ -20523,7 +20520,6 @@
 				934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */,
 				CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */,
 				41C760B10EDE03D300C1655F /* ScriptState.h in Headers */,
-				416F45F00ED7B311008215B6 /* ScriptString.h in Headers */,
 				934CC0E20ED39D6F00A658F2 /* ScriptValue.h in Headers */,
 				228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */,
 				CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */,
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index d7c086a..72e6d03 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -452,6 +452,13 @@ JSValue jsStringOrNull(ExecState* exec, const String& s)
     return jsString(exec, s);
 }
 
+JSValue jsOwnedStringOrNull(ExecState* exec, const String& s)
+{
+    if (s.isNull())
+        return jsNull();
+    return jsOwnedString(exec, stringToUString(s));
+}
+
 JSValue jsOwnedStringOrNull(ExecState* exec, const UString& s)
 {
     if (s.isNull())
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index f0bd2e2..64a3dad 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -254,6 +254,7 @@ namespace WebCore {
 
     // See JavaScriptCore for explanation: Should be used for any UString that is already owned by another
     // object, to let the engine know that collecting the JSString wrapper is unlikely to save memory.
+    JSC::JSValue jsOwnedStringOrNull(JSC::ExecState*, const String&); 
     JSC::JSValue jsOwnedStringOrNull(JSC::ExecState*, const JSC::UString&); 
 
     String identifierToString(const JSC::Identifier&);
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 49dfbaa..58d324d 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -128,7 +128,7 @@ JSValue JSXMLHttpRequest::send(ExecState* exec)
 JSValue JSXMLHttpRequest::responseText(ExecState* exec) const
 {
     ExceptionCode ec = 0;
-    const ScriptString& text = impl()->responseText(ec);
+    String text = impl()->responseText(ec);
     if (ec) {
         setDOMException(exec, ec);
         return jsUndefined();
diff --git a/WebCore/bindings/js/ScriptCallFrame.cpp b/WebCore/bindings/js/ScriptCallFrame.cpp
index 536e2c6..a3d98ac 100644
--- a/WebCore/bindings/js/ScriptCallFrame.cpp
+++ b/WebCore/bindings/js/ScriptCallFrame.cpp
@@ -39,7 +39,7 @@ using namespace JSC;
 namespace WebCore {
 
 ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, ExecState* exec, unsigned skipArgumentCount)
-    : m_functionName(functionName)
+    : m_functionName(ustringToString(functionName))
     , m_sourceURL(ustringToString(urlString))
     , m_lineNumber(lineNumber)
 {
diff --git a/WebCore/bindings/js/ScriptCallFrame.h b/WebCore/bindings/js/ScriptCallFrame.h
index 5369ced..89fe2be 100644
--- a/WebCore/bindings/js/ScriptCallFrame.h
+++ b/WebCore/bindings/js/ScriptCallFrame.h
@@ -32,7 +32,6 @@
 #define ScriptCallFrame_h
 
 #include <runtime/ArgList.h>
-#include "ScriptString.h"
 #include "ScriptValue.h"
 #include <wtf/Vector.h>
 
@@ -52,7 +51,7 @@ namespace WebCore {
         ScriptCallFrame(const JSC::UString& functionName, const JSC::UString& urlString, int lineNumber, JSC::ExecState*, unsigned skipArgumentCount);
         ~ScriptCallFrame();
 
-        const ScriptString& functionName() const { return m_functionName; }
+        const String& functionName() const { return m_functionName; }
         const String& sourceURL() const { return m_sourceURL; }
         unsigned lineNumber() const { return m_lineNumber; }
 
@@ -61,7 +60,7 @@ namespace WebCore {
         unsigned argumentCount() const { return m_arguments.size(); }
 
     private:
-        ScriptString m_functionName;
+        String m_functionName;
         String m_sourceURL;
         unsigned m_lineNumber;
 
diff --git a/WebCore/bindings/js/ScriptCallStack.h b/WebCore/bindings/js/ScriptCallStack.h
index a45e65a..17d1c46 100644
--- a/WebCore/bindings/js/ScriptCallStack.h
+++ b/WebCore/bindings/js/ScriptCallStack.h
@@ -33,7 +33,6 @@
 
 #include "ScriptCallFrame.h"
 #include "ScriptState.h"
-#include "ScriptString.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/RefPtr.h>
 
diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp
index 2e4d536..775e3ad 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -33,7 +33,6 @@
 
 #include "JSDOMBinding.h"
 #include "JSMainThreadExecState.h"
-#include "ScriptString.h"
 #include "ScriptValue.h"
 
 #include <runtime/JSLock.h>
@@ -52,11 +51,6 @@ void ScriptCallArgumentHandler::appendArgument(const ScriptObject& argument)
     m_arguments.append(argument.jsObject());
 }
 
-void ScriptCallArgumentHandler::appendArgument(const ScriptString& argument)
-{
-    m_arguments.append(jsString(m_exec, argument.ustring()));
-}
-
 void ScriptCallArgumentHandler::appendArgument(const ScriptValue& argument)
 {
     m_arguments.append(argument.jsValue());
diff --git a/WebCore/bindings/js/ScriptFunctionCall.h b/WebCore/bindings/js/ScriptFunctionCall.h
index 037a336..c7da858 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.h
+++ b/WebCore/bindings/js/ScriptFunctionCall.h
@@ -44,14 +44,12 @@ namespace JSC {
 
 namespace WebCore {
     class ScriptValue;
-    class ScriptString;
 
     class ScriptCallArgumentHandler {
     public:
         ScriptCallArgumentHandler(ScriptState* state) : m_exec(state) { }
 
         void appendArgument(const ScriptObject&);
-        void appendArgument(const ScriptString&);
         void appendArgument(const ScriptValue&);
         void appendArgument(const String&);
         void appendArgument(const char*);
diff --git a/WebCore/bindings/js/ScriptString.h b/WebCore/bindings/js/ScriptString.h
deleted file mode 100644
index 98dab6b..0000000
--- a/WebCore/bindings/js/ScriptString.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2008, Google Inc. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * 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 ScriptString_h
-#define ScriptString_h
-
-#include "JSDOMBinding.h"
-#include <runtime/UString.h>
-#include <runtime/UStringBuilder.h>
-#include <wtf/Forward.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class ScriptString {
-public:
-    ScriptString() {}
-    ScriptString(const char* s) : m_str(s) {}
-    ScriptString(const String& s) : m_str(stringToUString(s)) {}
-    ScriptString(const JSC::UString& s) : m_str(s) {}
-
-    operator JSC::UString() const { return m_str; }
-    operator String() const { return ustringToString(m_str); }
-    const JSC::UString& ustring() const { return m_str; }
-
-    bool isNull() const { return m_str.isNull(); }
-    size_t size() const { return m_str.length(); }
-
-    ScriptString& operator=(const char* s)
-    {
-        m_str = s;
-        return *this;
-    }
-
-    ScriptString& operator+=(const String& s)
-    {
-        JSC::UStringBuilder buffer;
-        buffer.append(m_str);
-        buffer.append(stringToUString(s));
-        m_str = buffer.toUString();
-        return *this;
-    }
-
-    bool operator==(const ScriptString& s) const
-    {
-        return m_str == s.m_str;
-    }
-
-    bool operator!=(const ScriptString& s) const
-    {
-        // Avoid exporting an extra symbol by re-using "==" operator.
-        return !(m_str == s.m_str);
-    }
-
-private:
-    JSC::UString m_str;
-};
-
-} // namespace WebCore
-
-#endif // ScriptString_h
diff --git a/WebCore/dom/ScriptExecutionContext.h b/WebCore/dom/ScriptExecutionContext.h
index d39cb64..b46a0f4 100644
--- a/WebCore/dom/ScriptExecutionContext.h
+++ b/WebCore/dom/ScriptExecutionContext.h
@@ -57,7 +57,6 @@ namespace WebCore {
 #endif
     class MessagePort;
     class SecurityOrigin;
-    class ScriptString;
 #if ENABLE(INSPECTOR)
     class InspectorController;
 #endif
diff --git a/WebCore/fileapi/FileReader.cpp b/WebCore/fileapi/FileReader.cpp
index 8036468..0b7b46d 100644
--- a/WebCore/fileapi/FileReader.cpp
+++ b/WebCore/fileapi/FileReader.cpp
@@ -43,6 +43,7 @@
 #include "ProgressEvent.h"
 #include "ResourceError.h"
 #include "ResourceRequest.h"
+#include "ResourceResponse.h"
 #include "ScriptExecutionContext.h"
 #include "TextResourceDecoder.h"
 #include "ThreadableBlobRegistry.h"
@@ -57,7 +58,6 @@ FileReader::FileReader(ScriptExecutionContext* context)
     : ActiveDOMObject(context, this)
     , m_state(None)
     , m_readType(ReadFileAsBinaryString)
-    , m_result("")
     , m_isRawDataConverted(false)
     , m_bytesLoaded(0)
     , m_totalBytes(0)
@@ -144,7 +144,7 @@ void FileReader::abort()
 
     terminate();
 
-    m_result = "";
+    m_builder.clear();
     m_error = FileError::create(ABORT_ERR);
 
     fireEvent(eventNames().errorEvent);
@@ -212,7 +212,7 @@ void FileReader::didReceiveData(const char* data, int lengthReceived)
 
     switch (m_readType) {
     case ReadFileAsBinaryString:
-        m_result += String(data, static_cast<unsigned>(lengthReceived));
+        m_builder.append(data, static_cast<unsigned>(lengthReceived));
         break;
     case ReadFileAsText:
     case ReadFileAsDataURL:
@@ -296,30 +296,30 @@ FileReader::ReadyState FileReader::readyState() const
     return EMPTY;
 }
 
-const ScriptString& FileReader::result()
+String FileReader::result()
 {
     // If reading as binary string, we can return the result immediately.
     if (m_readType == ReadFileAsBinaryString)
-        return m_result;
+        return m_builder.toString();
 
     // If we already convert the raw data received so far, we can return the result now.
     if (m_isRawDataConverted)
-        return m_result;
+        return m_builder.toString();
     m_isRawDataConverted = true;
 
     if (m_readType == ReadFileAsText)
         convertToText();
     // For data URL, we only do the coversion until we receive all the raw data.
     else if (m_readType == ReadFileAsDataURL && m_state == Completed)
-        convertToDataURL(m_rawData, m_fileType, m_result);
+        convertToDataURL(m_rawData, m_fileType, m_builder);
 
-    return m_result;
+    return m_builder.toString();
 }
 
 void FileReader::convertToText()
 {
     if (!m_rawData.size()) {
-        m_result = "";
+        m_builder.clear();
         return;
     }
 
@@ -330,28 +330,31 @@ void FileReader::convertToText()
     // FIXME: consider supporting incremental decoding to improve the perf.
     if (!m_decoder)
         m_decoder = TextResourceDecoder::create("text/plain", m_encoding.isValid() ? m_encoding : UTF8Encoding());
-    m_result = m_decoder->decode(&m_rawData.at(0), m_rawData.size());
+    m_builder.clear();
+    m_builder.append(m_decoder->decode(&m_rawData.at(0), m_rawData.size()));
 
     if (m_state == Completed && !m_error)
-        m_result += m_decoder->flush();
+        m_builder.append(m_decoder->flush());
 }
 
-void FileReader::convertToDataURL(const Vector<char>& rawData, const String& fileType, ScriptString& result)
+void FileReader::convertToDataURL(const Vector<char>& rawData, const String& fileType, StringBuilder& builder)
 {
-    result = "data:";
+    builder.clear();
+    builder.append("data:");
 
     if (!rawData.size())
         return;
 
-    result += fileType;
-    if (!fileType.isEmpty())
-        result += ";";
-    result += "base64,";
+    if (!fileType.isEmpty()) {
+        builder.append(fileType);
+        builder.append(";base64,");
+    } else
+        builder.append("base64,");
 
     Vector<char> out;
     base64Encode(rawData, out);
     out.append('\0');
-    result += out.data();
+    builder.append(out.data());
 }
 
 } // namespace WebCore
diff --git a/WebCore/fileapi/FileReader.h b/WebCore/fileapi/FileReader.h
index 68c0f83..f914dad 100644
--- a/WebCore/fileapi/FileReader.h
+++ b/WebCore/fileapi/FileReader.h
@@ -37,14 +37,14 @@
 #include "EventTarget.h"
 #include "FileError.h"
 #include "KURL.h"
-#include "PlatformString.h"
-#include "ScriptString.h"
 #include "TextEncoding.h"
 #include "ThreadableLoaderClient.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -77,11 +77,11 @@ public:
 
     ReadyState readyState() const;
     PassRefPtr<FileError> error() { return m_error; }
-    const ScriptString& result();
+    String result();
 
     // Helper methods, also used by FileReaderSync.
     static ExceptionCode httpStatusCodeToExceptionCode(int httpStatusCode);
-    static void convertToDataURL(const Vector<char>& rawData, const String& fileType, ScriptString& result);
+    static void convertToDataURL(const Vector<char>& rawData, const String& fileType, StringBuilder&);
 
     // ActiveDOMObject
     virtual bool canSuspend() const;
@@ -147,13 +147,7 @@ private:
     ReadType m_readType;
     TextEncoding m_encoding;
 
-    // Like XMLHttpRequest.m_responseText, we keep this as a ScriptString, not a WTF::String.
-    // That's because these strings can easily get huge (they are filled from the file) and
-    // because JS can easily observe many intermediate states, so it's very useful to be
-    // able to share the buffer with JavaScript versions of the whole or partial string.
-    // In contrast, this string doesn't interact much with the rest of the engine so it's not that
-    // big a cost that it isn't a String.
-    ScriptString m_result;
+    StringBuilder m_builder;
 
     // The raw data. We have to keep track of all the raw data for it to be converted to text or data URL data.
     Vector<char> m_rawData;
diff --git a/WebCore/fileapi/FileReaderSync.cpp b/WebCore/fileapi/FileReaderSync.cpp
index 6c76714..6425bcf 100644
--- a/WebCore/fileapi/FileReaderSync.cpp
+++ b/WebCore/fileapi/FileReaderSync.cpp
@@ -39,6 +39,7 @@
 #include "BlobURL.h"
 #include "FileReader.h"
 #include "ResourceRequest.h"
+#include "ResourceResponse.h"
 #include "ScriptExecutionContext.h"
 #include "TextEncoding.h"
 #include "TextResourceDecoder.h"
@@ -50,7 +51,7 @@ namespace WebCore {
 class FileReaderSyncLoader : public ThreadableLoaderClient {
 public:
     // If the output result is provided, use it. Otherwise, save it as the raw data.
-    FileReaderSyncLoader(ScriptString* result);
+    FileReaderSyncLoader(StringBuilder*);
 
     // Returns the http status code.
     void start(ScriptExecutionContext*, const ResourceRequest&, ExceptionCode&);
@@ -65,7 +66,7 @@ public:
 
 private:
     // The output result. The caller provides this in order to load the binary data directly.
-    ScriptString* m_result;
+    StringBuilder* m_builder;
 
     // The raw data. The caller does not provide the above output result and we need to save it here.
     Vector<char> m_rawData;
@@ -73,8 +74,8 @@ private:
     int m_httpStatusCode;    
 };
 
-FileReaderSyncLoader::FileReaderSyncLoader(ScriptString* result)
-    : m_result(result)
+FileReaderSyncLoader::FileReaderSyncLoader(StringBuilder* builder)
+    : m_builder(builder)
     , m_httpStatusCode(0)
 {
 }
@@ -100,8 +101,8 @@ void FileReaderSyncLoader::didReceiveResponse(const ResourceResponse& response)
 
 void FileReaderSyncLoader::didReceiveData(const char* data, int lengthReceived)
 {
-    if (m_result)
-        *m_result += String(data, static_cast<unsigned>(lengthReceived));
+    if (m_builder)
+        m_builder->append(data, static_cast<unsigned>(lengthReceived));
     else
         m_rawData.append(data, static_cast<unsigned>(lengthReceived));
 }
@@ -116,37 +117,32 @@ void FileReaderSyncLoader::didFail(const ResourceError&)
     m_httpStatusCode = 500;
 }
 
-FileReaderSync::FileReaderSync()
-    : m_result("")
-{
-}
-
-const ScriptString& FileReaderSync::readAsBinaryString(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
+String FileReaderSync::readAsBinaryString(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
 {
     if (!blob)
-        return m_result;
+        return m_builder.toString();
 
     read(scriptExecutionContext, blob, ReadAsBinaryString, ec);
-    return m_result;
+    return m_builder.toString();
 }
 
-const ScriptString& FileReaderSync::readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, const String& encoding, ExceptionCode& ec)
+String FileReaderSync::readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, const String& encoding, ExceptionCode& ec)
 {
     if (!blob)
-        return m_result;
+        return m_builder.toString();
 
     m_encoding = encoding;
     read(scriptExecutionContext, blob, ReadAsText, ec);
-    return m_result;
+    return m_builder.toString();
 }
 
-const ScriptString& FileReaderSync::readAsDataURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
+String FileReaderSync::readAsDataURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
 {
     if (!blob)
-        return m_result;
+        return m_builder.toString();
 
     read(scriptExecutionContext, blob, ReadAsDataURL, ec);
-    return m_result;
+    return m_builder.toString();
 }
 
 void FileReaderSync::read(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ReadType readType, ExceptionCode& ec)
@@ -158,7 +154,7 @@ void FileReaderSync::read(ScriptExecutionContext* scriptExecutionContext, Blob*
     ResourceRequest request(urlForReading);
     request.setHTTPMethod("GET");
 
-    FileReaderSyncLoader loader((readType == ReadAsBinaryString) ? &m_result : 0);
+    FileReaderSyncLoader loader((readType == ReadAsBinaryString) ? &m_builder : 0);
     loader.start(scriptExecutionContext, request, ec);
     ThreadableBlobRegistry::unregisterBlobURL(urlForReading);
     if (ec)
@@ -169,17 +165,17 @@ void FileReaderSync::read(ScriptExecutionContext* scriptExecutionContext, Blob*
         // Nothing to do since we need no conversion.
         return;
     case ReadAsText:
-        convertToText(loader.rawData().data(), loader.rawData().size(), m_result);
+        convertToText(loader.rawData().data(), loader.rawData().size(), m_builder);
         return;
     case ReadAsDataURL:
-        FileReader::convertToDataURL(loader.rawData(), blob->type(), m_result);
+        FileReader::convertToDataURL(loader.rawData(), blob->type(), m_builder);
         return;
     }
 
     ASSERT_NOT_REACHED();
 }
 
-void FileReaderSync::convertToText(const char* data, int size, ScriptString& result)
+void FileReaderSync::convertToText(const char* data, int size, StringBuilder& builder)
 {
     if (!size)
         return;
@@ -190,8 +186,9 @@ void FileReaderSync::convertToText(const char* data, int size, ScriptString& res
     // provided encoding.     
     // FIXME: consider supporting incremental decoding to improve the perf.
     RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/plain", m_encoding.isEmpty() ? UTF8Encoding() : TextEncoding(m_encoding));
-    result = decoder->decode(data, size);
-    result += decoder->flush();
+    builder.clear();
+    builder.append(decoder->decode(data, size));
+    builder.append(decoder->flush());
 }
 
 } // namespace WebCore
diff --git a/WebCore/fileapi/FileReaderSync.h b/WebCore/fileapi/FileReaderSync.h
index a517cab..cb0e00d 100644
--- a/WebCore/fileapi/FileReaderSync.h
+++ b/WebCore/fileapi/FileReaderSync.h
@@ -34,9 +34,9 @@
 #if ENABLE(BLOB)
 
 #include "ExceptionCode.h"
-#include "ScriptString.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -52,13 +52,13 @@ public:
 
     virtual ~FileReaderSync() { }
 
-    const ScriptString& readAsBinaryString(ScriptExecutionContext*, Blob*, ExceptionCode&);
-    const ScriptString& readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
+    String readAsBinaryString(ScriptExecutionContext*, Blob*, ExceptionCode&);
+    String readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec)
     {
         return readAsText(scriptExecutionContext, blob, "", ec);
     }
-    const ScriptString& readAsText(ScriptExecutionContext*, Blob*, const String& encoding, ExceptionCode&);
-    const ScriptString& readAsDataURL(ScriptExecutionContext*, Blob*, ExceptionCode&);
+    String readAsText(ScriptExecutionContext*, Blob*, const String& encoding, ExceptionCode&);
+    String readAsDataURL(ScriptExecutionContext*, Blob*, ExceptionCode&);
 
 private:
     enum ReadType {
@@ -67,18 +67,12 @@ private:
         ReadAsDataURL
     };
 
-    FileReaderSync();
-    
+    FileReaderSync() { }
+
     void read(ScriptExecutionContext*, Blob*, ReadType, ExceptionCode&);
-    void convertToText(const char* data, int size, ScriptString& result);
-
-    // Like XMLHttpRequest.m_responseText, we keep this as a ScriptString, not a WTF::String.
-    // That's because these strings can easily get huge (they are filled from the file) and
-    // because JS can easily observe many intermediate states, so it's very useful to be
-    // able to share the buffer with JavaScript versions of the whole or partial string.
-    // In contrast, this string doesn't interact much with the rest of the engine so it's not that
-    // big a cost that it isn't a String.
-    ScriptString m_result;
+    void convertToText(const char* data, int size, StringBuilder&);
+
+    StringBuilder m_builder;
 
     String m_encoding;
 };
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index c11390b..af0b383 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -86,7 +86,6 @@
 #include "ScriptProfile.h"
 #include "ScriptProfiler.h"
 #include "ScriptSourceCode.h"
-#include "ScriptString.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
 #include "SharedBuffer.h"
@@ -1132,7 +1131,7 @@ void InspectorController::didFailLoading(unsigned long identifier, const Resourc
         resource->updateScriptObject(m_frontend.get());
 }
 
-void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
+void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
 {
     if (!enabled())
         return;
@@ -1162,7 +1161,7 @@ void InspectorController::scriptImported(unsigned long identifier, const String&
     if (!resource)
         return;
 
-    resource->setOverrideContent(ScriptString(sourceString), InspectorResource::Script);
+    resource->setOverrideContent(sourceString, InspectorResource::Script);
 
     if (m_frontend)
         resource->updateScriptObject(m_frontend.get());
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index ab38a8b..b2087ba 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -82,7 +82,6 @@ class ResourceResponse;
 class ResourceError;
 class ScriptCallStack;
 class ScriptProfile;
-class ScriptString;
 class SharedBuffer;
 class Storage;
 class StorageArea;
@@ -173,7 +172,7 @@ public:
     void didReceiveContentLength(unsigned long identifier, int lengthReceived);
     void didFinishLoading(unsigned long identifier, double finishTime);
     void didFailLoading(unsigned long identifier, const ResourceError&);
-    void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
+    void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
     void scriptImported(unsigned long identifier, const String& sourceString);
 
     void setResourceTrackingEnabled(bool enabled);
diff --git a/WebCore/inspector/InspectorResource.cpp b/WebCore/inspector/InspectorResource.cpp
index ffe1f71..4019994 100644
--- a/WebCore/inspector/InspectorResource.cpp
+++ b/WebCore/inspector/InspectorResource.cpp
@@ -411,7 +411,7 @@ InspectorResource::Type InspectorResource::type() const
     return cachedResourceType();
 }
 
-void InspectorResource::setOverrideContent(const ScriptString& data, Type type)
+void InspectorResource::setOverrideContent(const String& data, Type type)
 {
     m_overrideContent = data;
     m_overrideContentType = type;
diff --git a/WebCore/inspector/InspectorResource.h b/WebCore/inspector/InspectorResource.h
index 7f71e6a..909075e 100644
--- a/WebCore/inspector/InspectorResource.h
+++ b/WebCore/inspector/InspectorResource.h
@@ -33,7 +33,6 @@
 
 #include "HTTPHeaderMap.h"
 #include "KURL.h"
-#include "ScriptString.h"
 #include "WebSocketHandshakeRequest.h"
 #include "WebSocketHandshakeResponse.h"
 
@@ -98,7 +97,7 @@ namespace WebCore {
         void updateWebSocketResponse(const WebSocketHandshakeResponse&);
 #endif
 
-        void setOverrideContent(const ScriptString& data, Type);
+        void setOverrideContent(const String& data, Type);
 
         String sourceString() const;
         String sourceBytes() const;
@@ -194,7 +193,7 @@ namespace WebCore {
         unsigned m_connectionID;
         bool m_connectionReused;
         RefPtr<ResourceLoadTiming> m_loadTiming;
-        ScriptString m_overrideContent;
+        String m_overrideContent;
         Type m_overrideContentType;
         Changes m_changes;
         bool m_isMainResource;
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 2f93102..7b925cb 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -90,7 +90,6 @@
 #include "SchemeRegistry.h"
 #include "ScriptController.h"
 #include "ScriptSourceCode.h"
-#include "ScriptString.h"
 #include "SecurityOrigin.h"
 #include "SegmentedString.h"
 #include "SerializedScriptValue.h"
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index 2af6b6f..2166d65 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -73,7 +73,6 @@ class ResourceError;
 class ResourceLoader;
 class ResourceResponse;
 class ScriptSourceCode;
-class ScriptString;
 class ScriptValue;
 class SecurityOrigin;
 class SerializedScriptValue;
diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h
index 85cf018..2e08223 100644
--- a/WebCore/loader/FrameLoaderClient.h
+++ b/WebCore/loader/FrameLoaderClient.h
@@ -73,7 +73,6 @@ namespace WebCore {
     class ResourceLoader;
     class ResourceRequest;
     class ResourceResponse;
-    class ScriptString;
     class SecurityOrigin;
     class SharedBuffer;
     class SubstituteData;
diff --git a/WebCore/loader/ResourceLoadNotifier.h b/WebCore/loader/ResourceLoadNotifier.h
index 758e414..93fcccc 100644
--- a/WebCore/loader/ResourceLoadNotifier.h
+++ b/WebCore/loader/ResourceLoadNotifier.h
@@ -40,7 +40,6 @@ class Frame;
 class ResourceError;
 class ResourceLoader;
 class ResourceResponse;
-class ScriptString;
 class ResourceRequest;
 
 class ResourceLoadNotifier : public Noncopyable {
diff --git a/WebCore/workers/WorkerScriptLoader.h b/WebCore/workers/WorkerScriptLoader.h
index a1a9afc..fc8b0b4 100644
--- a/WebCore/workers/WorkerScriptLoader.h
+++ b/WebCore/workers/WorkerScriptLoader.h
@@ -33,7 +33,6 @@
 #include "KURL.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
-#include "ScriptString.h"
 #include "TextResourceDecoder.h"
 #include "ThreadableLoader.h"
 #include "ThreadableLoaderClient.h"
diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp
index 8c82f10..afab73d 100644
--- a/WebCore/xml/XMLHttpRequest.cpp
+++ b/WebCore/xml/XMLHttpRequest.cpp
@@ -173,7 +173,6 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context)
     , m_asBlob(false)
 #endif
     , m_state(UNSENT)
-    , m_responseText("")
     , m_createdDocument(false)
     , m_error(false)
     , m_uploadEventsAllowed(true)
@@ -226,7 +225,7 @@ XMLHttpRequest::State XMLHttpRequest::readyState() const
     return m_state;
 }
 
-const ScriptString& XMLHttpRequest::responseText(ExceptionCode& ec) const
+String XMLHttpRequest::responseText(ExceptionCode& ec)
 {
 #if ENABLE(XHR_RESPONSE_BLOB)
     if (m_asBlob)
@@ -234,10 +233,10 @@ const ScriptString& XMLHttpRequest::responseText(ExceptionCode& ec) const
 #else
     UNUSED_PARAM(ec);
 #endif
-    return m_responseText;
+    return m_responseBuilder.toStringPreserveCapacity();
 }
 
-Document* XMLHttpRequest::responseXML(ExceptionCode& ec) const
+Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
 {
 #if ENABLE(XHR_RESPONSE_BLOB)
     if (m_asBlob) {
@@ -259,7 +258,7 @@ Document* XMLHttpRequest::responseXML(ExceptionCode& ec) const
             m_responseXML = Document::create(0, m_url);
             m_responseXML->open();
             // FIXME: Set Last-Modified.
-            m_responseXML->write(String(m_responseText));
+            m_responseXML->write(m_responseBuilder.toStringPreserveCapacity());
             m_responseXML->finishParsing();
             m_responseXML->close();
 
@@ -627,7 +626,7 @@ void XMLHttpRequest::abort()
 
     internalAbort();
 
-    m_responseText = "";
+    m_responseBuilder.clear();
     m_createdDocument = false;
     m_responseXML = 0;
 #if ENABLE(XHR_RESPONSE_BLOB)
@@ -676,7 +675,7 @@ void XMLHttpRequest::internalAbort()
 void XMLHttpRequest::clearResponse()
 {
     m_response = ResourceResponse();
-    m_responseText = "";
+    m_responseBuilder.clear();
     m_createdDocument = false;
     m_responseXML = 0;
 #if ENABLE(XHR_RESPONSE_BLOB)
@@ -733,7 +732,7 @@ void XMLHttpRequest::dropProtection()
     // report the extra cost at that point.
     JSC::JSGlobalData* globalData = scriptExecutionContext()->globalData();
     if (hasCachedDOMObjectWrapper(globalData, this))
-        globalData->heap.reportExtraMemoryCost(m_responseText.size() * 2);
+        globalData->heap.reportExtraMemoryCost(m_responseBuilder.length() * 2);
 #endif
 
     unsetPendingActivity(this);
@@ -942,7 +941,9 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier)
         changeState(HEADERS_RECEIVED);
 
     if (m_decoder)
-        m_responseText += m_decoder->flush();
+        m_responseBuilder.append(m_decoder->flush());
+
+    m_responseBuilder.shrinkToFit();
 
 #if ENABLE(XHR_RESPONSE_BLOB)
     // FIXME: Set m_responseBlob to something here in the m_asBlob case.
@@ -950,7 +951,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier)
 
 #if ENABLE(INSPECTOR)
     if (InspectorController* inspector = scriptExecutionContext()->inspectorController())
-        inspector->resourceRetrievedByXMLHttpRequest(identifier, m_responseText, m_url, m_lastSendURL, m_lastSendLineNumber);
+        inspector->resourceRetrievedByXMLHttpRequest(identifier, m_responseBuilder.toStringPreserveCapacity(), m_url, m_lastSendURL, m_lastSendLineNumber);
 #endif
 
     bool hadLoader = m_loader;
@@ -1019,7 +1020,7 @@ void XMLHttpRequest::didReceiveData(const char* data, int len)
     if (len == -1)
         len = strlen(data);
 
-    m_responseText += m_decoder->decode(data, len);
+    m_responseBuilder.append(m_decoder->decode(data, len));
 
     if (!m_error) {
         long long expectedLength = m_response.expectedContentLength();
diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h
index 481b51f..cb4e1cf 100644
--- a/WebCore/xml/XMLHttpRequest.h
+++ b/WebCore/xml/XMLHttpRequest.h
@@ -26,11 +26,11 @@
 #include "EventTarget.h"
 #include "FormData.h"
 #include "ResourceResponse.h"
-#include "ScriptString.h"
 #include "ThreadableLoaderClient.h"
 #include "XMLHttpRequestProgressEventThrottle.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/text/AtomicStringHash.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -89,8 +89,8 @@ public:
     void overrideMimeType(const String& override);
     String getAllResponseHeaders(ExceptionCode&) const;
     String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
-    const ScriptString& responseText(ExceptionCode&) const;
-    Document* responseXML(ExceptionCode&) const;
+    String responseText(ExceptionCode&);
+    Document* responseXML(ExceptionCode&);
 #if ENABLE(XHR_RESPONSE_BLOB)
     Blob* responseBlob(ExceptionCode&) const;
 #endif
@@ -176,13 +176,7 @@ private:
 
     RefPtr<TextResourceDecoder> m_decoder;
 
-    // Unlike most strings in the DOM, we keep this as a ScriptString, not a WTF::String.
-    // That's because these strings can easily get huge (they are filled from the network with
-    // no parsing) and because JS can easily observe many intermediate states, so it's very useful
-    // to be able to share the buffer with JavaScript versions of the whole or partial string.
-    // In contrast, this string doesn't interact much with the rest of the engine so it's not that
-    // big a cost that it isn't a String.
-    ScriptString m_responseText;
+    StringBuilder m_responseBuilder;
     mutable bool m_createdDocument;
     mutable RefPtr<Document> m_responseXML;
 
diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog
index a8dfcaf..59d761a 100644
--- a/WebKit/efl/ChangeLog
+++ b/WebKit/efl/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43987
+        Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
+        to construct their internal result string.  Remove ScriptString (this is now
+        redundant).
+
+        * WebCoreSupport/FrameLoaderClientEfl.cpp:
+        (WebCore::FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest):
+        * WebCoreSupport/FrameLoaderClientEfl.h:
+
 2010-10-13  Gyuyoung Kim  <gyuyoung.kim at samsung.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
index 8d96179..ede7d49 100644
--- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
+++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
@@ -759,7 +759,7 @@ bool FrameLoaderClientEfl::dispatchDidLoadResourceFromMemoryCache(DocumentLoader
     return false;
 }
 
-void FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&)
+void FrameLoaderClientEfl::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const String&)
 {
     notImplemented();
 }
diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
index d250b76..db1285d 100644
--- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
+++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
@@ -91,7 +91,7 @@ class FrameLoaderClientEfl : public FrameLoaderClient {
     virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long  identifier);
     virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long  identifier, const ResourceError&);
     virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length);
-    virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::ScriptString& sourceString);
+    virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::String& sourceString);
 
     virtual void dispatchDidHandleOnloadEvents();
     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 50d6ac1..5d8d762 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43987
+        Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
+        to construct their internal result string.  Remove ScriptString (this is now
+        redundant).
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+
 2010-10-12  Andy Estes  <aestes at apple.com>
 
         Rubber-stamped by Darin Adler.
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 5937022..c3fd457 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -111,7 +111,6 @@
 #import <WebCore/ResourceLoader.h>
 #import <WebCore/ResourceRequest.h>
 #import <WebCore/ScriptController.h>
-#import <WebCore/ScriptString.h>
 #import <WebCore/SharedBuffer.h>
 #import <WebCore/WebCoreObjCExtras.h>
 #import <WebCore/Widget.h>
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 8e7e514..2e5834f 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43987
+        Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
+        to construct their internal result string.  Remove ScriptString (this is now
+        redundant).
+
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+
 2010-10-13  Dinu Jacob  <dinu.jacob at nokia.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 2815171..4ebc7e1 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -64,7 +64,6 @@
 #include "ResourceHandleInternal.h"
 #include "ResourceHandle.h"
 #include "ScriptController.h"
-#include "ScriptString.h"
 #include "Settings.h"
 #include "QWebPageClient.h"
 #include "ViewportArguments.h"
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 13f06ac..a846b75 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43987
+        Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
+        to construct their internal result string.  Remove ScriptString (this is now
+        redundant).
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+
 2010-10-12  Adam Roben  <aroben at apple.com>
 
         Build TestWebKitAPI on Windows
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
index 4c7800f..ffc41b2 100644
--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -67,7 +67,6 @@
 #include <WebCore/PluginView.h>
 #include <WebCore/RenderPart.h>
 #include <WebCore/ResourceHandle.h>
-#include <WebCore/ScriptString.h>
 #pragma warning(pop)
 
 using namespace WebCore;
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index abbc87b..b7ec1f6 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43987
+        Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
+        to construct their internal result string.  Remove ScriptString (this is now
+        redundant).
+
+        * WebKitSupport/FrameLoaderClientWx.cpp:
+
 2010-09-28  Jenn Braithwaite  <jennb at chromium.org>
 
         Reviewed by Dmitry Titov.
diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
index 93a62ca..7963ef9 100644
--- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
@@ -49,7 +49,6 @@
 #include "ResourceError.h"
 #include "ResourceResponse.h"
 #include "ScriptController.h"
-#include "ScriptString.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c6db7bf..0588217 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43987
+        Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder
+        to construct their internal result string.  Remove ScriptString (this is now
+        redundant).
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
 2010-10-13  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index deb90e3..afe0075 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -196,7 +196,7 @@ bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader
     return false;
 }
 
-void WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString&)
+void WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const String&)
 {
     notImplemented();
 }
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
index 349d7b3..0b97ed0 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
@@ -69,7 +69,7 @@ private:
     virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier);
     virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&);
     virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length);
-    virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::ScriptString&);
+    virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WTF::String&);
     
     virtual void dispatchDidHandleOnloadEvents();
     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list