Title: [153852] trunk
Revision
153852
Author
[email protected]
Date
2013-08-08 15:38:04 -0700 (Thu, 08 Aug 2013)

Log Message

        [WK2] loader/go-back-cached-main-resource.html fails
        https://bugs.webkit.org/show_bug.cgi?id=116491

        Reviewed by Tim Horton.

        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
        * DumpRenderTree/gtk/DumpRenderTree.cpp:
        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
        * DumpRenderTree/win/DumpRenderTree.cpp:
        Added FIXMEs about making path printing normalization more compatible.

        * DumpRenderTree/mac/ResourceLoadDelegate.mm: (-[NSURL _drt_descriptionSuitableForTestResult]):
        Return last path component in cases where we used to return a full path, which is
        never desirable. Added a null check to basePath to prevent potentially getting
        an Objective C exception.

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::pathSuitableForTestResult): Changed to use path for main test window, not
        for a currently loading one (which is different for tests that use multiple windows).
        Changed to return "(null)" for empty URLs to match WK1 output. Changed to return
        last path component as last fallback.
        (WTR::dumpRequestDescriptionSuitableForTestResult): We no longer need to pass main
        frame URL here, and it was potentially a wrong frame.
        (WTR::dumpResponseDescriptionSuitableForTestResult): Ditto.
        (WTR::InjectedBundlePage::willPerformClientRedirectForFrame): Ditto.
        (WTR::InjectedBundlePage::didInitiateLoadForResource): Ditto.
        (WTR::InjectedBundlePage::willSendRequestForFrame): Ditto.
        (WTR::InjectedBundlePage::didReceiveResponseForResource): Ditto.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153851 => 153852)


--- trunk/LayoutTests/ChangeLog	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/LayoutTests/ChangeLog	2013-08-08 22:38:04 UTC (rev 153852)
@@ -1,3 +1,17 @@
+2013-08-08  Alexey Proskuryakov  <[email protected]>
+
+        [WK2] loader/go-back-cached-main-resource.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=116491
+
+        Reviewed by Tim Horton.
+
+        * platform/wk2/TestExpectations:
+        * webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt:
+        Updated to not have file:// in results. This may not be desirable for a webarchive
+        test, but shouldn't be too bad either.
+        * platform/mac-wk2/loader/go-back-cached-main-resource-expected.txt: Deleted.
+        Cross-platform results now work.
+
 2013-08-08  Jer Noble  <[email protected]>
 
         [EME] setMediaKeys function as defined in the EME specification does not work

Deleted: trunk/LayoutTests/platform/mac-wk2/loader/go-back-cached-main-resource-expected.txt (153851 => 153852)


--- trunk/LayoutTests/platform/mac-wk2/loader/go-back-cached-main-resource-expected.txt	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/LayoutTests/platform/mac-wk2/loader/go-back-cached-main-resource-expected.txt	2013-08-08 22:38:04 UTC (rev 153852)
@@ -1,25 +0,0 @@
-resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
-<unknown> - didFinishLoading
-resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
-resources/first-page.html - didFinishLoading
-resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
-resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
-resources/other-page.html - didFinishLoading
-resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
-resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
-resources/first-page.html - didFinishLoading
-resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
-resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
-resources/other-page.html - didFinishLoading
-resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL , http method GET> redirectResponse (null)
-resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
-resources/first-page.html - didFinishLoading
-This test check the following situation:
-
-First you navigate to a page (first-page.html).
-Then you go to another page (other-page.html).
-You repeat previous steps again (going to first-page.html and then to other-page.html).
-Finally you click back.
-The problem was that the resource load callbacks when going back to the cached main resource were not being called.
-
-See bug #112418.

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (153851 => 153852)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2013-08-08 22:38:04 UTC (rev 153852)
@@ -271,8 +271,6 @@
 
 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
 ########################################
 

Modified: trunk/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt (153851 => 153852)


--- trunk/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt	2013-08-08 22:38:04 UTC (rev 153852)
@@ -6,11 +6,11 @@
 <unknown> - didFinishLoading
 resources/subresource-null-mimetype.webarchive - didReceiveResponse <NSURLResponse resources/subresource-null-mimetype.webarchive, http status code 0>
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
-file:///test.png - willSendRequest <NSURLRequest URL file:///test.png, main document URL test-loading-archive-subresource-null-mimetype.html, http method GET> redirectResponse (null)
+test.png - willSendRequest <NSURLRequest URL test.png, main document URL test-loading-archive-subresource-null-mimetype.html, http method GET> redirectResponse (null)
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
 resources/subresource-null-mimetype.webarchive - didFinishLoading
-file:///test.png - didReceiveResponse <NSURLResponse file:///Users/pecoraro/Desktop/test.png, http status code 0>
-file:///test.png - didFinishLoading
+test.png - didReceiveResponse <NSURLResponse test.png, http status code 0>
+test.png - didFinishLoading
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
 main frame - didHandleOnloadEventsForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame

Modified: trunk/Tools/ChangeLog (153851 => 153852)


