Changeset 111097 in webkit


Ignore:
Timestamp:
Mar 16, 2012 5:29:38 PM (12 years ago)
Author:
Stephanie Lewis
Message:

Source/WebKit2: https://bugs.webkit.org/show_bug.cgi?id=81065
<rdar://problem/10944309> CrashTracer: [USER] 111 crashes in WebProcess at WebKitTestRunnerInjectedBundle: WTR::InjectedBundle::done + 142
Add some string function exports to Windows so the WebKitTestRunner can use them.

Reviewed by Geoff Garen.

  • win/WebKit2.def:

Tools: https://bugs.webkit.org/show_bug.cgi?id=81065
<rdar://problem/10944309> CrashTracer: [USER] 111 crashes in WebProcess at WebKitTestRunnerInjectedBundle: WTR::InjectedBundle::done + 142
Fix crash preventing WebKitTestRunner from working in Release.
WebKitTestRunner used ostringstream to collect output from the test. ostringstream is incompatible with our
FastMalloc overrides. When copying strings out ostringstream a new string is allocated with FastMalloc because
the allocation is inlined. When that string is freed is uses the system malloc because that call is not inlined.

I removed ostringstream in favor of StringBuilder.

Properly set NDEBUG on Release builds so we don't crash when when we free the strings StringBuilder created.

Reviewed by Geoff Garen.

Add DEBUG_DEFINES to set NDEBUG on release builds.

  • WebKitTestRunner/Configurations/Base.xcconfig:
  • WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:

Remove ostringstream member in favor of StringBuilder.

  • WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:

(WTR::InjectedBundle::initialize):
(WTR::InjectedBundle::beginTesting):
(WTR::InjectedBundle::done):

  • WebKitTestRunner/InjectedBundle/InjectedBundle.h:

(WTF):
(WTR::InjectedBundle::stringBuilder):
(InjectedBundle):

Append output to StringBuilder.

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::hasPrefix):
(WTR::dumpPath):
(WTR::rangeToStr):
(WTR::styleDecToStr):
(WTR::frameToStr):
(WTR::dumpFrameScrollPosition):
(WTR::dumpFrameText):
(WTR::dumpDescendantFramesText):
(WTR::InjectedBundlePage::dump):
(WTR::InjectedBundlePage::didReceiveTitleForFrame):
(WTR::InjectedBundlePage::didFinishDocumentLoadForFrame):
(WTR::InjectedBundlePage::willSendRequestForFrame):
(WTR::InjectedBundlePage::decidePolicyForNavigationAction):
(WTR::lastFileURLPathComponent):
(WTR::InjectedBundlePage::willAddMessageToConsole):
(WTR::InjectedBundlePage::willSetStatusbarText):
(WTR::InjectedBundlePage::willRunJavaScriptAlert):
(WTR::InjectedBundlePage::willRunJavaScriptConfirm):
(WTR::InjectedBundlePage::willRunJavaScriptPrompt):
(WTR::InjectedBundlePage::shouldBeginEditing):
(WTR::InjectedBundlePage::shouldEndEditing):
(WTR::InjectedBundlePage::shouldInsertNode):
(WTR::InjectedBundlePage::shouldInsertText):
(WTR::InjectedBundlePage::shouldDeleteRange):
(WTR::InjectedBundlePage::shouldChangeSelectedRange):
(WTR::InjectedBundlePage::shouldApplyStyle):
(WTR::InjectedBundlePage::didBeginEditing):
(WTR::InjectedBundlePage::didEndEditing):
(WTR::InjectedBundlePage::didChange):
(WTR::InjectedBundlePage::didChangeSelection):
(WTR::InjectedBundlePage::supportsFullScreen):
(WTR::InjectedBundlePage::enterFullScreenForElement):
(WTR::InjectedBundlePage::exitFullScreenForElement):
(WTR::InjectedBundlePage::beganEnterFullScreen):
(WTR::InjectedBundlePage::beganExitFullScreen):
(WTR::dumpBackForwardListItem):
(WTR::InjectedBundlePage::dumpBackForwardList):

  • WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:

(WTR::LayoutTestController::waitToDumpWatchdogTimerFired):
(WTR::LayoutTestController::dumpConfigurationForViewport):

Convert between WTF::String and WKStringRef.

  • WebKitTestRunner/StringFunctions.h:

