WebCore:
[WebKit-https.git] / WebKitTools / DumpRenderTree / mac / ResourceLoadDelegate.mm
index 89b8a61..2b7a8f3 100644 (file)
 {
     NSString *str = [NSString stringWithFormat:@"<NSError domain %@, code %d", [self domain], [self code]];
     NSURL *failingURL;
-    
+
     if ((failingURL = [[self userInfo] objectForKey:@"NSErrorFailingURLKey"]))
         str = [str stringByAppendingFormat:@", failing URL \"%@\"", [failingURL _drt_descriptionSuitableForTestResult]];
-        
+
     str = [str stringByAppendingFormat:@">"];
-    
+
     return str;
 }
 
@@ -76,9 +76,9 @@
     WebDataSource *dataSource = [mainFrame dataSource];
     if (!dataSource)
         dataSource = [mainFrame provisionalDataSource];
-    
+
     NSString *basePath = [[[[dataSource request] URL] path] stringByDeletingLastPathComponent];
-    
+
     return [[self path] substringFromIndex:[basePath length] + 1];
 }
 
@@ -97,7 +97,7 @@
 
 - (NSString *)_drt_descriptionSuitableForTestResult
 {
-    return [NSString stringWithFormat:@"<NSURLRequest %@>", [[self URL] _drt_descriptionSuitableForTestResult]];
+    return [NSString stringWithFormat:@"<NSURLRequest URL %@, main document URL %@>", [[self URL] _drt_descriptionSuitableForTestResult], [[self mainDocumentURL] _drt_descriptionSuitableForTestResult]];
 }
 
 @end
 - webView: (WebView *)wv identifierForInitialRequest: (NSURLRequest *)request fromDataSource: (WebDataSource *)dataSource
 {
     ASSERT([[dataSource webFrame] dataSource] || [[dataSource webFrame] provisionalDataSource]);
-    
-    if (!done && layoutTestController->dumpResourceLoadCallbacks())
+
+    if (!done && gLayoutTestController->dumpResourceLoadCallbacks())
         return [[request URL] _drt_descriptionSuitableForTestResult];
-    
+
     return @"<unknown>";
 }
 
 -(NSURLRequest *)webView: (WebView *)wv resource:identifier willSendRequest: (NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource
 {
-    if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+    if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
         NSString *string = [NSString stringWithFormat:@"%@ - willSendRequest %@ redirectResponse %@", identifier, [newRequest _drt_descriptionSuitableForTestResult],
             [redirectResponse _drt_descriptionSuitableForTestResult]];
         printf("%s\n", [string UTF8String]);
-    }    
+    }
 
     NSURL *url = [newRequest URL];
     NSString *host = [url host];
         && NSOrderedSame != [host compare:@"127.0.0.1"]
         && NSOrderedSame != [host compare:@"255.255.255.255"] // used in some tests that expect to get back an error
         && NSOrderedSame != [host caseInsensitiveCompare:@"localhost"]) {
-        fprintf(stderr, "Blocked access to external URL %s\n", [[url absoluteString] cStringUsingEncoding:NSUTF8StringEncoding]);
+        printf("Blocked access to external URL %s\n", [[url absoluteString] cStringUsingEncoding:NSUTF8StringEncoding]);
         return nil;
     }
 
     if (disallowedURLs && CFSetContainsValue(disallowedURLs, url))
         return nil;
-    
+
     return newRequest;
 }
 
 
 -(void)webView: (WebView *)wv resource:identifier didReceiveResponse: (NSURLResponse *)response fromDataSource:(WebDataSource *)dataSource
 {
-    if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+    if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
         NSString *string = [NSString stringWithFormat:@"%@ - didReceiveResponse %@", identifier, [response _drt_descriptionSuitableForTestResult]];
-        printf ("%s\n", [string UTF8String]);
-    }    
+        printf("%s\n", [string UTF8String]);
+    }
 }
 
 -(void)webView: (WebView *)wv resource:identifier didReceiveContentLength: (NSInteger)length fromDataSource:(WebDataSource *)dataSource
 
 -(void)webView: (WebView *)wv resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
 {
-    if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+    if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
         NSString *string = [NSString stringWithFormat:@"%@ - didFinishLoading", identifier];
-        printf ("%s\n", [string UTF8String]);
+        printf("%s\n", [string UTF8String]);
     }
 }
 
 -(void)webView: (WebView *)wv resource:identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource
 {
-    if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+    if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
         NSString *string = [NSString stringWithFormat:@"%@ - didFailLoadingWithError: %@", identifier, [error _drt_descriptionSuitableForTestResult]];
-        printf ("%s\n", [string UTF8String]);
+        printf("%s\n", [string UTF8String]);
     }
 }
 
 
 -(NSCachedURLResponse *) webView: (WebView *)wv resource:(id)identifier willCacheResponse:(NSCachedURLResponse *)response fromDataSource:(WebDataSource *)dataSource
 {
-    if (!done && layoutTestController->dumpResourceLoadCallbacks()) {
+    if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
         NSString *string = [NSString stringWithFormat:@"%@ - willCacheResponse: called", identifier];
-        printf ("%s\n", [string UTF8String]);
+        printf("%s\n", [string UTF8String]);
     }
     return response;
 }