Title: [99031] trunk
Revision
99031
Author
commit-qu...@webkit.org
Date
2011-11-01 19:08:19 -0700 (Tue, 01 Nov 2011)

Log Message

[Mac] _drt_descriptionSuitableForTestResult generate an exception for absolute paths above the main frame
https://bugs.webkit.org/show_bug.cgi?id=71342

Patch by Benjamin Poulain <bpoul...@apple.com> on 2011-11-01
Reviewed by Darin Adler.

Tools:

[NSURL _drt_descriptionSuitableForTestResult] was generating a NSRangeException due to the call to
[NSString substringFromIndex:] with an index out of the string range.

The source of this path is the test-loading-archive-subresource-null-mimetype.html which load a subresource
from the root of the disk.
The problem was hidden because the exception are catched when calling the delegate.

This patch changes _drt_descriptionSuitableForTestResult to return absolute string if the resource is not
in a subdirectory of the main frame.

* DumpRenderTree/mac/ResourceLoadDelegate.mm:
(-[NSURL _drt_descriptionSuitableForTestResult]):

LayoutTests:

Update the test results following the fix of _drt_descriptionSuitableForTestResult.

* webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (99030 => 99031)


--- trunk/LayoutTests/ChangeLog	2011-11-02 02:08:13 UTC (rev 99030)
+++ trunk/LayoutTests/ChangeLog	2011-11-02 02:08:19 UTC (rev 99031)
@@ -1,3 +1,14 @@
+2011-11-01  Benjamin Poulain  <bpoul...@apple.com>
+
+        [Mac] _drt_descriptionSuitableForTestResult generate an exception for absolute paths above the main frame
+        https://bugs.webkit.org/show_bug.cgi?id=71342
+
+        Reviewed by Darin Adler.
+
+        Update the test results following the fix of _drt_descriptionSuitableForTestResult.
+
+        * webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt:
+
 2011-11-01  Anna Cavender  <ann...@chromium.org>
 
         Makes [Reflect] work for constants.

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


--- trunk/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt	2011-11-02 02:08:13 UTC (rev 99030)
+++ trunk/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt	2011-11-02 02:08:19 UTC (rev 99031)
@@ -6,7 +6,10 @@
 <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)
 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>
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
 main frame - didHandleOnloadEventsForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame

Modified: trunk/Tools/ChangeLog (99030 => 99031)


--- trunk/Tools/ChangeLog	2011-11-02 02:08:13 UTC (rev 99030)
+++ trunk/Tools/ChangeLog	2011-11-02 02:08:19 UTC (rev 99031)
@@ -1,3 +1,23 @@
+2011-11-01  Benjamin Poulain  <bpoul...@apple.com>
+
+        [Mac] _drt_descriptionSuitableForTestResult generate an exception for absolute paths above the main frame
+        https://bugs.webkit.org/show_bug.cgi?id=71342
+
+        Reviewed by Darin Adler.
+
+        [NSURL _drt_descriptionSuitableForTestResult] was generating a NSRangeException due to the call to
+        [NSString substringFromIndex:] with an index out of the string range.
+
+        The source of this path is the test-loading-archive-subresource-null-mimetype.html which load a subresource
+        from the root of the disk.
+        The problem was hidden because the exception are catched when calling the delegate.
+
+        This patch changes _drt_descriptionSuitableForTestResult to return absolute string if the resource is not
+        in a subdirectory of the main frame.
+
+        * DumpRenderTree/mac/ResourceLoadDelegate.mm:
+        (-[NSURL _drt_descriptionSuitableForTestResult]):
+
 2011-11-01  Alok Priyadarshi  <al...@chromium.org>
 
         [chromium] --enable-hardware-gpu flag is not recognized by run-webkit-tests

Modified: trunk/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm (99030 => 99031)


--- trunk/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm	2011-11-02 02:08:13 UTC (rev 99030)
+++ trunk/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm	2011-11-02 02:08:19 UTC (rev 99031)
@@ -83,7 +83,11 @@
 
     NSString *basePath = [[[[dataSource request] URL] path] stringByDeletingLastPathComponent];
 
-    return [[self path] substringFromIndex:[basePath length] + 1];
+    if ([[self path] hasPrefix:basePath]) {
+        ASSERT([[self path] length] >= ([basePath length] + 1));
+        return [[self path] substringFromIndex:[basePath length] + 1];
+    }
+    return [self absoluteString];
 }
 
 @end
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to