LayoutTests:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2007 04:21:52 +0000 (04:21 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 May 2007 04:21:52 +0000 (04:21 +0000)
        Reviewed by Justin.

        - added a bunch of layout tests using the new load delegate testing mechanism

        * http/tests/loading/bad-scheme-subframe-expected.txt: Added.
        * http/tests/loading/bad-scheme-subframe.html: Added.
        * http/tests/loading/bad-server-subframe-expected.txt: Added.
        * http/tests/loading/bad-server-subframe.html: Added.
        * http/tests/loading/basic-expected.txt: Added.
        * http/tests/loading/basic.html: Added.
        * http/tests/loading/empty-subframe-expected.txt: Added.
        * http/tests/loading/empty-subframe.html: Added.
        * http/tests/loading/simple-subframe-expected.txt: Added.
        * http/tests/loading/simple-subframe.html: Added.

WebKitTools:

        Reviewed by Justin.

        - created a new mechanism to log FrameLoadDelegate callbacks in directories named "loading"

        The reason for doing things in this slightly odd way is to make sure we don't miss the load delegates
        that happen before the load commits.

        Basically I moved WaitUntilDoneDelegate into a separate file (FrameLoadDelegate.m) and added
        optional logging for every FrameLoadDelegate callback, including SPI callbacks.

        * DumpRenderTree/DumpRenderTree.h:
        * DumpRenderTree/DumpRenderTree.m:
        (createWebView):
        (dumpRenderTree):
        (dump):
        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
        (-[LayoutTestController clearBackForwardList]):
        (-[LayoutTestController setUseDashboardCompatibilityMode:]):
        (-[LayoutTestController dumpFrameLoadCallbacks]):
        (-[LayoutTestController setWindowIsKey:]):
        (-[LayoutTestController setMainFrameIsFirstResponder:]):
        (-[LayoutTestController _doLoad:target:]):
        (-[LayoutTestController _doBackOrForwardNavigation:]):
        (-[LayoutTestController queueReload]):
        (-[LayoutTestController queueScript:]):
        (-[LayoutTestController queueLoad:target:]):
        (-[LayoutTestController setAcceptsEditing:]):
        (-[LayoutTestController setTabKeyCyclesThroughElements:]):
        (shouldLogFrameLoadDelegates):
        (runTest):
        (displayWebView):
        (+[DumpRenderTreeEvent mouseLocation]):
        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
        * DumpRenderTree/DumpRenderTreeDraggingInfo.m:
        (-[DumpRenderTreeDraggingInfo draggingDestinationWindow]):
        * DumpRenderTree/EventSendingController.m:
        (-[EventSendingController mouseDown]):
        (-[EventSendingController mouseUp]):
        (-[EventSendingController mouseMoveToX:Y:]):
        (-[EventSendingController contextClick]):
        * DumpRenderTree/FrameLoadDelegate.h: Added.
        * DumpRenderTree/FrameLoadDelegate.m: Added.
        (-[WebFrame _drt_descriptionSuitableForTestResult]):
        (-[FrameLoadDelegate processWork:]):
        (-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]):
        (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]):
        (-[FrameLoadDelegate webView:didCommitLoadForFrame:]):
        (-[FrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]):
        (-[FrameLoadDelegate webView:didFinishLoadForFrame:]):
        (-[FrameLoadDelegate webView:didFailLoadWithError:forFrame:]):
        (-[FrameLoadDelegate webView:windowScriptObjectAvailable:]):
        (-[FrameLoadDelegate webView:didClearWindowObject:forFrame:]):
        (-[FrameLoadDelegate webView:didReceiveTitle:forFrame:]):
        (-[FrameLoadDelegate webView:didReceiveServerRedirectForProvisionalLoadForFrame:]):
        (-[FrameLoadDelegate webView:didReceiveIcon:forFrame:]):
        (-[FrameLoadDelegate webView:didChangeLocationWithinPageForFrame:]):
        (-[FrameLoadDelegate webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:]):
        (-[FrameLoadDelegate webView:didCancelClientRedirectForFrame:]):
        (-[FrameLoadDelegate webView:willCloseFrame:]):
        (-[FrameLoadDelegate webView:didFirstLayoutInFrame:]):
        (-[FrameLoadDelegate webView:didFinishDocumentLoadForFrame:]):
        (-[FrameLoadDelegate webView:didHandleOnloadEventsForFrame:]):
        * DumpRenderTree/ResourceLoadDelegate.m:
        (-[NSURL _drt_descriptionSuitableForTestResult]):
        * DumpRenderTree/UIDelegate.m:
        (-[UIDelegate webViewFocus:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@21523 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/loading/bad-scheme-subframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/bad-scheme-subframe.html [new file with mode: 0644]
LayoutTests/http/tests/loading/bad-server-subframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/bad-server-subframe.html [new file with mode: 0644]
LayoutTests/http/tests/loading/basic-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/basic.html [new file with mode: 0644]
LayoutTests/http/tests/loading/empty-subframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/empty-subframe.html [new file with mode: 0644]
LayoutTests/http/tests/loading/simple-subframe-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/simple-subframe.html [new file with mode: 0644]
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.h
WebKitTools/DumpRenderTree/DumpRenderTree.m
WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
WebKitTools/DumpRenderTree/DumpRenderTreeDraggingInfo.m
WebKitTools/DumpRenderTree/EventSendingController.m
WebKitTools/DumpRenderTree/FrameLoadDelegate.h [new file with mode: 0644]
WebKitTools/DumpRenderTree/FrameLoadDelegate.m [new file with mode: 0644]
WebKitTools/DumpRenderTree/ResourceLoadDelegate.m
WebKitTools/DumpRenderTree/UIDelegate.m

index f952abf..02ec16c 100644 (file)
@@ -1,3 +1,20 @@
+2007-05-16  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Justin.
+        
+        - added a bunch of layout tests using the new load delegate testing mechanism
+
+        * http/tests/loading/bad-scheme-subframe-expected.txt: Added.
+        * http/tests/loading/bad-scheme-subframe.html: Added.
+        * http/tests/loading/bad-server-subframe-expected.txt: Added.
+        * http/tests/loading/bad-server-subframe.html: Added.
+        * http/tests/loading/basic-expected.txt: Added.
+        * http/tests/loading/basic.html: Added.
+        * http/tests/loading/empty-subframe-expected.txt: Added.
+        * http/tests/loading/empty-subframe.html: Added.
+        * http/tests/loading/simple-subframe-expected.txt: Added.
+        * http/tests/loading/simple-subframe.html: Added.
+
 2007-05-16  dethbakin  <bdakin@apple.com>
 
         Reviewed by Hyatt.
diff --git a/LayoutTests/http/tests/loading/bad-scheme-subframe-expected.txt b/LayoutTests/http/tests/loading/bad-scheme-subframe-expected.txt
new file mode 100644 (file)
index 0000000..0938bbe
--- /dev/null
@@ -0,0 +1,13 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didFirstLayoutInFrame
+main frame - willCloseFrame
+main frame - didCommitLoadForFrame
+main frame - didClearWindowObjectForFrame
+frame "f1" - didClearWindowObjectForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "f1" - didFirstLayoutInFrame
+frame "f1" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+main frame - didFirstLayoutInFrame
+This is a test of load callbacks. It is only useful inside the regression test tool.
+
diff --git a/LayoutTests/http/tests/loading/bad-scheme-subframe.html b/LayoutTests/http/tests/loading/bad-scheme-subframe.html
new file mode 100644 (file)
index 0000000..b54bcb1
--- /dev/null
@@ -0,0 +1,6 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+This is a test of load callbacks. It is only useful inside the regression test tool.<br>
+<iframe name="f1" src="this-is-definitely-a-bad-uri-scheme:"></iframe>
diff --git a/LayoutTests/http/tests/loading/bad-server-subframe-expected.txt b/LayoutTests/http/tests/loading/bad-server-subframe-expected.txt
new file mode 100644 (file)
index 0000000..6761f39
--- /dev/null
@@ -0,0 +1,16 @@
+main frame - didStartProvisionalLoadForFrame
+frame "f1" - willCloseFrame
+main frame - willCloseFrame
+main frame - didCommitLoadForFrame
+main frame - didClearWindowObjectForFrame
+frame "f1" - didClearWindowObjectForFrame
+frame "f1" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "f1" - didFirstLayoutInFrame
+main frame - didFirstLayoutInFrame
+frame "f1" - didFailProvisionalLoadWithError
+main frame - didFinishLoadForFrame
+This is a test of load callbacks. It is only useful inside the regression test tool.
+It also assumes there is no web server running locally on port 54321.
+
diff --git a/LayoutTests/http/tests/loading/bad-server-subframe.html b/LayoutTests/http/tests/loading/bad-server-subframe.html
new file mode 100644 (file)
index 0000000..f235aed
--- /dev/null
@@ -0,0 +1,7 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+This is a test of load callbacks. It is only useful inside the regression test tool.<br>
+It also assumes there is no web server running locally on port 54321.<br>
+<iframe name="f1" src="http://localhost:54321"></iframe>
diff --git a/LayoutTests/http/tests/loading/basic-expected.txt b/LayoutTests/http/tests/loading/basic-expected.txt
new file mode 100644 (file)
index 0000000..a6ac8d4
--- /dev/null
@@ -0,0 +1,10 @@
+main frame - didStartProvisionalLoadForFrame
+frame "f1" - willCloseFrame
+main frame - willCloseFrame
+main frame - didCommitLoadForFrame
+main frame - didClearWindowObjectForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFirstLayoutInFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didFinishLoadForFrame
+This is a test of load callbacks. It is only useful inside the regression test tool.
diff --git a/LayoutTests/http/tests/loading/basic.html b/LayoutTests/http/tests/loading/basic.html
new file mode 100644 (file)
index 0000000..2e9c83c
--- /dev/null
@@ -0,0 +1,5 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+This is a test of load callbacks. It is only useful inside the regression test tool.
diff --git a/LayoutTests/http/tests/loading/empty-subframe-expected.txt b/LayoutTests/http/tests/loading/empty-subframe-expected.txt
new file mode 100644 (file)
index 0000000..cd8a00d
--- /dev/null
@@ -0,0 +1,19 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - willCloseFrame
+main frame - didCommitLoadForFrame
+main frame - didClearWindowObjectForFrame
+frame "f1" - didClearWindowObjectForFrame
+frame "f1" - didStartProvisionalLoadForFrame
+frame "f1" - willCloseFrame
+frame "f1" - didCommitLoadForFrame
+frame "f1" - didClearWindowObjectForFrame
+frame "f1" - didHandleOnloadEventsForFrame
+frame "f1" - didFinishDocumentLoadForFrame
+frame "f1" - didFinishLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "f1" - didFirstLayoutInFrame
+main frame - didFirstLayoutInFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didFinishLoadForFrame
+This is a test of load callbacks. It is only useful inside the regression test tool.
+
diff --git a/LayoutTests/http/tests/loading/empty-subframe.html b/LayoutTests/http/tests/loading/empty-subframe.html
new file mode 100644 (file)
index 0000000..a265314
--- /dev/null
@@ -0,0 +1,6 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+This is a test of load callbacks. It is only useful inside the regression test tool.<br>
+<iframe name="f1"></iframe>
diff --git a/LayoutTests/http/tests/loading/simple-subframe-expected.txt b/LayoutTests/http/tests/loading/simple-subframe-expected.txt
new file mode 100644 (file)
index 0000000..89ceb04
--- /dev/null
@@ -0,0 +1,36 @@
+main frame - didStartProvisionalLoadForFrame
+frame "f1" - willCloseFrame
+main frame - willCloseFrame
+main frame - didCommitLoadForFrame
+main frame - didClearWindowObjectForFrame
+frame "f1" - didClearWindowObjectForFrame
+frame "f1" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "f1" - willCloseFrame
+frame "f1" - didCommitLoadForFrame
+frame "f1" - didClearWindowObjectForFrame
+frame "f1" - didHandleOnloadEventsForFrame
+main frame - didHandleOnloadEventsForFrame
+frame "f1" - didFirstLayoutInFrame
+main frame - didFirstLayoutInFrame
+frame "f1" - didFinishDocumentLoadForFrame
+frame "f1" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 482x18
+        text run at (0,0) width 482: "This is a test of load callbacks. It is only useful inside the regression test tool."
+      RenderBR {BR} at (482,14) size 0x0
+      RenderPartObject {IFRAME} at (0,18) size 304x154 [border: (2px inset #000000)]
+        layer at (0,0) size 300x150
+          RenderView at (0,0) size 300x150
+        layer at (0,0) size 300x150
+          RenderBlock {HTML} at (0,0) size 300x150
+            RenderBody {BODY} at (8,8) size 284x134
+              RenderInline {B} at (0,0) size 23x18
+                RenderText {#text} at (0,0) size 23x18
+                  text run at (0,0) width 23: "test"
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/http/tests/loading/simple-subframe.html b/LayoutTests/http/tests/loading/simple-subframe.html
new file mode 100644 (file)
index 0000000..105a1c1
--- /dev/null
@@ -0,0 +1,6 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpFrameLoadCallbacks();
+</script>
+This is a test of load callbacks. It is only useful inside the regression test tool.<br>
+<iframe name="f1" src="data:text/html,<b>test</b>"></iframe>
index 0fc9826..bed6d31 100644 (file)
@@ -1,3 +1,72 @@
+2007-05-16  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Justin.
+        
+        - created a new mechanism to log FrameLoadDelegate callbacks in directories named "loading"
+        
+        The reason for doing things in this slightly odd way is to make sure we don't miss the load delegates
+        that happen before the load commits.
+        
+        Basically I moved WaitUntilDoneDelegate into a separate file (FrameLoadDelegate.m) and added
+        optional logging for every FrameLoadDelegate callback, including SPI callbacks.
+
+        * DumpRenderTree/DumpRenderTree.h:
+        * DumpRenderTree/DumpRenderTree.m:
+        (createWebView):
+        (dumpRenderTree):
+        (dump):
+        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
+        (-[LayoutTestController clearBackForwardList]):
+        (-[LayoutTestController setUseDashboardCompatibilityMode:]):
+        (-[LayoutTestController dumpFrameLoadCallbacks]):
+        (-[LayoutTestController setWindowIsKey:]):
+        (-[LayoutTestController setMainFrameIsFirstResponder:]):
+        (-[LayoutTestController _doLoad:target:]):
+        (-[LayoutTestController _doBackOrForwardNavigation:]):
+        (-[LayoutTestController queueReload]):
+        (-[LayoutTestController queueScript:]):
+        (-[LayoutTestController queueLoad:target:]):
+        (-[LayoutTestController setAcceptsEditing:]):
+        (-[LayoutTestController setTabKeyCyclesThroughElements:]):
+        (shouldLogFrameLoadDelegates):
+        (runTest):
+        (displayWebView):
+        (+[DumpRenderTreeEvent mouseLocation]):
+        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+        * DumpRenderTree/DumpRenderTreeDraggingInfo.m:
+        (-[DumpRenderTreeDraggingInfo draggingDestinationWindow]):
+        * DumpRenderTree/EventSendingController.m:
+        (-[EventSendingController mouseDown]):
+        (-[EventSendingController mouseUp]):
+        (-[EventSendingController mouseMoveToX:Y:]):
+        (-[EventSendingController contextClick]):
+        * DumpRenderTree/FrameLoadDelegate.h: Added.
+        * DumpRenderTree/FrameLoadDelegate.m: Added.
+        (-[WebFrame _drt_descriptionSuitableForTestResult]):
+        (-[FrameLoadDelegate processWork:]):
+        (-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]):
+        (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]):
+        (-[FrameLoadDelegate webView:didCommitLoadForFrame:]):
+        (-[FrameLoadDelegate webView:didFailProvisionalLoadWithError:forFrame:]):
+        (-[FrameLoadDelegate webView:didFinishLoadForFrame:]):
+        (-[FrameLoadDelegate webView:didFailLoadWithError:forFrame:]):
+        (-[FrameLoadDelegate webView:windowScriptObjectAvailable:]):
+        (-[FrameLoadDelegate webView:didClearWindowObject:forFrame:]):
+        (-[FrameLoadDelegate webView:didReceiveTitle:forFrame:]):
+        (-[FrameLoadDelegate webView:didReceiveServerRedirectForProvisionalLoadForFrame:]):
+        (-[FrameLoadDelegate webView:didReceiveIcon:forFrame:]):
+        (-[FrameLoadDelegate webView:didChangeLocationWithinPageForFrame:]):
+        (-[FrameLoadDelegate webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:]):
+        (-[FrameLoadDelegate webView:didCancelClientRedirectForFrame:]):
+        (-[FrameLoadDelegate webView:willCloseFrame:]):
+        (-[FrameLoadDelegate webView:didFirstLayoutInFrame:]):
+        (-[FrameLoadDelegate webView:didFinishDocumentLoadForFrame:]):
+        (-[FrameLoadDelegate webView:didHandleOnloadEventsForFrame:]):
+        * DumpRenderTree/ResourceLoadDelegate.m:
+        (-[NSURL _drt_descriptionSuitableForTestResult]):
+        * DumpRenderTree/UIDelegate.m:
+        (-[UIDelegate webViewFocus:]):
+
 2007-05-16  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Darin and Geoff.
index e822c17..bbe3408 100644 (file)
  */
 
 @class DumpRenderTreeDraggingInfo;
+@class NavigationController;
 @class WebFrame;
+@class WebScriptObject;
 @class WebView;
 
 extern BOOL windowIsKey;
-extern WebFrame *frame;
+extern WebFrame *mainFrame;
 extern DumpRenderTreeDraggingInfo *draggingInfo;
 extern volatile BOOL done;
 extern BOOL shouldDumpResourceLoadCallbacks;
+extern BOOL shouldDumpFrameLoadCallbacks;
+extern BOOL dumpTitleChanges;
 extern NSMutableSet *disallowedURLs;
 extern BOOL waitToDump;
 extern BOOL canOpenWindows;
 extern BOOL closeWebViews;
 extern BOOL addFileToPasteboardOnDrag;
+extern NSMutableArray *workQueue;
+extern WebFrame *topLoadingFrame;
+extern BOOL workQueueFrozen;
+extern NavigationController *navigationController;
 
 WebView *createWebView();
+void dump(void);
+
+@interface LayoutTestController : NSObject
+{
+    WebScriptObject *storedWebScriptObject;
+}
+- (void)dealloc;
+@end
+
index bc1bb3c..966d012 100644 (file)
  
 #import "DumpRenderTree.h"
 
-#import "AppleScriptController.h"
 #import "EditingDelegate.h"
 #import "EventSendingController.h"
-#import "GCController.h"
+#import "FrameLoadDelegate.h"
 #import "NavigationController.h"
 #import "ObjCPlugin.h"
 #import "ObjCPluginFunction.h"
 #import "ResourceLoadDelegate.h"
-#import "TextInputController.h"
 #import "UIDelegate.h"
 #import <ApplicationServices/ApplicationServices.h> // for CMSetDefaultProfileBySpace
 #import <CoreFoundation/CoreFoundation.h>
 @interface DumpRenderTreeEvent : NSEvent
 @end
 
-@interface WaitUntilDoneDelegate : NSObject
-@end
-
-@interface LayoutTestController : NSObject
-{
-    WebScriptObject *storedWebScriptObject;
-}
-- (void)dealloc;
-@end
-
 @interface LocalPasteboard : NSPasteboard
 {
     NSMutableArray *typesArray;
 @end
 
 BOOL windowIsKey = YES;
-WebFrame *frame = 0;
+WebFrame *mainFrame = 0;
 BOOL shouldDumpEditingCallbacks;
 BOOL shouldDumpResourceLoadCallbacks;
+BOOL shouldDumpFrameLoadCallbacks;
 NSMutableSet *disallowedURLs = 0;
 BOOL waitToDump;     // TRUE if waitUntilDone() has been called, but notifyDone() has not yet been called
 BOOL canOpenWindows;
@@ -117,10 +106,10 @@ static NSString *md5HashStringForBitmap(CGImageRef bitmap);
 static void displayWebView();
 
 volatile BOOL done;
-static NavigationController *navigationController;
+NavigationController *navigationController = nil;
 
 // Delegates
-static WaitUntilDoneDelegate *waitUntilDoneDelegate;
+static FrameLoadDelegate *frameLoadDelegate;
 static UIDelegate *uiDelegate;
 static EditingDelegate *editingDelegate;
 static ResourceLoadDelegate *resourceLoadDelegate;
@@ -136,13 +125,13 @@ static ResourceLoadDelegate *resourceLoadDelegate;
 // in progress.  Usually this is the same as the main frame, but not always.  In the case
 // where a frameset is loaded, and then new content is loaded into one of the child frames,
 // that child frame is the "topmost frame that is loading".
-static WebFrame *topLoadingFrame;     // !nil iff a load is in progress
+WebFrame *topLoadingFrame = nil;     // !nil iff a load is in progress
 
 static BOOL dumpAsText;
 static BOOL dumpDOMAsWebArchive;
 static BOOL dumpSourceAsWebArchive;
 static BOOL dumpSelectionRect;
-static BOOL dumpTitleChanges;
+BOOL dumpTitleChanges = NO;
 static BOOL dumpBackForwardList;
 static BOOL dumpChildFrameScrollPositions;
 static int dumpPixels;
@@ -162,10 +151,10 @@ static WebHistoryItem *prevTestBFItem = nil;  // current b/f item at the end of
 static unsigned char* screenCaptureBuffer;
 static CGColorSpaceRef sharedColorSpace;
 // a queue of NSInvocations, queued by callouts from the test, to be exec'ed when the load is done
-static NSMutableArray *workQueue = nil;
+NSMutableArray *workQueue = nil;
 // to prevent infinite loops, only the first page of a test can add to a work queue
 // (since we may well come back to that same page)
-static BOOL workQueueFrozen;
+BOOL workQueueFrozen = nil;
 const unsigned maxViewHeight = 600;
 const unsigned maxViewWidth = 800;
 
@@ -386,7 +375,7 @@ WebView *createWebView()
     WebView *webView = [[WebView alloc] initWithFrame:rect];
         
     [webView setUIDelegate:uiDelegate];
-    [webView setFrameLoadDelegate:waitUntilDoneDelegate];
+    [webView setFrameLoadDelegate:frameLoadDelegate];
     [webView setEditingDelegate:editingDelegate];
     [webView setResourceLoadDelegate:resourceLoadDelegate];
     
@@ -480,7 +469,7 @@ void dumpRenderTree(int argc, const char *argv[])
     
     localPasteboards = [[NSMutableDictionary alloc] init];
     navigationController = [[NavigationController alloc] init];
-    waitUntilDoneDelegate = [[WaitUntilDoneDelegate alloc] init];
+    frameLoadDelegate = [[FrameLoadDelegate alloc] init];
     uiDelegate = [[UIDelegate alloc] init];
     editingDelegate = [[EditingDelegate alloc] init];    
     resourceLoadDelegate = [[ResourceLoadDelegate alloc] init];
@@ -490,7 +479,7 @@ void dumpRenderTree(int argc, const char *argv[])
     [[WebPluginDatabase sharedDatabase] refresh];
     
     WebView *webView = createWebView();    
-    frame = [webView mainFrame];
+    mainFrame = [webView mainFrame];
     NSWindow *window = [webView window];
     
     workQueue = [[NSMutableArray alloc] init];
@@ -539,7 +528,7 @@ void dumpRenderTree(int argc, const char *argv[])
 
     [WebCoreStatistics emptyCache]; // Otherwise SVGImages trigger false positives for Frame/Node counts    
     [webView close];
-    frame = nil;
+    mainFrame = nil;
 
     // Work around problem where registering drag types leaves an outstanding
     // "perform selector" on the window, which retains the window. It's a bit
@@ -549,7 +538,7 @@ void dumpRenderTree(int argc, const char *argv[])
     
     [window close]; // releases when closed
     [webView release];
-    [waitUntilDoneDelegate release];
+    [frameLoadDelegate release];
     [editingDelegate release];
     [resourceLoadDelegate release];
     [uiDelegate release];
@@ -753,28 +742,28 @@ static void dumpBackForwardListForWebView(WebView *view)
     printf("===============================================\n");
 }
 
-static void dump(void)
+void dump(void)
 {
     if (dumpTree) {
         NSString *result = nil;
 
-        dumpAsText |= [[[[frame dataSource] response] MIMEType] isEqualToString:@"text/plain"];
+        dumpAsText |= [[[[mainFrame dataSource] response] MIMEType] isEqualToString:@"text/plain"];
         if (dumpAsText) {
-            DOMElement *documentElement = [[frame DOMDocument] documentElement];
+            DOMElement *documentElement = [[mainFrame DOMDocument] documentElement];
             result = [[(DOMElement *)documentElement innerText] stringByAppendingString:@"\n"];
         } else if (dumpDOMAsWebArchive) {
-            WebArchive *webArchive = [[frame DOMDocument] webArchive];
+            WebArchive *webArchive = [[mainFrame DOMDocument] webArchive];
             result = serializeWebArchiveToXML(webArchive);
         } else if (dumpSourceAsWebArchive) {
-            WebArchive *webArchive = [[frame dataSource] webArchive];
+            WebArchive *webArchive = [[mainFrame dataSource] webArchive];
             result = serializeWebArchiveToXML(webArchive);
         } else {
             bool isSVGW3CTest = ([currentTest rangeOfString:@"svg/W3C-SVG-1.1"].length);
             if (isSVGW3CTest)
-                [[frame webView] setFrameSize:NSMakeSize(480, 360)];
+                [[mainFrame webView] setFrameSize:NSMakeSize(480, 360)];
             else 
-                [[frame webView] setFrameSize:NSMakeSize(maxViewWidth, maxViewHeight)];
-            result = [frame renderTreeAsExternalRepresentation];
+                [[mainFrame webView] setFrameSize:NSMakeSize(maxViewWidth, maxViewHeight)];
+            result = [mainFrame renderTreeAsExternalRepresentation];
         }
 
         if (!result) {
@@ -782,16 +771,16 @@ static void dump(void)
             if (dumpAsText)
                 errorMessage = "[documentElement innerText]";
             else if (dumpDOMAsWebArchive)
-                errorMessage = "[[frame DOMDocument] webArchive]";
+                errorMessage = "[[mainFrame DOMDocument] webArchive]";
             else if (dumpSourceAsWebArchive)
-                errorMessage = "[[frame dataSource] webArchive]";
+                errorMessage = "[[mainFrame dataSource] webArchive]";
             else
-                errorMessage = "[frame renderTreeAsExternalRepresentation]";
+                errorMessage = "[mainFrame renderTreeAsExternalRepresentation]";
             printf("ERROR: nil result from %s", errorMessage);
         } else {
             fputs([result UTF8String], stdout);
             if (!dumpAsText && !dumpDOMAsWebArchive && !dumpSourceAsWebArchive)
-                dumpFrameScrollPosition(frame);
+                dumpFrameScrollPosition(mainFrame);
         }
 
         if (dumpBackForwardList) {
@@ -810,7 +799,7 @@ static void dump(void)
     if (dumpPixels) {
         if (!dumpAsText && !dumpDOMAsWebArchive && !dumpSourceAsWebArchive) {
             // grab a bitmap from the view
-            WebView* view = [frame webView];
+            WebView* view = [mainFrame webView];
             NSSize webViewSize = [view frame].size;
 
             CGContextRef cgContext = CGBitmapContextCreate(screenCaptureBuffer, webViewSize.width, webViewSize.height, 8, webViewSize.width * 4, sharedColorSpace, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedLast);
@@ -843,7 +832,7 @@ static void dump(void)
                 }
             }
             if (dumpSelectionRect) {
-                NSView *documentView = [[frame frameView] documentView];
+                NSView *documentView = [[mainFrame frameView] documentView];
                 if ([documentView conformsToProtocol:@protocol(WebDocumentSelection)]) {
                     [[NSColor redColor] set];
                     [NSBezierPath strokeRect:[documentView convertRect:[(id <WebDocumentSelection>)documentView selectionRect] fromView:nil]];
@@ -902,132 +891,6 @@ static void dump(void)
     done = YES;
 }
 
-@implementation WaitUntilDoneDelegate
-
-// Exec messages in the work queue until they're all done, or one of them starts a new load
-- (void)processWork:(id)dummy
-{
-    // quit doing work once a load is in progress
-    while ([workQueue count] > 0 && !topLoadingFrame) {
-        [[workQueue objectAtIndex:0] invoke];
-        [workQueue removeObjectAtIndex:0];
-    }
-    
-    // if we didn't start a new load, then we finished all the commands, so we're ready to dump state
-    if (!topLoadingFrame && !waitToDump)
-        dump();
-}
-
-- (void)webView:(WebView *)c locationChangeDone:(NSError *)error forDataSource:(WebDataSource *)dataSource
-{
-    if ([dataSource webFrame] == topLoadingFrame) {
-        topLoadingFrame = nil;
-        workQueueFrozen = YES;      // first complete load freezes the queue for the rest of this test
-        if (!waitToDump) {
-            if ([workQueue count] > 0)
-                [self performSelector:@selector(processWork:) withObject:nil afterDelay:0];
-            else
-                dump();
-        }
-    }
-}
-
-- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)f
-{
-    ASSERT([f provisionalDataSource]);
-    // Make sure we only set this once per test.  If it gets cleared, and then set again, we might
-    // end up doing two dumps for one test.
-    if (!topLoadingFrame && !done)
-        topLoadingFrame = f;
-}
-
-- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)f
-{
-    ASSERT(![f provisionalDataSource]);
-    ASSERT([f dataSource]);
-
-    windowIsKey = YES;
-    NSView *documentView = [[frame frameView] documentView];
-    [[[frame webView] window] makeFirstResponder:documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
-}
-
-- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame
-{
-    ASSERT([frame provisionalDataSource]);
-
-    [self webView:sender locationChangeDone:error forDataSource:[frame provisionalDataSource]];
-}
-
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
-{
-    // FIXME: This call to displayIfNeeded can be removed when <rdar://problem/5092361> is fixed.
-    // After that is fixed, we will reenable painting after WebCore is done loading the document, 
-    // and this call will no longer be needed.
-    if ([[sender mainFrame] isEqual:frame])
-        [sender displayIfNeeded];
-    [self webView:sender locationChangeDone:nil forDataSource:[frame dataSource]];
-    [navigationController webView:sender didFinishLoadForFrame:frame];
-}
-
-- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame
-{
-    ASSERT(![frame provisionalDataSource]);
-    ASSERT([frame dataSource]);
-
-    [self webView:sender locationChangeDone:error forDataSource:[frame dataSource]];
-}
-
-- (void)webView:(WebView *)sender windowScriptObjectAvailable:(WebScriptObject *)obj 
-{ 
-    ASSERT_NOT_REACHED();
-}
-
-- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)obj forFrame:(WebFrame *)frame
-{
-    ASSERT(obj == [frame windowObject]);
-    ASSERT([obj JSObject] == JSContextGetGlobalObject([frame globalContext]));
-    
-    LayoutTestController *ltc = [[LayoutTestController alloc] init];
-    [obj setValue:ltc forKey:@"layoutTestController"];
-    [ltc release];
-    
-    EventSendingController *esc = [[EventSendingController alloc] init];
-    [obj setValue:esc forKey:@"eventSender"];
-    [esc release];
-    
-    TextInputController *tic = [[TextInputController alloc] initWithWebView:sender];
-    [obj setValue:tic forKey:@"textInputController"];
-    [tic release];
-    
-    AppleScriptController *asc = [[AppleScriptController alloc] initWithWebView:sender];
-    [obj setValue:asc forKey:@"appleScriptController"];
-    [asc release];
-    
-    GCController *gcc = [[GCController alloc] init];
-    [obj setValue:gcc forKey:@"GCController"];
-    [gcc release];
-    
-    [obj setValue:navigationController forKey:@"navigationController"];
-    
-    ObjCPlugin *plugin = [[ObjCPlugin alloc] init];
-    [obj setValue:plugin forKey:@"objCPlugin"];
-    [plugin release];
-    
-    ObjCPluginFunction *pluginFunction = [[ObjCPluginFunction alloc] init];
-    [obj setValue:pluginFunction forKey:@"objCPluginFunction"];
-    [pluginFunction release];
-}
-
-- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
-{
-    if (dumpTitleChanges)
-        printf("TITLE CHANGED: %s\n", [title UTF8String]);
-}
-
-@end
-
 @implementation LayoutTestController
 
 + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
@@ -1042,6 +905,7 @@ static void dump(void)
             || aSelector == @selector(dumpChildFrameScrollPositions)
             || aSelector == @selector(dumpEditingCallbacks)
             || aSelector == @selector(dumpResourceLoadCallbacks)
+            || aSelector == @selector(dumpFrameLoadCallbacks)
             || aSelector == @selector(setWindowIsKey:)
             || aSelector == @selector(setMainFrameIsFirstResponder:)
             || aSelector == @selector(dumpSelectionRect)
@@ -1122,7 +986,7 @@ static void dump(void)
 
 - (void)clearBackForwardList
 {
-    WebBackForwardList *backForwardList = [[frame webView] backForwardList];
+    WebBackForwardList *backForwardList = [[mainFrame webView] backForwardList];
     WebHistoryItem *item = [[backForwardList currentItem] retain];
 
     // We clear the history by setting the back/forward list's capacity to 0
@@ -1137,7 +1001,7 @@ static void dump(void)
 
 - (void)setUseDashboardCompatibilityMode:(BOOL)flag
 {
-    [[frame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:flag];
+    [[mainFrame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:flag];
 }
 
 - (void)setCloseRemainingWindowsWhenComplete:(BOOL)closeWindows
@@ -1255,20 +1119,25 @@ static void dump(void)
     shouldDumpResourceLoadCallbacks = YES;
 }
 
+- (void)dumpFrameLoadCallbacks
+{
+    shouldDumpFrameLoadCallbacks = YES;
+}
+
 - (void)setWindowIsKey:(BOOL)flag
 {
     windowIsKey = flag;
-    NSView *documentView = [[frame frameView] documentView];
+    NSView *documentView = [[mainFrame frameView] documentView];
     if ([documentView isKindOfClass:[WebHTMLView class]])
         [(WebHTMLView *)documentView _updateActiveState];
 }
 
 - (void)setMainFrameIsFirstResponder:(BOOL)flag
 {
-    NSView *documentView = [[frame frameView] documentView];
+    NSView *documentView = [[mainFrame frameView] documentView];
     
     NSResponder *firstResponder = flag ? documentView : nil;
-    [[[frame webView] window] makeFirstResponder:firstResponder];
+    [[[mainFrame webView] window] makeFirstResponder:firstResponder];
         
     if ([documentView isKindOfClass:[WebHTMLView class]])
         [(WebHTMLView *)documentView _updateActiveState];
@@ -1315,9 +1184,9 @@ static void dump(void)
 {
     WebFrame *targetFrame;
     if (target && ![target isKindOfClass:[WebUndefined class]])
-        targetFrame = [frame findFrameNamed:target];
+        targetFrame = [mainFrame findFrameNamed:target];
     else
-        targetFrame = frame;
+        targetFrame = mainFrame;
     [targetFrame loadRequest:[NSURLRequest requestWithURL:url]];
 }
 
@@ -1325,12 +1194,12 @@ static void dump(void)
 {
     int bfIndex = [index intValue];
     if (bfIndex == 1)
-        [[frame webView] goForward];
+        [[mainFrame webView] goForward];
     if (bfIndex == -1)
-        [[frame webView] goBack];
+        [[mainFrame webView] goBack];
     else {        
-        WebBackForwardList *bfList = [[frame webView] backForwardList];
-        [[frame webView] goToBackForwardItem:[bfList itemAtIndex:bfIndex]];
+        WebBackForwardList *bfList = [[mainFrame webView] backForwardList];
+        [[mainFrame webView] goToBackForwardItem:[bfList itemAtIndex:bfIndex]];
     }
 }
 
@@ -1346,28 +1215,28 @@ static void dump(void)
 
 - (void)queueReload
 {
-    [self _addWorkForTarget:[frame webView] selector:@selector(reload:) arg1:self arg2:nil];
+    [self _addWorkForTarget:[mainFrame webView] selector:@selector(reload:) arg1:self arg2:nil];
 }
 
 - (void)queueScript:(NSString *)script
 {
-    [self _addWorkForTarget:[frame webView] selector:@selector(stringByEvaluatingJavaScriptFromString:) arg1:script arg2:nil];
+    [self _addWorkForTarget:[mainFrame webView] selector:@selector(stringByEvaluatingJavaScriptFromString:) arg1:script arg2:nil];
 }
 
 - (void)queueLoad:(NSString *)URLString target:(NSString *)target
 {
-    NSURL *URL = [NSURL URLWithString:URLString relativeToURL:[[[frame dataSource] response] URL]];
+    NSURL *URL = [NSURL URLWithString:URLString relativeToURL:[[[mainFrame dataSource] response] URL]];
     [self _addWorkForTarget:self selector:@selector(_doLoad:target:) arg1:URL arg2:target];
 }
 
 - (void)setAcceptsEditing:(BOOL)newAcceptsEditing
 {
-    [(EditingDelegate *)[[frame webView] editingDelegate] setAcceptsEditing:newAcceptsEditing];
+    [(EditingDelegate *)[[mainFrame webView] editingDelegate] setAcceptsEditing:newAcceptsEditing];
 }
 
 - (void)setTabKeyCyclesThroughElements:(BOOL)newTabKeyCyclesThroughElements
 {
-    [[frame webView] setTabKeyCyclesThroughElements:newTabKeyCyclesThroughElements];
+    [[mainFrame webView] setTabKeyCyclesThroughElements:newTabKeyCyclesThroughElements];
 }
 
 - (void)storeWebScriptObject:(WebScriptObject *)webScriptObject
@@ -1474,6 +1343,11 @@ static void dump(void)
 
 @end
 
+static bool shouldLogFrameLoadDelegates(const char *pathOrURL)
+{
+    return strstr(pathOrURL, "loading/");
+}    
+
 static void runTest(const char *pathOrURL)
 {
     CFStringRef pathOrURLString = CFStringCreateWithCString(NULL, pathOrURL, kCFStringEncodingUTF8);
@@ -1494,8 +1368,8 @@ static void runTest(const char *pathOrURL)
         return;
     }
 
-    [(EditingDelegate *)[[frame webView] editingDelegate] setAcceptsEditing:YES];
-    [[frame webView] setTabKeyCyclesThroughElements: YES];
+    [(EditingDelegate *)[[mainFrame webView] editingDelegate] setAcceptsEditing:YES];
+    [[mainFrame webView] setTabKeyCyclesThroughElements: YES];
     done = NO;
     topLoadingFrame = nil;
     waitToDump = NO;
@@ -1505,6 +1379,7 @@ static void runTest(const char *pathOrURL)
     dumpChildFrameScrollPositions = NO;
     shouldDumpEditingCallbacks = NO;
     shouldDumpResourceLoadCallbacks = NO;
+    shouldDumpFrameLoadCallbacks = NO;
     dumpSelectionRect = NO;
     dumpTitleChanges = NO;
     dumpBackForwardList = NO;
@@ -1512,7 +1387,7 @@ static void runTest(const char *pathOrURL)
     canOpenWindows = NO;
     closeWebViews = YES;
     addFileToPasteboardOnDrag = NO;
-    [[frame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:NO];
+    [[mainFrame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:NO];
     testRepaint = testRepaintDefault;
     repaintSweepHorizontally = repaintSweepHorizontallyDefault;
     if ([WebHistory optionalSharedHistory])
@@ -1524,7 +1399,7 @@ static void runTest(const char *pathOrURL)
         CFRelease(currentTest);
     currentTest = (NSString *)pathOrURLString;
     [prevTestBFItem release];
-    prevTestBFItem = [[[[frame webView] backForwardList] currentItem] retain];
+    prevTestBFItem = [[[[mainFrame webView] backForwardList] currentItem] retain];
     [workQueue removeAllObjects];
     workQueueFrozen = NO;
 
@@ -1533,7 +1408,9 @@ static void runTest(const char *pathOrURL)
         [WebCoreStatistics startIgnoringWebCoreNodeLeaks];
 
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    [frame loadRequest:[NSURLRequest requestWithURL:(NSURL *)URL]];
+    if (shouldLogFrameLoadDelegates(pathOrURL))
+        shouldDumpFrameLoadCallbacks = YES;
+    [mainFrame loadRequest:[NSURLRequest requestWithURL:(NSURL *)URL]];
     CFRelease(URL);
     [pool release];
     while (!done) {
@@ -1543,7 +1420,7 @@ static void runTest(const char *pathOrURL)
     }
     pool = [[NSAutoreleasePool alloc] init];
     [EventSendingController clearSavedEvents];
-    [[frame webView] setSelectedDOMRange:nil affinity:NSSelectionAffinityDownstream];
+    [[mainFrame webView] setSelectedDOMRange:nil affinity:NSSelectionAffinityDownstream];
     
     if (closeRemainingWindowsWhenComplete) {
         NSArray* array = [(NSArray *)allWindowsRef copy];
@@ -1553,7 +1430,7 @@ static void runTest(const char *pathOrURL)
             NSWindow *window = [array objectAtIndex:i];
 
             // Don't try to close the main window
-            if (window == [[frame webView] window])
+            if (window == [[mainFrame webView] window])
                 continue;
             
             WebView *webView = [[[window contentView] subviews] objectAtIndex:0];
@@ -1567,8 +1444,8 @@ static void runTest(const char *pathOrURL)
     [pool release];
     
     // We should only have our main window left when we're done
-    assert(CFArrayGetCount(allWindowsRef) == 1);
-    assert(CFArrayGetValueAtIndex(allWindowsRef, 0) == [[frame webView] window]);
+    ASSERT(CFArrayGetCount(allWindowsRef) == 1);
+    ASSERT(CFArrayGetValueAtIndex(allWindowsRef, 0) == [[mainFrame webView] window]);
     
     if (_shouldIgnoreWebCoreNodeLeaks)
         [WebCoreStatistics stopIgnoringWebCoreNodeLeaks];
@@ -1606,7 +1483,7 @@ static NSString *md5HashStringForBitmap(CGImageRef bitmap)
 
 static void displayWebView()
 {
-    NSView *webView = [frame webView];
+    NSView *webView = [mainFrame webView];
     [webView display];
     [webView lockFocus];
     [[[NSColor blackColor] colorWithAlphaComponent:0.66] set];
@@ -1814,7 +1691,7 @@ static CFArrayCallBacks NonRetainingArrayCallbacks = {
 
 + (NSPoint)mouseLocation
 {
-    return [[[frame webView] window] convertBaseToScreen:lastMousePosition];
+    return [[[mainFrame webView] window] convertBaseToScreen:lastMousePosition];
 }
 
 @end
index d8a8ffe..f607b53 100644 (file)
@@ -45,6 +45,9 @@
                22181BD209DC8C4B008342E8 /* ObjCPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 22181BCE09DC8C4B008342E8 /* ObjCPlugin.m */; };
                22181BD309DC8C4B008342E8 /* ObjCPluginFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 22181BCF09DC8C4B008342E8 /* ObjCPluginFunction.h */; };
                22181BD409DC8C4B008342E8 /* ObjCPluginFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 22181BD009DC8C4B008342E8 /* ObjCPluginFunction.m */; };
+               6508A2980BFABB8000AD2696 /* FrameLoadDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6508A26D0BFAB71B00AD2696 /* FrameLoadDelegate.m */; };
+               6508A2990BFABB8100AD2696 /* FrameLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6508A26C0BFAB71B00AD2696 /* FrameLoadDelegate.h */; };
+               6508A29A0BFABB8200AD2696 /* ResourceLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6CA8630B7120CF00A24B62 /* ResourceLoadDelegate.h */; };
                9340994C08540CAE007F3BC8 /* DumpRenderTreePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */; };
                9340994E08540CAE007F3BC8 /* DumpRenderTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* DumpRenderTree.m */; settings = {ATTRIBUTES = (); COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                9340995108540CAE007F3BC8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9335435F03D75502008635CE /* WebKit.framework */; };
                22181BCF09DC8C4B008342E8 /* ObjCPluginFunction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ObjCPluginFunction.h; sourceTree = "<group>"; };
                22181BD009DC8C4B008342E8 /* ObjCPluginFunction.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ObjCPluginFunction.m; sourceTree = "<group>"; };
                32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
+               6508A26C0BFAB71B00AD2696 /* FrameLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoadDelegate.h; sourceTree = "<group>"; };
+               6508A26D0BFAB71B00AD2696 /* FrameLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = FrameLoadDelegate.m; sourceTree = "<group>"; };
                9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; };
                93442CF408F8BA4900BFE8CA /* TextInputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputController.h; sourceTree = "<group>"; };
                1422A2750AF6F4BD00E1A883 /* Delegates */ = {
                        isa = PBXGroup;
                        children = (
+                               6508A26C0BFAB71B00AD2696 /* FrameLoadDelegate.h */,
+                               6508A26D0BFAB71B00AD2696 /* FrameLoadDelegate.m */,
                                A803FFF309CAAFE0009B2A37 /* EditingDelegate.h */,
                                A803FFF409CAAFE0009B2A37 /* EditingDelegate.m */,
                                1A6CA8630B7120CF00A24B62 /* ResourceLoadDelegate.h */,
                                22181BD309DC8C4B008342E8 /* ObjCPluginFunction.h in Headers */,
                                14770FE20A22ADF7009342EE /* GCController.h in Headers */,
                                1422A1BA0AF6EDD600E1A883 /* UIDelegate.h in Headers */,
+                               6508A2990BFABB8100AD2696 /* FrameLoadDelegate.h in Headers */,
+                               6508A29A0BFABB8200AD2696 /* ResourceLoadDelegate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                14770FE30A22ADF7009342EE /* GCController.mm in Sources */,
                                1A6CA8DE0B7122D100A24B62 /* ResourceLoadDelegate.m in Sources */,
                                1422A1BB0AF6EDD600E1A883 /* UIDelegate.m in Sources */,
+                               6508A2980BFABB8000AD2696 /* FrameLoadDelegate.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index b0407e1..41aa639 100644 (file)
@@ -54,7 +54,7 @@
 
 - (NSWindow *)draggingDestinationWindow 
 {
-    return [[frame webView] window];
+    return [[mainFrame webView] window];
 }
 
 - (NSDragOperation)draggingSourceOperationMask 
index b565469..e3ffbe6 100644 (file)
@@ -177,7 +177,7 @@ BOOL replayingSavedEvents;
 
 - (void)mouseDown
 {
-    [[[frame frameView] documentView] layout];
+    [[[mainFrame frameView] documentView] layout];
     if ([self currentEventTime] - lastClick >= 1)
         clickCount = 1;
     else
@@ -186,13 +186,13 @@ BOOL replayingSavedEvents;
                                         location:lastMousePosition 
                                    modifierFlags:0 
                                        timestamp:[self currentEventTime]
-                                    windowNumber:[[[frame webView] window] windowNumber] 
+                                    windowNumber:[[[mainFrame webView] window] windowNumber] 
                                          context:[NSGraphicsContext currentContext] 
                                      eventNumber:++eventNumber 
                                       clickCount:clickCount 
                                         pressure:0.0];
 
-    NSView *subView = [[frame webView] hitTest:[event locationInWindow]];
+    NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]];
     if (subView) {
         [subView mouseDown:event];
         down = YES;
@@ -212,28 +212,28 @@ BOOL replayingSavedEvents;
         return;
     }
 
-    [[[frame frameView] documentView] layout];
+    [[[mainFrame frameView] documentView] layout];
     NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp 
                                         location:lastMousePosition 
                                    modifierFlags:0 
                                        timestamp:[self currentEventTime]
-                                    windowNumber:[[[frame webView] window] windowNumber] 
+                                    windowNumber:[[[mainFrame webView] window] windowNumber] 
                                          context:[NSGraphicsContext currentContext] 
                                      eventNumber:++eventNumber 
                                       clickCount:clickCount 
                                         pressure:0.0];
 
-    NSView *targetView = [[frame webView] hitTest:[event locationInWindow]];
+    NSView *targetView = [[mainFrame webView] hitTest:[event locationInWindow]];
     // FIXME: Silly hack to teach DRT to respect capturing mouse events outside the WebView.
     // The right solution is just to use NSApplication's built-in event sending methods, 
     // instead of rolling our own algorithm for selecting an event target.
-    targetView = targetView ? targetView : [[frame frameView] documentView];
+    targetView = targetView ? targetView : [[mainFrame frameView] documentView];
     assert(targetView);
     [targetView mouseUp:event];
     down = NO;
     lastClick = [event timestamp];
     if (draggingInfo) {
-        WebView *webView = [frame webView];
+        WebView *webView = [mainFrame webView];
         
         NSDragOperation dragOperation = [webView draggingUpdated:draggingInfo];
         
@@ -261,7 +261,7 @@ BOOL replayingSavedEvents;
         return;
     }
 
-    NSView *view = [frame webView];
+    NSView *view = [mainFrame webView];
     lastMousePosition = [view convertPoint:NSMakePoint(x, [view frame].size.height - y) toView:nil];
     NSEvent *event = [NSEvent mouseEventWithType:(down ? NSLeftMouseDragged : NSMouseMoved) 
                                         location:lastMousePosition 
@@ -273,13 +273,13 @@ BOOL replayingSavedEvents;
                                       clickCount:(down ? clickCount : 0) 
                                         pressure:0.0];
 
-    NSView *subView = [[frame webView] hitTest:[event locationInWindow]];
+    NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]];
     if (subView) {
         if (down) {
             [subView mouseDragged:event];
             if (draggingInfo) {
                 [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] movedTo:lastMousePosition];
-                [[frame webView] draggingUpdated:draggingInfo];
+                [[mainFrame webView] draggingUpdated:draggingInfo];
             }
         } else
             [subView mouseMoved:event];
@@ -288,7 +288,7 @@ BOOL replayingSavedEvents;
 
 - (void)contextClick
 {
-    [[[frame frameView] documentView] layout];
+    [[[mainFrame frameView] documentView] layout];
     if ([self currentEventTime] - lastClick >= 1)
         clickCount = 1;
     else
@@ -297,13 +297,13 @@ BOOL replayingSavedEvents;
                                         location:lastMousePosition 
                                    modifierFlags:0 
                                        timestamp:[self currentEventTime]
-                                    windowNumber:[[[frame webView] window] windowNumber] 
+                                    windowNumber:[[[mainFrame webView] window] windowNumber] 
                                          context:[NSGraphicsContext currentContext] 
                                      eventNumber:++eventNumber 
                                       clickCount:clickCount 
                                         pressure:0.0];
 
-    NSView *subView = [[frame webView] hitTest:[event locationInWindow]];
+    NSView *subView = [[mainFrame webView] hitTest:[event locationInWindow]];
     if (subView)
         [subView menuForEvent:event];
 }
@@ -353,13 +353,13 @@ BOOL replayingSavedEvents;
                 break;
         }
 
-    [[[frame frameView] documentView] layout];
+    [[[mainFrame frameView] documentView] layout];
     
     NSEvent *event = [NSEvent keyEventWithType:NSKeyDown
                         location:NSMakePoint(5, 5)
                         modifierFlags:mask
                         timestamp:[self currentEventTime]
-                        windowNumber:[[[frame webView] window] windowNumber]
+                        windowNumber:[[[mainFrame webView] window] windowNumber]
                         context:[NSGraphicsContext currentContext]
                         characters:character
                         charactersIgnoringModifiers:character
@@ -367,7 +367,7 @@ BOOL replayingSavedEvents;
                         keyCode:0];
     
 
-    NSResponder *firstResponder = [[[frame webView] window] firstResponder];
+    NSResponder *firstResponder = [[[mainFrame webView] window] firstResponder];
     [firstResponder keyDown:event];
 }
 
diff --git a/WebKitTools/DumpRenderTree/FrameLoadDelegate.h b/WebKitTools/DumpRenderTree/FrameLoadDelegate.h
new file mode 100644 (file)
index 0000000..41c1d3d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2007, Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+    * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface FrameLoadDelegate : NSObject {
+}
+
+@end
diff --git a/WebKitTools/DumpRenderTree/FrameLoadDelegate.m b/WebKitTools/DumpRenderTree/FrameLoadDelegate.m
new file mode 100644 (file)
index 0000000..c9d63af
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2007, Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+    * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "FrameLoadDelegate.h"
+
+#import "AppleScriptController.h"
+#import "DumpRenderTree.h"
+#import "EventSendingController.h"
+#import "GCController.h"
+#import "NavigationController.h"
+#import "ObjCPlugin.h"
+#import "ObjCPluginFunction.h"
+
+#import "TextInputController.h"
+
+#import <JavaScriptCore/Assertions.h>
+#import <JavaScriptCore/JavaScriptCore.h>
+#import <WebKit/WebKit.h>
+#import <WebKit/WebHTMLViewPrivate.h>
+#import <WebKit/WebFramePrivate.h>
+#import <WebCore/WebScriptObjectPendingPublic.h>
+
+@interface NSURL (DRTExtras)
+- (NSString *)_drt_descriptionSuitableForTestResult;
+@end
+
+@interface NSError (DRTExtras)
+- (NSString *)_drt_descriptionSuitableForTestResult;
+@end
+
+@interface NSURLResponse (DRTExtras)
+- (NSString *)_drt_descriptionSuitableForTestResult;
+@end
+
+@interface NSURLRequest (DRTExtras)
+- (NSString *)_drt_descriptionSuitableForTestResult;
+@end
+
+@interface WebFrame (DRTExtras)
+- (NSString *)_drt_descriptionSuitableForTestResult;
+@end
+
+@implementation WebFrame (DRTExtras)
+- (NSString *)_drt_descriptionSuitableForTestResult
+{
+    BOOL isMainFrame = (self == [[self webView] mainFrame]);
+    NSString *name = [self name];
+    if (isMainFrame) {
+        if ([name length])
+            return [NSString stringWithFormat:@"main frame \"%@\"", name];
+        else
+            return @"main frame";
+    } else {
+        if (name)
+            return [NSString stringWithFormat:@"frame \"%@\"", name];
+        else
+            return @"frame (anonymous)";
+    }
+}
+@end
+
+@implementation FrameLoadDelegate
+
+// Exec messages in the work queue until they're all done, or one of them starts a new load
+- (void)processWork:(id)dummy
+{
+    // quit doing work once a load is in progress
+    while ([workQueue count] > 0 && !topLoadingFrame) {
+        [[workQueue objectAtIndex:0] invoke];
+        [workQueue removeObjectAtIndex:0];
+    }
+    
+    // if we didn't start a new load, then we finished all the commands, so we're ready to dump state
+    if (!topLoadingFrame && !waitToDump)
+        dump();
+}
+
+- (void)webView:(WebView *)c locationChangeDone:(NSError *)error forDataSource:(WebDataSource *)dataSource
+{
+    if ([dataSource webFrame] == topLoadingFrame) {
+        topLoadingFrame = nil;
+        workQueueFrozen = YES;      // first complete load freezes the queue for the rest of this test
+        if (!waitToDump) {
+            if ([workQueue count] > 0)
+                [self performSelector:@selector(processWork:) withObject:nil afterDelay:0];
+            else
+                dump();
+        }
+    }
+}
+
+- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didStartProvisionalLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+    
+    ASSERT([frame provisionalDataSource]);
+    // Make sure we only set this once per test.  If it gets cleared, and then set again, we might
+    // end up doing two dumps for one test.
+    if (!topLoadingFrame && !done)
+        topLoadingFrame = frame;
+}
+
+- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didCommitLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+    
+    ASSERT(![frame provisionalDataSource]);
+    ASSERT([frame dataSource]);
+    
+    windowIsKey = YES;
+    NSView *documentView = [[mainFrame frameView] documentView];
+    [[[mainFrame webView] window] makeFirstResponder:documentView];
+    if ([documentView isKindOfClass:[WebHTMLView class]])
+        [(WebHTMLView *)documentView _updateActiveState];
+}
+
+- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didFailProvisionalLoadWithError", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+    
+    ASSERT([frame provisionalDataSource]);
+    [self webView:sender locationChangeDone:error forDataSource:[frame provisionalDataSource]];
+}
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didFinishLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+    
+    // FIXME: This call to displayIfNeeded can be removed when <rdar://problem/5092361> is fixed.
+    // After that is fixed, we will reenable painting after WebCore is done loading the document, 
+    // and this call will no longer be needed.
+    if ([[sender mainFrame] isEqual:frame])
+        [sender displayIfNeeded];
+    [self webView:sender locationChangeDone:nil forDataSource:[frame dataSource]];
+    [navigationController webView:sender didFinishLoadForFrame:frame];
+}
+
+- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didFailLoadWithError", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+    
+    ASSERT(![frame provisionalDataSource]);
+    ASSERT([frame dataSource]);
+    
+    [self webView:sender locationChangeDone:error forDataSource:[frame dataSource]];    
+}
+
+- (void)webView:(WebView *)webView windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject;
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"?? - windowScriptObjectAvailable"];
+        printf ("%s\n", [string UTF8String]);
+    }
+    
+    ASSERT_NOT_REACHED();
+}
+
+- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)obj forFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didClearWindowObjectForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+        
+    ASSERT(obj == [frame windowObject]);
+    ASSERT([obj JSObject] == JSContextGetGlobalObject([frame globalContext]));
+    
+    LayoutTestController *ltc = [[LayoutTestController alloc] init];
+    [obj setValue:ltc forKey:@"layoutTestController"];
+    [ltc release];
+    
+    EventSendingController *esc = [[EventSendingController alloc] init];
+    [obj setValue:esc forKey:@"eventSender"];
+    [esc release];
+    
+    TextInputController *tic = [[TextInputController alloc] initWithWebView:sender];
+    [obj setValue:tic forKey:@"textInputController"];
+    [tic release];
+    
+    AppleScriptController *asc = [[AppleScriptController alloc] initWithWebView:sender];
+    [obj setValue:asc forKey:@"appleScriptController"];
+    [asc release];
+    
+    GCController *gcc = [[GCController alloc] init];
+    [obj setValue:gcc forKey:@"GCController"];
+    [gcc release];
+    
+    [obj setValue:navigationController forKey:@"navigationController"];
+    
+    ObjCPlugin *plugin = [[ObjCPlugin alloc] init];
+    [obj setValue:plugin forKey:@"objCPlugin"];
+    [plugin release];
+    
+    ObjCPluginFunction *pluginFunction = [[ObjCPluginFunction alloc] init];
+    [obj setValue:pluginFunction forKey:@"objCPluginFunction"];
+    [pluginFunction release];
+}
+
+- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didReceiveTitle: %@", [frame _drt_descriptionSuitableForTestResult], title];
+        printf ("%s\n", [string UTF8String]);
+    }
+    
+    if (dumpTitleChanges)
+        printf("TITLE CHANGED: %s\n", [title UTF8String]);
+}
+
+- (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didReceiveServerRedirectForProvisionalLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender didReceiveIcon:(NSImage *)image forFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didReceiveIconForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender didChangeLocationWithinPageForFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didChangeLocationWithinPageForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - willPerformClientRedirectToURL: %@ ", [frame _drt_descriptionSuitableForTestResult], [URL _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender didCancelClientRedirectForFrame:(WebFrame *)frame
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didCancelClientRedirectForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame;
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - willCloseFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didFirstLayoutInFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender didFinishDocumentLoadForFrame:(WebFrame *)frame;
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didFinishDocumentLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+- (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame;
+{
+    if (shouldDumpFrameLoadCallbacks && !done) {
+        NSString *string = [NSString stringWithFormat:@"%@ - didHandleOnloadEventsForFrame", [frame _drt_descriptionSuitableForTestResult]];
+        printf ("%s\n", [string UTF8String]);
+    }
+}
+
+@end
index fb901bf..c5839e3 100644 (file)
@@ -70,9 +70,9 @@
     if (![self isFileURL])
         return [self description];
 
-    WebDataSource *dataSource = [frame dataSource];
+    WebDataSource *dataSource = [mainFrame dataSource];
     if (!dataSource)
-        dataSource = [frame provisionalDataSource];
+        dataSource = [mainFrame provisionalDataSource];
     
     NSString *basePath = [[[[dataSource request] URL] path] stringByDeletingLastPathComponent];
     
index 5202e5f..90d0736 100644 (file)
@@ -67,7 +67,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
 - (void)webViewFocus:(WebView *)webView
 {
     windowIsKey = YES;
-    NSView *documentView = [[frame frameView] documentView];
+    NSView *documentView = [[mainFrame frameView] documentView];
     if ([documentView isKindOfClass:[WebHTMLView class]])
         [(WebHTMLView *)documentView _updateActiveState];
 }