--- trunk/Tools/ChangeLog	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/Tools/ChangeLog	2013-08-08 22:38:04 UTC (rev 153852)
@@ -1,3 +1,34 @@
+2013-08-08  Alexey Proskuryakov  <[email protected]>
+
+        [WK2] loader/go-back-cached-main-resource.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=116491
+
+        Reviewed by Tim Horton.
+
+        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        Added FIXMEs about making path printing normalization more compatible.
+
+        * DumpRenderTree/mac/ResourceLoadDelegate.mm: (-[NSURL _drt_descriptionSuitableForTestResult]):
+        Return last path component in cases where we used to return a full path, which is
+        never desirable. Added a null check to basePath to prevent potentially getting
+        an Objective C exception.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::pathSuitableForTestResult): Changed to use path for main test window, not
+        for a currently loading one (which is different for tests that use multiple windows).
+        Changed to return "(null)" for empty URLs to match WK1 output. Changed to return
+        last path component as last fallback.
+        (WTR::dumpRequestDescriptionSuitableForTestResult): We no longer need to pass main
+        frame URL here, and it was potentially a wrong frame.
+        (WTR::dumpResponseDescriptionSuitableForTestResult): Ditto.
+        (WTR::InjectedBundlePage::willPerformClientRedirectForFrame): Ditto.
+        (WTR::InjectedBundlePage::didInitiateLoadForResource): Ditto.
+        (WTR::InjectedBundlePage::willSendRequestForFrame): Ditto.
+        (WTR::InjectedBundlePage::didReceiveResponseForResource): Ditto.
+
 2013-08-08  Alex Christensen  <[email protected]>
 
         WTR::pathSuitableForTestResult should behave the same as _drt_descriptionSuitableForTestResult so we can unskip tests.

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp (153851 => 153852)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2013-08-08 22:38:04 UTC (rev 153852)
@@ -336,6 +336,7 @@
     policyDelegatePermissive = false;
 }
 
+// FIXME (119585): Make this match other platforms better.
 static CString pathSuitableForTestResult(const char* uriString)
 {
     if (!uriString)

Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (153851 => 153852)


--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-08-08 22:38:04 UTC (rev 153852)
@@ -1140,7 +1140,7 @@
     g_signal_connect(webFrame, "insecure-content-run", G_CALLBACK(didRunInsecureContent), NULL);
 }
 
-
+// FIXME (119584): Make this match other platforms better.
 static CString pathFromSoupURI(SoupURI* uri)
 {
     if (!uri)

Modified: trunk/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm (153851 => 153852)


--- trunk/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm	2013-08-08 22:38:04 UTC (rev 153852)
@@ -84,9 +84,9 @@
     NSString *basePath = [[[[dataSource request] URL] path] stringByDeletingLastPathComponent];
     basePath = [basePath stringByAppendingString:@"/"];
 
-    if ([[self path] hasPrefix:basePath])
+    if (basePath && [[self path] hasPrefix:basePath])
         return [[self path] substringFromIndex:[basePath length]];
-    return [self absoluteString];
+    return [self lastPathComponent]; // We lose some information here, but it's better than exposing a full path, which is always machine specific.
 }
 
 @end

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (153851 => 153852)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2013-08-08 22:38:04 UTC (rev 153852)
@@ -275,6 +275,7 @@
     }
 }
 
+// FIXME (119591): Make this match other platforms better.
 static QString urlSuitableForTestResult(const QString& url)
 {
     if (url.isEmpty() || !url.startsWith(QLatin1String("file://")))

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (153851 => 153852)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2013-08-08 22:38:04 UTC (rev 153852)
@@ -141,6 +141,7 @@
     return adoptCF(CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index)));
 }
 
+// FIXME (119583): Make this match other platforms better.
 wstring urlSuitableForTestResult(const wstring& urlString)
 {
     RetainPtr<CFURLRef> url = "" reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (153851 => 153852)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2013-08-08 22:29:16 UTC (rev 153851)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2013-08-08 22:38:04 UTC (rev 153852)
@@ -235,22 +235,27 @@
 
 static const char divider = '/';
 
-static inline WTF::String pathSuitableForTestResult(WKURLRef fileUrl, WKURLRef mainFrameURL)
+static inline WTF::String pathSuitableForTestResult(WKURLRef fileUrl)
 {
     if (!fileUrl)
-        return String();
+        return "(null)";
 
     WKRetainPtr<WKStringRef> schemeString = adoptWK(WKURLCopyScheme(fileUrl));
     if (!isLocalFileScheme(schemeString.get()))
         return toWTFString(adoptWK(WKURLCopyString(fileUrl)));
 
+    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+    WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(mainFrame));
+    if (!mainFrameURL)
+        mainFrameURL = adoptWK(WKBundleFrameCopyProvisionalURL(mainFrame));
+
     String pathString = toWTFString(adoptWK(WKURLCopyPath(fileUrl)));
-    String mainFrameURLPathString = toWTFString(adoptWK(WKURLCopyPath(mainFrameURL)));
+    String mainFrameURLPathString = toWTFString(adoptWK(WKURLCopyPath(mainFrameURL.get())));
     String basePath = mainFrameURLPathString.substring(0, mainFrameURLPathString.reverseFind(divider) + 1);
     
-    if (pathString.startsWith(basePath))
+    if (!basePath.isEmpty() && pathString.startsWith(basePath))
         return pathString.substring(basePath.length());
-    return toWTFString(adoptWK(WKURLCopyString(fileUrl)));
+    return toWTFString(adoptWK(WKURLCopyLastPathComponent(fileUrl))); // We lose some information here, but it's better than exposing a full path, which is always machine specific.
 }
 
 static HashMap<uint64_t, String> assignedUrlsCache;
