Title: [154194] trunk/Tools
Revision
154194
Author
[email protected]
Date
2013-08-16 11:06:08 -0700 (Fri, 16 Aug 2013)

Log Message

[Windows] URL printing code in DRT doesn't match WTR or Mac DRT
https://bugs.webkit.org/show_bug.cgi?id=119583

Reviewed by Alexey Proskuryakov.

* DumpRenderTree/win/DumpRenderTree.cpp:
(urlSuitableForTestResult): Revise URL output to match Mac DRT by emiting last path
component if the URL does not contain the expected base URL.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (154193 => 154194)


--- trunk/Tools/ChangeLog	2013-08-16 18:02:17 UTC (rev 154193)
+++ trunk/Tools/ChangeLog	2013-08-16 18:06:08 UTC (rev 154194)
@@ -1,3 +1,14 @@
+2013-08-16  Brent Fulgham  <[email protected]>
+
+        [Windows] URL printing code in DRT doesn't match WTR or Mac DRT
+        https://bugs.webkit.org/show_bug.cgi?id=119583
+
+        Reviewed by Alexey Proskuryakov.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (urlSuitableForTestResult): Revise URL output to match Mac DRT by emiting last path
+        component if the URL does not contain the expected base URL.
+
 2013-08-16  Pratik Solanki  <[email protected]>
 
         <https://webkit.org/b/119852> Frame::scriptController() should return a reference

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (154193 => 154194)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2013-08-16 18:02:17 UTC (rev 154193)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2013-08-16 18:06:08 UTC (rev 154194)
@@ -141,7 +141,12 @@
     return adoptCF(CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index)));
 }
 
-// FIXME (119583): Make this match other platforms better.
+static wstring lastPathComponentAsWString(CFURLRef url)
+{
+    RetainPtr<CFStringRef> lastPathComponent = adoptCF(CFURLCopyLastPathComponent(url));
+    return cfStringRefToWString(lastPathComponent.get());
+}
+
 wstring urlSuitableForTestResult(const wstring& urlString)
 {
     RetainPtr<CFURLRef> url = "" reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0));
@@ -153,16 +158,16 @@
     COMPtr<IWebDataSource> dataSource;
     if (FAILED(frame->dataSource(&dataSource))) {
         if (FAILED(frame->provisionalDataSource(&dataSource)))
-            return urlString;
+            return lastPathComponentAsWString(url.get());
     }
 
     COMPtr<IWebMutableURLRequest> request;
     if (FAILED(dataSource->request(&request)))
-        return urlString;
+        return lastPathComponentAsWString(url.get());
 
     _bstr_t requestURLString;
     if (FAILED(request->URL(requestURLString.GetAddress())))
-        return urlString;
+        return lastPathComponentAsWString(url.get());
 
     RetainPtr<CFURLRef> requestURL = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(requestURLString.GetBSTR()), requestURLString.length() * sizeof(OLECHAR), kCFStringEncodingUTF16, 0));
     RetainPtr<CFURLRef> baseURL = adoptCF(CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, requestURL.get()));
@@ -170,7 +175,10 @@
     RetainPtr<CFStringRef> basePath = adoptCF(CFURLCopyPath(baseURL.get()));
     RetainPtr<CFStringRef> path = adoptCF(CFURLCopyPath(url.get()));
 
-    return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get());
+    if (basePath.get() && CFStringHasPrefix(path.get(), basePath.get()))
+        return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get());
+
+    return lastPathComponentAsWString(url.get());
 }
 
 wstring lastPathComponent(const wstring& urlString)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to