Title: [153830] trunk
Revision
153830
Author
[email protected]
Date
2013-08-08 10:41:55 -0700 (Thu, 08 Aug 2013)

Log Message

        WTR::pathSuitableForTestResult should behave the same as _drt_descriptionSuitableForTestResult so we can unskip tests.
        https://bugs.webkit.org/show_bug.cgi?id=116125

        Reviewed by Tim Horton. Tweaked and re-landed by Alexey Proskuryakov.

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::pathSuitableForTestResult):
        Changed string operations to match _drt_descriptionSuitableForTestResult.
        (WTR::dumpRequestDescriptionSuitableForTestResult):
        (WTR::dumpResponseDescriptionSuitableForTestResult):
        (WTR::InjectedBundlePage::willPerformClientRedirectForFrame):
        (WTR::InjectedBundlePage::didInitiateLoadForResource):
        (WTR::InjectedBundlePage::willSendRequestForFrame):
        (WTR::InjectedBundlePage::didReceiveResponseForResource):
        Pass the main frame's URL to pathSuitableForTestResult.
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
        Added WKBundlePageRef to willPerformClientRedirectForFrame.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153829 => 153830)


--- trunk/LayoutTests/ChangeLog	2013-08-08 17:41:11 UTC (rev 153829)
+++ trunk/LayoutTests/ChangeLog	2013-08-08 17:41:55 UTC (rev 153830)
@@ -1,3 +1,11 @@
+2013-08-08  Alexey Proskuryakov  <[email protected]>
+
+        WTR::pathSuitableForTestResult should behave the same as _drt_descriptionSuitableForTestResult so we can unskip tests.
+        https://bugs.webkit.org/show_bug.cgi?id=116125
+
+        * platform/wk2/TestExpectations: Removed a test that now passes, added one that fails
+        (will look into that separately).
+
 2013-08-08  Zalan Bujtas  <[email protected]>
 
         REGRESSION (r121551) Incorrect handling of invalid media query list.

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (153829 => 153830)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2013-08-08 17:41:11 UTC (rev 153829)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2013-08-08 17:41:55 UTC (rev 153830)
@@ -271,6 +271,8 @@
 
 webkit.org/b/105952 fast/loader/submit-form-while-parsing-2.html [ Pass Failure ]
 
+webkit.org/b/116491 loader/go-back-cached-main-resource.html [ Failure ] 
+
 ### END OF (1) Classified failures with bug reports
 ########################################
 
@@ -433,8 +435,6 @@
 # Unexpected redirection happens.
 http/tests/loading/redirect-methods.html
 
-webkit.org/b/116125 webarchive/loading/test-loading-archive-subresource-null-mimetype.html [ Failure ]
-
 # Should pass now on ports other than EFL and GTK.
 # But it needs to be checked first.
 http/tests/loading/bad-scheme-subframe.html

Modified: trunk/Tools/ChangeLog (153829 => 153830)


--- trunk/Tools/ChangeLog	2013-08-08 17:41:11 UTC (rev 153829)
+++ trunk/Tools/ChangeLog	2013-08-08 17:41:55 UTC (rev 153830)
@@ -1,3 +1,23 @@
+2013-08-08  Alex Christensen  <[email protected]>
+
+        WTR::pathSuitableForTestResult should behave the same as _drt_descriptionSuitableForTestResult so we can unskip tests.
+        https://bugs.webkit.org/show_bug.cgi?id=116125
+
+        Reviewed by Tim Horton. Tweaked and re-landed by Alexey Proskuryakov.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::pathSuitableForTestResult):
+        Changed string operations to match _drt_descriptionSuitableForTestResult.
+        (WTR::dumpRequestDescriptionSuitableForTestResult):
+        (WTR::dumpResponseDescriptionSuitableForTestResult):
+        (WTR::InjectedBundlePage::willPerformClientRedirectForFrame):
+        (WTR::InjectedBundlePage::didInitiateLoadForResource):
+        (WTR::InjectedBundlePage::willSendRequestForFrame):
+        (WTR::InjectedBundlePage::didReceiveResponseForResource):
+        Pass the main frame's URL to pathSuitableForTestResult.
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+        Added WKBundlePageRef to willPerformClientRedirectForFrame.
+
 2013-08-07  Simon Fraser  <[email protected]>
 
         Allow the DumpRenderTree runloop to be idle while waiting for a test to complete

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (153829 => 153830)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2013-08-08 17:41:11 UTC (rev 153829)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2013-08-08 17:41:55 UTC (rev 153830)
@@ -235,7 +235,7 @@
 
 static const char divider = '/';
 
