Changeset 137127 in webkit
- Timestamp:
- Dec 10, 2012 2:44:33 AM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r137118 r137127 1 2012-12-10 Martin Robinson <mrobinson@igalia.com> 2 3 [WTR] Move text output accumulation to the UIProcess 4 https://bugs.webkit.org/show_bug.cgi?id=104214 5 6 Reviewed by Darin Adler. 7 8 Instead of accumulating text output in the InjectedBundle and then sending it to the UIProcess 9 once a test is finished, immediately send any text output to the UIProcess. This will allow 10 WebKitTestRunner to output text from the UIProcess as well. 11 12 * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: Remove the handling of the text output 13 StringBuilder. Add a method to send output to the UIProcess. 14 * WebKitTestRunner/InjectedBundle/InjectedBundle.h: 15 (InjectedBundle): 16 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: Change code that appends to the StringBuilder 17 to use the new outputText method. 18 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: 19 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: Ditto. 20 * WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp: Ditto. 21 * WebKitTestRunner/TestInvocation.cpp: 22 (WTR::TestInvocation::TestInvocation): Intialize the StringBuilder. 23 (WTR::TestInvocation::invoke): Clear the StringBuilder when a new tests starts. 24 (WTR::TestInvocation::dumpResults): m_textOutput is a StringBuilder now so the 25 method of printing the text is slightly different. 26 (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Handle the new TextOutput 27 message by appending the results to the StringBuilder. 28 * WebKitTestRunner/TestInvocation.h: 29 (TestInvocation): Switch the type of m_textOutput. 30 1 31 2012-12-10 Mihnea Ovidenie <mihnea@adobe.com> 2 32 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
r135508 r137127 87 87 { 88 88 m_bundle = bundle; 89 m_stringBuilder = WTF::adoptPtr(new WTF::StringBuilder());90 89 91 90 WKBundleClient client = { … … 219 218 WKTypeRef value = WKDictionaryGetItemForKey(dictionary, wkKey.get()); 220 219 if (WKGetTypeID(value) != WKBooleanGetTypeID()) { 221 stringBuilder()->appendLiteral("Boolean value for key \""); 222 stringBuilder()->append(key); 223 stringBuilder()->appendLiteral("\" not found in dictionary\n"); 220 outputText(makeString("Boolean value for key", key, " not found in dictionary\n")); 224 221 return false; 225 222 } … … 233 230 m_pixelResult.clear(); 234 231 m_repaintRects.clear(); 235 m_stringBuilder->clear();236 232 237 233 m_testRunner = TestRunner::create(); … … 293 289 WKRetainPtr<WKMutableDictionaryRef> doneMessageBody(AdoptWK, WKMutableDictionaryCreate()); 294 290 295 WKRetainPtr<WKStringRef> textOutputKey(AdoptWK, WKStringCreateWithUTF8CString("TextOutput"));296 WKRetainPtr<WKStringRef> textOutput(AdoptWK, WKStringCreateWithUTF8CString(m_stringBuilder->toString().utf8().data()));297 WKDictionaryAddItem(doneMessageBody.get(), textOutputKey.get(), textOutput.get());298 299 291 WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult")); 300 292 WKDictionaryAddItem(doneMessageBody.get(), pixelResultKey.get(), m_pixelResult.get()); … … 323 315 } 324 316 325 void InjectedBundle::dumpBackForwardListsForAllPages( )317 void InjectedBundle::dumpBackForwardListsForAllPages(StringBuilder& stringBuilder) 326 318 { 327 319 size_t size = m_pages.size(); 328 320 for (size_t i = 0; i < size; ++i) 329 m_pages[i]->dumpBackForwardList(); 330 } 331 321 m_pages[i]->dumpBackForwardList(stringBuilder); 322 } 323 324 void InjectedBundle::outputText(const String& output) 325 { 326 if (m_state != Testing) 327 return; 328 if (output.isEmpty()) 329 return; 330 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("TextOutput")); 331 WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithUTF8CString(output.utf8().data())); 332 WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get()); 333 } 334 332 335 void InjectedBundle::postNewBeforeUnloadReturnValue(bool value) 333 336 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
r132914 r137127 34 34 #include <WebKit2/WKBase.h> 35 35 #include <WebKit2/WKRetainPtr.h> 36 #include <sstream> 37 #include <wtf/Forward.h> 36 38 #include <wtf/OwnPtr.h> 37 39 #include <wtf/RefPtr.h> 38 40 #include <wtf/Vector.h> 39 40 #include <sstream>41 42 namespace WTF {43 class StringBuilder;44 }45 41 46 42 namespace WTR { … … 68 64 void closeOtherPages(); 69 65 70 void dumpBackForwardListsForAllPages( );66 void dumpBackForwardListsForAllPages(StringBuilder&); 71 67 72 68 void done(); 73 WTF::StringBuilder* stringBuilder() { return m_stringBuilder.get(); }74 69 void setPixelResult(WKImageRef image) { m_pixelResult = image; } 75 70 void setRepaintRects(WKArrayRef rects) { m_repaintRects = rects; } … … 83 78 bool useWaitToDumpWatchdogTimer() const { return m_useWaitToDumpWatchdogTimer; } 84 79 80 void outputText(const String&); 85 81 void postNewBeforeUnloadReturnValue(bool); 86 82 void postAddChromeInputField(); … … 145 141 WKBundleFrameRef m_topLoadingFrame; 146 142 147 OwnPtr<WTF::StringBuilder> m_stringBuilder;148 149 143 enum State { 150 144 Idle, -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
r137067 r137127 105 105 JSValueRef parentNode = propertyValue(context, nodeValue, "parentNode"); 106 106 107 WTF::StringBuilder stringBuilder;107 StringBuilder stringBuilder; 108 108 stringBuilder.append(toWTFString(nodeName)); 109 109 … … 154 154 int endOffset = propertyValueInt(context, rangeObject, "endOffset"); 155 155 156 WTF::StringBuilder stringBuilder;156 StringBuilder stringBuilder; 157 157 stringBuilder.appendLiteral("range from "); 158 158 stringBuilder.appendNumber(startOffset); … … 190 190 // No existing tests actually hit this code path at the time of this writing, because WebCore doesn't call 191 191 // the editing client if the styling operation source is CommandFromDOM or CommandFromDOMWithUserInterface. 192 WTF::StringBuilder stringBuilder;192 StringBuilder stringBuilder; 193 193 stringBuilder.appendLiteral("<DOMCSSStyleDeclaration ADDRESS>"); 194 194 return stringBuilder.toString(); … … 197 197 static WTF::String securityOriginToStr(WKSecurityOriginRef origin) 198 198 { 199 WTF::StringBuilder stringBuilder;199 StringBuilder stringBuilder; 200 200 stringBuilder.append('{'); 201 201 stringBuilder.append(toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin)))); … … 212 212 { 213 213 WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); 214 WTF::StringBuilder stringBuilder;214 StringBuilder stringBuilder; 215 215 if (WKBundleFrameIsMainFrame(frame)) { 216 216 if (!WKStringIsEmpty(name.get())) { … … 250 250 251 251 String pathString = toWTFString(adoptWK(WKURLCopyPath(fileUrl))); 252 WTF::StringBuilder stringBuilder;252 StringBuilder stringBuilder; 253 253 254 254 // Remove the leading path from file urls. … … 285 285 static HashMap<uint64_t, String> assignedUrlsCache; 286 286 287 static inline void dumpResourceURL(uint64_t identifier )287 static inline void dumpResourceURL(uint64_t identifier, StringBuilder& stringBuilder) 288 288 { 289 289 if (assignedUrlsCache.contains(identifier)) 290 InjectedBundle::shared().stringBuilder()->append(assignedUrlsCache.get(identifier));290 stringBuilder.append(assignedUrlsCache.get(identifier)); 291 291 else 292 InjectedBundle::shared().stringBuilder()->appendLiteral("<unknown>");292 stringBuilder.appendLiteral("<unknown>"); 293 293 } 294 294 … … 454 454 455 455 // String output must be identical to -[WebFrame _drt_descriptionSuitableForTestResult]. 456 static void dumpFrameDescriptionSuitableForTestResult(WKBundleFrameRef frame )456 static void dumpFrameDescriptionSuitableForTestResult(WKBundleFrameRef frame, StringBuilder& stringBuilder) 457 457 { 458 458 WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); 459 459 if (WKBundleFrameIsMainFrame(frame)) { 460 460 if (WKStringIsEmpty(name.get())) { 461 InjectedBundle::shared().stringBuilder()->appendLiteral("main frame");461 stringBuilder.appendLiteral("main frame"); 462 462 return; 463 463 } 464 464 465 InjectedBundle::shared().stringBuilder()->appendLiteral("main frame \"");466 InjectedBundle::shared().stringBuilder()->append(toWTFString(name));467 InjectedBundle::shared().stringBuilder()->append('"');465 stringBuilder.appendLiteral("main frame \""); 466 stringBuilder.append(toWTFString(name)); 467 stringBuilder.append('"'); 468 468 return; 469 469 } 470 470 471 471 if (WKStringIsEmpty(name.get())) { 472 InjectedBundle::shared().stringBuilder()->appendLiteral("frame (anonymous)"); 473 return; 474 } 475 476 InjectedBundle::shared().stringBuilder()->appendLiteral("frame \""); 477 InjectedBundle::shared().stringBuilder()->append(toWTFString(name)); 478 InjectedBundle::shared().stringBuilder()->append('"'); 479 } 480 481 static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request) 472 stringBuilder.appendLiteral("frame (anonymous)"); 473 return; 474 } 475 476 stringBuilder.appendLiteral("frame \""); 477 stringBuilder.append(toWTFString(name)); 478 stringBuilder.append('"'); 479 } 480 481 static void dumpLoadEvent(WKBundleFrameRef frame, const char* eventName) 482 { 483 StringBuilder stringBuilder; 484 dumpFrameDescriptionSuitableForTestResult(frame, stringBuilder); 485 stringBuilder.appendLiteral(" - "); 486 stringBuilder.append(eventName); 487 stringBuilder.append('\n'); 488 InjectedBundle::shared().outputText(stringBuilder.toString()); 489 } 490 491 static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request, StringBuilder& stringBuilder) 482 492 { 483 493 WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request)); … … 485 495 WKRetainPtr<WKStringRef> httpMethod = adoptWK(WKURLRequestCopyHTTPMethod(request)); 486 496 487 InjectedBundle::shared().stringBuilder()->appendLiteral("<NSURLRequest URL ");488 InjectedBundle::shared().stringBuilder()->append(pathSuitableForTestResult(url.get()));489 InjectedBundle::shared().stringBuilder()->appendLiteral(", main document URL ");490 InjectedBundle::shared().stringBuilder()->append(urlSuitableForTestResult(firstParty.get()));491 InjectedBundle::shared().stringBuilder()->appendLiteral(", http method ");497 stringBuilder.appendLiteral("<NSURLRequest URL "); 498 stringBuilder.append(pathSuitableForTestResult(url.get())); 499 stringBuilder.appendLiteral(", main document URL "); 500 stringBuilder.append(urlSuitableForTestResult(firstParty.get())); 501 stringBuilder.appendLiteral(", http method "); 492 502 493 503 if (WKStringIsEmpty(httpMethod.get())) 494 InjectedBundle::shared().stringBuilder()->appendLiteral("(none)");504 stringBuilder.appendLiteral("(none)"); 495 505 else 496 InjectedBundle::shared().stringBuilder()->append(toWTFString(httpMethod));497 498 InjectedBundle::shared().stringBuilder()->append('>');499 } 500 501 static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response )506 stringBuilder.append(toWTFString(httpMethod)); 507 508 stringBuilder.append('>'); 509 } 510 511 static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response, StringBuilder& stringBuilder) 502 512 { 503 513 WKRetainPtr<WKURLRef> url = adoptWK(WKURLResponseCopyURL(response)); 504 514 if (!url) { 505 InjectedBundle::shared().stringBuilder()->appendLiteral("(null)");506 return; 507 } 508 InjectedBundle::shared().stringBuilder()->appendLiteral("<NSURLResponse ");509 InjectedBundle::shared().stringBuilder()->append(pathSuitableForTestResult(url.get()));510 InjectedBundle::shared().stringBuilder()->appendLiteral(", http status code ");511 InjectedBundle::shared().stringBuilder()->appendNumber(WKURLResponseHTTPStatusCode(response));512 InjectedBundle::shared().stringBuilder()->append('>');513 } 514 515 static inline void dumpErrorDescriptionSuitableForTestResult(WKErrorRef error )515 stringBuilder.appendLiteral("(null)"); 516 return; 517 } 518 stringBuilder.appendLiteral("<NSURLResponse "); 519 stringBuilder.append(pathSuitableForTestResult(url.get())); 520 stringBuilder.appendLiteral(", http status code "); 521 stringBuilder.appendNumber(WKURLResponseHTTPStatusCode(response)); 522 stringBuilder.append('>'); 523 } 524 525 static inline void dumpErrorDescriptionSuitableForTestResult(WKErrorRef error, StringBuilder& stringBuilder) 516 526 { 517 527 WKRetainPtr<WKStringRef> errorDomain = adoptWK(WKErrorCopyDomain(error)); … … 527 537 errorDomain = adoptWK(WKStringCreateWithUTF8CString("WebKitErrorDomain")); 528 538 529 InjectedBundle::shared().stringBuilder()->appendLiteral("<NSError domain ");530 InjectedBundle::shared().stringBuilder()->append(toWTFString(errorDomain));531 InjectedBundle::shared().stringBuilder()->appendLiteral(", code ");532 InjectedBundle::shared().stringBuilder()->appendNumber(errorCode);539 stringBuilder.appendLiteral("<NSError domain "); 540 stringBuilder.append(toWTFString(errorDomain)); 541 stringBuilder.appendLiteral(", code "); 542 stringBuilder.appendNumber(errorCode); 533 543 534 544 WKRetainPtr<WKURLRef> url = adoptWK(WKErrorCopyFailingURL(error)); 535 545 if (url.get()) { 536 546 WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyString(url.get())); 537 InjectedBundle::shared().stringBuilder()->appendLiteral(", failing URL \"");538 InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString));539 InjectedBundle::shared().stringBuilder()->append('"');540 } 541 542 InjectedBundle::shared().stringBuilder()->append('>');547 stringBuilder.appendLiteral(", failing URL \""); 548 stringBuilder.append(toWTFString(urlString)); 549 stringBuilder.append('"'); 550 } 551 552 stringBuilder.append('>'); 543 553 } 544 554 … … 579 589 WKRetainPtr<WKBundleIntentRef> intent(AdoptWK, WKBundleIntentRequestCopyIntent(intentRequest)); 580 590 581 InjectedBundle::shared().stringBuilder()->appendLiteral("Received Web Intent: action="); 591 StringBuilder stringBuilder; 592 stringBuilder.appendLiteral("Received Web Intent: action="); 582 593 WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKBundleIntentCopyAction(intent.get())); 583 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkAction.get()));584 InjectedBundle::shared().stringBuilder()->appendLiteral(" type=");594 stringBuilder.append(toWTFString(wkAction.get())); 595 stringBuilder.appendLiteral(" type="); 585 596 WKRetainPtr<WKStringRef> wkType(AdoptWK, WKBundleIntentCopyType(intent.get())); 586 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkType.get()));587 InjectedBundle::shared().stringBuilder()->append('\n');597 stringBuilder.append(toWTFString(wkType.get())); 598 stringBuilder.append('\n'); 588 599 589 600 const size_t numMessagePorts = WKBundleIntentMessagePortCount(intent.get()); 590 601 if (numMessagePorts) { 591 InjectedBundle::shared().stringBuilder()->appendLiteral("Have ");592 InjectedBundle::shared().stringBuilder()->appendNumber(numMessagePorts);593 InjectedBundle::shared().stringBuilder()->appendLiteral(" ports\n");602 stringBuilder.appendLiteral("Have "); 603 stringBuilder.appendNumber(numMessagePorts); 604 stringBuilder.appendLiteral(" ports\n"); 594 605 } 595 606 … … 598 609 WKRetainPtr<WKStringRef> wkService(AdoptWK, WKURLCopyString(wkServiceUrl.get())); 599 610 if (wkService && !WKStringIsEmpty(wkService.get())) { 600 InjectedBundle::shared().stringBuilder()->appendLiteral("Explicit intent service: ");601 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkService.get()));602 InjectedBundle::shared().stringBuilder()->append('\n');611 stringBuilder.appendLiteral("Explicit intent service: "); 612 stringBuilder.append(toWTFString(wkService.get())); 613 stringBuilder.append('\n'); 603 614 } 604 615 } … … 610 621 WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkExtraKeys.get(), i)); 611 622 WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(wkExtras.get(), wkKey)); 612 InjectedBundle::shared().stringBuilder()->appendLiteral("Extras[");613 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkKey));614 InjectedBundle::shared().stringBuilder()->appendLiteral("] = ");615 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkValue));616 InjectedBundle::shared().stringBuilder()->append('\n');623 stringBuilder.appendLiteral("Extras["); 624 stringBuilder.append(toWTFString(wkKey)); 625 stringBuilder.appendLiteral("] = "); 626 stringBuilder.append(toWTFString(wkValue)); 627 stringBuilder.append('\n'); 617 628 } 618 629 … … 621 632 for (size_t i = 0; i < numSuggestions; ++i) { 622 633 WKStringRef wkSuggestion = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkSuggestions.get(), i)); 623 InjectedBundle::shared().stringBuilder()->appendLiteral("Have suggestion "); 624 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkSuggestion)); 625 InjectedBundle::shared().stringBuilder()->append('\n'); 626 } 634 stringBuilder.appendLiteral("Have suggestion "); 635 stringBuilder.append(toWTFString(wkSuggestion)); 636 stringBuilder.append('\n'); 637 } 638 639 InjectedBundle::shared().outputText(stringBuilder.toString()); 627 640 #endif 628 641 } … … 631 644 { 632 645 #if ENABLE(WEB_INTENTS_TAG) 633 InjectedBundle::shared().stringBuilder()->appendLiteral("Registered Web Intent Service: action="); 646 StringBuilder stringBuilder; 647 stringBuilder.appendLiteral("Registered Web Intent Service: action="); 634 648 WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentServiceInfoCopyAction(serviceInfo)); 635 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkAction.get()));636 InjectedBundle::shared().stringBuilder()->appendLiteral(" type=");649 stringBuilder.append(toWTFString(wkAction.get())); 650 stringBuilder.appendLiteral(" type="); 637 651 WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentServiceInfoCopyType(serviceInfo)); 638 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkType.get()));639 InjectedBundle::shared().stringBuilder()->appendLiteral(" title=");652 stringBuilder.append(toWTFString(wkType.get())); 653 stringBuilder.appendLiteral(" title="); 640 654 WKRetainPtr<WKStringRef> wkTitle(AdoptWK, WKIntentServiceInfoCopyTitle(serviceInfo)); 641 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkTitle.get()));642 InjectedBundle::shared().stringBuilder()->appendLiteral(" url=");655 stringBuilder.append(toWTFString(wkTitle.get())); 656 stringBuilder.appendLiteral(" url="); 643 657 WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKIntentServiceInfoCopyHref(serviceInfo)); 644 658 if (wkUrl) 645 InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKURLCopyString(wkUrl.get()))));646 InjectedBundle::shared().stringBuilder()->appendLiteral(" disposition=");659 stringBuilder.append(toWTFString(adoptWK(WKURLCopyString(wkUrl.get())))); 660 stringBuilder.appendLiteral(" disposition="); 647 661 WKRetainPtr<WKStringRef> wkDisposition(AdoptWK, WKIntentServiceInfoCopyDisposition(serviceInfo)); 648 InjectedBundle::shared().stringBuilder()->append(toWTFString(wkDisposition.get())); 649 InjectedBundle::shared().stringBuilder()->append('\n'); 662 stringBuilder.append(toWTFString(wkDisposition.get())); 663 stringBuilder.append('\n'); 664 InjectedBundle::shared().outputText(stringBuilder.toString()); 650 665 #endif 651 666 } … … 748 763 platformDidStartProvisionalLoadForFrame(frame); 749 764 750 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { 751 dumpFrameDescriptionSuitableForTestResult(frame); 752 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didStartProvisionalLoadForFrame\n"); 753 } 765 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 766 dumpLoadEvent(frame, "didStartProvisionalLoadForFrame"); 754 767 755 768 if (!InjectedBundle::shared().topLoadingFrame()) 756 769 InjectedBundle::shared().setTopLoadingFrame(frame); 757 770 758 if (InjectedBundle::shared().testRunner()->shouldStopProvisionalFrameLoads()) { 759 dumpFrameDescriptionSuitableForTestResult(frame); 760 InjectedBundle::shared().stringBuilder()->appendLiteral(" - stopping load in didStartProvisionalLoadForFrame callback\n"); 761 WKBundleFrameStopLoading(frame); 762 } 771 if (InjectedBundle::shared().testRunner()->shouldStopProvisionalFrameLoads()) 772 dumpLoadEvent(frame, "stopping load in didStartProvisionalLoadForFrame callback"); 763 773 } 764 774 … … 771 781 return; 772 782 773 dumpFrameDescriptionSuitableForTestResult(frame); 774 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didReceiveServerRedirectForProvisionalLoadForFrame\n"); 783 dumpLoadEvent(frame, "didReceiveServerRedirectForProvisionalLoadForFrame"); 775 784 } 776 785 … … 780 789 return; 781 790 782 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { 783 dumpFrameDescriptionSuitableForTestResult(frame); 784 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailProvisionalLoadWithError\n"); 785 } 791 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 792 dumpLoadEvent(frame, "didFailProvisionalLoadWithError"); 786 793 787 794 frameDidChangeLocation(frame); … … 796 803 return; 797 804 798 dumpFrameDescriptionSuitableForTestResult(frame); 799 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didCommitLoadForFrame\n"); 805 dumpLoadEvent(frame, "didCommitLoadForFrame"); 800 806 } 801 807 … … 808 814 return; 809 815 810 InjectedBundle::shared(). stringBuilder()->appendLiteral("postProgressFinishedNotification\n");816 InjectedBundle::shared().outputText("postProgressFinishedNotification\n"); 811 817 } 812 818 813 819 enum FrameNamePolicy { ShouldNotIncludeFrameName, ShouldIncludeFrameName }; 814 820 815 static void dumpFrameScrollPosition(WKBundleFrameRef frame, FrameNamePolicy shouldIncludeFrameName = ShouldNotIncludeFrameName)821 static void dumpFrameScrollPosition(WKBundleFrameRef frame, StringBuilder& stringBuilder, FrameNamePolicy shouldIncludeFrameName = ShouldNotIncludeFrameName) 816 822 { 817 823 double x = numericWindowPropertyValue(frame, "pageXOffset"); 818 824 double y = numericWindowPropertyValue(frame, "pageYOffset"); 819 if (fabs(x) > 0.00000001 || fabs(y) > 0.00000001) { 820 if (shouldIncludeFrameName) { 821 WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); 822 InjectedBundle::shared().stringBuilder()->appendLiteral("frame '"); 823 InjectedBundle::shared().stringBuilder()->append(toWTFString(name)); 824 InjectedBundle::shared().stringBuilder()->appendLiteral("' "); 825 } 826 InjectedBundle::shared().stringBuilder()->appendLiteral("scrolled to "); 827 InjectedBundle::shared().stringBuilder()->append(WTF::String::number(x)); 828 InjectedBundle::shared().stringBuilder()->append(','); 829 InjectedBundle::shared().stringBuilder()->append(WTF::String::number(y)); 830 InjectedBundle::shared().stringBuilder()->append('\n'); 831 } 832 } 833 834 static void dumpDescendantFrameScrollPositions(WKBundleFrameRef frame) 825 if (fabs(x) <= 0.00000001 && fabs(y) <= 0.00000001) 826 return; 827 828 if (shouldIncludeFrameName) { 829 WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); 830 stringBuilder.appendLiteral("frame '"); 831 stringBuilder.append(toWTFString(name)); 832 stringBuilder.appendLiteral("' "); 833 } 834 stringBuilder.appendLiteral("scrolled to "); 835 stringBuilder.append(WTF::String::number(x)); 836 stringBuilder.append(','); 837 stringBuilder.append(WTF::String::number(y)); 838 stringBuilder.append('\n'); 839 } 840 841 static void dumpDescendantFrameScrollPositions(WKBundleFrameRef frame, StringBuilder& stringBuilder) 835 842 { 836 843 WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame)); … … 838 845 for (size_t i = 0; i < size; ++i) { 839 846 WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i)); 840 dumpFrameScrollPosition(subframe, ShouldIncludeFrameName);841 dumpDescendantFrameScrollPositions(subframe );842 } 843 } 844 845 void InjectedBundlePage::dumpAllFrameScrollPositions( )847 dumpFrameScrollPosition(subframe, stringBuilder, ShouldIncludeFrameName); 848 dumpDescendantFrameScrollPositions(subframe, stringBuilder); 849 } 850 } 851 852 void InjectedBundlePage::dumpAllFrameScrollPositions(StringBuilder& stringBuilder) 846 853 { 847 854 WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page); 848 dumpFrameScrollPosition(frame );849 dumpDescendantFrameScrollPositions(frame );855 dumpFrameScrollPosition(frame, stringBuilder); 856 dumpDescendantFrameScrollPositions(frame, stringBuilder); 850 857 } 851 858 … … 874 881 } 875 882 876 static void dumpFrameText(WKBundleFrameRef frame )883 static void dumpFrameText(WKBundleFrameRef frame, StringBuilder& stringBuilder) 877 884 { 878 885 // If the frame doesn't have a document element, its inner text will be an empty string, so … … 883 890 884 891 WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame)); 885 InjectedBundle::shared().stringBuilder()->append(toWTFString(text));886 InjectedBundle::shared().stringBuilder()->append('\n');887 } 888 889 static void dumpDescendantFramesText(WKBundleFrameRef frame )892 stringBuilder.append(toWTFString(text)); 893 stringBuilder.append('\n'); 894 } 895 896 static void dumpDescendantFramesText(WKBundleFrameRef frame, StringBuilder& stringBuilder) 890 897 { 891 898 WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame)); … … 894 901 WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i)); 895 902 WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe)); 896 InjectedBundle::shared().stringBuilder()->appendLiteral("\n--------\nFrame: '"); 897 InjectedBundle::shared().stringBuilder()->append(toWTFString(subframeName)); 898 InjectedBundle::shared().stringBuilder()->appendLiteral("'\n--------\n"); 899 dumpFrameText(subframe); 900 dumpDescendantFramesText(subframe); 901 } 902 } 903 904 void InjectedBundlePage::dumpAllFramesText() 903 904 stringBuilder.appendLiteral("\n--------\nFrame: '"); 905 stringBuilder.append(toWTFString(subframeName)); 906 stringBuilder.appendLiteral("'\n--------\n"); 907 908 dumpFrameText(subframe, stringBuilder); 909 dumpDescendantFramesText(subframe, stringBuilder); 910 } 911 } 912 913 void InjectedBundlePage::dumpAllFramesText(StringBuilder& stringBuilder) 905 914 { 906 915 WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page); 907 dumpFrameText(frame );908 dumpDescendantFramesText(frame );916 dumpFrameText(frame, stringBuilder); 917 dumpDescendantFramesText(frame, stringBuilder); 909 918 } 910 919 … … 924 933 InjectedBundle::shared().testRunner()->dumpAsText(false); 925 934 935 StringBuilder stringBuilder; 936 926 937 switch (InjectedBundle::shared().testRunner()->whatToDump()) { 927 938 case TestRunner::RenderTree: { 928 939 WKRetainPtr<WKStringRef> text(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page)); 929 InjectedBundle::shared().stringBuilder()->append(toWTFString(text));940 stringBuilder.append(toWTFString(text)); 930 941 break; 931 942 } 932 943 case TestRunner::MainFrameText: 933 dumpFrameText(WKBundlePageGetMainFrame(m_page) );944 dumpFrameText(WKBundlePageGetMainFrame(m_page), stringBuilder); 934 945 break; 935 946 case TestRunner::AllFramesText: 936 dumpAllFramesText( );947 dumpAllFramesText(stringBuilder); 937 948 break; 938 949 } 939 950 940 951 if (InjectedBundle::shared().testRunner()->shouldDumpAllFrameScrollPositions()) 941 dumpAllFrameScrollPositions( );952 dumpAllFrameScrollPositions(stringBuilder); 942 953 else if (InjectedBundle::shared().testRunner()->shouldDumpMainFrameScrollPosition()) 943 dumpFrameScrollPosition(WKBundlePageGetMainFrame(m_page) );954 dumpFrameScrollPosition(WKBundlePageGetMainFrame(m_page), stringBuilder); 944 955 945 956 if (InjectedBundle::shared().testRunner()->shouldDumpBackForwardListsForAllWindows()) 946 InjectedBundle::shared().dumpBackForwardListsForAllPages( );957 InjectedBundle::shared().dumpBackForwardListsForAllPages(stringBuilder); 947 958 948 959 if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().testRunner()->shouldDumpPixels()) { … … 956 967 } 957 968 969 InjectedBundle::shared().outputText(stringBuilder.toString()); 958 970 InjectedBundle::shared().done(); 959 971 } … … 964 976 return; 965 977 978 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 979 dumpLoadEvent(frame, "didFinishLoadForFrame"); 980 981 frameDidChangeLocation(frame, /*shouldDump*/ true); 982 } 983 984 void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef) 985 { 986 if (!InjectedBundle::shared().isTestRunning()) 987 return; 988 989 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 990 dumpLoadEvent(frame, "didFailLoadWithError"); 991 992 frameDidChangeLocation(frame); 993 } 994 995 void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame) 996 { 997 if (!InjectedBundle::shared().isTestRunning()) 998 return; 999 1000 StringBuilder stringBuilder; 966 1001 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { 967 dumpFrameDescriptionSuitableForTestResult(frame); 968 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFinishLoadForFrame\n"); 969 } 970 971 frameDidChangeLocation(frame, /*shouldDump*/ true); 972 } 973 974 void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef) 975 { 976 if (!InjectedBundle::shared().isTestRunning()) 977 return; 978 979 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { 980 dumpFrameDescriptionSuitableForTestResult(frame); 981 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailLoadWithError\n"); 982 } 983 984 frameDidChangeLocation(frame); 985 } 986 987 void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame) 988 { 989 if (!InjectedBundle::shared().isTestRunning()) 990 return; 991 992 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { 993 dumpFrameDescriptionSuitableForTestResult(frame); 994 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didReceiveTitle: "); 995 InjectedBundle::shared().stringBuilder()->append(toWTFString(title)); 996 InjectedBundle::shared().stringBuilder()->append('\n'); 997 } 998 999 if (!InjectedBundle::shared().testRunner()->shouldDumpTitleChanges()) 1000 return; 1001 1002 InjectedBundle::shared().stringBuilder()->appendLiteral("TITLE CHANGED: '"); 1003 InjectedBundle::shared().stringBuilder()->append(toWTFString(title)); 1004 InjectedBundle::shared().stringBuilder()->appendLiteral("'\n"); 1002 dumpFrameDescriptionSuitableForTestResult(frame, stringBuilder); 1003 stringBuilder.appendLiteral(" - didReceiveTitle: "); 1004 stringBuilder.append(toWTFString(title)); 1005 stringBuilder.append('\n'); 1006 } 1007 1008 if (InjectedBundle::shared().testRunner()->shouldDumpTitleChanges()) { 1009 stringBuilder.appendLiteral("TITLE CHANGED: '"); 1010 stringBuilder.append(toWTFString(title)); 1011 stringBuilder.appendLiteral("'\n"); 1012 } 1013 1014 InjectedBundle::shared().outputText(stringBuilder.toString()); 1005 1015 } 1006 1016 … … 1040 1050 return; 1041 1051 1042 dumpFrameDescriptionSuitableForTestResult(frame); 1043 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didCancelClientRedirectForFrame\n"); 1052 dumpLoadEvent(frame, "didCancelClientRedirectForFrame"); 1044 1053 } 1045 1054 … … 1052 1061 return; 1053 1062 1054 dumpFrameDescriptionSuitableForTestResult(frame); 1055 InjectedBundle::shared().stringBuilder()->appendLiteral(" - willPerformClientRedirectToURL: "); 1056 InjectedBundle::shared().stringBuilder()->append(pathSuitableForTestResult(url)); 1057 InjectedBundle::shared().stringBuilder()->appendLiteral(" \n"); 1063 StringBuilder stringBuilder; 1064 dumpFrameDescriptionSuitableForTestResult(frame, stringBuilder); 1065 stringBuilder.appendLiteral(" - willPerformClientRedirectToURL: "); 1066 stringBuilder.append(pathSuitableForTestResult(url)); 1067 stringBuilder.appendLiteral(" \n"); 1068 InjectedBundle::shared().outputText(stringBuilder.toString()); 1058 1069 } 1059 1070 … … 1067 1078 return; 1068 1079 1069 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { 1070 dumpFrameDescriptionSuitableForTestResult(frame); 1071 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFinishDocumentLoadForFrame\n"); 1072 } 1080 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 1081 dumpLoadEvent(frame, "didFinishDocumentLoadForFrame"); 1073 1082 1074 1083 unsigned pendingFrameUnloadEvents = WKBundleFrameGetPendingUnloadCount(frame); 1075 1084 if (pendingFrameUnloadEvents) { 1076 InjectedBundle::shared().stringBuilder()->append(frameToStr(frame)); 1077 InjectedBundle::shared().stringBuilder()->appendLiteral(" - has "); 1078 InjectedBundle::shared().stringBuilder()->appendNumber(pendingFrameUnloadEvents); 1079 InjectedBundle::shared().stringBuilder()->appendLiteral(" onunload handler(s)\n"); 1085 StringBuilder stringBuilder; 1086 stringBuilder.append(frameToStr(frame)); 1087 stringBuilder.appendLiteral(" - has "); 1088 stringBuilder.appendNumber(pendingFrameUnloadEvents); 1089 stringBuilder.appendLiteral(" onunload handler(s)\n"); 1090 InjectedBundle::shared().outputText(stringBuilder.toString()); 1080 1091 } 1081 1092 } … … 1086 1097 return; 1087 1098 1088 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { 1089 dumpFrameDescriptionSuitableForTestResult(frame); 1090 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didHandleOnloadEventsForFrame\n"); 1091 } 1099 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 1100 dumpLoadEvent(frame, "didHandleOnloadEventsForFrame"); 1092 1101 } 1093 1102 … … 1095 1104 { 1096 1105 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 1097 InjectedBundle::shared(). stringBuilder()->appendLiteral("didDisplayInsecureContent\n");1106 InjectedBundle::shared().outputText("didDisplayInsecureContent\n"); 1098 1107 } 1099 1108 … … 1101 1110 { 1102 1111 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 1103 InjectedBundle::shared(). stringBuilder()->appendLiteral("didRunInsecureContent\n");1112 InjectedBundle::shared().outputText("didRunInsecureContent\n"); 1104 1113 } 1105 1114 … … 1107 1116 { 1108 1117 if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) 1109 InjectedBundle::shared(). stringBuilder()->appendLiteral("didDetectXSS\n");1118 InjectedBundle::shared().outputText("didDetectXSS\n"); 1110 1119 } 1111 1120 … … 1138 1147 if (InjectedBundle::shared().isTestRunning() 1139 1148 && InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) { 1140 dumpResourceURL(identifier); 1141 InjectedBundle::shared().stringBuilder()->appendLiteral(" - willSendRequest "); 1142 dumpRequestDescriptionSuitableForTestResult(request); 1143 InjectedBundle::shared().stringBuilder()->appendLiteral(" redirectResponse "); 1144 dumpResponseDescriptionSuitableForTestResult(response); 1145 InjectedBundle::shared().stringBuilder()->append('\n'); 1149 StringBuilder stringBuilder; 1150 dumpResourceURL(identifier, stringBuilder); 1151 stringBuilder.appendLiteral(" - willSendRequest "); 1152 dumpRequestDescriptionSuitableForTestResult(request, stringBuilder); 1153 stringBuilder.appendLiteral(" redirectResponse "); 1154 dumpResponseDescriptionSuitableForTestResult(response, stringBuilder); 1155 stringBuilder.append('\n'); 1156 InjectedBundle::shared().outputText(stringBuilder.toString()); 1146 1157 } 1147 1158 … … 1151 1162 WKRetainPtr<WKURLRef> redirectURL = adoptWK(WKURLResponseCopyURL(response)); 1152 1163 if (InjectedBundle::shared().isTestRunning() && InjectedBundle::shared().testRunner()->willSendRequestReturnsNullOnRedirect() && redirectURL) { 1153 InjectedBundle::shared(). stringBuilder()->appendLiteral("Returning null for this redirect\n");1164 InjectedBundle::shared().outputText("Returning null for this redirect\n"); 1154 1165 return 0; 1155 1166 } … … 1175 1186 } 1176 1187 if (!mainFrameIsExternal) { 1177 InjectedBundle::shared().stringBuilder()->appendLiteral("Blocked access to external URL "); 1178 InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString)); 1179 InjectedBundle::shared().stringBuilder()->append('\n'); 1188 StringBuilder stringBuilder; 1189 stringBuilder.appendLiteral("Blocked access to external URL "); 1190 stringBuilder.append(toWTFString(urlString)); 1191 stringBuilder.append('\n'); 1192 InjectedBundle::shared().outputText(stringBuilder.toString()); 1180 1193 return 0; 1181 1194 } … … 1192 1205 1193 1206 if (InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) { 1194 dumpResourceURL(identifier); 1195 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didReceiveResponse "); 1196 dumpResponseDescriptionSuitableForTestResult(response); 1197 InjectedBundle::shared().stringBuilder()->append('\n'); 1207 StringBuilder stringBuilder; 1208 dumpResourceURL(identifier, stringBuilder); 1209 stringBuilder.appendLiteral(" - didReceiveResponse "); 1210 dumpResponseDescriptionSuitableForTestResult(response, stringBuilder); 1211 stringBuilder.append('\n'); 1212 InjectedBundle::shared().outputText(stringBuilder.toString()); 1198 1213 } 1199 1214 … … 1206 1221 WKRetainPtr<WKStringRef> mimeTypeString = adoptWK(WKURLResponseCopyMIMEType(response)); 1207 1222 1208 InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString)); 1209 InjectedBundle::shared().stringBuilder()->appendLiteral(" has MIME type "); 1210 InjectedBundle::shared().stringBuilder()->append(toWTFString(mimeTypeString)); 1211 InjectedBundle::shared().stringBuilder()->append('\n'); 1223 StringBuilder stringBuilder; 1224 stringBuilder.append(toWTFString(urlString)); 1225 stringBuilder.appendLiteral(" has MIME type "); 1226 stringBuilder.append(toWTFString(mimeTypeString)); 1227 stringBuilder.append('\n'); 1228 InjectedBundle::shared().outputText(stringBuilder.toString()); 1212 1229 } 1213 1230 … … 1224 1241 return; 1225 1242 1226 dumpResourceURL(identifier); 1227 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFinishLoading\n"); 1243 StringBuilder stringBuilder; 1244 dumpResourceURL(identifier, stringBuilder); 1245 stringBuilder.appendLiteral(" - didFinishLoading\n"); 1246 InjectedBundle::shared().outputText(stringBuilder.toString()); 1228 1247 } 1229 1248 … … 1236 1255 return; 1237 1256 1238 dumpResourceURL(identifier); 1239 InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailLoadingWithError: "); 1240 1241 dumpErrorDescriptionSuitableForTestResult(error); 1242 InjectedBundle::shared().stringBuilder()->append('\n'); 1257 StringBuilder stringBuilder; 1258 dumpResourceURL(identifier, stringBuilder); 1259 stringBuilder.appendLiteral(" - didFailLoadingWithError: "); 1260 1261 dumpErrorDescriptionSuitableForTestResult(error, stringBuilder); 1262 stringBuilder.append('\n'); 1263 InjectedBundle::shared().outputText(stringBuilder.toString()); 1243 1264 } 1244 1265 … … 1251 1272 return true; 1252 1273 1253 InjectedBundle::shared().stringBuilder()->appendNumber(identifier); 1254 InjectedBundle::shared().stringBuilder()->appendLiteral(" - willCacheResponse: called\n"); 1274 StringBuilder stringBuilder; 1275 stringBuilder.appendNumber(identifier); 1276 stringBuilder.appendLiteral(" - willCacheResponse: called\n"); 1277 InjectedBundle::shared().outputText(stringBuilder.toString()); 1255 1278 1256 1279 // The default behavior is the cache the response. … … 1292 1315 WKRetainPtr<WKStringRef> urlScheme = adoptWK(WKURLCopyScheme(url.get())); 1293 1316 1294 InjectedBundle::shared().stringBuilder()->appendLiteral("Policy delegate: attempt to load "); 1317 StringBuilder stringBuilder; 1318 stringBuilder.appendLiteral("Policy delegate: attempt to load "); 1295 1319 if (isLocalFileScheme(urlScheme.get())) { 1296 1320 WKRetainPtr<WKStringRef> filename = adoptWK(WKURLCopyLastPathComponent(url.get())); 1297 InjectedBundle::shared().stringBuilder()->append(toWTFString(filename));1321 stringBuilder.append(toWTFString(filename)); 1298 1322 } else { 1299 1323 WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyString(url.get())); 1300 InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString));1301 } 1302 InjectedBundle::shared().stringBuilder()->appendLiteral(" with navigation type \'");1303 InjectedBundle::shared().stringBuilder()->append(toWTFString(NavigationTypeToString(WKBundleNavigationActionGetNavigationType(navigationAction))));1304 InjectedBundle::shared().stringBuilder()->appendLiteral("\'");1324 stringBuilder.append(toWTFString(urlString)); 1325 } 1326 stringBuilder.appendLiteral(" with navigation type \'"); 1327 stringBuilder.append(toWTFString(NavigationTypeToString(WKBundleNavigationActionGetNavigationType(navigationAction)))); 1328 stringBuilder.appendLiteral("\'"); 1305 1329 WKBundleHitTestResultRef hitTestResultRef = WKBundleNavigationActionCopyHitTestResult(navigationAction); 1306 1330 if (hitTestResultRef) { 1307 InjectedBundle::shared().stringBuilder()->appendLiteral(" originating from "); 1308 InjectedBundle::shared().stringBuilder()->append(dumpPath(m_page, m_world.get(), WKBundleHitTestResultCopyNodeHandle(hitTestResultRef))); 1309 } 1310 1311 InjectedBundle::shared().stringBuilder()->append('\n'); 1331 stringBuilder.appendLiteral(" originating from "); 1332 stringBuilder.append(dumpPath(m_page, m_world.get(), WKBundleHitTestResultCopyNodeHandle(hitTestResultRef))); 1333 } 1334 1335 stringBuilder.append('\n'); 1336 InjectedBundle::shared().outputText(stringBuilder.toString()); 1312 1337 InjectedBundle::shared().testRunner()->notifyDone(); 1313 1338 … … 1325 1350 { 1326 1351 if (WKURLResponseIsAttachment(response)) { 1352 StringBuilder stringBuilder; 1327 1353 WKRetainPtr<WKStringRef> filename = adoptWK(WKURLResponseCopySuggestedFilename(response)); 1328 InjectedBundle::shared().stringBuilder()->appendLiteral("Policy delegate: resource is an attachment, suggested file name \'"); 1329 InjectedBundle::shared().stringBuilder()->append(toWTFString(filename)); 1330 InjectedBundle::shared().stringBuilder()->appendLiteral("\'\n"); 1354 stringBuilder.appendLiteral("Policy delegate: resource is an attachment, suggested file name \'"); 1355 stringBuilder.append(toWTFString(filename)); 1356 stringBuilder.appendLiteral("\'\n"); 1357 InjectedBundle::shared().outputText(stringBuilder.toString()); 1331 1358 } 1332 1359 … … 1407 1434 messageString = messageString.substring(0, fileProtocolStart) + lastFileURLPathComponent(messageString.substring(fileProtocolStart)); 1408 1435 1409 InjectedBundle::shared().stringBuilder()->appendLiteral("CONSOLE MESSAGE: "); 1436 StringBuilder stringBuilder; 1437 stringBuilder.appendLiteral("CONSOLE MESSAGE: "); 1410 1438 if (lineNumber) { 1411 InjectedBundle::shared().stringBuilder()->appendLiteral("line ");1412 InjectedBundle::shared().stringBuilder()->appendNumber(lineNumber);1413 InjectedBundle::shared().stringBuilder()->appendLiteral(": ");1414 } 1415 InjectedBundle::shared().stringBuilder()->append(messageString);1416 InjectedBundle::shared().stringBuilder()->append('\n');1417 1439 stringBuilder.appendLiteral("line "); 1440 stringBuilder.appendNumber(lineNumber); 1441 stringBuilder.appendLiteral(": "); 1442 } 1443 stringBuilder.append(messageString); 1444 stringBuilder.append('\n'); 1445 InjectedBundle::shared().outputText(stringBuilder.toString()); 1418 1446 } 1419 1447 … … 1426 1454 return; 1427 1455 1428 InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE STATUS CALLBACK: setStatusText:"); 1429 InjectedBundle::shared().stringBuilder()->append(toWTFString(statusbarText)); 1430 InjectedBundle::shared().stringBuilder()->append('\n'); 1456 StringBuilder stringBuilder; 1457 stringBuilder.appendLiteral("UI DELEGATE STATUS CALLBACK: setStatusText:"); 1458 stringBuilder.append(toWTFString(statusbarText)); 1459 stringBuilder.append('\n'); 1460 InjectedBundle::shared().outputText(stringBuilder.toString()); 1431 1461 } 1432 1462 … … 1436 1466 return; 1437 1467 1438 InjectedBundle::shared().stringBuilder()->appendLiteral("ALERT: "); 1439 InjectedBundle::shared().stringBuilder()->append(toWTFString(message)); 1440 InjectedBundle::shared().stringBuilder()->append('\n'); 1468 StringBuilder stringBuilder; 1469 stringBuilder.appendLiteral("ALERT: "); 1470 stringBuilder.append(toWTFString(message)); 1471 stringBuilder.append('\n'); 1472 InjectedBundle::shared().outputText(stringBuilder.toString()); 1441 1473 } 1442 1474 … … 1446 1478 return; 1447 1479 1448 InjectedBundle::shared().stringBuilder()->appendLiteral("CONFIRM: "); 1449 InjectedBundle::shared().stringBuilder()->append(toWTFString(message)); 1450 InjectedBundle::shared().stringBuilder()->append('\n'); 1480 StringBuilder stringBuilder; 1481 stringBuilder.appendLiteral("CONFIRM: "); 1482 stringBuilder.append(toWTFString(message)); 1483 stringBuilder.append('\n'); 1484 InjectedBundle::shared().outputText(stringBuilder.toString()); 1451 1485 } 1452 1486 1453 1487 void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef) 1454 1488 { 1455 InjectedBundle::shared().stringBuilder()->appendLiteral("PROMPT: "); 1456 InjectedBundle::shared().stringBuilder()->append(toWTFString(message)); 1457 InjectedBundle::shared().stringBuilder()->appendLiteral(", default text: "); 1458 InjectedBundle::shared().stringBuilder()->append(toWTFString(defaultValue)); 1459 InjectedBundle::shared().stringBuilder()->append('\n'); 1489 StringBuilder stringBuilder; 1490 stringBuilder.appendLiteral("PROMPT: "); 1491 stringBuilder.append(toWTFString(message)); 1492 stringBuilder.appendLiteral(", default text: "); 1493 stringBuilder.append(toWTFString(defaultValue)); 1494 stringBuilder.append('\n'); 1495 InjectedBundle::shared().outputText(stringBuilder.toString()); 1460 1496 } 1461 1497 … … 1469 1505 int64_t truncatedSpaceNeeded = (totalBytesNeeded / 10000) * 10000; 1470 1506 1471 InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:"); 1472 InjectedBundle::shared().stringBuilder()->append(securityOriginToStr(origin)); 1473 InjectedBundle::shared().stringBuilder()->appendLiteral(" totalSpaceNeeded:~"); 1474 InjectedBundle::shared().stringBuilder()->appendNumber(truncatedSpaceNeeded); 1475 InjectedBundle::shared().stringBuilder()->append('\n'); 1507 StringBuilder stringBuilder; 1508 stringBuilder.appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:"); 1509 stringBuilder.append(securityOriginToStr(origin)); 1510 stringBuilder.appendLiteral(" totalSpaceNeeded:~"); 1511 stringBuilder.appendNumber(truncatedSpaceNeeded); 1512 stringBuilder.append('\n'); 1513 InjectedBundle::shared().outputText(stringBuilder.toString()); 1476 1514 } 1477 1515 … … 1486 1524 { 1487 1525 if (InjectedBundle::shared().testRunner()->shouldDumpDatabaseCallbacks()) { 1488 InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:"); 1489 InjectedBundle::shared().stringBuilder()->append(securityOriginToStr(origin)); 1490 InjectedBundle::shared().stringBuilder()->appendLiteral(" database:"); 1491 InjectedBundle::shared().stringBuilder()->append(toWTFString(databaseName)); 1492 InjectedBundle::shared().stringBuilder()->append('\n'); 1526 StringBuilder stringBuilder; 1527 stringBuilder.appendLiteral("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:"); 1528 stringBuilder.append(securityOriginToStr(origin)); 1529 stringBuilder.appendLiteral(" database:"); 1530 stringBuilder.append(toWTFString(databaseName)); 1531 stringBuilder.append('\n'); 1532 InjectedBundle::shared().outputText(stringBuilder.toString()); 1493 1533 } 1494 1534 … … 1560 1600 1561 1601 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1562 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldBeginEditingInDOMRange:"); 1563 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); 1564 InjectedBundle::shared().stringBuilder()->append('\n'); 1602 StringBuilder stringBuilder; 1603 stringBuilder.appendLiteral("EDITING DELEGATE: shouldBeginEditingInDOMRange:"); 1604 stringBuilder.append(rangeToStr(m_page, m_world.get(), range)); 1605 stringBuilder.append('\n'); 1606 InjectedBundle::shared().outputText(stringBuilder.toString()); 1565 1607 } 1566 1608 return InjectedBundle::shared().testRunner()->shouldAllowEditing(); … … 1573 1615 1574 1616 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1575 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldEndEditingInDOMRange:"); 1576 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); 1577 InjectedBundle::shared().stringBuilder()->append('\n'); 1617 StringBuilder stringBuilder; 1618 stringBuilder.appendLiteral("EDITING DELEGATE: shouldEndEditingInDOMRange:"); 1619 stringBuilder.append(rangeToStr(m_page, m_world.get(), range)); 1620 stringBuilder.append('\n'); 1621 InjectedBundle::shared().outputText(stringBuilder.toString()); 1578 1622 } 1579 1623 return InjectedBundle::shared().testRunner()->shouldAllowEditing(); … … 1592 1636 1593 1637 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1594 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldInsertNode:"); 1595 InjectedBundle::shared().stringBuilder()->append(dumpPath(m_page, m_world.get(), node)); 1596 InjectedBundle::shared().stringBuilder()->appendLiteral(" replacingDOMRange:"); 1597 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), rangeToReplace)); 1598 InjectedBundle::shared().stringBuilder()->appendLiteral(" givenAction:"); 1599 InjectedBundle::shared().stringBuilder()->append(insertactionstring[action]); 1600 InjectedBundle::shared().stringBuilder()->append('\n'); 1638 StringBuilder stringBuilder; 1639 stringBuilder.appendLiteral("EDITING DELEGATE: shouldInsertNode:"); 1640 stringBuilder.append(dumpPath(m_page, m_world.get(), node)); 1641 stringBuilder.appendLiteral(" replacingDOMRange:"); 1642 stringBuilder.append(rangeToStr(m_page, m_world.get(), rangeToReplace)); 1643 stringBuilder.appendLiteral(" givenAction:"); 1644 stringBuilder.append(insertactionstring[action]); 1645 stringBuilder.append('\n'); 1646 InjectedBundle::shared().outputText(stringBuilder.toString()); 1601 1647 } 1602 1648 return InjectedBundle::shared().testRunner()->shouldAllowEditing(); … … 1615 1661 1616 1662 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1617 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldInsertText:"); 1618 InjectedBundle::shared().stringBuilder()->append(toWTFString(text)); 1619 InjectedBundle::shared().stringBuilder()->appendLiteral(" replacingDOMRange:"); 1620 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), rangeToReplace)); 1621 InjectedBundle::shared().stringBuilder()->appendLiteral(" givenAction:"); 1622 InjectedBundle::shared().stringBuilder()->append(insertactionstring[action]); 1623 InjectedBundle::shared().stringBuilder()->append('\n'); 1663 StringBuilder stringBuilder; 1664 stringBuilder.appendLiteral("EDITING DELEGATE: shouldInsertText:"); 1665 stringBuilder.append(toWTFString(text)); 1666 stringBuilder.appendLiteral(" replacingDOMRange:"); 1667 stringBuilder.append(rangeToStr(m_page, m_world.get(), rangeToReplace)); 1668 stringBuilder.appendLiteral(" givenAction:"); 1669 stringBuilder.append(insertactionstring[action]); 1670 stringBuilder.append('\n'); 1671 InjectedBundle::shared().outputText(stringBuilder.toString()); 1624 1672 } 1625 1673 return InjectedBundle::shared().testRunner()->shouldAllowEditing(); … … 1632 1680 1633 1681 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1634 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldDeleteDOMRange:"); 1635 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); 1636 InjectedBundle::shared().stringBuilder()->append('\n'); 1682 StringBuilder stringBuilder; 1683 stringBuilder.appendLiteral("EDITING DELEGATE: shouldDeleteDOMRange:"); 1684 stringBuilder.append(rangeToStr(m_page, m_world.get(), range)); 1685 stringBuilder.append('\n'); 1686 InjectedBundle::shared().outputText(stringBuilder.toString()); 1637 1687 } 1638 1688 return InjectedBundle::shared().testRunner()->shouldAllowEditing(); … … 1654 1704 1655 1705 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1656 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldChangeSelectedDOMRange:"); 1657 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), fromRange)); 1658 InjectedBundle::shared().stringBuilder()->appendLiteral(" toDOMRange:"); 1659 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), toRange)); 1660 InjectedBundle::shared().stringBuilder()->appendLiteral(" affinity:"); 1661 InjectedBundle::shared().stringBuilder()->append(affinitystring[affinity]); 1662 InjectedBundle::shared().stringBuilder()->appendLiteral(" stillSelecting:"); 1663 InjectedBundle::shared().stringBuilder()->append(boolstring[stillSelecting]); 1664 InjectedBundle::shared().stringBuilder()->append('\n'); 1706 StringBuilder stringBuilder; 1707 stringBuilder.appendLiteral("EDITING DELEGATE: shouldChangeSelectedDOMRange:"); 1708 stringBuilder.append(rangeToStr(m_page, m_world.get(), fromRange)); 1709 stringBuilder.appendLiteral(" toDOMRange:"); 1710 stringBuilder.append(rangeToStr(m_page, m_world.get(), toRange)); 1711 stringBuilder.appendLiteral(" affinity:"); 1712 stringBuilder.append(affinitystring[affinity]); 1713 stringBuilder.appendLiteral(" stillSelecting:"); 1714 stringBuilder.append(boolstring[stillSelecting]); 1715 stringBuilder.append('\n'); 1716 InjectedBundle::shared().outputText(stringBuilder.toString()); 1665 1717 } 1666 1718 return InjectedBundle::shared().testRunner()->shouldAllowEditing(); … … 1673 1725 1674 1726 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1675 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldApplyStyle:"); 1676 InjectedBundle::shared().stringBuilder()->append(styleDecToStr(style)); 1677 InjectedBundle::shared().stringBuilder()->appendLiteral(" toElementsInDOMRange:"); 1678 InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); 1679 InjectedBundle::shared().stringBuilder()->append('\n'); 1727 StringBuilder stringBuilder; 1728 stringBuilder.appendLiteral("EDITING DELEGATE: shouldApplyStyle:"); 1729 stringBuilder.append(styleDecToStr(style)); 1730 stringBuilder.appendLiteral(" toElementsInDOMRange:"); 1731 stringBuilder.append(rangeToStr(m_page, m_world.get(), range)); 1732 stringBuilder.append('\n'); 1733 InjectedBundle::shared().outputText(stringBuilder.toString()); 1680 1734 } 1681 1735 return InjectedBundle::shared().testRunner()->shouldAllowEditing(); … … 1686 1740 if (!InjectedBundle::shared().isTestRunning()) 1687 1741 return; 1688 1689 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1690 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidBeginEditing:"); 1691 InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); 1692 InjectedBundle::shared().stringBuilder()->append('\n'); 1693 } 1742 if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) 1743 return; 1744 1745 StringBuilder stringBuilder; 1746 stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidBeginEditing:"); 1747 stringBuilder.append(toWTFString(notificationName)); 1748 stringBuilder.append('\n'); 1749 InjectedBundle::shared().outputText(stringBuilder.toString()); 1694 1750 } 1695 1751 … … 1698 1754 if (!InjectedBundle::shared().isTestRunning()) 1699 1755 return; 1700 1701 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1702 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidEndEditing:"); 1703 InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); 1704 InjectedBundle::shared().stringBuilder()->append('\n'); 1705 } 1756 if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) 1757 return; 1758 1759 StringBuilder stringBuilder; 1760 stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidEndEditing:"); 1761 stringBuilder.append(toWTFString(notificationName)); 1762 stringBuilder.append('\n'); 1763 InjectedBundle::shared().outputText(stringBuilder.toString()); 1706 1764 } 1707 1765 … … 1710 1768 if (!InjectedBundle::shared().isTestRunning()) 1711 1769 return; 1712 1713 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1714 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidChange:"); 1715 InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); 1716 InjectedBundle::shared().stringBuilder()->append('\n'); 1717 } 1770 if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) 1771 return; 1772 1773 StringBuilder stringBuilder; 1774 stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidChange:"); 1775 stringBuilder.append(toWTFString(notificationName)); 1776 stringBuilder.append('\n'); 1777 InjectedBundle::shared().outputText(stringBuilder.toString()); 1718 1778 } 1719 1779 … … 1722 1782 if (!InjectedBundle::shared().isTestRunning()) 1723 1783 return; 1724 1725 if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { 1726 InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidChangeSelection:"); 1727 InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); 1728 InjectedBundle::shared().stringBuilder()->append('\n'); 1729 } 1784 if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) 1785 return; 1786 1787 StringBuilder stringBuilder; 1788 stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidChangeSelection:"); 1789 stringBuilder.append(toWTFString(notificationName)); 1790 stringBuilder.append('\n'); 1791 InjectedBundle::shared().outputText(stringBuilder.toString()); 1730 1792 } 1731 1793 … … 1734 1796 { 1735 1797 if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) 1736 InjectedBundle::shared(). stringBuilder()->appendLiteral("supportsFullScreen() == true\n");1798 InjectedBundle::shared().outputText("supportsFullScreen() == true\n"); 1737 1799 return true; 1738 1800 } … … 1741 1803 { 1742 1804 if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) 1743 InjectedBundle::shared(). stringBuilder()->appendLiteral("enterFullScreenForElement()\n");1805 InjectedBundle::shared().outputText("enterFullScreenForElement()\n"); 1744 1806 1745 1807 if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { … … 1752 1814 { 1753 1815 if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) 1754 InjectedBundle::shared(). stringBuilder()->appendLiteral("exitFullScreenForElement()\n");1816 InjectedBundle::shared().outputText("exitFullScreenForElement()\n"); 1755 1817 1756 1818 if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { … … 1763 1825 { 1764 1826 if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) 1765 InjectedBundle::shared(). stringBuilder()->appendLiteral("beganEnterFullScreen()\n");1827 InjectedBundle::shared().outputText("beganEnterFullScreen()\n"); 1766 1828 } 1767 1829 … … 1769 1831 { 1770 1832 if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) 1771 InjectedBundle::shared(). stringBuilder()->appendLiteral("beganExitFullScreen()\n");1833 InjectedBundle::shared().outputText("beganExitFullScreen()\n"); 1772 1834 } 1773 1835 … … 1775 1837 { 1776 1838 if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) 1777 InjectedBundle::shared(). stringBuilder()->appendLiteral("closeFullScreen()\n");1839 InjectedBundle::shared().outputText("closeFullScreen()\n"); 1778 1840 1779 1841 if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { … … 1789 1851 } 1790 1852 1791 static void dumpBackForwardListItem(WKBundleBackForwardListItemRef item, unsigned indent, bool isCurrentItem )1853 static void dumpBackForwardListItem(WKBundleBackForwardListItemRef item, unsigned indent, bool isCurrentItem, StringBuilder& stringBuilder) 1792 1854 { 1793 1855 unsigned column = 0; 1794 1856 if (isCurrentItem) { 1795 InjectedBundle::shared().stringBuilder()->appendLiteral("curr->");1857 stringBuilder.appendLiteral("curr->"); 1796 1858 column = 6; 1797 1859 } 1798 1860 for (unsigned i = column; i < indent; i++) 1799 InjectedBundle::shared().stringBuilder()->append(' ');1861 stringBuilder.append(' '); 1800 1862 1801 1863 WTF::String url = toWTFString(adoptWK(WKURLCopyString(adoptWK(WKBundleBackForwardListItemCopyURL(item)).get()))); … … 1807 1869 else 1808 1870 start += directoryName.length(); 1809 InjectedBundle::shared().stringBuilder()->appendLiteral("(file test):");1810 InjectedBundle::shared().stringBuilder()->append(url.substring(start));1871 stringBuilder.appendLiteral("(file test):"); 1872 stringBuilder.append(url.substring(start)); 1811 1873 } else 1812 InjectedBundle::shared().stringBuilder()->append(url);1874 stringBuilder.append(url); 1813 1875 1814 1876 WTF::String target = toWTFString(adoptWK(WKBundleBackForwardListItemCopyTarget(item))); 1815 1877 if (target.length()) { 1816 InjectedBundle::shared().stringBuilder()->appendLiteral(" (in frame \"");1817 InjectedBundle::shared().stringBuilder()->append(target);1818 InjectedBundle::shared().stringBuilder()->appendLiteral("\")");1878 stringBuilder.appendLiteral(" (in frame \""); 1879 stringBuilder.append(target); 1880 stringBuilder.appendLiteral("\")"); 1819 1881 } 1820 1882 1821 1883 // FIXME: Need WKBackForwardListItemIsTargetItem. 1822 1884 if (WKBundleBackForwardListItemIsTargetItem(item)) 1823 InjectedBundle::shared().stringBuilder()->appendLiteral(" **nav target**");1824 1825 InjectedBundle::shared().stringBuilder()->append('\n');1885 stringBuilder.appendLiteral(" **nav target**"); 1886 1887 stringBuilder.append('\n'); 1826 1888 1827 1889 if (WKRetainPtr<WKArrayRef> kids = adoptWK(WKBundleBackForwardListItemCopyChildren(item))) { … … 1833 1895 stable_sort(sortedKids.begin(), sortedKids.end(), compareByTargetName); 1834 1896 for (size_t i = 0; i < size; ++i) 1835 dumpBackForwardListItem(sortedKids[i], indent + 4, false );1836 } 1837 } 1838 1839 void InjectedBundlePage::dumpBackForwardList( )1840 { 1841 InjectedBundle::shared().stringBuilder()->appendLiteral("\n============== Back Forward List ==============\n");1897 dumpBackForwardListItem(sortedKids[i], indent + 4, false, stringBuilder); 1898 } 1899 } 1900 1901 void InjectedBundlePage::dumpBackForwardList(StringBuilder& stringBuilder) 1902 { 1903 stringBuilder.appendLiteral("\n============== Back Forward List ==============\n"); 1842 1904 1843 1905 WKBundleBackForwardListRef list = WKBundlePageGetBackForwardList(m_page); … … 1868 1930 1869 1931 for (int i = itemsToPrint.size() - 1; i >= 0; i--) 1870 dumpBackForwardListItem(itemsToPrint[i].get(), 8, i == currentItemIndex );1871 1872 InjectedBundle::shared().stringBuilder()->appendLiteral("===============================================\n");1932 dumpBackForwardListItem(itemsToPrint[i].get(), 8, i == currentItemIndex, stringBuilder); 1933 1934 stringBuilder.appendLiteral("===============================================\n"); 1873 1935 } 1874 1936 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
r131560 r137127 30 30 #include <WebKit2/WKBundleScriptWorld.h> 31 31 #include <WebKit2/WKRetainPtr.h> 32 #include <wtf/text/WTFString.h> 32 33 33 34 namespace WTR { … … 51 52 void resetAfterTest(); 52 53 53 void dumpBackForwardList( );54 void dumpBackForwardList(WTF::StringBuilder&); 54 55 55 56 private: … … 170 171 void didChangeSelection(WKStringRef notificationName); 171 172 172 void dumpAllFramesText( );173 void dumpAllFrameScrollPositions( );173 void dumpAllFramesText(WTF::StringBuilder&); 174 void dumpAllFrameScrollPositions(WTF::StringBuilder&); 174 175 175 176 void platformDidStartProvisionalLoadForFrame(WKBundleFrameRef); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r135508 r137127 150 150 { 151 151 invalidateWaitToDumpWatchdogTimer(); 152 const char* message = "FAIL: Timed out waiting for notifyDone to be called\n"; 153 InjectedBundle::shared().stringBuilder()->append(message); 154 InjectedBundle::shared().stringBuilder()->append("\n"); 152 InjectedBundle::shared().outputText("FAIL: Timed out waiting for notifyDone to be called\n\n"); 155 153 InjectedBundle::shared().done(); 156 154 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp
r135267 r137127 56 56 GOwnPtr<gchar> signalNameAndValue(signalValue ? g_strdup_printf("%s = %s", signalName, signalValue) : g_strdup(signalName)); 57 57 GOwnPtr<gchar> accessibilityEventString(g_strdup_printf("Accessibility object emitted \"%s\" / Name: \"%s\" / Role: %d\n", signalNameAndValue.get(), objectName, objectRole)); 58 InjectedBundle::shared(). stringBuilder()->append(accessibilityEventString.get());58 InjectedBundle::shared().outputText(String::fromUTF8(accessibilityEventString.get())); 59 59 } 60 60 -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r136004 r137127 39 39 #include <wtf/OwnArrayPtr.h> 40 40 #include <wtf/PassOwnArrayPtr.h> 41 #include <wtf/PassOwnPtr.h> 41 42 #include <wtf/text/CString.h> 42 43 … … 194 195 updateTiledDrawingForCurrentTest(m_pathOrURL.c_str()); 195 196 197 m_textOutput.clear(); 198 196 199 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("BeginTest")); 197 200 WKRetainPtr<WKMutableDictionaryRef> beginTestMessageBody = adoptWK(WKMutableDictionaryCreate()); … … 285 288 void TestInvocation::dumpResults() 286 289 { 287 dump( toWTFString(m_textOutput.get()).utf8().data());290 dump(m_textOutput.toString().utf8().data()); 288 291 289 292 if (m_dumpPixels && m_pixelResult) … … 337 340 WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody); 338 341 339 WKRetainPtr<WKStringRef> textOutputKey(AdoptWK, WKStringCreateWithUTF8CString("TextOutput"));340 m_textOutput = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, textOutputKey.get()));341 342 342 WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult")); 343 343 m_pixelResult = static_cast<WKImageRef>(WKDictionaryGetItemForKey(messageBodyDictionary, pixelResultKey.get())); … … 351 351 return; 352 352 } 353 353 354 if (WKStringIsEqualToUTF8CString(messageName, "TextOutput")) { 355 ASSERT(WKGetTypeID(messageBody) == WStringGetTypeID()); 356 WKStringRef textOutput = static_cast<WKStringRef>(messageBody); 357 m_textOutput.append(toWTFString(textOutput)); 358 } 359 354 360 if (WKStringIsEqualToUTF8CString(messageName, "BeforeUnloadReturnValue")) { 355 361 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); -
trunk/Tools/WebKitTestRunner/TestInvocation.h
r136004 r137127 30 30 #include <WebKit2/WKRetainPtr.h> 31 31 #include <wtf/Noncopyable.h> 32 #include <wtf/OwnPtr.h> 33 #include <wtf/text/StringBuilder.h> 32 34 33 35 namespace WTR { … … 68 70 bool m_error; 69 71 70 WKRetainPtr<WKStringRef>m_textOutput;72 StringBuilder m_textOutput; 71 73 WKRetainPtr<WKImageRef> m_pixelResult; 72 74 WKRetainPtr<WKArrayRef> m_repaintRects;
Note: See TracChangeset
for help on using the changeset viewer.