@@ -468,16 +473,16 @@
     InjectedBundle::shared().outputText(stringBuilder.toString());
 }
 
-static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request, StringBuilder& stringBuilder, WKURLRef mainFrameURL)
+static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request, StringBuilder& stringBuilder)
 {
     WKRetainPtr<WKURLRef> url = ""
     WKRetainPtr<WKURLRef> firstParty = adoptWK(WKURLRequestCopyFirstPartyForCookies(request));
     WKRetainPtr<WKStringRef> httpMethod = adoptWK(WKURLRequestCopyHTTPMethod(request));
 
     stringBuilder.appendLiteral("<NSURLRequest URL ");
-    stringBuilder.append(pathSuitableForTestResult(url.get(), mainFrameURL));
+    stringBuilder.append(pathSuitableForTestResult(url.get()));
     stringBuilder.appendLiteral(", main document URL ");
-    stringBuilder.append(pathSuitableForTestResult(firstParty.get(), mainFrameURL));
+    stringBuilder.append(pathSuitableForTestResult(firstParty.get()));
     stringBuilder.appendLiteral(", http method ");
 
     if (WKStringIsEmpty(httpMethod.get()))
@@ -488,7 +493,7 @@
     stringBuilder.append('>');
 }
 
-static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response, StringBuilder& stringBuilder, WKURLRef mainFrameURL)
+static inline void dumpResponseDescriptionSuitableForTestResult(WKURLResponseRef response, StringBuilder& stringBuilder)
 {
     WKRetainPtr<WKURLRef> url = ""
     if (!url) {
@@ -496,7 +501,7 @@
         return;
     }
     stringBuilder.appendLiteral("<NSURLResponse ");
-    stringBuilder.append(pathSuitableForTestResult(url.get(), mainFrameURL));
+    stringBuilder.append(pathSuitableForTestResult(url.get()));
     stringBuilder.appendLiteral(", http status code ");
     stringBuilder.appendNumber(WKURLResponseHTTPStatusCode(response));
     stringBuilder.append('>');
@@ -974,7 +979,7 @@
     dumpLoadEvent(frame, "didCancelClientRedirectForFrame");
 }
 
-void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date)
+void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef frame, WKURLRef url, double delay, double date)
 {
     if (!InjectedBundle::shared().isTestRunning())
         return;
@@ -983,10 +988,9 @@
         return;
 
     StringBuilder stringBuilder;
-    WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
     dumpFrameDescriptionSuitableForTestResult(frame, stringBuilder);
     stringBuilder.appendLiteral(" - willPerformClientRedirectToURL: ");
-    stringBuilder.append(pathSuitableForTestResult(url, mainFrameURL.get()));
+    stringBuilder.append(pathSuitableForTestResult(url));
     stringBuilder.appendLiteral(" \n");
     InjectedBundle::shared().outputText(stringBuilder.toString());
 }
@@ -1050,8 +1054,7 @@
         return;
 
     WKRetainPtr<WKURLRef> url = ""
-    WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
-    assignedUrlsCache.add(identifier, pathSuitableForTestResult(url.get(), mainFrameURL.get()));
+    assignedUrlsCache.add(identifier, pathSuitableForTestResult(url.get()));
 }
 
 // Resource Load Client Callbacks
@@ -1073,10 +1076,9 @@
         StringBuilder stringBuilder;
         dumpResourceURL(identifier, stringBuilder);
         stringBuilder.appendLiteral(" - willSendRequest ");
-        WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
-        dumpRequestDescriptionSuitableForTestResult(request, stringBuilder, mainFrameURL.get());
+        dumpRequestDescriptionSuitableForTestResult(request, stringBuilder);
         stringBuilder.appendLiteral(" redirectResponse ");
-        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder, mainFrameURL.get());
+        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder);
         stringBuilder.append('\n');
         InjectedBundle::shared().outputText(stringBuilder.toString());
     }
@@ -1132,8 +1134,7 @@
         StringBuilder stringBuilder;
         dumpResourceURL(identifier, stringBuilder);
         stringBuilder.appendLiteral(" - didReceiveResponse ");
-        WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)));
-        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder, mainFrameURL.get());
+        dumpResponseDescriptionSuitableForTestResult(response, stringBuilder);
         stringBuilder.append('\n');
         InjectedBundle::shared().outputText(stringBuilder.toString());
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to