-static inline WTF::String pathSuitableForTestResult(WKURLRef fileUrl)
+static inline WTF::String pathSuitableForTestResult(WKURLRef fileUrl, WKURLRef mainFrameURL)
 {
     if (!fileUrl)
         return String();
@@ -245,39 +245,14 @@
         return toWTFString(adoptWK(WKURLCopyString(fileUrl)));
 
     String pathString = toWTFString(adoptWK(WKURLCopyPath(fileUrl)));
-    StringBuilder stringBuilder;
-
-    // Remove the leading path from file urls.
-    const size_t indexBaseName = pathString.reverseFind(divider);
-    if (indexBaseName != notFound) {
-        const size_t indexDirName = pathString.reverseFind(divider, indexBaseName - 1);
-        if (indexDirName != notFound)
-            stringBuilder.append(pathString.substring(indexDirName + 1, indexBaseName - indexDirName - 1));
-        stringBuilder.append(divider);
-        stringBuilder.append(pathString.substring(indexBaseName + 1)); // Filename.
-    } else {
-        stringBuilder.append(divider);
-        stringBuilder.append(pathString); // Return "/pathString".
-    }
-
-    return stringBuilder.toString();
+    String mainFrameURLPathString = toWTFString(adoptWK(WKURLCopyPath(mainFrameURL)));
+    String basePath = mainFrameURLPathString.substring(0, mainFrameURLPathString.reverseFind(divider) + 1);
+    
+    if (pathString.startsWith(basePath))
+        return pathString.substring(basePath.length());
+    return toWTFString(adoptWK(WKURLCopyString(fileUrl)));
 }
 
-static inline WTF::String urlSuitableForTestResult(WKURLRef fileUrl)
-{
-    if (!fileUrl)
-        return String();
-
-    WKRetainPtr<WKStringRef> schemeString = adoptWK(WKURLCopyScheme(fileUrl));
-    if (!isLocalFileScheme(schemeString.get()))
-        return toWTFString(adoptWK(WKURLCopyString(fileUrl)));
-
-    WTF::String urlString = toWTFString(adoptWK(WKURLCopyString(fileUrl)));
-    const size_t indexBaseName = urlString.reverseFind(divider);
-
-    return (indexBaseName == notFound) ? urlString : urlString.substring(indexBaseName + 1);
-}
-
 static HashMap<uint64_t, String> assignedUrlsCache;
 
 static inline void dumpResourceURL(uint64_t identifier, StringBuilder& stringBuilder)
@@ -493,16 +468,16 @@
     InjectedBundle::shared().outputText(stringBuilder.toString());
 }
 
-static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request, StringBuilder& stringBuilder)
+static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request, StringBuilder& stringBuilder, WKURLRef mainFrameURL)
 {
     WKRetainPtr<WKURLRef> url = ""
     WKRetainPtr<WKURLRef> firstParty = adoptWK(WKURLRequestCopyFirstPartyForCookies(request));
     WKRetainPtr<WKStringRef> httpMethod = adoptWK(WKURLRequestCopyHTTPMethod(request));
 
     stringBuilder.appendLiteral("<NSURLRequest URL ");
-    stringBuilder.append(pathSuitableForTestResult(url.get()));
+    stringBuilder.append(pathSuitableForTestResult(url.get(), mainFrameURL));
     stringBuilder.appendLiteral(", main document URL ");
-    stringBuilder.append(urlSuitableForTestResult(firstParty.get()));
+    stringBuilder.append(pathSuitableForTestResult(firstParty.get(), mainFrameURL));
     stringBuilder.appendLiteral(", http method ");
 
     if (WKStringIsEmpty(httpMethod.get()))
@@ -513,7 +488,7 @@
     stringBuilder.append('>');
 }
 
