diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
commit | d0424a769059c84ae20beb3c217812792ea6726b (patch) | |
tree | 6f94a5c3db8c52c6694ee56498542a6c35417350 /Tools/WebKitTestRunner | |
parent | 88a04ac016f57c2d78e714682445dff2e7db4ade (diff) | |
download | qtwebkit-d0424a769059c84ae20beb3c217812792ea6726b.tar.gz |
Imported WebKit commit 37c5e5041d39a14ea0d429a77ebd352e4bd26516 (http://svn.webkit.org/repository/webkit/trunk@128608)
New snapshot that enables WebKit2 build on Windows (still some bugs) and allows for WebKit to be built with qmake && make
Diffstat (limited to 'Tools/WebKitTestRunner')
12 files changed, 318 insertions, 190 deletions
diff --git a/Tools/WebKitTestRunner/CMakeLists.txt b/Tools/WebKitTestRunner/CMakeLists.txt index e4f4f729f..a3ea88dca 100644 --- a/Tools/WebKitTestRunner/CMakeLists.txt +++ b/Tools/WebKitTestRunner/CMakeLists.txt @@ -68,7 +68,7 @@ GENERATE_BINDINGS(WebKitTestRunnerInjectedBundle_SOURCES "${WebKitTestRunnerInjectedBundle_IDL_FILES}" "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings" "--include=${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings" - "" + "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}" ${DERIVED_SOURCES_DIR}/InjectedBundle JS TestRunner ) diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl index a49471850..e0079b7f8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl @@ -47,6 +47,7 @@ module WTR { void dumpResourceLoadCallbacks(); void dumpResourceResponseMIMETypes(); void dumpWillCacheResponse(); + void dumpApplicationCacheDelegateCallbacks(); // Special options. void keepWebHistory(); @@ -63,12 +64,14 @@ module WTR { void setPrivateBrowsingEnabled(in boolean value); void setPopupBlockingEnabled(in boolean value); void setAuthorAndUserStylesEnabled(in boolean value); + void setCustomPolicyDelegate(in boolean enabled, in boolean permissive); void addOriginAccessWhitelistEntry(in DOMString sourceOrigin, in DOMString destinationProtocol, in DOMString destinationHost, in boolean allowDestinationSubdomains); void removeOriginAccessWhitelistEntry(in DOMString sourceOrigin, in DOMString destinationProtocol, in DOMString destinationHost, in boolean allowDestinationSubdomains); void setUserStyleSheetEnabled(in boolean value); void setUserStyleSheetLocation(in DOMString location); void setMinimumTimerInterval(in double interval); // Interval specified in seconds. void setSpatialNavigationEnabled(in boolean value); + void setTabKeyCyclesThroughElements(in boolean enabled); // Special DOM functions. void clearBackForwardList(); @@ -80,6 +83,7 @@ module WTR { // Special DOM variables. attribute boolean globalFlag; + readonly attribute unsigned long workerThreadCount; // Repaint testing. void testRepaint(); @@ -112,6 +116,8 @@ module WTR { long long applicationCacheDiskUsageForOrigin(in DOMString origin); void clearApplicationCacheForOrigin(in DOMString name); void setApplicationCacheOriginQuota(in unsigned long long bytes); + void disallowIncreaseForApplicationCacheQuota(); + object originsWithApplicationCache(); // Compositing testing. DOMString layerTreeAsText(); @@ -170,6 +176,8 @@ module WTR { void denyWebNotificationPermission(in DOMString origin); void removeAllWebNotificationPermissions(); void simulateWebNotificationClick(in object notification); + + boolean callShouldCloseOnWebView(); }; } diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp index ecfa6b31a..b7e203cda 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp @@ -74,6 +74,13 @@ static WKEventModifiers parseModifierArray(JSContextRef context, JSValueRef arra { if (!arrayValue) return 0; + + // The value may either be a string with a single modifier or an array of modifiers. + if (JSValueIsString(context, arrayValue)) { + JSRetainPtr<JSStringRef> string(Adopt, JSValueToStringCopy(context, arrayValue, 0)); + return parseModifier(string.get()); + } + if (!JSValueIsObject(context, arrayValue)) return 0; JSObjectRef array = const_cast<JSObjectRef>(arrayValue); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index e4e41235b..99f95d65d 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -242,11 +242,18 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings) WKBundleSetMinimumLogicalFontSize(m_bundle, m_pageGroup, 9); WKBundleSetMinimumTimerInterval(m_bundle, m_pageGroup, 0.010); // 10 milliseconds (DOMTimer::s_minDefaultTimerInterval) WKBundleSetSpatialNavigationEnabled(m_bundle, m_pageGroup, false); + WKBundleSetAllowFileAccessFromFileURLs(m_bundle, m_pageGroup, true); + WKBundleSetPluginsEnabled(m_bundle, m_pageGroup, true); + WKBundleSetPopupBlockingEnabled(m_bundle, m_pageGroup, false); WKBundleRemoveAllUserContent(m_bundle, m_pageGroup); m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates")); m_testRunner->setUserStyleSheetEnabled(false); + m_testRunner->setXSSAuditorEnabled(false); + m_testRunner->setCloseRemainingWindowsWhenComplete(false); + m_testRunner->setAcceptsEditing(true); + m_testRunner->setTabKeyCyclesThroughElements(true); page()->prepare(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index 6746a70a8..cb05a6582 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -41,6 +41,8 @@ #include <WebKit2/WKBundleNavigationAction.h> #include <WebKit2/WKBundleNodeHandlePrivate.h> #include <WebKit2/WKBundlePagePrivate.h> +#include <WebKit2/WKBundlePrivate.h> +#include <WebKit2/WKSecurityOrigin.h> #include <WebKit2/WKURLRequest.h> #include <wtf/HashMap.h> #include <wtf/text/CString.h> @@ -106,7 +108,7 @@ static WTF::String dumpPath(JSGlobalContextRef context, JSObjectRef nodeValue) stringBuilder.append(toWTFString(nodeName)); if (parentNode && JSValueIsObject(context, parentNode)) { - stringBuilder.append(" > "); + stringBuilder.appendLiteral(" > "); stringBuilder.append(dumpPath(context, (JSObjectRef)parentNode)); } @@ -152,13 +154,13 @@ static WTF::String rangeToStr(WKBundlePageRef page, WKBundleScriptWorldRef world int endOffset = propertyValueInt(context, rangeObject, "endOffset"); WTF::StringBuilder stringBuilder; - stringBuilder.append("range from "); - stringBuilder.append(WTF::String::number(startOffset)); - stringBuilder.append(" of "); + stringBuilder.appendLiteral("range from "); + stringBuilder.appendNumber(startOffset); + stringBuilder.appendLiteral(" of "); stringBuilder.append(dumpPath(context, startNodeObject)); - stringBuilder.append(" to "); - stringBuilder.append(WTF::String::number(endOffset)); - stringBuilder.append(" of "); + stringBuilder.appendLiteral(" to "); + stringBuilder.appendNumber(endOffset); + stringBuilder.appendLiteral(" of "); stringBuilder.append(dumpPath(context, endNodeObject)); return stringBuilder.toString(); } @@ -188,7 +190,7 @@ static WTF::String styleDecToStr(WKBundleCSSStyleDeclarationRef style) // No existing tests actually hit this code path at the time of this writing, because WebCore doesn't call // the editing client if the styling operation source is CommandFromDOM or CommandFromDOMWithUserInterface. WTF::StringBuilder stringBuilder; - stringBuilder.append("<DOMCSSStyleDeclaration ADDRESS>"); + stringBuilder.appendLiteral("<DOMCSSStyleDeclaration ADDRESS>"); return stringBuilder.toString(); } @@ -198,19 +200,19 @@ static WTF::String frameToStr(WKBundleFrameRef frame) WTF::StringBuilder stringBuilder; if (WKBundleFrameIsMainFrame(frame)) { if (!WKStringIsEmpty(name.get())) { - stringBuilder.append("main frame \""); + stringBuilder.appendLiteral("main frame \""); stringBuilder.append(toWTFString(name)); - stringBuilder.append("\""); + stringBuilder.append('"'); } else - stringBuilder.append("main frame"); + stringBuilder.appendLiteral("main frame"); } else { if (!WKStringIsEmpty(name.get())) { - stringBuilder.append("frame \""); + stringBuilder.appendLiteral("frame \""); stringBuilder.append(toWTFString(name)); - stringBuilder.append("\""); + stringBuilder.append('"'); } else - stringBuilder.append("frame (anonymous)"); + stringBuilder.appendLiteral("frame (anonymous)"); } return stringBuilder.toString(); @@ -268,6 +270,14 @@ static inline WTF::String urlSuitableForTestResult(WKURLRef fileUrl) static HashMap<uint64_t, String> assignedUrlsCache; +static inline void dumpResourceURL(uint64_t identifier) +{ + if (assignedUrlsCache.contains(identifier)) + InjectedBundle::shared().stringBuilder()->append(assignedUrlsCache.get(identifier)); + else + InjectedBundle::shared().stringBuilder()->appendLiteral("<unknown>"); +} + InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) : m_page(page) , m_world(AdoptWK, WKBundleScriptWorldCreateWorld()) @@ -349,6 +359,7 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) 0, /*statusBarIsVisible*/ 0, /*menuBarIsVisible*/ 0, /*toolbarsAreVisible*/ + didReachApplicationCacheOriginQuota, }; WKBundlePageSetUIClient(m_page, &uiClient); @@ -430,24 +441,24 @@ static void dumpFrameDescriptionSuitableForTestResult(WKBundleFrameRef frame) WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); if (WKBundleFrameIsMainFrame(frame)) { if (WKStringIsEmpty(name.get())) { - InjectedBundle::shared().stringBuilder()->append("main frame"); + InjectedBundle::shared().stringBuilder()->appendLiteral("main frame"); return; } - InjectedBundle::shared().stringBuilder()->append("main frame \""); + InjectedBundle::shared().stringBuilder()->appendLiteral("main frame \""); InjectedBundle::shared().stringBuilder()->append(toWTFString(name)); - InjectedBundle::shared().stringBuilder()->append("\""); + InjectedBundle::shared().stringBuilder()->append('"'); return; } if (WKStringIsEmpty(name.get())) { - InjectedBundle::shared().stringBuilder()->append("frame (anonymous)"); + InjectedBundle::shared().stringBuilder()->appendLiteral("frame (anonymous)"); return; } - InjectedBundle::shared().stringBuilder()->append("frame \""); + InjectedBundle::shared().stringBuilder()->appendLiteral("frame \""); InjectedBundle::shared().stringBuilder()->append(toWTFString(name)); - InjectedBundle::shared().stringBuilder()->append("\""); + InjectedBundle::shared().stringBuilder()->append('"'); } static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request) @@ -456,32 +467,32 @@ static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef r WKRetainPtr<WKURLRef> firstParty = adoptWK(WKURLRequestCopyFirstPartyForCookies(request)); WKRetainPtr<WKStringRef> httpMethod = adoptWK(WKURLRequestCopyHTTPMethod(request)); - InjectedBundle::shared().stringBuilder()->append("<NSURLRequest URL "); + InjectedBundle::shared().stringBuilder()->appendLiteral("<NSURLRequest URL "); InjectedBundle::shared().stringBuilder()->append(pathSuitableForTestResult(url.get())); - InjectedBundle::shared().stringBuilder()->append(", main document URL "); + InjectedBundle::shared().stringBuilder()->appendLiteral(", main document URL "); InjectedBundle::shared().stringBuilder()->append(urlSuitableForTestResult(firstParty.get())); - InjectedBundle::shared().stringBuilder()->append(", http method "); + InjectedBundle::shared().stringBuilder()->appendLiteral(", http method "); if (WKStringIsEmpty(httpMethod.get())) - InjectedBundle::shared().stringBuilder()->append("(none)"); + InjectedBundle::shared().stringBuilder()->appendLiteral("(none)"); else InjectedBundle::shared().stringBuilder()->append(toWTFString(httpMethod)); - InjectedBundle::shared().stringBuilder()->append(">"); + InjectedBundle::shared().stringBuilder()->append('>'); } static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response) { WKRetainPtr<WKURLRef> url = adoptWK(WKURLResponseCopyURL(response)); if (!url) { - InjectedBundle::shared().stringBuilder()->append("(null)"); + InjectedBundle::shared().stringBuilder()->appendLiteral("(null)"); return; } - InjectedBundle::shared().stringBuilder()->append("<NSURLResponse "); + InjectedBundle::shared().stringBuilder()->appendLiteral("<NSURLResponse "); InjectedBundle::shared().stringBuilder()->append(pathSuitableForTestResult(url.get())); - InjectedBundle::shared().stringBuilder()->append(", http status code "); - InjectedBundle::shared().stringBuilder()->append(WTF::String::number(WKURLResponseHTTPStatusCode(response))); - InjectedBundle::shared().stringBuilder()->append(">"); + InjectedBundle::shared().stringBuilder()->appendLiteral(", http status code "); + InjectedBundle::shared().stringBuilder()->appendNumber(WKURLResponseHTTPStatusCode(response)); + InjectedBundle::shared().stringBuilder()->append('>'); } static inline void dumpErrorDescriptionSuitableForTestResult(WKErrorRef error) @@ -498,20 +509,20 @@ static inline void dumpErrorDescriptionSuitableForTestResult(WKErrorRef error) if (WKStringIsEqualToUTF8CString(errorDomain.get(), "WebKitPolicyError")) errorDomain = adoptWK(WKStringCreateWithUTF8CString("WebKitErrorDomain")); - InjectedBundle::shared().stringBuilder()->append("<NSError domain "); + InjectedBundle::shared().stringBuilder()->appendLiteral("<NSError domain "); InjectedBundle::shared().stringBuilder()->append(toWTFString(errorDomain)); - InjectedBundle::shared().stringBuilder()->append(", code "); - InjectedBundle::shared().stringBuilder()->append(String::number(errorCode)); + InjectedBundle::shared().stringBuilder()->appendLiteral(", code "); + InjectedBundle::shared().stringBuilder()->appendNumber(errorCode); WKRetainPtr<WKURLRef> url = adoptWK(WKErrorCopyFailingURL(error)); if (url.get()) { WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyString(url.get())); - InjectedBundle::shared().stringBuilder()->append(", failing URL \""); + InjectedBundle::shared().stringBuilder()->appendLiteral(", failing URL \""); InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString)); - InjectedBundle::shared().stringBuilder()->append("\""); + InjectedBundle::shared().stringBuilder()->append('"'); } - InjectedBundle::shared().stringBuilder()->append(">"); + InjectedBundle::shared().stringBuilder()->append('>'); } void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void *clientInfo) @@ -550,28 +561,28 @@ void InjectedBundlePage::didReceiveIntentForFrame(WKBundlePageRef page, WKBundle static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->m_currentIntentRequest = intentRequest; WKRetainPtr<WKBundleIntentRef> intent(AdoptWK, WKBundleIntentRequestCopyIntent(intentRequest)); - InjectedBundle::shared().stringBuilder()->append("Received Web Intent: action="); + InjectedBundle::shared().stringBuilder()->appendLiteral("Received Web Intent: action="); WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKBundleIntentCopyAction(intent.get())); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkAction.get())); - InjectedBundle::shared().stringBuilder()->append(" type="); + InjectedBundle::shared().stringBuilder()->appendLiteral(" type="); WKRetainPtr<WKStringRef> wkType(AdoptWK, WKBundleIntentCopyType(intent.get())); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkType.get())); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); const size_t numMessagePorts = WKBundleIntentMessagePortCount(intent.get()); if (numMessagePorts) { - InjectedBundle::shared().stringBuilder()->append("Have "); - InjectedBundle::shared().stringBuilder()->append(WTF::String::number(numMessagePorts)); - InjectedBundle::shared().stringBuilder()->append(" ports\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("Have "); + InjectedBundle::shared().stringBuilder()->appendNumber(numMessagePorts); + InjectedBundle::shared().stringBuilder()->appendLiteral(" ports\n"); } WKRetainPtr<WKURLRef> wkServiceUrl(AdoptWK, WKBundleIntentCopyService(intent.get())); if (wkServiceUrl) { WKRetainPtr<WKStringRef> wkService(AdoptWK, WKURLCopyString(wkServiceUrl.get())); if (wkService && !WKStringIsEmpty(wkService.get())) { - InjectedBundle::shared().stringBuilder()->append("Explicit intent service: "); + InjectedBundle::shared().stringBuilder()->appendLiteral("Explicit intent service: "); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkService.get())); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } } @@ -581,20 +592,20 @@ void InjectedBundlePage::didReceiveIntentForFrame(WKBundlePageRef page, WKBundle for (size_t i = 0; i < numExtraKeys; ++i) { WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkExtraKeys.get(), i)); WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(wkExtras.get(), wkKey)); - InjectedBundle::shared().stringBuilder()->append("Extras["); + InjectedBundle::shared().stringBuilder()->appendLiteral("Extras["); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkKey)); - InjectedBundle::shared().stringBuilder()->append("] = "); + InjectedBundle::shared().stringBuilder()->appendLiteral("] = "); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkValue)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } WKRetainPtr<WKArrayRef> wkSuggestions(AdoptWK, WKBundleIntentCopySuggestions(intent.get())); const size_t numSuggestions = WKArrayGetSize(wkSuggestions.get()); for (size_t i = 0; i < numSuggestions; ++i) { WKStringRef wkSuggestion = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkSuggestions.get(), i)); - InjectedBundle::shared().stringBuilder()->append("Have suggestion "); + InjectedBundle::shared().stringBuilder()->appendLiteral("Have suggestion "); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkSuggestion)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } #endif } @@ -602,22 +613,22 @@ void InjectedBundlePage::didReceiveIntentForFrame(WKBundlePageRef page, WKBundle void InjectedBundlePage::registerIntentServiceForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo) { #if ENABLE(WEB_INTENTS_TAG) - InjectedBundle::shared().stringBuilder()->append("Registered Web Intent Service: action="); + InjectedBundle::shared().stringBuilder()->appendLiteral("Registered Web Intent Service: action="); WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentServiceInfoCopyAction(serviceInfo)); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkAction.get())); - InjectedBundle::shared().stringBuilder()->append(" type="); + InjectedBundle::shared().stringBuilder()->appendLiteral(" type="); WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentServiceInfoCopyType(serviceInfo)); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkType.get())); - InjectedBundle::shared().stringBuilder()->append(" title="); + InjectedBundle::shared().stringBuilder()->appendLiteral(" title="); WKRetainPtr<WKStringRef> wkTitle(AdoptWK, WKIntentServiceInfoCopyTitle(serviceInfo)); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkTitle.get())); - InjectedBundle::shared().stringBuilder()->append(" url="); + InjectedBundle::shared().stringBuilder()->appendLiteral(" url="); WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKIntentServiceInfoCopyHref(serviceInfo)); InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKURLCopyString(wkUrl.get())))); - InjectedBundle::shared().stringBuilder()->append(" disposition="); + InjectedBundle::shared().stringBuilder()->appendLiteral(" disposition="); WKRetainPtr<WKStringRef> wkDisposition(AdoptWK, WKIntentServiceInfoCopyDisposition(serviceInfo)); InjectedBundle::shared().stringBuilder()->append(toWTFString(wkDisposition.get())); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); #endif } @@ -718,7 +729,7 @@ void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame) if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didStartProvisionalLoadForFrame\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didStartProvisionalLoadForFrame\n"); } if (InjectedBundle::shared().topLoadingFrame()) @@ -735,7 +746,7 @@ void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBu return; dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didReceiveServerRedirectForProvisionalLoadForFrame\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didReceiveServerRedirectForProvisionalLoadForFrame\n"); } void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef error) @@ -762,7 +773,7 @@ void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame) return; dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didCommitLoadForFrame\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didCommitLoadForFrame\n"); } void InjectedBundlePage::didFinishProgress() @@ -773,7 +784,7 @@ void InjectedBundlePage::didFinishProgress() if (!InjectedBundle::shared().testRunner()->shouldDumpProgressFinishedCallback()) return; - InjectedBundle::shared().stringBuilder()->append("postProgressFinishedNotification\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("postProgressFinishedNotification\n"); } enum FrameNamePolicy { ShouldNotIncludeFrameName, ShouldIncludeFrameName }; @@ -785,15 +796,15 @@ static void dumpFrameScrollPosition(WKBundleFrameRef frame, FrameNamePolicy shou if (fabs(x) > 0.00000001 || fabs(y) > 0.00000001) { if (shouldIncludeFrameName) { WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); - InjectedBundle::shared().stringBuilder()->append("frame '"); + InjectedBundle::shared().stringBuilder()->appendLiteral("frame '"); InjectedBundle::shared().stringBuilder()->append(toWTFString(name)); - InjectedBundle::shared().stringBuilder()->append("' "); + InjectedBundle::shared().stringBuilder()->appendLiteral("' "); } - InjectedBundle::shared().stringBuilder()->append("scrolled to "); + InjectedBundle::shared().stringBuilder()->appendLiteral("scrolled to "); InjectedBundle::shared().stringBuilder()->append(WTF::String::number(x)); - InjectedBundle::shared().stringBuilder()->append(","); + InjectedBundle::shared().stringBuilder()->append(','); InjectedBundle::shared().stringBuilder()->append(WTF::String::number(y)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } } @@ -849,7 +860,7 @@ static void dumpFrameText(WKBundleFrameRef frame) WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyInnerText(frame)); InjectedBundle::shared().stringBuilder()->append(toWTFString(text)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } static void dumpDescendantFramesText(WKBundleFrameRef frame) @@ -859,9 +870,9 @@ static void dumpDescendantFramesText(WKBundleFrameRef frame) for (size_t i = 0; i < size; ++i) { WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i)); WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe)); - InjectedBundle::shared().stringBuilder()->append("\n--------\nFrame: '"); + InjectedBundle::shared().stringBuilder()->appendLiteral("\n--------\nFrame: '"); InjectedBundle::shared().stringBuilder()->append(toWTFString(subframeName)); - InjectedBundle::shared().stringBuilder()->append("'\n--------\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("'\n--------\n"); dumpFrameText(subframe); dumpDescendantFramesText(subframe); } @@ -927,7 +938,7 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame) if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didFinishLoadForFrame\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFinishLoadForFrame\n"); } if (frame != InjectedBundle::shared().topLoadingFrame()) @@ -962,17 +973,17 @@ void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFram if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didReceiveTitle: "); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didReceiveTitle: "); InjectedBundle::shared().stringBuilder()->append(toWTFString(title)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } if (!InjectedBundle::shared().testRunner()->shouldDumpTitleChanges()) return; - InjectedBundle::shared().stringBuilder()->append("TITLE CHANGED: "); + InjectedBundle::shared().stringBuilder()->appendLiteral("TITLE CHANGED: "); InjectedBundle::shared().stringBuilder()->append(toWTFString(title)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world) @@ -1011,7 +1022,7 @@ void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundleFrameRef frame) return; dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didCancelClientRedirectForFrame\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didCancelClientRedirectForFrame\n"); } void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundleFrameRef frame, WKURLRef url, double delay, double date) @@ -1023,9 +1034,9 @@ void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundleFrameRef fram return; dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - willPerformClientRedirectToURL: "); - InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKURLCopyString(url)))); - InjectedBundle::shared().stringBuilder()->append(" \n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - willPerformClientRedirectToURL: "); + InjectedBundle::shared().stringBuilder()->append(pathSuitableForTestResult(url)); + InjectedBundle::shared().stringBuilder()->appendLiteral(" \n"); } void InjectedBundlePage::didSameDocumentNavigationForFrame(WKBundleFrameRef frame, WKSameDocumentNavigationType type) @@ -1039,15 +1050,15 @@ void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundleFrameRef frame) if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didFinishDocumentLoadForFrame\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFinishDocumentLoadForFrame\n"); } unsigned pendingFrameUnloadEvents = WKBundleFrameGetPendingUnloadCount(frame); if (pendingFrameUnloadEvents) { InjectedBundle::shared().stringBuilder()->append(frameToStr(frame)); - InjectedBundle::shared().stringBuilder()->append(" - has "); - InjectedBundle::shared().stringBuilder()->append(WTF::String::number(pendingFrameUnloadEvents)); - InjectedBundle::shared().stringBuilder()->append(" onunload handler(s)\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - has "); + InjectedBundle::shared().stringBuilder()->appendNumber(pendingFrameUnloadEvents); + InjectedBundle::shared().stringBuilder()->appendLiteral(" onunload handler(s)\n"); } } @@ -1058,20 +1069,26 @@ void InjectedBundlePage::didHandleOnloadEventsForFrame(WKBundleFrameRef frame) if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) { dumpFrameDescriptionSuitableForTestResult(frame); - InjectedBundle::shared().stringBuilder()->append(" - didHandleOnloadEventsForFrame\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didHandleOnloadEventsForFrame\n"); } } void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundleFrameRef frame) { + if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) + InjectedBundle::shared().stringBuilder()->appendLiteral("didDisplayInsecureContent\n"); } void InjectedBundlePage::didRunInsecureContentForFrame(WKBundleFrameRef frame) { + if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) + InjectedBundle::shared().stringBuilder()->appendLiteral("didRunInsecureContent\n"); } void InjectedBundlePage::didDetectXSSForFrame(WKBundleFrameRef frame) { + if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) + InjectedBundle::shared().stringBuilder()->appendLiteral("didDetectXSS\n"); } void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef request, bool) @@ -1105,14 +1122,12 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef, WKB if (InjectedBundle::shared().isTestRunning() && InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) { - InjectedBundle::shared().stringBuilder()->append(assignedUrlsCache.contains(identifier) - ? assignedUrlsCache.get(identifier) - : "<unknown>"); - InjectedBundle::shared().stringBuilder()->append(" - willSendRequest "); + dumpResourceURL(identifier); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - willSendRequest "); dumpRequestDescriptionSuitableForTestResult(request); - InjectedBundle::shared().stringBuilder()->append(" redirectResponse "); + InjectedBundle::shared().stringBuilder()->appendLiteral(" redirectResponse "); dumpResponseDescriptionSuitableForTestResult(response); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request)); @@ -1135,9 +1150,9 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef, WKB mainFrameIsExternal = isHTTPOrHTTPSScheme(mainFrameScheme.get()) && !isLocalHost(mainFrameHost.get()); } if (!mainFrameIsExternal) { - InjectedBundle::shared().stringBuilder()->append("Blocked access to external URL "); + InjectedBundle::shared().stringBuilder()->appendLiteral("Blocked access to external URL "); InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); return 0; } } @@ -1152,12 +1167,10 @@ void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundle return; if (InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) { - InjectedBundle::shared().stringBuilder()->append(assignedUrlsCache.contains(identifier) - ? assignedUrlsCache.get(identifier) - : "<unknown>"); - InjectedBundle::shared().stringBuilder()->append(" - didReceiveResponse "); + dumpResourceURL(identifier); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didReceiveResponse "); dumpResponseDescriptionSuitableForTestResult(response); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } @@ -1169,9 +1182,9 @@ void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundle WKRetainPtr<WKStringRef> mimeTypeString = adoptWK(WKURLResponseCopyMIMEType(response)); InjectedBundle::shared().stringBuilder()->append(toWTFString(urlString)); - InjectedBundle::shared().stringBuilder()->append(" has MIME type "); + InjectedBundle::shared().stringBuilder()->appendLiteral(" has MIME type "); InjectedBundle::shared().stringBuilder()->append(toWTFString(mimeTypeString)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } void InjectedBundlePage::didReceiveContentLengthForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, uint64_t) @@ -1186,10 +1199,8 @@ void InjectedBundlePage::didFinishLoadForResource(WKBundlePageRef, WKBundleFrame if (!InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) return; - InjectedBundle::shared().stringBuilder()->append(assignedUrlsCache.contains(identifier) - ? assignedUrlsCache.get(identifier) - : "<unknown>"); - InjectedBundle::shared().stringBuilder()->append(" - didFinishLoading\n"); + dumpResourceURL(identifier); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFinishLoading\n"); } void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKErrorRef error) @@ -1200,13 +1211,11 @@ void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRe if (!InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) return; - InjectedBundle::shared().stringBuilder()->append(assignedUrlsCache.contains(identifier) - ? assignedUrlsCache.get(identifier) - : "<unknown>"); - InjectedBundle::shared().stringBuilder()->append(" - didFailLoadingWithError: "); + dumpResourceURL(identifier); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailLoadingWithError: "); dumpErrorDescriptionSuitableForTestResult(error); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } bool InjectedBundlePage::shouldCacheResponse(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier) @@ -1217,8 +1226,8 @@ bool InjectedBundlePage::shouldCacheResponse(WKBundlePageRef, WKBundleFrameRef, if (!InjectedBundle::shared().testRunner()->shouldDumpWillCacheResponse()) return true; - InjectedBundle::shared().stringBuilder()->append(WTF::String::number(identifier)); - InjectedBundle::shared().stringBuilder()->append(" - willCacheResponse: called\n"); + InjectedBundle::shared().stringBuilder()->appendNumber(identifier); + InjectedBundle::shared().stringBuilder()->appendLiteral(" - willCacheResponse: called\n"); // The default behavior is the cache the response. return true; @@ -1255,23 +1264,21 @@ WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForNavigationAction(WKB if (!InjectedBundle::shared().testRunner()->isPolicyDelegateEnabled()) return WKBundlePagePolicyActionUse; - if (InjectedBundle::shared().testRunner()->waitToDump()) { - WKRetainPtr<WKStringRef> url = adoptWK(WKURLCopyString(WKURLRequestCopyURL(request))); - InjectedBundle::shared().stringBuilder()->append("Policy delegate: attempt to load "); - InjectedBundle::shared().stringBuilder()->append(toWTFString(url)); - InjectedBundle::shared().stringBuilder()->append(" with navigation type \'"); - InjectedBundle::shared().stringBuilder()->append(toWTFString(NavigationTypeToString(WKBundleNavigationActionGetNavigationType(navigationAction)))); - InjectedBundle::shared().stringBuilder()->append("\'"); - WKBundleHitTestResultRef hitTestResultRef = WKBundleNavigationActionCopyHitTestResult(navigationAction); - if (hitTestResultRef) { - InjectedBundle::shared().stringBuilder()->append(" originating from "); - InjectedBundle::shared().stringBuilder()->append(dumpPath(m_page, m_world.get(), WKBundleHitTestResultCopyNodeHandle(hitTestResultRef))); - } - - InjectedBundle::shared().stringBuilder()->append("\n"); - InjectedBundle::shared().testRunner()->notifyDone(); + WKRetainPtr<WKStringRef> url = adoptWK(WKURLCopyString(WKURLRequestCopyURL(request))); + InjectedBundle::shared().stringBuilder()->appendLiteral("Policy delegate: attempt to load "); + InjectedBundle::shared().stringBuilder()->append(toWTFString(url)); + InjectedBundle::shared().stringBuilder()->appendLiteral(" with navigation type \'"); + InjectedBundle::shared().stringBuilder()->append(toWTFString(NavigationTypeToString(WKBundleNavigationActionGetNavigationType(navigationAction)))); + InjectedBundle::shared().stringBuilder()->appendLiteral("\'"); + WKBundleHitTestResultRef hitTestResultRef = WKBundleNavigationActionCopyHitTestResult(navigationAction); + if (hitTestResultRef) { + InjectedBundle::shared().stringBuilder()->appendLiteral(" originating from "); + InjectedBundle::shared().stringBuilder()->append(dumpPath(m_page, m_world.get(), WKBundleHitTestResultCopyNodeHandle(hitTestResultRef))); } + InjectedBundle::shared().stringBuilder()->append('\n'); + InjectedBundle::shared().testRunner()->notifyDone(); + if (InjectedBundle::shared().testRunner()->isPolicyDelegatePermissive()) return WKBundlePagePolicyActionUse; return WKBundlePagePolicyActionPassThrough; @@ -1318,6 +1325,11 @@ void InjectedBundlePage::willRunJavaScriptPrompt(WKBundlePageRef page, WKStringR static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptPrompt(message, defaultValue, frame); } +void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReachApplicationCacheOriginQuota(origin, totalBytesNeeded); +} + static WTF::String lastFileURLPathComponent(const WTF::String& path) { size_t pos = path.find("file://"); @@ -1349,14 +1361,14 @@ void InjectedBundlePage::willAddMessageToConsole(WKStringRef message, uint32_t l // FIXME: The code below does not handle additional text after url nor multiple urls. This matches DumpRenderTree implementation. messageString = messageString.substring(0, fileProtocolStart) + lastFileURLPathComponent(messageString.substring(fileProtocolStart)); - InjectedBundle::shared().stringBuilder()->append("CONSOLE MESSAGE: "); + InjectedBundle::shared().stringBuilder()->appendLiteral("CONSOLE MESSAGE: "); if (lineNumber) { - InjectedBundle::shared().stringBuilder()->append("line "); - InjectedBundle::shared().stringBuilder()->append(WTF::String::number(lineNumber)); - InjectedBundle::shared().stringBuilder()->append(": "); + InjectedBundle::shared().stringBuilder()->appendLiteral("line "); + InjectedBundle::shared().stringBuilder()->appendNumber(lineNumber); + InjectedBundle::shared().stringBuilder()->appendLiteral(": "); } InjectedBundle::shared().stringBuilder()->append(messageString); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } @@ -1368,9 +1380,9 @@ void InjectedBundlePage::willSetStatusbarText(WKStringRef statusbarText) if (!InjectedBundle::shared().testRunner()->shouldDumpStatusCallbacks()) return; - InjectedBundle::shared().stringBuilder()->append("UI DELEGATE STATUS CALLBACK: setStatusText:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE STATUS CALLBACK: setStatusText:"); InjectedBundle::shared().stringBuilder()->append(toWTFString(statusbarText)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } void InjectedBundlePage::willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef) @@ -1378,9 +1390,9 @@ void InjectedBundlePage::willRunJavaScriptAlert(WKStringRef message, WKBundleFra if (!InjectedBundle::shared().isTestRunning()) return; - InjectedBundle::shared().stringBuilder()->append("ALERT: "); + InjectedBundle::shared().stringBuilder()->appendLiteral("ALERT: "); InjectedBundle::shared().stringBuilder()->append(toWTFString(message)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } void InjectedBundlePage::willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef) @@ -1388,18 +1400,46 @@ void InjectedBundlePage::willRunJavaScriptConfirm(WKStringRef message, WKBundleF if (!InjectedBundle::shared().isTestRunning()) return; - InjectedBundle::shared().stringBuilder()->append("CONFIRM: "); + InjectedBundle::shared().stringBuilder()->appendLiteral("CONFIRM: "); InjectedBundle::shared().stringBuilder()->append(toWTFString(message)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef) { - InjectedBundle::shared().stringBuilder()->append("PROMPT: "); + InjectedBundle::shared().stringBuilder()->appendLiteral("PROMPT: "); InjectedBundle::shared().stringBuilder()->append(toWTFString(message)); - InjectedBundle::shared().stringBuilder()->append(", default text: "); + InjectedBundle::shared().stringBuilder()->appendLiteral(", default text: "); InjectedBundle::shared().stringBuilder()->append(toWTFString(defaultValue)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); +} + +void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKSecurityOriginRef origin, int64_t totalBytesNeeded) +{ + if (!InjectedBundle::shared().testRunner()->shouldDumpApplicationCacheDelegateCallbacks()) + return; + + // For example, numbers from 30000 - 39999 will output as 30000. + // Rounding up or down does not really matter for these tests. It's + // sufficient to just get a range of 10000 to determine if we were + // above or below a threshold. + int64_t truncatedSpaceNeeded = (totalBytesNeeded / 10000) * 10000; + + InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{"); + InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin)))); + InjectedBundle::shared().stringBuilder()->appendLiteral(", "); + InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyHost(origin)))); + InjectedBundle::shared().stringBuilder()->appendLiteral(", "); + InjectedBundle::shared().stringBuilder()->appendNumber(WKSecurityOriginGetPort(origin)); + InjectedBundle::shared().stringBuilder()->appendLiteral("} totalSpaceNeeded:~"); + InjectedBundle::shared().stringBuilder()->appendNumber(truncatedSpaceNeeded); + InjectedBundle::shared().stringBuilder()->append('\n'); + + if (InjectedBundle::shared().testRunner()->shouldDisallowIncreaseForApplicationCacheQuota()) + return; + + // Reset default application cache quota. + WKBundleResetApplicationCacheOriginQuota(InjectedBundle::shared().bundle(), adoptWK(WKSecurityOriginCopyToString(origin)).get()); } // Editor Client Callbacks @@ -1465,9 +1505,9 @@ bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeHandleRef range) return true; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldBeginEditingInDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldBeginEditingInDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); } @@ -1478,9 +1518,9 @@ bool InjectedBundlePage::shouldEndEditing(WKBundleRangeHandleRef range) return true; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldEndEditingInDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldEndEditingInDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); } @@ -1497,13 +1537,13 @@ bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRa }; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldInsertNode:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldInsertNode:"); InjectedBundle::shared().stringBuilder()->append(dumpPath(m_page, m_world.get(), node)); - InjectedBundle::shared().stringBuilder()->append(" replacingDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" replacingDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), rangeToReplace)); - InjectedBundle::shared().stringBuilder()->append(" givenAction:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" givenAction:"); InjectedBundle::shared().stringBuilder()->append(insertactionstring[action]); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); } @@ -1520,13 +1560,13 @@ bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeHandleR }; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldInsertText:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldInsertText:"); InjectedBundle::shared().stringBuilder()->append(toWTFString(text)); - InjectedBundle::shared().stringBuilder()->append(" replacingDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" replacingDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), rangeToReplace)); - InjectedBundle::shared().stringBuilder()->append(" givenAction:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" givenAction:"); InjectedBundle::shared().stringBuilder()->append(insertactionstring[action]); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); } @@ -1537,9 +1577,9 @@ bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeHandleRef range) return true; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldDeleteDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldDeleteDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); } @@ -1559,15 +1599,15 @@ bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeHandleRef fromRa }; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldChangeSelectedDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldChangeSelectedDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), fromRange)); - InjectedBundle::shared().stringBuilder()->append(" toDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" toDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), toRange)); - InjectedBundle::shared().stringBuilder()->append(" affinity:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" affinity:"); InjectedBundle::shared().stringBuilder()->append(affinitystring[affinity]); - InjectedBundle::shared().stringBuilder()->append(" stillSelecting:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" stillSelecting:"); InjectedBundle::shared().stringBuilder()->append(boolstring[stillSelecting]); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); } @@ -1578,11 +1618,11 @@ bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, return true; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: shouldApplyStyle:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: shouldApplyStyle:"); InjectedBundle::shared().stringBuilder()->append(styleDecToStr(style)); - InjectedBundle::shared().stringBuilder()->append(" toElementsInDOMRange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" toElementsInDOMRange:"); InjectedBundle::shared().stringBuilder()->append(rangeToStr(m_page, m_world.get(), range)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); } @@ -1593,9 +1633,9 @@ void InjectedBundlePage::didBeginEditing(WKStringRef notificationName) return; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidBeginEditing:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidBeginEditing:"); InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } } @@ -1605,9 +1645,9 @@ void InjectedBundlePage::didEndEditing(WKStringRef notificationName) return; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidEndEditing:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidEndEditing:"); InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } } @@ -1617,9 +1657,9 @@ void InjectedBundlePage::didChange(WKStringRef notificationName) return; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidChange:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidChange:"); InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } } @@ -1629,9 +1669,9 @@ void InjectedBundlePage::didChangeSelection(WKStringRef notificationName) return; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { - InjectedBundle::shared().stringBuilder()->append("EDITING DELEGATE: webViewDidChangeSelection:"); + InjectedBundle::shared().stringBuilder()->appendLiteral("EDITING DELEGATE: webViewDidChangeSelection:"); InjectedBundle::shared().stringBuilder()->append(toWTFString(notificationName)); - InjectedBundle::shared().stringBuilder()->append("\n"); + InjectedBundle::shared().stringBuilder()->append('\n'); } } @@ -1639,14 +1679,14 @@ void InjectedBundlePage::didChangeSelection(WKStringRef notificationName) bool InjectedBundlePage::supportsFullScreen(WKBundlePageRef pageRef, WKFullScreenKeyboardRequestType requestType) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) - InjectedBundle::shared().stringBuilder()->append("supportsFullScreen() == true\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("supportsFullScreen() == true\n"); return true; } void InjectedBundlePage::enterFullScreenForElement(WKBundlePageRef pageRef, WKBundleNodeHandleRef elementRef) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) - InjectedBundle::shared().stringBuilder()->append("enterFullScreenForElement()\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("enterFullScreenForElement()\n"); if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { WKBundlePageWillEnterFullScreen(pageRef); @@ -1657,7 +1697,7 @@ void InjectedBundlePage::enterFullScreenForElement(WKBundlePageRef pageRef, WKBu void InjectedBundlePage::exitFullScreenForElement(WKBundlePageRef pageRef, WKBundleNodeHandleRef elementRef) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) - InjectedBundle::shared().stringBuilder()->append("exitFullScreenForElement()\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("exitFullScreenForElement()\n"); if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { WKBundlePageWillExitFullScreen(pageRef); @@ -1668,19 +1708,19 @@ void InjectedBundlePage::exitFullScreenForElement(WKBundlePageRef pageRef, WKBun void InjectedBundlePage::beganEnterFullScreen(WKBundlePageRef, WKRect, WKRect) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) - InjectedBundle::shared().stringBuilder()->append("beganEnterFullScreen()\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("beganEnterFullScreen()\n"); } void InjectedBundlePage::beganExitFullScreen(WKBundlePageRef, WKRect, WKRect) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) - InjectedBundle::shared().stringBuilder()->append("beganExitFullScreen()\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("beganExitFullScreen()\n"); } void InjectedBundlePage::closeFullScreen(WKBundlePageRef pageRef) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) - InjectedBundle::shared().stringBuilder()->append("closeFullScreen()\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("closeFullScreen()\n"); if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { WKBundlePageWillExitFullScreen(pageRef); @@ -1698,7 +1738,7 @@ static void dumpBackForwardListItem(WKBundleBackForwardListItemRef item, unsigne { unsigned column = 0; if (isCurrentItem) { - InjectedBundle::shared().stringBuilder()->append("curr->"); + InjectedBundle::shared().stringBuilder()->appendLiteral("curr->"); column = 6; } for (unsigned i = column; i < indent; i++) @@ -1712,21 +1752,21 @@ static void dumpBackForwardListItem(WKBundleBackForwardListItemRef item, unsigne start = 0; else start += directoryName.length(); - InjectedBundle::shared().stringBuilder()->append("(file test):"); + InjectedBundle::shared().stringBuilder()->appendLiteral("(file test):"); InjectedBundle::shared().stringBuilder()->append(url.substring(start)); } else InjectedBundle::shared().stringBuilder()->append(url); WTF::String target = toWTFString(adoptWK(WKBundleBackForwardListItemCopyTarget(item))); if (target.length()) { - InjectedBundle::shared().stringBuilder()->append(" (in frame \""); + InjectedBundle::shared().stringBuilder()->appendLiteral(" (in frame \""); InjectedBundle::shared().stringBuilder()->append(target); - InjectedBundle::shared().stringBuilder()->append("\")"); + InjectedBundle::shared().stringBuilder()->appendLiteral("\")"); } // FIXME: Need WKBackForwardListItemIsTargetItem. if (WKBundleBackForwardListItemIsTargetItem(item)) - InjectedBundle::shared().stringBuilder()->append(" **nav target**"); + InjectedBundle::shared().stringBuilder()->appendLiteral(" **nav target**"); InjectedBundle::shared().stringBuilder()->append('\n'); @@ -1744,7 +1784,7 @@ static void dumpBackForwardListItem(WKBundleBackForwardListItemRef item, unsigne void InjectedBundlePage::dumpBackForwardList() { - InjectedBundle::shared().stringBuilder()->append("\n============== Back Forward List ==============\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("\n============== Back Forward List ==============\n"); WKBundleBackForwardListRef list = WKBundlePageGetBackForwardList(m_page); @@ -1775,7 +1815,7 @@ void InjectedBundlePage::dumpBackForwardList() for (int i = itemsToPrint.size() - 1; i >= 0; i--) dumpBackForwardListItem(itemsToPrint[i].get(), 8, i == currentItemIndex); - InjectedBundle::shared().stringBuilder()->append("===============================================\n"); + InjectedBundle::shared().stringBuilder()->appendLiteral("===============================================\n"); } } // namespace WTR diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index 3ad203d13..370f427f9 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -124,11 +124,13 @@ private: static void willRunJavaScriptAlert(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo); static void willRunJavaScriptConfirm(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo); static void willRunJavaScriptPrompt(WKBundlePageRef, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo); + static void didReachApplicationCacheOriginQuota(WKBundlePageRef, WKSecurityOriginRef, int64_t totalBytesNeeded, const void* clientInfo); void willAddMessageToConsole(WKStringRef message, uint32_t lineNumber); void willSetStatusbarText(WKStringRef statusbarText); void willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef); void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef); void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef); + void didReachApplicationCacheOriginQuota(WKSecurityOriginRef, int64_t totalBytesNeeded); #if ENABLE(FULLSCREEN_API) // Full Screen client diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp index 373439d62..fa2db1b47 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp @@ -46,6 +46,8 @@ #include <WebKit2/WebKit2_C.h> #include <wtf/CurrentTime.h> #include <wtf/HashMap.h> +#include <wtf/OwnArrayPtr.h> +#include <wtf/PassOwnArrayPtr.h> #include <wtf/text/StringBuilder.h> #if ENABLE(WEB_INTENTS) @@ -55,9 +57,7 @@ namespace WTR { -// This is lower than DumpRenderTree's timeout, to make it easier to work through the failures -// Eventually it should be changed to match. -const double TestRunner::waitToDumpWatchdogTimerInterval = 6; +const double TestRunner::waitToDumpWatchdogTimerInterval = 30; PassRefPtr<TestRunner> TestRunner::create() { @@ -80,6 +80,8 @@ TestRunner::TestRunner() , m_dumpResourceLoadCallbacks(false) , m_dumpResourceResponseMIMETypes(false) , m_dumpWillCacheResponse(false) + , m_dumpApplicationCacheDelegateCallbacks(false) + , m_disallowIncreaseForApplicationCacheQuota(false) , m_waitToDump(false) , m_testRepaint(false) , m_testRepaintSweepHorizontally(false) @@ -323,6 +325,35 @@ void TestRunner::setApplicationCacheOriginQuota(unsigned long long bytes) WKBundleSetApplicationCacheOriginQuota(InjectedBundle::shared().bundle(), origin.get(), bytes); } +void TestRunner::disallowIncreaseForApplicationCacheQuota() +{ + m_disallowIncreaseForApplicationCacheQuota = true; +} + +static inline JSValueRef stringArrayToJS(JSContextRef context, WKArrayRef strings) +{ + const size_t count = WKArrayGetSize(strings); + + OwnArrayPtr<JSValueRef> jsStringsArray = adoptArrayPtr(new JSValueRef[count]); + for (size_t i = 0; i < count; ++i) { + WKStringRef stringRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(strings, i)); + JSRetainPtr<JSStringRef> stringJS = toJS(stringRef); + jsStringsArray[i] = JSValueMakeString(context, stringJS.get()); + } + + return JSObjectMakeArray(context, count, jsStringsArray.get(), 0); +} + +JSValueRef TestRunner::originsWithApplicationCache() +{ + WKRetainPtr<WKArrayRef> origins(AdoptWK, WKBundleCopyOriginsWithApplicationCache(InjectedBundle::shared().bundle())); + + WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page()); + JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); + + return stringArrayToJS(context, origins.get()); +} + bool TestRunner::isCommandEnabled(JSStringRef name) { return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get()); @@ -567,6 +598,11 @@ static void callTestRunnerCallback(unsigned index) JSValueUnprotect(context, callback); } +unsigned TestRunner::workerThreadCount() +{ + return WKBundleGetWorkerThreadCount(InjectedBundle::shared().bundle()); +} + void TestRunner::addChromeInputField(JSValueRef callback) { cacheTestRunnerCallback(AddChromeInputFieldCallbackID, callback); @@ -699,6 +735,11 @@ void TestRunner::setSpatialNavigationEnabled(bool enabled) WKBundleSetSpatialNavigationEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled); } +void TestRunner::setTabKeyCyclesThroughElements(bool enabled) +{ + WKBundleSetTabKeyCyclesThroughElements(InjectedBundle::shared().bundle(), InjectedBundle::shared().page()->page(), enabled); +} + void TestRunner::grantWebNotificationPermission(JSStringRef origin) { WKRetainPtr<WKStringRef> originWK = toWK(origin); @@ -724,4 +765,10 @@ void TestRunner::simulateWebNotificationClick(JSValueRef notification) InjectedBundle::shared().postSimulateWebNotificationClick(notificationID); } +bool TestRunner::callShouldCloseOnWebView() +{ + WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page()); + return WKBundleFrameCallShouldCloseOnWebView(mainFrame); +} + } // namespace WTR diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h index 54fb84708..674f19e1b 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h @@ -82,6 +82,7 @@ public: void dumpResourceLoadCallbacks() { m_dumpResourceLoadCallbacks = true; } void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; } void dumpWillCacheResponse() { m_dumpWillCacheResponse = true; } + void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; } void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; } void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; } @@ -108,6 +109,7 @@ public: void setUserStyleSheetLocation(JSStringRef); void setMinimumTimerInterval(double seconds); // Interval specified in seconds. void setSpatialNavigationEnabled(bool); + void setTabKeyCyclesThroughElements(bool); // Special DOM functions. JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element); @@ -149,6 +151,9 @@ public: void setAppCacheMaximumSize(uint64_t); long long applicationCacheDiskUsageForOrigin(JSStringRef origin); void setApplicationCacheOriginQuota(unsigned long long); + void disallowIncreaseForApplicationCacheQuota(); + bool shouldDisallowIncreaseForApplicationCacheQuota() { return m_disallowIncreaseForApplicationCacheQuota; } + JSValueRef originsWithApplicationCache(); // Printing bool isPageBoxVisible(int pageIndex); @@ -171,6 +176,7 @@ public: bool shouldDumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; } bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; } bool shouldDumpWillCacheResponse() const { return m_dumpWillCacheResponse; } + bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; } bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; } bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; } @@ -203,6 +209,8 @@ public: bool globalFlag() const { return m_globalFlag; } void setGlobalFlag(bool value) { m_globalFlag = value; } + + unsigned workerThreadCount(); void addChromeInputField(JSValueRef); void removeChromeInputField(JSValueRef); @@ -240,6 +248,8 @@ public: void setPageVisibility(JSStringRef state); void resetPageVisibility(); + bool callShouldCloseOnWebView(); + private: static const double waitToDumpWatchdogTimerInterval; @@ -265,6 +275,8 @@ private: bool m_dumpResourceLoadCallbacks; bool m_dumpResourceResponseMIMETypes; bool m_dumpWillCacheResponse; + bool m_dumpApplicationCacheDelegateCallbacks; + bool m_disallowIncreaseForApplicationCacheQuota; bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called. bool m_testRepaint; bool m_testRepaintSweepHorizontally; diff --git a/Tools/WebKitTestRunner/InjectedBundle/gtk/AccessibilityUIElementGtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/gtk/AccessibilityUIElementGtk.cpp index e83b784b2..659934685 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/gtk/AccessibilityUIElementGtk.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/gtk/AccessibilityUIElementGtk.cpp @@ -166,9 +166,10 @@ void AccessibilityUIElement::getChildrenWithRange(Vector<RefPtr<AccessibilityUIE int AccessibilityUIElement::childrenCount() { - Vector<RefPtr<AccessibilityUIElement> > children; - getChildren(children); - return children.size(); + if (!m_element) + return 0; + + return atk_object_get_n_accessible_children(ATK_OBJECT(m_element)); } PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::elementAtPoint(int x, int y) diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index 0179522cc..3da3880eb 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -223,6 +223,8 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WK 0, // mouseDidMoveOverElement 0, // decidePolicyForNotificationPermissionRequest 0, // unavailablePluginButtonClicked + 0, // showColorPicker + 0, // hideColorPicker }; WKPageSetPageUIClient(newPage, &otherPageUIClient); @@ -391,6 +393,8 @@ void TestController::initialize(int argc, const char* argv[]) 0, // mouseDidMoveOverElement decidePolicyForNotificationPermissionRequest, // decidePolicyForNotificationPermissionRequest 0, // unavailablePluginButtonClicked + 0, // showColorPicker + 0, // hideColorPicker }; WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient); diff --git a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp index a184f6df4..f68351d7b 100644 --- a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp +++ b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp @@ -85,13 +85,13 @@ static const char* getEnvironmentVariableOrExit(const char* variableName) void TestController::initializeInjectedBundlePath() { const char* bundlePath = getEnvironmentVariableOrExit("TEST_RUNNER_INJECTED_BUNDLE_FILENAME"); - m_injectedBundlePath = WKStringCreateWithUTF8CString(bundlePath); + m_injectedBundlePath.adopt(WKStringCreateWithUTF8CString(bundlePath)); } void TestController::initializeTestPluginDirectory() { const char* pluginPath = getEnvironmentVariableOrExit("TEST_RUNNER_PLUGIN_PATH"); - m_testPluginDirectory = WKStringCreateWithUTF8CString(pluginPath); + m_testPluginDirectory.adopt(WKStringCreateWithUTF8CString(pluginPath)); } void TestController::platformInitializeContext() diff --git a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp index 4a4cbec14..dedb18aa6 100644 --- a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp +++ b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp @@ -99,7 +99,7 @@ void TestController::initializeInjectedBundlePath() if (!isExistingLibrary(path)) qFatal("Cannot find the injected bundle at %s\n", qPrintable(path)); - m_injectedBundlePath = WKStringCreateWithQString(path); + m_injectedBundlePath.adopt(WKStringCreateWithQString(path)); } void TestController::initializeTestPluginDirectory() @@ -107,7 +107,7 @@ void TestController::initializeTestPluginDirectory() // FIXME: the test plugin cause some trouble for us, so we don't load it for the time being. // See: https://bugs.webkit.org/show_bug.cgi?id=86620 - // m_testPluginDirectory = WKStringCreateWithUTF8CString(qgetenv("QTWEBKIT_PLUGIN_PATH").constData()); + // m_testPluginDirectory.adopt(WKStringCreateWithUTF8CString(qgetenv("QTWEBKIT_PLUGIN_PATH").constData())); } void TestController::platformInitializeContext() |