Unreviewed, rolling out r161840.
http://trac.webkit.org/changeset/161840
https://bugs.webkit.org/show_bug.cgi?id=126870

Caused jsscore and layout test failures (Requested by smfr on
#webkit).

Source/JavaScriptCore:

* API/JSValueRef.cpp:
(JSValueMakeFromJSONString):
* bindings/ScriptValue.cpp:
(Deprecated::jsToInspectorValue):
* inspector/InspectorValues.cpp:
* runtime/DatePrototype.cpp:
(JSC::formatLocaleDate):
* runtime/Identifier.h:
(JSC::Identifier::characters):
* runtime/JSStringBuilder.h:
(JSC::JSStringBuilder::append):

Source/WebCore:

* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject _convertValueToObjcValue:JSC::originRootObject:rootObject:]):
* editing/CompositeEditCommand.cpp:
(WebCore::containsOnlyWhitespace):
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::insertText):
* editing/VisibleUnits.cpp:
(WebCore::startOfParagraph):
(WebCore::endOfParagraph):
* html/parser/HTMLParserIdioms.cpp:
(WebCore::stripLeadingAndTrailingHTMLSpaces):
(WebCore::parseHTMLNonNegativeInteger):
* inspector/ContentSearchUtils.cpp:
(WebCore::ContentSearchUtils::createSearchRegexSource):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::newLineAndWhitespaceDelimiters):
* inspector/InspectorStyleTextEditor.cpp:
(WebCore::InspectorStyleTextEditor::insertProperty):
(WebCore::InspectorStyleTextEditor::internalReplaceProperty):
* platform/Length.cpp:
(WebCore::newCoordsArray):
* platform/LinkHash.cpp:
(WebCore::visitedLinkHash):
* platform/graphics/Color.cpp:
(WebCore::Color::parseHexColor):
(WebCore::Color::Color):
* platform/graphics/TextRun.h:
(WebCore::TextRun::TextRun):
* platform/text/TextEncodingRegistry.cpp:
(WebCore::atomicCanonicalTextEncodingName):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::constructTextRun):
* rendering/RenderCombineText.cpp:
(WebCore::RenderCombineText::width):
* svg/SVGFontElement.cpp:
(WebCore::SVGFontElement::registerLigaturesInGlyphCache):
* xml/XPathFunctions.cpp:
(WebCore::XPath::FunId::evaluate):
* xml/XPathNodeSet.h:

Source/WTF:

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::replace):
* wtf/text/WTFString.h:
(WTF::String::isAllSpecialCharacters):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/xml/XPathFunctions.cpp b/Source/WebCore/xml/XPathFunctions.cpp
index 432440a..37a276f 100644
--- a/Source/WebCore/xml/XPathFunctions.cpp
+++ b/Source/WebCore/xml/XPathFunctions.cpp
@@ -307,17 +307,18 @@
 Value FunId::evaluate() const
 {
     Value a = argument(0).evaluate();
+    StringBuilder idList; // A whitespace-separated list of IDs
 
-    String idList; // A whitespace-separated list of IDs
     if (a.isNodeSet()) {
-        StringBuilder spaceSeparatedList;
-        for (auto& node : a.toNodeSet()) {
-            spaceSeparatedList.append(stringValue(node.get()));
-            spaceSeparatedList.append(' ');
+        const NodeSet& nodes = a.toNodeSet();
+        for (size_t i = 0; i < nodes.size(); ++i) {
+            String str = stringValue(nodes[i]);
+            idList.append(str);
+            idList.append(' ');
         }
-        idList = spaceSeparatedList.toString();
     } else {
-        idList = a.toString();
+        String str = a.toString();
+        idList.append(str);
     }
     
     TreeScope& contextScope = evaluationContext().node->treeScope();
@@ -339,7 +340,7 @@
 
         // If there are several nodes with the same id, id() should return the first one.
         // In WebKit, getElementById behaves so, too, although its behavior in this case is formally undefined.
-        Node* node = contextScope.getElementById(idList.substring(startPos, endPos - startPos));
+        Node* node = contextScope.getElementById(String(idList.characters() + startPos, endPos - startPos));
         if (node && resultSet.add(node).isNewEntry)
             result.append(node);