(WTR::toWTFString):
(WTR):

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r111080 r111097  
     12012-03-16  Stephanie Lewis  <slewis@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=81065
     4        <rdar://problem/10944309> CrashTracer: [USER] 111 crashes in WebProcess at WebKitTestRunnerInjectedBundle: WTR::InjectedBundle::done + 142
     5        Add some string function exports to Windows so the WebKitTestRunner can use them.
     6
     7        Reviewed by Geoff Garen.
     8
     9        * win/WebKit2.def:
     10
    1112012-03-16  Brady Eidson  <beidson@apple.com>
    212
  • trunk/Source/WebKit2/win/WebKit2.def

    r110808 r111097  
    164164        ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
    165165        ?equal@WTF@@YA_NPBVStringImpl@1@PBE@Z
     166        ?equal@WTF@@YA_NPBVStringImpl@1@0@Z
    166167        ?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBE@Z
    167168        ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
     169        ?find@StringImpl@WTF@@QAEIPAV12@I@Z
    168170        ?frameDestroyed@FrameDestructionObserver@WebCore@@UAEXXZ
     171        ?fromUTF8WithLatin1Fallback@String@WTF@@SA?AV12@PBEI@Z
    169172        ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
    170173        ?getData16SlowCase@StringImpl@WTF@@ABEPB_WXZ
     
    178181        ?lastChangeWasUserEdit@HTMLTextFormControlElement@WebCore@@QBE_NXZ
    179182        ?markersFor@DocumentMarkerController@WebCore@@QAE?AV?$Vector@PAVDocumentMarker@WebCore@@$0A@@WTF@@PAVNode@2@VMarkerTypes@DocumentMarker@2@@Z
     183        ?number@String@WTF@@SA?AV12@I@Z
     184        ?number@String@WTF@@SA?AV12@H@Z
    180185        ?observeFrame@FrameDestructionObserver@WebCore@@IAEXPAVFrame@2@@Z
    181186        ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z
     
    185190        ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVElement@2@HH_N@Z
    186191        ?removeAllShadowRoots@ShadowTree@WebCore@@QAEXXZ
     192        ?remove@String@WTF@@QAEXIH@Z
     193        ?reverseFind@StringImpl@WTF@@QAEI_WI@Z
    187194        ?s_frontendCounter@InspectorInstrumentation@WebCore@@0HA
    188195        ?s_info@JSNode@WebCore@@2UClassInfo@JSC@@B
     
    209216        ?setFixedElementsLayoutRelativeToFrame@Settings@WebCore@@QAEX_N@Z
    210217        ?shadowTree@Element@WebCore@@QBEPAVShadowTree@2@XZ
     218        ?substring@String@WTF@@QBE?AV12@II@Z
    211219        ?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
    212220        ?text@Range@WebCore@@QBE?AVString@WTF@@XZ
     
    221229        ?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
    222230        ?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@@WTF@@XZ
     231        ?utf8@String@WTF@@QBE?AVCString@2@_N@Z
    223232        ?view@Document@WebCore@@QBEPAVFrameView@2@XZ
    224233        ?willDetachPage@FrameDestructionObserver@WebCore@@UAEXXZ
  • trunk/Tools/ChangeLog

    r111095 r111097  
     12012-03-16  Stephanie Lewis  <slewis@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=81065
     4        <rdar://problem/10944309> CrashTracer: [USER] 111 crashes in WebProcess at WebKitTestRunnerInjectedBundle: WTR::InjectedBundle::done + 142
     5        Fix crash preventing WebKitTestRunner from working in Release. 
     6        WebKitTestRunner used ostringstream to collect output from the test.  ostringstream is incompatible with our
     7        FastMalloc overrides.  When copying strings out ostringstream a new string is allocated with FastMalloc because
     8        the allocation is inlined.  When that string is freed is uses the system malloc because that call is not inlined.
     9
     10        I removed ostringstream in favor of StringBuilder. 
     11
     12        Properly set NDEBUG on Release builds so we don't crash when when we free the strings StringBuilder created.
     13
     14        Reviewed by Geoff Garen.
     15
     16        Add DEBUG_DEFINES to set NDEBUG on release builds.
     17        * WebKitTestRunner/Configurations/Base.xcconfig:
     18        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     19
     20        Remove ostringstream member in favor of StringBuilder.
     21        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     22        (WTR::InjectedBundle::initialize):
     23        (WTR::InjectedBundle::beginTesting):
     24        (WTR::InjectedBundle::done):
     25        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
     26        (WTF):
     27        (WTR::InjectedBundle::stringBuilder):
     28        (InjectedBundle):
     29
     30        Append output to StringBuilder.
     31        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     32        (WTR::hasPrefix):
     33        (WTR::dumpPath):
     34        (WTR::rangeToStr):
     35        (WTR::styleDecToStr):
     36        (WTR::frameToStr):
     37        (WTR::dumpFrameScrollPosition):
     38        (WTR::dumpFrameText):
     39        (WTR::dumpDescendantFramesText):
     40        (WTR::InjectedBundlePage::dump):
     41        (WTR::InjectedBundlePage::didReceiveTitleForFrame):
     42        (WTR::InjectedBundlePage::didFinishDocumentLoadForFrame):
     43        (WTR::InjectedBundlePage::willSendRequestForFrame):
     44        (WTR::InjectedBundlePage::decidePolicyForNavigationAction):
     45        (WTR::lastFileURLPathComponent):
     46        (WTR::InjectedBundlePage::willAddMessageToConsole):
     47        (WTR::InjectedBundlePage::willSetStatusbarText):
     48        (WTR::InjectedBundlePage::willRunJavaScriptAlert):
     49        (WTR::InjectedBundlePage::willRunJavaScriptConfirm):
     50        (WTR::InjectedBundlePage::willRunJavaScriptPrompt):
     51        (WTR::InjectedBundlePage::shouldBeginEditing):
     52        (WTR::InjectedBundlePage::shouldEndEditing):
     53        (WTR::InjectedBundlePage::shouldInsertNode):
     54        (WTR::InjectedBundlePage::shouldInsertText):
     55        (WTR::InjectedBundlePage::shouldDeleteRange):
     56        (WTR::InjectedBundlePage::shouldChangeSelectedRange):
     57        (WTR::InjectedBundlePage::shouldApplyStyle):
     58        (WTR::InjectedBundlePage::didBeginEditing):
     59        (WTR::InjectedBundlePage::didEndEditing):
     60        (WTR::InjectedBundlePage::didChange):
     61        (WTR::InjectedBundlePage::didChangeSelection):
     62        (WTR::InjectedBundlePage::supportsFullScreen):
     63        (WTR::InjectedBundlePage::enterFullScreenForElement):
     64        (WTR::InjectedBundlePage::exitFullScreenForElement):
     65        (WTR::InjectedBundlePage::beganEnterFullScreen):
     66        (WTR::InjectedBundlePage::beganExitFullScreen):
     67        (WTR::dumpBackForwardListItem):
     68        (WTR::InjectedBundlePage::dumpBackForwardList):
     69        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
     70        (WTR::LayoutTestController::waitToDumpWatchdogTimerFired):
     71        (WTR::LayoutTestController::dumpConfigurationForViewport):
     72       
     73        Convert between WTF::String and WKStringRef.
     74        * WebKitTestRunner/StringFunctions.h:
     75        (WTR::toWTFString):
     76        (WTR):
     77        * WebKitTestRunner/TestInvocation.cpp:
     78        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
     79
    1802012-03-16  Eric Seidel  <eric@webkit.org>
    281
  • trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig

    r110033 r111097  
    2626HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders ${SRCROOT}/../../Source/JavaScriptCore/icu $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport;
    2727FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks;
    28 GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST;
     28GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST;
    2929DEBUG_INFORMATION_FORMAT = dwarf
    3030PREBINDING = NO
     
    4040VALID_ARCHS = i386 x86_64;
    4141GCC_PREFIX_HEADER = WebKitTestRunnerPrefix.h
     42
     43DEBUG_DEFINES_debug = ;
     44DEBUG_DEFINES_normal = NDEBUG;
     45DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
    4246
    4347CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR));
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r110382 r111097  
    3737#include <WebKit2/WebKit2.h>
    3838#include <wtf/PassOwnPtr.h>
     39#include <wtf/text/CString.h>
     40#include <wtf/text/StringBuilder.h>
    3941#include <wtf/Vector.h>
    4042
     
    7981{
    8082    m_bundle = bundle;
     83    m_stringBuilder = WTF::adoptPtr(new WTF::StringBuilder());
    8184
    8285    WKBundleClient client = {
     
    192195    m_state = Testing;
    193196
    194     m_outputStream.str("");
    195197    m_pixelResult.clear();
    196198    m_repaintRects.clear();
     199    m_stringBuilder->clear();
    197200
    198201    m_layoutTestController = LayoutTestController::create();
     
    231234
    232235    WKRetainPtr<WKStringRef> textOutputKey(AdoptWK, WKStringCreateWithUTF8CString("TextOutput"));
    233     WKRetainPtr<WKStringRef> textOutput(AdoptWK, WKStringCreateWithUTF8CString(m_outputStream.str().c_str()));
     236    WKRetainPtr<WKStringRef> textOutput(AdoptWK, WKStringCreateWithUTF8CString(m_stringBuilder->toString().utf8().data()));
    234237    WKDictionaryAddItem(doneMessageBody.get(), textOutputKey.get(), textOutput.get());
    235238   
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h

    r110382 r111097  
    4040#include <sstream>
    4141
     42namespace WTF {
     43class StringBuilder;
     44}
     45
    4246namespace WTR {
    4347
     
    6771
    6872    void done();
    69     std::ostringstream& os() { return m_outputStream; }
     73    WTF::StringBuilder* stringBuilder() { return m_stringBuilder.get(); }
    7074    void setPixelResult(WKImageRef image) { m_pixelResult = image; }
    7175    void setRepaintRects(WKArrayRef rects) { m_repaintRects = rects; }
     
    117121    WKBundleFrameRef m_topLoadingFrame;
    118122
    119     std::ostringstream m_outputStream;
     123    OwnPtr<WTF::StringBuilder> m_stringBuilder;
    120124   
    121125    enum State {
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r110708 r111097  
    4343#include <WebKit2/WKBundlePagePrivate.h>
    4444#include <WebKit2/WKURLRequest.h>
     45#include <wtf/text/CString.h>
     46#include <wtf/text/StringBuilder.h>
    4547
    4648#if PLATFORM(QT)
     
    5254namespace WTR {
    5355
    54 static bool hasPrefix(const string& searchString, const string& prefix)
    55 {
    56     return searchString.length() >= prefix.length() && searchString.substr(0, prefix.length()) == prefix;
     56static bool hasPrefix(const WTF::String& searchString, const WTF::String& prefix)
     57{
     58    return searchString.length() >= prefix.length() && searchString.substring(0, prefix.length()) == prefix;
    5759}
    5860
     
    8486}
    8587
    86 static string dumpPath(JSGlobalContextRef context, JSObjectRef nodeValue)
     88static WTF::String dumpPath(JSGlobalContextRef context, JSObjectRef nodeValue)
    8789{
    8890    JSValueRef nodeNameValue = propertyValue(context, nodeValue, "nodeName");
     
    9294    JSValueRef parentNode = propertyValue(context, nodeValue, "parentNode");
    9395
    94     ostringstream out;
    95     out << nodeName;
    96 
    97     if (parentNode && JSValueIsObject(context, parentNode))
    98         out << " > " << dumpPath(context, (JSObjectRef)parentNode);
    99 
    100     return out.str();
    101 }
    102 
    103 static string dumpPath(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleNodeHandleRef node)
     96    WTF::StringBuilder stringBuilder;
     97    stringBuilder.append(toWTFString(nodeName));
     98
     99    if (parentNode && JSValueIsObject(context, parentNode)) {
     100        stringBuilder.append(" > ");
     101        stringBuilder.append(dumpPath(context, (JSObjectRef)parentNode));
     102    }
     103
     104    return stringBuilder.toString();
     105}
     106
     107static WTF::String dumpPath(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleNodeHandleRef node)
    104108{
    105109    if (!node)
     
    116120}
    117121
    118 static string toStr(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleRangeHandleRef rangeRef)
     122static WTF::String rangeToStr(WKBundlePageRef page, WKBundleScriptWorldRef world, WKBundleRangeHandleRef rangeRef)
    119123{
    120124    if (!rangeRef)
    121125        return "(null)";
    122 
     126 
    123127    WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
    124128
     
    139143    int endOffset = propertyValueInt(context, rangeObject, "endOffset");
    140144
    141     ostringstream out;
    142     out << "range from " << startOffset << " of " << dumpPath(context, startNodeObject) << " to " << endOffset << " of " << dumpPath(context, endNodeObject);
    143     return out.str();
    144 }
    145 
    146 static WKRetainPtr<WKStringRef> navigationTypeToString(WKFrameNavigationType type)
     145    WTF::StringBuilder stringBuilder;
     146    stringBuilder.append("range from ");
     147    stringBuilder.append(WTF::String::number(startOffset));
     148    stringBuilder.append(" of ");
     149    stringBuilder.append(dumpPath(context, startNodeObject));
     150    stringBuilder.append(" to ");
     151    stringBuilder.append(WTF::String::number(endOffset));
     152    stringBuilder.append(" of ");
     153    stringBuilder.append(dumpPath(context, endNodeObject));
     154    return stringBuilder.toString();
     155}
     156
     157static WKRetainPtr<WKStringRef> NavigationTypeToString(WKFrameNavigationType type)
    147158{
    148159    switch (type) {
     
    163174}
    164175
    165 static ostream& operator<<(ostream& out, WKBundleCSSStyleDeclarationRef style)
     176static WTF::String styleDecToStr(WKBundleCSSStyleDeclarationRef style)
    166177{
    167178    // DumpRenderTree calls -[DOMCSSStyleDeclaration description], which just dumps class name and object address.
    168179    // No existing tests actually hit this code path at the time of this writing, because WebCore doesn't call
    169180    // the editing client if the styling operation source is CommandFromDOM or CommandFromDOMWithUserInterface.
    170     out << "<DOMCSSStyleDeclaration ADDRESS>";
    171     return out;
    172 }
    173 
    174 static ostream& operator<<(ostream& out, WKBundleFrameRef frame)
     181    WTF::StringBuilder stringBuilder;
     182    stringBuilder.append("<DOMCSSStyleDeclaration ADDRESS>");
     183    return stringBuilder.toString();
     184}
     185
     186static WTF::String frameToStr(WKBundleFrameRef frame)
    175187{
    176188    WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
     189    WTF::StringBuilder stringBuilder;
    177190    if (WKBundleFrameIsMainFrame(frame)) {
    178         if (!WKStringIsEmpty(name.get()))
    179             out << "main frame \"" << name << "\"";
     191        if (!WKStringIsEmpty(name.get())) {
     192            stringBuilder.append("main frame \"");
     193            stringBuilder.append(toWTFString(name));
     194            stringBuilder.append("\"");
     195        } else
     196            stringBuilder.append("main frame");
     197    } else {
     198        if (!WKStringIsEmpty(name.get())) {
     199            stringBuilder.append("frame \"");
     200            stringBuilder.append(toWTFString(name));
     201            stringBuilder.append("\"");
     202        }
    180203        else
    181             out << "main frame";
    182     } else {
    183         if (!WKStringIsEmpty(name.get()))
    184             out << "frame \"" << name << "\"";
    185         else
    186             out << "frame (anonymous)";
    187     }
    188 
    189     return out;
     204            stringBuilder.append("frame (anonymous)");
     205    }
     206   
     207    return stringBuilder.toString();
    190208}
    191209
     
    476494        if (shouldIncludeFrameName) {
    477495            WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
    478             InjectedBundle::shared().os() << "frame '" << name << "' ";
     496            InjectedBundle::shared().stringBuilder()->append("frame '");
     497            InjectedBundle::shared().stringBuilder()->append(toWTFString(name));
     498            InjectedBundle::shared().stringBuilder()->append("' ");
    479499        }
    480         InjectedBundle::shared().os() << "scrolled to " << x << "," << y << "\n";
     500        InjectedBundle::shared().stringBuilder()->append("scrolled to ");
     501        InjectedBundle::shared().stringBuilder()->append(WTF::String::number(x));
     502        InjectedBundle::shared().stringBuilder()->append(",");
     503        InjectedBundle::shared().stringBuilder()->append(WTF::String::number(y));
     504        InjectedBundle::shared().stringBuilder()->append("\n");
    481505    }
    482506}
     
    533557
    534558    WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame));
    535     InjectedBundle::shared().os() << text << "\n";
     559    InjectedBundle::shared().stringBuilder()->append(toWTFString(text));
     560    InjectedBundle::shared().stringBuilder()->append("\n");
    536561}
    537562
     
    543568        WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i));
    544569        WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe));
    545         InjectedBundle::shared().os() << "\n--------\nFrame: '" << subframeName << "'\n--------\n";
     570        InjectedBundle::shared().stringBuilder()->append("\n--------\nFrame: '");
     571        InjectedBundle::shared().stringBuilder()->append(toWTFString(subframeName));
     572        InjectedBundle::shared().stringBuilder()->append("'\n--------\n");
    546573        dumpFrameText(subframe);
    547574        dumpDescendantFramesText(subframe);
     
    567594
    568595    WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
    569     string url = toSTD(adoptWK(WKURLCopyString(adoptWK(WKBundleFrameCopyURL(frame)).get())));
    570     if (strstr(url.c_str(), "dumpAsText/"))
     596    WTF::String url = toWTFString(adoptWK(WKURLCopyString(adoptWK(WKBundleFrameCopyURL(frame)).get())));
     597    if (url.find("dumpAsText/") != WTF::notFound)
    571598        InjectedBundle::shared().layoutTestController()->dumpAsText(false);
    572599
     
    574601    case LayoutTestController::RenderTree: {
    575602        WKRetainPtr<WKStringRef> text(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page));
    576         InjectedBundle::shared().os() << text;
     603        InjectedBundle::shared().stringBuilder()->append(toWTFString(text));
    577604        break;
    578605    }
     
    640667        return;
    641668
    642     InjectedBundle::shared().os() << "TITLE CHANGED: " << title << "\n";
     669    InjectedBundle::shared().stringBuilder()->append("TITLE CHANGED: ");
     670    InjectedBundle::shared().stringBuilder()->append(toWTFString(title));
     671    InjectedBundle::shared().stringBuilder()->append("\n");
    643672}
    644673
     
    688717
    689718    unsigned pendingFrameUnloadEvents = WKBundleFrameGetPendingUnloadCount(frame);
    690     if (pendingFrameUnloadEvents)
    691         InjectedBundle::shared().os() << frame << " - has " << pendingFrameUnloadEvents << " onunload handler(s)\n";
     719    if (pendingFrameUnloadEvents) {
     720        InjectedBundle::shared().stringBuilder()->append(frameToStr(frame));
     721        InjectedBundle::shared().stringBuilder()->append(" - has ");
     722        InjectedBundle::shared().stringBuilder()->append(WTF::String::number(pendingFrameUnloadEvents));
     723        InjectedBundle::shared().stringBuilder()->append(" onunload handler(s)\n");
     724    }
    692725}
    693726
     
    722755    WKRetainPtr<WKStringRef> host = adoptWK(WKURLCopyHostName(url.get()));
    723756    WKRetainPtr<WKStringRef> scheme = adoptWK(WKURLCopyScheme(url.get()));
     757    WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyString(url.get()));
    724758    if (host && !WKStringIsEmpty(host.get())
    725759        && (WKStringIsEqualToUTF8CStringIgnoringCase(scheme.get(), "http") || WKStringIsEqualToUTF8CStringIgnoringCase(scheme.get(), "https"))
     
    727761        && !WKStringIsEqualToUTF8CString(host.get(), "255.255.255.255") // Used in some tests that expect to get back an error.
    728762        && !WKStringIsEqualToUTF8CStringIgnoringCase(host.get(), "localhost")) {
    729         InjectedBundle::shared().os() << "Blocked access to external URL " << url << "\n";
     763        InjectedBundle::shared().stringBuilder()->append("Blocked access to external URL ");
     764        InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString));
     765        InjectedBundle::shared().stringBuilder()->append("\n");
    730766        return 0;
    731767    }
     
    783819
    784820    if (InjectedBundle::shared().layoutTestController()->waitToDump()) {
    785         InjectedBundle::shared().os() << "Policy delegate: attempt to load " << adoptWK(WKURLRequestCopyURL(request)) << " with navigation type \'" << navigationTypeToString(WKBundleNavigationActionGetNavigationType(navigationAction)) << "\'";
     821        WKRetainPtr<WKStringRef> url = adoptWK(WKURLCopyString(WKURLRequestCopyURL(request)));
     822        InjectedBundle::shared().stringBuilder()->append("Policy delegate: attempt to load ");
     823        InjectedBundle::shared().stringBuilder()->append(toWTFString(url));
     824        InjectedBundle::shared().stringBuilder()->append(" with navigation type \'");
     825        InjectedBundle::shared().stringBuilder()->append(toWTFString(NavigationTypeToString(WKBundleNavigationActionGetNavigationType(navigationAction))));
     826        InjectedBundle::shared().stringBuilder()->append("\'");
    786827        WKBundleHitTestResultRef hitTestResultRef = WKBundleNavigationActionCopyHitTestResult(navigationAction);
    787         if (hitTestResultRef)
    788             InjectedBundle::shared().os() << " originating from " << dumpPath(m_page, m_world.get(), WKBundleHitTestResultCopyNodeHandle(hitTestResultRef));
    789 
    790         InjectedBundle::shared().os() << "\n";
     828        if (hitTestResultRef) {
     829            InjectedBundle::shared().stringBuilder()->append(" originating from ");
     830            InjectedBundle::shared().stringBuilder()->append(dumpPath(m_page, m_world.get(), WKBundleHitTestResultCopyNodeHandle(hitTestResultRef)));
     831        }
     832
     833        InjectedBundle::shared().stringBuilder()->append("\n");
    791834        InjectedBundle::shared().layoutTestController()->notifyDone();
    792835    }
     
    838881}
    839882
    840 static string lastFileURLPathComponent(const string& path)
     883static WTF::String lastFileURLPathComponent(const WTF::String& path)
    841884{
    842885    size_t pos = path.find("file://");
    843     ASSERT(string::npos != pos);
    844 
    845     string tmpPath = path.substr(pos + 7);
     886    ASSERT(WTF::notFound != pos);
     887
     888    WTF::String tmpPath = path.substring(pos + 7);
    846889    if (tmpPath.length() < 2) // Keep the lone slash to avoid empty output.
    847890        return tmpPath;
     
    849892    // Remove the trailing delimiter
    850893    if (tmpPath[tmpPath.length() - 1] == '/')
    851         tmpPath.erase(tmpPath.length() - 1);
    852 
    853     pos = tmpPath.rfind('/');
    854     if (string::npos != pos)
    855         return tmpPath.substr(pos + 1);
     894        tmpPath.remove(tmpPath.length() - 1);
     895
     896    pos = tmpPath.reverseFind('/');
     897    if (WTF::notFound != pos)
     898        return tmpPath.substring(pos + 1);
    856899
    857900    return tmpPath;
     
    863906        return;
    864907
    865     string messageString = toSTD(message);
     908    WTF::String messageString = toWTFString(message);
    866909    size_t fileProtocolStart = messageString.find("file://");
    867     if (fileProtocolStart != string::npos)
     910    if (fileProtocolStart != WTF::notFound)
    868911        // FIXME: The code below does not handle additional text after url nor multiple urls. This matches DumpRenderTree implementation.
    869         messageString = messageString.substr(0, fileProtocolStart) + lastFileURLPathComponent(messageString.substr(fileProtocolStart));
    870 
    871     InjectedBundle::shared().os() << "CONSOLE MESSAGE: ";
    872     if (lineNumber)
    873         InjectedBundle::shared().os() << "line " << lineNumber << ": ";
    874     InjectedBundle::shared().os() << messageString << "\n";
     912        messageString = messageString.substring(0, fileProtocolStart) + lastFileURLPathComponent(messageString.substring(fileProtocolStart));
     913
     914    InjectedBundle::shared().stringBuilder()->append("CONSOLE MESSAGE: ");
     915    if (lineNumber) {
     916        InjectedBundle::shared().stringBuilder()->append("line ");
     917        InjectedBundle::shared().stringBuilder()->append(WTF::String::number(lineNumber));
     918        InjectedBundle::shared().stringBuilder()->append(": ");
     919    }
     920    InjectedBundle::shared().stringBuilder()->append(messageString);
     921    InjectedBundle::shared().stringBuilder()->append("\n");
    875922
    876923}
     
    884931        return;
    885932
    886     InjectedBundle::shared().os() << "UI DELEGATE STATUS CALLBACK: setStatusText:" << statusbarText << "\n";
     933    InjectedBundle::shared().stringBuilder()->append("UI DELEGATE STATUS CALLBACK: setStatusText:");
     934    InjectedBundle::shared().stringBuilder()->append(toWTFString(statusbarText));
     935    InjectedBundle::shared().stringBuilder()->append("\n");
    887936}
    888937
     
    892941        return;
    893942
    894     InjectedBundle::shared().os() << "ALERT: " << message << "\n";
     943    InjectedBundle::shared().stringBuilder()->append("ALERT: ");
     944    InjectedBundle::shared().stringBuilder()->append(toWTFString(message));
     945    InjectedBundle::shared().stringBuilder()->append("\n");
    895946}
    896947
     
    900951        return;
    901952
    902     InjectedBundle::shared().os() << "CONFIRM: " << message << "\n";
     953    InjectedBundle::shared().stringBuilder()->append("CONFIRM: ");
     954    InjectedBundle::shared().stringBuilder()->append(toWTFString(message));
     955    InjectedBundle::shared().stringBuilder()->append("\n");
    903956}
    904957
    905958void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef)
    906959{
    907     InjectedBundle::shared().os() << "PROMPT: " << message << ", default text: " << defaultValue <<  "\n";
     960    InjectedBundle::shared().stringBuilder()->append("PROMPT: ");
     961    InjectedBundle::shared().stringBuilder()->append(toWTFString(message));
     962    InjectedBundle::shared().stringBuilder()->append(", default text: ");
     963    InjectedBundle::shared().stringBuilder()->append(toWTFString(defaultValue));
     964    InjectedBundle::shared().stringBuilder()->append("\n");
    908965}
    909966
     
    9701027        return true;
    9711028
    972     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    973         InjectedBundle::shared().os() << "EDITING DELEGATE: shouldBeginEditingInDOMRange:" << toStr(m_page, m_world.get(), range) << "\n";
     1029    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1030        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldBeginEditingInDOMRange:");
     1031        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range));
     1032        InjectedBundle::shared().stringBuilder()->append("\n");
     1033    }
    9741034    return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
    9751035}
     
    9801040        return true;
    9811041
    982     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    983         InjectedBundle::shared().os() << "EDITING DELEGATE: shouldEndEditingInDOMRange:" << toStr(m_page, m_world.get(), range) << "\n";
     1042    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1043        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldEndEditingInDOMRange:");
     1044        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range));
     1045        InjectedBundle::shared().stringBuilder()->append("\n");
     1046    }
    9841047    return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
    9851048}
     
    9961059    };
    9971060
    998     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    999         InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertNode:" << dumpPath(m_page, m_world.get(), node) << " replacingDOMRange:" << toStr(m_page, m_world.get(), rangeToReplace) << " givenAction:" << insertactionstring[action] << "\n";
     1061    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1062        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldInsertNode:");
     1063        InjectedBundle::shared().stringBuilder()->append(dumpPath(m_page, m_world.get(), node));
     1064        InjectedBundle::shared().stringBuilder()->append(" replacingDOMRange:");
     1065        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), rangeToReplace));
     1066        InjectedBundle::shared().stringBuilder()->append(" givenAction:");
     1067        InjectedBundle::shared().stringBuilder()->append(insertactionstring[action]);
     1068        InjectedBundle::shared().stringBuilder()->append("\n");
     1069    }
    10001070    return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
    10011071}
     
    10121082    };
    10131083
    1014     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1015         InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertText:" << text << " replacingDOMRange:" << toStr(m_page, m_world.get(), rangeToReplace) << " givenAction:" << insertactionstring[action] << "\n";
     1084    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1085        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldInsertText:");
     1086        InjectedBundle::shared().stringBuilder()->append(toWTFString(text));
     1087        InjectedBundle::shared().stringBuilder()->append(" replacingDOMRange:");
     1088        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), rangeToReplace));
     1089        InjectedBundle::shared().stringBuilder()->append(" givenAction:");
     1090        InjectedBundle::shared().stringBuilder()->append(insertactionstring[action]);
     1091        InjectedBundle::shared().stringBuilder()->append("\n");
     1092    }
    10161093    return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
    10171094}
     
    10221099        return true;
    10231100
    1024     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1025         InjectedBundle::shared().os() << "EDITING DELEGATE: shouldDeleteDOMRange:" << toStr(m_page, m_world.get(), range) << "\n";
     1101    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1102        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldDeleteDOMRange:");
     1103        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range));
     1104        InjectedBundle::shared().stringBuilder()->append("\n");
     1105    }
    10261106    return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
    10271107}
     
    10411121    };
    10421122
    1043     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1044         InjectedBundle::shared().os() << "EDITING DELEGATE: shouldChangeSelectedDOMRange:" << toStr(m_page, m_world.get(), fromRange) << " toDOMRange:" << toStr(m_page, m_world.get(), toRange) << " affinity:" << affinitystring[affinity] << " stillSelecting:" << boolstring[stillSelecting] << "\n";
     1123    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1124        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldChangeSelectedDOMRange:");
     1125        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), fromRange));
     1126        InjectedBundle::shared().stringBuilder()->append(" toDOMRange:");
     1127        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), toRange));
     1128        InjectedBundle::shared().stringBuilder()->append(" affinity:");
     1129        InjectedBundle::shared().stringBuilder()->append(affinitystring[affinity]);
     1130        InjectedBundle::shared().stringBuilder()->append(" stillSelecting:");
     1131        InjectedBundle::shared().stringBuilder()->append(boolstring[stillSelecting]);
     1132        InjectedBundle::shared().stringBuilder()->append("\n");
     1133    }
    10451134    return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
    10461135}
     
    10511140        return true;
    10521141
    1053     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1054         InjectedBundle::shared().os() << "EDITING DELEGATE: shouldApplyStyle:" << style << " toElementsInDOMRange:" << toStr(m_page, m_world.get(), range)  << "\n";
     1142    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1143        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldApplyStyle:");
     1144        InjectedBundle::shared().stringBuilder()->append(styleDecToStr(style));
     1145        InjectedBundle::shared().stringBuilder()->append(" toElementsInDOMRange:");
     1146        InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range));
     1147        InjectedBundle::shared().stringBuilder()->append("\n");
     1148    }
    10551149    return InjectedBundle::shared().layoutTestController()->shouldAllowEditing();
    10561150}
     
    10611155        return;
    10621156
    1063     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1064         InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidBeginEditing:" << notificationName << "\n";
     1157    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1158        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidBeginEditing:");
     1159        InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName));
     1160        InjectedBundle::shared().stringBuilder()->append("\n");
     1161    }
    10651162}
    10661163
     
    10701167        return;
    10711168
    1072     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1073         InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidEndEditing:" << notificationName << "\n";
     1169    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1170        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidEndEditing:");
     1171        InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName));
     1172        InjectedBundle::shared().stringBuilder()->append("\n");
     1173    }
    10741174}
    10751175
     
    10791179        return;
    10801180
    1081     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1082         InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChange:" << notificationName << "\n";
     1181    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1182        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidChange:");
     1183        InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName));
     1184        InjectedBundle::shared().stringBuilder()->append("\n");
     1185    }
    10831186}
    10841187
     
    10881191        return;
    10891192
    1090     if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
    1091         InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChangeSelection:" << notificationName << "\n";
     1193    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) {
     1194        InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidChangeSelection:");
     1195        InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName));
     1196        InjectedBundle::shared().stringBuilder()->append("\n");
     1197    }
    10921198}
    10931199
     
    10961202{
    10971203    if (InjectedBundle::shared().layoutTestController()->shouldDumpFullScreenCallbacks())
    1098         InjectedBundle::shared().os() << "supportsFullScreen() == true\n";
     1204        InjectedBundle::shared().stringBuilder()->append("supportsFullScreen() == true\n");
    10991205    return true;
    11001206}
     
    11031209{
    11041210    if (InjectedBundle::shared().layoutTestController()->shouldDumpFullScreenCallbacks())
    1105         InjectedBundle::shared().os() << "enterFullScreenForElement()\n";
     1211        InjectedBundle::shared().stringBuilder()->append("enterFullScreenForElement()\n");
    11061212    WKBundlePageWillEnterFullScreen(pageRef);
    11071213    WKBundlePageDidEnterFullScreen(pageRef);
     
    11111217{
    11121218    if (InjectedBundle::shared().layoutTestController()->shouldDumpFullScreenCallbacks())
    1113         InjectedBundle::shared().os() << "exitFullScreenForElement()\n";
     1219        InjectedBundle::shared().stringBuilder()->append("exitFullScreenForElement()\n");
    11141220    WKBundlePageWillExitFullScreen(pageRef);
    11151221    WKBundlePageDidExitFullScreen(pageRef);
     
    11191225{
    11201226    if (InjectedBundle::shared().layoutTestController()->shouldDumpFullScreenCallbacks())
    1121         InjectedBundle::shared().os() << "beganEnterFullScreen()\n";
     1227        InjectedBundle::shared().stringBuilder()->append("beganEnterFullScreen()\n");
    11221228}
    11231229
     
    11251231{
    11261232    if (InjectedBundle::shared().layoutTestController()->shouldDumpFullScreenCallbacks())
    1127         InjectedBundle::shared().os() << "beganExitFullScreen()\n";
     1233        InjectedBundle::shared().stringBuilder()->append("beganExitFullScreen()\n");
    11281234}
    11291235#endif
     
    11381244    unsigned column = 0;
    11391245    if (isCurrentItem) {
    1140         InjectedBundle::shared().os() << "curr->";
     1246        InjectedBundle::shared().stringBuilder()->append("curr->");
    11411247        column = 6;
    11421248    }
    11431249    for (unsigned i = column; i < indent; i++)
    1144         InjectedBundle::shared().os() << ' ';
    1145 
    1146     string url = toSTD(adoptWK(WKURLCopyString(adoptWK(WKBundleBackForwardListItemCopyURL(item)).get())));
     1250        InjectedBundle::shared().stringBuilder()->append(' ');
     1251
     1252    WTF::String url = toWTFString(adoptWK(WKURLCopyString(adoptWK(WKBundleBackForwardListItemCopyURL(item)).get())));
    11471253    if (hasPrefix(url, "file:")) {
    1148         string directoryName = "/LayoutTests/";
     1254        WTF::String directoryName = "/LayoutTests/";
    11491255        size_t start = url.find(directoryName);
    1150         if (start == string::npos)
     1256        if (start == WTF::notFound)
    11511257            start = 0;
    11521258        else
    1153             start += directoryName.size();
    1154         InjectedBundle::shared().os() << "(file test):" << url.substr(start);
     1259            start += directoryName.length();
     1260        InjectedBundle::shared().stringBuilder()->append("(file test):");
     1261        InjectedBundle::shared().stringBuilder()->append(url.substring(start));
    11551262    } else
    1156         InjectedBundle::shared().os() << url;
    1157 
    1158     string target = toSTD(adoptWK(WKBundleBackForwardListItemCopyTarget(item)));
    1159     if (target.length())
    1160         InjectedBundle::shared().os() << " (in frame \"" << target << "\")";
     1263        InjectedBundle::shared().stringBuilder()->append(url);
     1264
     1265    WTF::String target = toWTFString(adoptWK(WKBundleBackForwardListItemCopyTarget(item)));
     1266    if (target.length()) {
     1267        InjectedBundle::shared().stringBuilder()->append(" (in frame \"");
     1268        InjectedBundle::shared().stringBuilder()->append(target);
     1269        InjectedBundle::shared().stringBuilder()->append("\")");
     1270    }
    11611271
    11621272    // FIXME: Need WKBackForwardListItemIsTargetItem.
    11631273    if (WKBundleBackForwardListItemIsTargetItem(item))
    1164         InjectedBundle::shared().os() << "  **nav target**";
    1165 
    1166     InjectedBundle::shared().os() << '\n';
     1274        InjectedBundle::shared().stringBuilder()->append("  **nav target**");
     1275
     1276    InjectedBundle::shared().stringBuilder()->append('\n');
    11671277
    11681278    if (WKRetainPtr<WKArrayRef> kids = adoptWK(WKBundleBackForwardListItemCopyChildren(item))) {
     
    11801290void InjectedBundlePage::dumpBackForwardList()
    11811291{
    1182     InjectedBundle::shared().os() << "\n============== Back Forward List ==============\n";
     1292    InjectedBundle::shared().stringBuilder()->append("\n============== Back Forward List ==============\n");
    11831293
    11841294    WKBundleBackForwardListRef list = WKBundlePageGetBackForwardList(m_page);
     
    12111321        dumpBackForwardListItem(itemsToPrint[i].get(), 8, i == currentItemIndex);
    12121322
    1213     InjectedBundle::shared().os() << "===============================================\n";
     1323    InjectedBundle::shared().stringBuilder()->append("===============================================\n");
    12141324}
    12151325
  • trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp

    r110909 r111097  
    4444#include <WebKit2/WebKit2.h>
    4545#include <wtf/HashMap.h>
     46#include <wtf/text/StringBuilder.h>
    4647
    4748namespace WTR {
     
    159160    invalidateWaitToDumpWatchdogTimer();
    160161    const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
    161     InjectedBundle::shared().os() << message << "\n";
     162    InjectedBundle::shared().stringBuilder()->append(message);
     163    InjectedBundle::shared().stringBuilder()->append("\n");
    162164    InjectedBundle::shared().done();
    163165}
     
    537539void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight)
    538540{
    539     InjectedBundle::shared().os() << toSTD(adoptWK(WKBundlePageViewportConfigurationAsText(InjectedBundle::shared().page()->page(), deviceDPI, deviceWidth, deviceHeight, availableWidth, availableHeight)));
     541    InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKBundlePageViewportConfigurationAsText(InjectedBundle::shared().page()->page(), deviceDPI, deviceWidth, deviceHeight, availableWidth, availableHeight))));
    540542}
    541543
  • trunk/Tools/WebKitTestRunner/StringFunctions.h

    r82730 r111097  
    3939#include <wtf/PassOwnArrayPtr.h>
    4040#include <wtf/Platform.h>
     41#include <wtf/text/WTFString.h>
    4142#include <wtf/Vector.h>
    4243
     
    7879}
    7980
    80 // Streaming functions
    81 
    82 inline std::ostream& operator<<(std::ostream& out, WKStringRef stringRef)
     81inline WTF::String toWTFString(WKStringRef string)
    8382{
    84     if (!stringRef)
    85         return out;
    86 
    87     return out << toSTD(stringRef);
     83    size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string);
     84    OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
     85    size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize);
     86    return WTF::String::fromUTF8WithLatin1Fallback(buffer.get(), stringLength - 1);
    8887}
    89 
    90 inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKStringRef>& stringRef)
     88   
     89inline WTF::String toWTFString(const WKRetainPtr<WKStringRef>& string)
    9190{
    92     return out << stringRef.get();
    93 }
    94 
    95 inline std::ostream& operator<<(std::ostream& out, WKURLRef urlRef)
    96 {
    97     if (!urlRef)
    98         return out;
    99 
    100     return out << toSTD(adoptWK(WKURLCopyString(urlRef)));
    101 }
    102 
    103 inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKURLRef>& urlRef)
    104 {
    105     return out << urlRef.get();
     91    return toWTFString(string.get());
    10692}
    10793
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r110382 r111097  
    3838#include <wtf/OwnArrayPtr.h>
    3939#include <wtf/PassOwnArrayPtr.h>
     40#include <wtf/text/CString.h>
    4041
    4142#if OS(WINDOWS)
     
    243244
    244245        // Dump text.
    245         dump(toSTD(textOutput).c_str(), true);
     246        dump(toWTFString(textOutput).utf8().data(), true);
    246247
    247248        // Dump pixels (if necessary).
  • trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj

    r108836 r111097  
    636636                        baseConfigurationReference = BC793427118F7DAF005EA8E2 /* DebugRelease.xcconfig */;
    637637                        buildSettings = {
     638                                DEBUG_DEFINES = "$(DEBUG_DEFINES_debug)";
    638639                                GCC_OPTIMIZATION_LEVEL = 0;
    639640                        };
Note: See TracChangeset for help on using the changeset viewer.