-static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response, StringBuilder& stringBuilder)
+static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response, StringBuilder& stringBuilder, WKURLRef mainFrameURL)
 {
     WKRetainPtr<WKURLRef> url = ""
     if (!url) {
@@ -521,7 +496,7 @@
         return;
     }
     stringBuilder.appendLiteral("<NSURLResponse ");
-    stringBuilder.append(pathSuitableForTestResult(url.get()));
+    stringBuilder.append(pathSuitableForTestResult(url.get(), mainFrameURL));
     stringBuilder.appendLiteral(", http status code ");
     stringBuilder.appendNumber(WKURLResponseHTTPStatusCode(response));
     stringBuilder.append('>');
@@ -614,7 +589,7 @@
 
 void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void* clientInfo)
 {
-    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willPerformClientRedirectForFrame(frame, url, delay, date);
+    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willPerformClientRedirectForFrame(page, frame, url, delay, date);
 }
 
 void InjectedBundlePage::didSameDocumentNavigationForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef*, const void* clientInfo)
@@ -999,7 +974,7 @@
     dumpLoadEvent(frame, "didCancelClientRedirectForFrame");
 }
 
-void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundleFrameRef frame, WKURLRef url, double delay, double date)
+void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return;
@@ -1008,9 +983,10 @@
         return;
 
     StringBuilder stringBuilder;
+    WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
     dumpFrameDescriptionSuitableForTestResult(frame, stringBuilder);
     stringBuilder.appendLiteral(" - willPerformClientRedirectToURL: ");
-    stringBuilder.append(pathSuitableForTestResult(url));
+    stringBuilder.append(pathSuitableForTestResult(url, mainFrameURL.get()));
     stringBuilder.appendLiteral(" \n");
     InjectedBundle::shared().outputText(stringBuilder.toString());
 }
@@ -1065,7 +1041,7 @@
         InjectedBundle::shared().outputText("didDetectXSS\n");
 }
 
-void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef request, bool)
+void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef request, bool)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return;
@@ -1074,7 +1050,8 @@
         return;
 
     WKRetainPtr<WKURLRef> url = ""
-    assignedUrlsCache.add(identifier, pathSuitableForTestResult(url.get()));
+    WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
+    assignedUrlsCache.add(identifier, pathSuitableForTestResult(url.get(), mainFrameURL.get()));
 }
 
 // Resource Load Client Callbacks
@@ -1089,16 +1066,17 @@
     return WKStringIsEqualToUTF8CStringIgnoringCase(scheme, "http") || WKStringIsEqualToUTF8CStringIgnoringCase(scheme, "https");
 }
 
-WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef frame, uint64_t identifier, WKURLRequestRef request, WKURLResponseRef response)
+WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLRequestRef request, WKURLResponseRef response)
 {
     if (InjectedBundle::shared().isTestRunning()
         && InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) {
         StringBuilder stringBuilder;
         dumpResourceURL(identifier, stringBuilder);
         stringBuilder.appendLiteral(" - willSendRequest ");
-        dumpRequestDescriptionSuitableForTestResult(request, stringBuilder);
+        WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
+        dumpRequestDescriptionSuitableForTestResult(request, stringBuilder, mainFrameURL.get());
         stringBuilder.appendLiteral(" redirectResponse ");
-        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder);
+        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder, mainFrameURL.get());
         stringBuilder.append('\n');
         InjectedBundle::shared().outputText(stringBuilder.toString());
     }
@@ -1145,7 +1123,7 @@
     return request;
 }
 
-void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef response)
+void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef response)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return;
@@ -1154,7 +1132,8 @@
         StringBuilder stringBuilder;
         dumpResourceURL(identifier, stringBuilder);
         stringBuilder.appendLiteral(" - didReceiveResponse ");
-        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder);
+        WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
+        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder, mainFrameURL.get());
         stringBuilder.append('\n');
         InjectedBundle::shared().outputText(stringBuilder.toString());
     }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h (153829 => 153830)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2013-08-08 17:41:11 UTC (rev 153829)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2013-08-08 17:41:55 UTC (rev 153830)
@@ -86,7 +86,7 @@
     void didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef);
     void didClearWindowForFrame(WKBundleFrameRef, WKBundleScriptWorldRef);
     void didCancelClientRedirectForFrame(WKBundleFrameRef);
-    void willPerformClientRedirectForFrame(WKBundleFrameRef, WKURLRef url, double delay, double date);
+    void willPerformClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, WKURLRef, double delay, double date);
     void didSameDocumentNavigationForFrame(WKBundleFrameRef, WKSameDocumentNavigationType);
     void didFinishDocumentLoadForFrame(WKBundleFrameRef);
     void didHandleOnloadEventsForFrame(WKBundleFrameRef);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to