WebKitTools:
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Sep 2007 23:41:07 +0000 (23:41 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Sep 2007 23:41:07 +0000 (23:41 +0000)
        Reviewed by Oliver.

        Initial refactor of DumpRenderTree in preparation of making it more platform independent.
        - Move LayoutTestController into its own file.
        - Move Objective-C only functions on LayoutTestController into a new controller called the
          ObjCController.

        * DumpRenderTree/DumpRenderTree.h:
        * DumpRenderTree/DumpRenderTree.m:
        (displayWebView):
        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
        * DumpRenderTree/FrameLoadDelegate.m:
        (-[FrameLoadDelegate webView:didClearWindowObject:forFrame:]):
        * DumpRenderTree/LayoutTestController.h: Added.
        * DumpRenderTree/LayoutTestController.m: Added.
        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
        (+[LayoutTestController webScriptNameForSelector:]):
        (-[LayoutTestController clearBackForwardList]):
        (-[LayoutTestController setUseDashboardCompatibilityMode:]):
        (-[LayoutTestController setCloseRemainingWindowsWhenComplete:]):
        (-[LayoutTestController setCustomPolicyDelegate:]):
        (-[LayoutTestController keepWebHistory]):
        (-[LayoutTestController setCallCloseOnWebViews:]):
        (-[LayoutTestController setCanOpenWindows]):
        (-[LayoutTestController waitUntilDone]):
        (-[LayoutTestController waitUntilDoneWatchdogFired]):
        (-[LayoutTestController notifyDone]):
        (-[LayoutTestController dumpAsText]):
        (-[LayoutTestController addFileToPasteboardOnDrag]):
        (-[LayoutTestController addDisallowedURL:]):
        (-[LayoutTestController setUserStyleSheetLocation:]):
        (-[LayoutTestController setUserStyleSheetEnabled:]):
        (-[LayoutTestController dumpDOMAsWebArchive]):
        (-[LayoutTestController dumpSourceAsWebArchive]):
        (-[LayoutTestController dumpSelectionRect]):
        (-[LayoutTestController dumpTitleChanges]):
        (-[LayoutTestController dumpBackForwardList]):
        (-[LayoutTestController windowCount]):
        (-[LayoutTestController dumpChildFrameScrollPositions]):
        (-[LayoutTestController dumpChildFramesAsText]):
        (-[LayoutTestController dumpEditingCallbacks]):
        (-[LayoutTestController dumpResourceLoadCallbacks]):
        (-[LayoutTestController dumpFrameLoadCallbacks]):
        (-[LayoutTestController setWindowIsKey:]):
        (-[LayoutTestController setMainFrameIsFirstResponder:]):
        (-[LayoutTestController display]):
        (-[LayoutTestController testRepaint]):
        (-[LayoutTestController repaintSweepHorizontally]):
        (-[LayoutTestController invokeUndefinedMethodFromWebScript:withArguments:]):
        (-[LayoutTestController _addWorkForTarget:selector:arg1:arg2:]):
        (-[LayoutTestController _doLoad:target:]):
        (-[LayoutTestController _doBackOrForwardNavigation:]):
        (-[LayoutTestController queueBackNavigation:]):
        (-[LayoutTestController queueForwardNavigation:]):
        (-[LayoutTestController queueReload]):
        (-[LayoutTestController queueScript:]):
        (-[LayoutTestController queueLoad:target:]):
        (-[LayoutTestController setAcceptsEditing:]):
        (-[LayoutTestController setTabKeyCyclesThroughElements:]):
        (-[LayoutTestController storeWebScriptObject:]):
        (-[LayoutTestController accessStoredWebScriptObject]):
        (-[LayoutTestController dealloc]):
        (-[LayoutTestController decodeHostName:]):
        (-[LayoutTestController encodeHostName:]):
        * DumpRenderTree/ObjCController.h: Added.
        * DumpRenderTree/ObjCController.m: Added.
        (+[ObjCController isSelectorExcludedFromWebScript:]):
        (+[ObjCController webScriptNameForSelector:]):
        (-[ObjCController objCClassNameOf:]):
        (-[ObjCController objCObjectOfClass:]):
        (-[ObjCController objCIdentityIsEqual::]):
        (-[ObjCController objCLongLongRoundTrip:]):
        (-[ObjCController objCUnsignedLongLongRoundTrip:]):
        (-[ObjCController testWrapperRoundTripping:]):

LayoutTests:

        Reviewed by Oliver.

        Change objective-c tests to use the new ObjCController.

        * fast/dom/Window/window-properties.html:
        * fast/dom/wrapper-classes.html:
        * platform/mac/fast/dom/wrapper-round-tripping.html:
        * platform/mac/fast/objc/longlongTest.html:

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties.html
LayoutTests/fast/dom/wrapper-classes.html
LayoutTests/platform/mac/fast/dom/wrapper-round-tripping.html
LayoutTests/platform/mac/fast/objc/longlongTest.html
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.h
WebKitTools/DumpRenderTree/DumpRenderTree.m
WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
WebKitTools/DumpRenderTree/FrameLoadDelegate.m
WebKitTools/DumpRenderTree/LayoutTestController.h [new file with mode: 0644]
WebKitTools/DumpRenderTree/LayoutTestController.m [new file with mode: 0644]
WebKitTools/DumpRenderTree/ObjCController.h [new file with mode: 0644]
WebKitTools/DumpRenderTree/ObjCController.m [new file with mode: 0644]

index 03aa23be94b880e0c225f54167c1714a4ab78307..1ca5c4bf08e3d7c086f813792359ad700f731a3e 100644 (file)
@@ -1,3 +1,14 @@
+2007-09-09  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Oliver.
+
+        Change objective-c tests to use the new ObjCController.
+
+        * fast/dom/Window/window-properties.html:
+        * fast/dom/wrapper-classes.html:
+        * platform/mac/fast/dom/wrapper-round-tripping.html:
+        * platform/mac/fast/objc/longlongTest.html:
+
 2007-09-09  Sam Weinig  <sam@webkit.org>
 
         Rubber-stamped by Oliver.
index 0b1be612ed82218d0e70e5925f0584b04c0d89e5..e6ee3b5b7654a3b94e3548a6b3c0a09f4d52b755 100644 (file)
@@ -55,6 +55,7 @@ var __skip__ = {
     "window.appleScriptController" : 1,
     "window.eventSender" : 1,
     "window.navigationController" : 1,
+    "window.objCController" : 1,
     "window.objCPlugin" : 1,
     "window.objCPluginFunction" : 1,
     "window.textInputController" : 1
index 8850e2f5f5da94126ab58c8af6b224802843c39e..dcad2f63a2b46f9742544a78fa2516008f65f229 100644 (file)
@@ -29,16 +29,16 @@ function jsWrapperClass(node)
 
 function objCWrapperClass(node)
 {
-    if (!window.layoutTestController)
+    if (!window.objCController)
         return "only works under DumpRenderTree";
-    return layoutTestController.objCClassName(node);
+    return objCController.objCClassName(node);
 }
 
 function objCObjectOfClass(name)
 {
-    if (!window.layoutTestController)
+    if (!window.objCController)
         return "only works under DumpRenderTree";
-    return layoutTestController.objCObjectOfClass(name);
+    return objCController.objCObjectOfClass(name);
 }
 
 function tagJSWrapperClass(tagName)
@@ -56,7 +56,7 @@ function testTag(tagName, className, objCClassName)
     shouldBe("tagJSWrapperClass('" + tagName + "')", "'" + className + "'");
     if (!objCClassName)
         objCClassName = "DOM" + className;
-    if (window.layoutTestController)
+    if (window.objCController)
         shouldBe("tagObjCWrapperClass('" + tagName + "')", "'" + objCClassName + "'");
 }
 
@@ -65,7 +65,7 @@ function test(expression, className, objCClassName)
     shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'");
     if (!objCClassName)
         objCClassName = "DOM" + className;
-    if (window.layoutTestController)
+    if (window.objCController)
         shouldBe("objCWrapperClass(" + expression + ")", "'" + objCClassName + "'");
 }
 
index 1f380be5c62b0ef6f91ba015e8ec332d9cc113ff..172dab137eb4f9ac730b9dd58a18f094acb32ce1 100644 (file)
@@ -27,7 +27,7 @@ function runTest()
     var message = "FAIL: Test did not run properly.";
     try {
         var object = { returnThis: function() { return this; } };
-        success = layoutTestController.testWrapperRoundTripping(object);
+        success = objCController.testWrapperRoundTripping(object);
         message = success
             ? "PASS."
             : "FAIL: wrapper round tripping failed.";
index 876dac66c379d91780ba3c79f683d095ebab91d8..a4a196e6cf2834b8e96d50728a4ad8664dc1ad10 100644 (file)
@@ -9,7 +9,7 @@
 
             function testLongLong(num, expected)
             {
-                var result = layoutTestController.objCLongLongRoundTrip(num);
+                var result = objCController.objCLongLongRoundTrip(num);
                 if (result == expected)
                     log("PASS Test LongLong: result is " + result + " as expected!");
                 else
@@ -18,7 +18,7 @@
 
             function testUnsignedLongLong(num, expected)
             {
-                var result = layoutTestController.objCUnsignedLongLongRoundTrip(num);
+                var result = objCController.objCUnsignedLongLongRoundTrip(num);
                 if (result == expected)
                     log("PASS Test UnsignedLongLong: result is " + result + " as expected!");
                 else
index 6330bcbcd28ec1902943eb84bfb5e2859ba5b00f..b30db95ce00f8a4c25adb6f7a4c08e2691f6ee4b 100644 (file)
@@ -1,3 +1,80 @@
+2007-09-09  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Oliver.
+
+        Initial refactor of DumpRenderTree in preparation of making it more platform independent. 
+        - Move LayoutTestController into its own file.
+        - Move Objective-C only functions on LayoutTestController into a new controller called the
+          ObjCController. 
+
+        * DumpRenderTree/DumpRenderTree.h:
+        * DumpRenderTree/DumpRenderTree.m:
+        (displayWebView):
+        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+        * DumpRenderTree/FrameLoadDelegate.m:
+        (-[FrameLoadDelegate webView:didClearWindowObject:forFrame:]):
+        * DumpRenderTree/LayoutTestController.h: Added.
+        * DumpRenderTree/LayoutTestController.m: Added.
+        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
+        (+[LayoutTestController webScriptNameForSelector:]):
+        (-[LayoutTestController clearBackForwardList]):
+        (-[LayoutTestController setUseDashboardCompatibilityMode:]):
+        (-[LayoutTestController setCloseRemainingWindowsWhenComplete:]):
+        (-[LayoutTestController setCustomPolicyDelegate:]):
+        (-[LayoutTestController keepWebHistory]):
+        (-[LayoutTestController setCallCloseOnWebViews:]):
+        (-[LayoutTestController setCanOpenWindows]):
+        (-[LayoutTestController waitUntilDone]):
+        (-[LayoutTestController waitUntilDoneWatchdogFired]):
+        (-[LayoutTestController notifyDone]):
+        (-[LayoutTestController dumpAsText]):
+        (-[LayoutTestController addFileToPasteboardOnDrag]):
+        (-[LayoutTestController addDisallowedURL:]):
+        (-[LayoutTestController setUserStyleSheetLocation:]):
+        (-[LayoutTestController setUserStyleSheetEnabled:]):
+        (-[LayoutTestController dumpDOMAsWebArchive]):
+        (-[LayoutTestController dumpSourceAsWebArchive]):
+        (-[LayoutTestController dumpSelectionRect]):
+        (-[LayoutTestController dumpTitleChanges]):
+        (-[LayoutTestController dumpBackForwardList]):
+        (-[LayoutTestController windowCount]):
+        (-[LayoutTestController dumpChildFrameScrollPositions]):
+        (-[LayoutTestController dumpChildFramesAsText]):
+        (-[LayoutTestController dumpEditingCallbacks]):
+        (-[LayoutTestController dumpResourceLoadCallbacks]):
+        (-[LayoutTestController dumpFrameLoadCallbacks]):
+        (-[LayoutTestController setWindowIsKey:]):
+        (-[LayoutTestController setMainFrameIsFirstResponder:]):
+        (-[LayoutTestController display]):
+        (-[LayoutTestController testRepaint]):
+        (-[LayoutTestController repaintSweepHorizontally]):
+        (-[LayoutTestController invokeUndefinedMethodFromWebScript:withArguments:]):
+        (-[LayoutTestController _addWorkForTarget:selector:arg1:arg2:]):
+        (-[LayoutTestController _doLoad:target:]):
+        (-[LayoutTestController _doBackOrForwardNavigation:]):
+        (-[LayoutTestController queueBackNavigation:]):
+        (-[LayoutTestController queueForwardNavigation:]):
+        (-[LayoutTestController queueReload]):
+        (-[LayoutTestController queueScript:]):
+        (-[LayoutTestController queueLoad:target:]):
+        (-[LayoutTestController setAcceptsEditing:]):
+        (-[LayoutTestController setTabKeyCyclesThroughElements:]):
+        (-[LayoutTestController storeWebScriptObject:]):
+        (-[LayoutTestController accessStoredWebScriptObject]):
+        (-[LayoutTestController dealloc]):
+        (-[LayoutTestController decodeHostName:]):
+        (-[LayoutTestController encodeHostName:]):
+        * DumpRenderTree/ObjCController.h: Added.
+        * DumpRenderTree/ObjCController.m: Added.
+        (+[ObjCController isSelectorExcludedFromWebScript:]):
+        (+[ObjCController webScriptNameForSelector:]):
+        (-[ObjCController objCClassNameOf:]):
+        (-[ObjCController objCObjectOfClass:]):
+        (-[ObjCController objCIdentityIsEqual::]):
+        (-[ObjCController objCLongLongRoundTrip:]):
+        (-[ObjCController objCUnsignedLongLongRoundTrip:]):
+        (-[ObjCController testWrapperRoundTripping:]):
+
 2007-09-07  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Alice.
index bbe3408e403be68ce39f04b6e72099a676ee904f..98a577ce87988d1dcc8a71080e576da5e7dd4a04 100644 (file)
  */
 
 @class DumpRenderTreeDraggingInfo;
+@class EditingDelegate;
+@class FrameLoadDelegate;
 @class NavigationController;
+@class PolicyDelegate;
+@class ResourceLoadDelegate;
+@class UIDelegate;
 @class WebFrame;
 @class WebScriptObject;
 @class WebView;
 
+
+extern BOOL dumpAsText;
+extern BOOL dumpDOMAsWebArchive;
+extern BOOL dumpSourceAsWebArchive;
+extern BOOL dumpSelectionRect;
+extern BOOL dumpTitleChanges;
+extern BOOL dumpBackForwardList;
+extern BOOL dumpChildFrameScrollPositions;
+extern BOOL dumpChildFramesAsText;
+extern BOOL testRepaint;
+extern BOOL repaintSweepHorizontally;
 extern BOOL windowIsKey;
+extern BOOL shouldDumpEditingCallbacks;
+extern BOOL shouldDumpResourceLoadCallbacks;
+extern BOOL shouldDumpFrameLoadCallbacks;
 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 closeRemainingWindowsWhenComplete;
 extern BOOL addFileToPasteboardOnDrag;
 extern NSMutableArray *workQueue;
 extern WebFrame *topLoadingFrame;
 extern BOOL workQueueFrozen;
 extern NavigationController *navigationController;
+extern NSTimer *waitToDumpWatchdog;
+extern NSTimeInterval waitToDumpWatchdogInterval;
+extern CFMutableArrayRef allWindowsRef;
+
+// Delegates
+extern FrameLoadDelegate *frameLoadDelegate;
+extern UIDelegate *uiDelegate;
+extern EditingDelegate *editingDelegate;
+extern ResourceLoadDelegate *resourceLoadDelegate;
+extern PolicyDelegate *policyDelegate;
 
 WebView *createWebView();
+void displayWebView();
 void dump(void);
 
-@interface LayoutTestController : NSObject
-{
-    WebScriptObject *storedWebScriptObject;
-}
-- (void)dealloc;
-@end
-
index e949fb1c201672937e4e9b4ed6c1d715e91c4575..f91b7632eb5ef9b761549e96ea1fbe2f3e1654bf 100644 (file)
 #import "PolicyDelegate.h"
 #import "ResourceLoadDelegate.h"
 #import "UIDelegate.h"
+
 #import <ApplicationServices/ApplicationServices.h> // for CMSetDefaultProfileBySpace
 #import <CoreFoundation/CoreFoundation.h>
+#import <JavaScriptCore/Assertions.h>
 #import <JavaScriptCore/JavaScriptCore.h>
 #import <WebKit/DOMElementPrivate.h>
 #import <WebKit/DOMExtensions.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebDocumentPrivate.h>
 #import <WebKit/WebEditingDelegate.h>
-#import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebFrameView.h>
-#import <WebKit/WebHTMLViewPrivate.h>
 #import <WebKit/WebHistory.h>
 #import <WebKit/WebHistoryItemPrivate.h>
-#import <WebKit/WebNSURLExtras.h>
 #import <WebKit/WebPluginDatabase.h>
 #import <WebKit/WebPreferences.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebViewPrivate.h>
-#import <JavaScriptCore/Assertions.h>
 #import <getopt.h>
 #import <mach-o/getsect.h>
 #import <malloc/malloc.h>
@@ -91,7 +89,6 @@
 
 BOOL windowIsKey = YES;
 WebFrame *mainFrame = 0;
-BOOL shouldDumpSubframesAsText;
 BOOL shouldDumpEditingCallbacks;
 BOOL shouldDumpResourceLoadCallbacks;
 BOOL shouldDumpFrameLoadCallbacks;
@@ -104,20 +101,19 @@ BOOL addFileToPasteboardOnDrag = NO;
 
 static void runTest(const char *pathOrURL);
 static NSString *md5HashStringForBitmap(CGImageRef bitmap);
-static void displayWebView();
 
 volatile BOOL done;
 NavigationController *navigationController = nil;
 
-static NSTimer *waitToDumpWatchdog;
-static NSTimeInterval waitToDumpWatchdogInterval = 10; // seconds
+NSTimer *waitToDumpWatchdog;
+NSTimeInterval waitToDumpWatchdogInterval = 10; // seconds
 
 // Delegates
-static FrameLoadDelegate *frameLoadDelegate;
-static UIDelegate *uiDelegate;
-static EditingDelegate *editingDelegate;
-static ResourceLoadDelegate *resourceLoadDelegate;
-static PolicyDelegate *policyDelegate;
+FrameLoadDelegate *frameLoadDelegate;
+UIDelegate *uiDelegate;
+EditingDelegate *editingDelegate;
+ResourceLoadDelegate *resourceLoadDelegate;
+PolicyDelegate *policyDelegate;
 
 // Deciding when it's OK to dump out the state is a bit tricky.  All these must be true:
 // - There is no load in progress
@@ -132,39 +128,43 @@ static PolicyDelegate *policyDelegate;
 // that child frame is the "topmost frame that is loading".
 WebFrame *topLoadingFrame = nil;     // !nil iff a load is in progress
 
-static BOOL dumpAsText;
-static BOOL dumpDOMAsWebArchive;
-static BOOL dumpSourceAsWebArchive;
-static BOOL dumpSelectionRect;
+BOOL dumpAsText;
+BOOL dumpDOMAsWebArchive;
+BOOL dumpSourceAsWebArchive;
+BOOL dumpSelectionRect;
 BOOL dumpTitleChanges = NO;
-static BOOL dumpBackForwardList;
-static BOOL dumpChildFrameScrollPositions;
-static BOOL dumpChildFramesAsText;
+BOOL dumpBackForwardList;
+BOOL dumpChildFrameScrollPositions;
+BOOL dumpChildFramesAsText;
+BOOL testRepaint;
+BOOL repaintSweepHorizontally;
+
 static int dumpPixels;
 static int paint;
 static int dumpAllPixels;
 static int threaded;
 static BOOL readFromWindow;
 static int testRepaintDefault;
-static BOOL testRepaint;
 static int repaintSweepHorizontallyDefault;
-static BOOL repaintSweepHorizontally;
 static int dumpTree = YES;
 static BOOL printSeparators;
 static NSString *currentTest = nil;
+
 static NSMutableDictionary *localPasteboards;
 static WebHistoryItem *prevTestBFItem = nil;  // current b/f item at the end of the previous test
 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
 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)
 BOOL workQueueFrozen = NO;
+
 const unsigned maxViewHeight = 600;
 const unsigned maxViewWidth = 800;
 
-static CFMutableArrayRef allWindowsRef;
+CFMutableArrayRef allWindowsRef;
 
 static pthread_mutex_t javaScriptThreadsMutex = PTHREAD_MUTEX_INITIALIZER;
 static BOOL javaScriptThreadsShouldTerminate;
@@ -1005,519 +1005,6 @@ void dump(void)
     done = YES;
 }
 
-@implementation LayoutTestController
-
-+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
-{
-    if (0
-            || aSelector == @selector(accessStoredWebScriptObject)
-            || aSelector == @selector(addDisallowedURL:)    
-            || aSelector == @selector(addFileToPasteboardOnDrag)
-            || aSelector == @selector(clearBackForwardList)
-            || aSelector == @selector(decodeHostName:)
-            || aSelector == @selector(display)
-            || aSelector == @selector(dumpAsText)
-            || aSelector == @selector(dumpBackForwardList)
-            || aSelector == @selector(dumpChildFrameScrollPositions)
-            || aSelector == @selector(dumpChildFramesAsText)
-            || aSelector == @selector(dumpDOMAsWebArchive)
-            || aSelector == @selector(dumpEditingCallbacks)
-            || aSelector == @selector(dumpFrameLoadCallbacks)
-            || aSelector == @selector(dumpResourceLoadCallbacks)
-            || aSelector == @selector(dumpSelectionRect)
-            || aSelector == @selector(dumpSourceAsWebArchive)
-            || aSelector == @selector(dumpTitleChanges)
-            || aSelector == @selector(encodeHostName:)
-            || aSelector == @selector(keepWebHistory)
-            || aSelector == @selector(notifyDone)
-            || aSelector == @selector(objCClassNameOf:)
-            || aSelector == @selector(objCIdentityIsEqual::)
-            || aSelector == @selector(objCObjectOfClass:)
-            || aSelector == @selector(objCLongLongRoundTrip:)
-            || aSelector == @selector(objCUnsignedLongLongRoundTrip:)
-            || aSelector == @selector(queueBackNavigation:)
-            || aSelector == @selector(queueForwardNavigation:)
-            || aSelector == @selector(queueLoad:target:)
-            || aSelector == @selector(queueReload)
-            || aSelector == @selector(queueScript:)
-            || aSelector == @selector(repaintSweepHorizontally)
-            || aSelector == @selector(setAcceptsEditing:)
-            || aSelector == @selector(setCallCloseOnWebViews:)
-            || aSelector == @selector(setCanOpenWindows)
-            || aSelector == @selector(setCloseRemainingWindowsWhenComplete:)
-            || aSelector == @selector(setCustomPolicyDelegate:)
-            || aSelector == @selector(setMainFrameIsFirstResponder:)
-            || aSelector == @selector(setTabKeyCyclesThroughElements:)
-            || aSelector == @selector(setUseDashboardCompatibilityMode:)
-            || aSelector == @selector(setUserStyleSheetEnabled:)
-            || aSelector == @selector(setUserStyleSheetLocation:)
-            || aSelector == @selector(setWindowIsKey:)
-            || aSelector == @selector(storeWebScriptObject:)
-            || aSelector == @selector(testRepaint)
-            || aSelector == @selector(testWrapperRoundTripping:)
-            || aSelector == @selector(waitUntilDone)
-            || aSelector == @selector(windowCount)
-        )
-        return NO;
-    return YES;
-}
-
-+ (NSString *)webScriptNameForSelector:(SEL)aSelector
-{
-    if (aSelector == @selector(setWindowIsKey:))
-        return @"setWindowIsKey";
-    if (aSelector == @selector(setMainFrameIsFirstResponder:))
-        return @"setMainFrameIsFirstResponder";
-    if (aSelector == @selector(queueBackNavigation:))
-        return @"queueBackNavigation";
-    if (aSelector == @selector(queueForwardNavigation:))
-        return @"queueForwardNavigation";
-    if (aSelector == @selector(queueScript:))
-        return @"queueScript";
-    if (aSelector == @selector(queueLoad:target:))
-        return @"queueLoad";
-    if (aSelector == @selector(setAcceptsEditing:))
-        return @"setAcceptsEditing";
-    if (aSelector == @selector(setTabKeyCyclesThroughElements:))
-        return @"setTabKeyCyclesThroughElements";
-    if (aSelector == @selector(storeWebScriptObject:))
-        return @"storeWebScriptObject";
-    if (aSelector == @selector(testWrapperRoundTripping:))
-        return @"testWrapperRoundTripping";
-    if (aSelector == @selector(setUserStyleSheetLocation:))
-        return @"setUserStyleSheetLocation";
-    if (aSelector == @selector(setUserStyleSheetEnabled:))
-        return @"setUserStyleSheetEnabled";
-    if (aSelector == @selector(objCClassNameOf:))
-        return @"objCClassName";
-    if (aSelector == @selector(objCObjectOfClass:))
-        return @"objCObjectOfClass";
-    if (aSelector == @selector(objCIdentityIsEqual::))
-        return @"objCIdentityIsEqual";
-    if (aSelector == @selector(addDisallowedURL:))
-        return @"addDisallowedURL";
-    if (aSelector == @selector(setCallCloseOnWebViews:))
-        return @"setCallCloseOnWebViews";
-    if (aSelector == @selector(setCloseRemainingWindowsWhenComplete:))
-        return @"setCloseRemainingWindowsWhenComplete";
-    if (aSelector == @selector(setCustomPolicyDelegate:))
-        return @"setCustomPolicyDelegate";
-    if (aSelector == @selector(setUseDashboardCompatibilityMode:))
-        return @"setUseDashboardCompatiblityMode";
-    if (aSelector == @selector(encodeHostName:))
-        return @"encodeHostName";
-    if (aSelector == @selector(decodeHostName:))
-        return @"decodeHostName";    
-    if (aSelector == @selector(objCLongLongRoundTrip:))
-        return @"objCLongLongRoundTrip";
-    if (aSelector == @selector(objCUnsignedLongLongRoundTrip:))
-        return @"objCUnsignedLongLongRoundTrip";
-    
-    return nil;
-}
-
-- (void)clearBackForwardList
-{
-    WebBackForwardList *backForwardList = [[mainFrame webView] backForwardList];
-    WebHistoryItem *item = [[backForwardList currentItem] retain];
-
-    // We clear the history by setting the back/forward list's capacity to 0
-    // then restoring it back and adding back the current item.
-    int capacity = [backForwardList capacity];
-    [backForwardList setCapacity:0];
-    [backForwardList setCapacity:capacity];
-    [backForwardList addItem:item];
-    [backForwardList goToItem:item];
-    [item release];
-}
-
-- (void)setUseDashboardCompatibilityMode:(BOOL)flag
-{
-    [[mainFrame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:flag];
-}
-
-- (void)setCloseRemainingWindowsWhenComplete:(BOOL)closeWindows
-{
-    closeRemainingWindowsWhenComplete = closeWindows;
-}
-
-- (void)setCustomPolicyDelegate:(BOOL)setDelegate
-{
-    if (setDelegate)
-        [[mainFrame webView] setPolicyDelegate:policyDelegate];
-    else
-        [[mainFrame webView] setPolicyDelegate:nil];
-}
-
-- (void)keepWebHistory
-{
-    if (![WebHistory optionalSharedHistory]) {
-        WebHistory *history = [[WebHistory alloc] init];
-        [WebHistory setOptionalSharedHistory:history];
-        [history release];
-    }
-}
-
-- (void)setCallCloseOnWebViews:(BOOL)callClose
-{
-    closeWebViews = callClose;
-}
-
-- (void)setCanOpenWindows
-{
-    canOpenWindows = YES;
-}
-
-- (void)waitUntilDone 
-{
-    waitToDump = YES;
-    if (!waitToDumpWatchdog)
-        waitToDumpWatchdog = [[NSTimer scheduledTimerWithTimeInterval:waitToDumpWatchdogInterval target:self selector:@selector(waitUntilDoneWatchdogFired) userInfo:nil repeats:NO] retain];
-}
-
-- (void)waitUntilDoneWatchdogFired
-{
-    const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
-    fprintf(stderr, message);
-    fprintf(stdout, message);
-    dump();
-}
-
-- (void)notifyDone
-{
-    if (waitToDump && !topLoadingFrame && [workQueue count] == 0)
-        dump();
-    waitToDump = NO;
-}
-
-- (void)dumpAsText
-{
-    dumpAsText = YES;
-}
-
-- (void)addFileToPasteboardOnDrag
-{
-    addFileToPasteboardOnDrag = YES;
-}
-
-- (void)addDisallowedURL:(NSString *)urlString
-{
-    if (!disallowedURLs)
-        disallowedURLs = [[NSMutableSet alloc] init];
-    
-    
-    // Canonicalize the URL
-    NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
-    request = [NSURLProtocol canonicalRequestForRequest:request];
-    
-    [disallowedURLs addObject:[request URL]];
-}
-
-- (void)setUserStyleSheetLocation:(NSString *)path
-{
-    NSURL *url = [NSURL URLWithString:path];
-    [[WebPreferences standardPreferences] setUserStyleSheetLocation:url];
-}
-
-- (void)setUserStyleSheetEnabled:(BOOL)flag
-{
-    [[WebPreferences standardPreferences] setUserStyleSheetEnabled:flag];
-}
-
-- (void)dumpDOMAsWebArchive
-{
-    dumpDOMAsWebArchive = YES;
-}
-
-- (void)dumpSourceAsWebArchive
-{
-    dumpSourceAsWebArchive = YES;
-}
-
-- (void)dumpSelectionRect
-{
-    dumpSelectionRect = YES;
-}
-
-- (void)dumpTitleChanges
-{
-    dumpTitleChanges = YES;
-}
-
-- (void)dumpBackForwardList
-{
-    dumpBackForwardList = YES;
-}
-
-- (int)windowCount
-{
-    return CFArrayGetCount(allWindowsRef);
-}
-
-- (void)dumpChildFrameScrollPositions
-{
-    dumpChildFrameScrollPositions = YES;
-}
-
-- (void)dumpChildFramesAsText
-{
-    dumpChildFramesAsText = YES;
-}
-
-- (void)dumpEditingCallbacks
-{
-    shouldDumpEditingCallbacks = YES;
-}
-
-- (void)dumpResourceLoadCallbacks
-{
-    shouldDumpResourceLoadCallbacks = YES;
-}
-
-- (void)dumpFrameLoadCallbacks
-{
-    shouldDumpFrameLoadCallbacks = YES;
-}
-
-- (void)setWindowIsKey:(BOOL)flag
-{
-    windowIsKey = flag;
-    NSView *documentView = [[mainFrame frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
-}
-
-- (void)setMainFrameIsFirstResponder:(BOOL)flag
-{
-    NSView *documentView = [[mainFrame frameView] documentView];
-    
-    NSResponder *firstResponder = flag ? documentView : nil;
-    [[[mainFrame webView] window] makeFirstResponder:firstResponder];
-        
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
-}
-
-- (void)display
-{
-    displayWebView();
-}
-
-- (void)testRepaint
-{
-    testRepaint = YES;
-}
-
-- (void)repaintSweepHorizontally
-{
-    repaintSweepHorizontally = YES;
-}
-
-- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
-{
-    return nil;
-}
-
-- (void)_addWorkForTarget:(id)target selector:(SEL)selector arg1:(id)arg1 arg2:(id)arg2
-{
-    if (workQueueFrozen)
-        return;
-    NSMethodSignature *sig = [target methodSignatureForSelector:selector];
-    NSInvocation *work = [NSInvocation invocationWithMethodSignature:sig];
-    [work retainArguments];
-    [work setTarget:target];
-    [work setSelector:selector];
-    if (arg1) {
-        [work setArgument:&arg1 atIndex:2];
-        if (arg2)
-            [work setArgument:&arg2 atIndex:3];
-    }
-    [workQueue addObject:work];
-}
-
-- (void)_doLoad:(NSURL *)url target:(NSString *)target
-{
-    WebFrame *targetFrame;
-    if (target && ![target isKindOfClass:[WebUndefined class]])
-        targetFrame = [mainFrame findFrameNamed:target];
-    else
-        targetFrame = mainFrame;
-    [targetFrame loadRequest:[NSURLRequest requestWithURL:url]];
-}
-
-- (void)_doBackOrForwardNavigation:(NSNumber *)index
-{
-    int bfIndex = [index intValue];
-    if (bfIndex == 1)
-        [[mainFrame webView] goForward];
-    if (bfIndex == -1)
-        [[mainFrame webView] goBack];
-    else {        
-        WebBackForwardList *bfList = [[mainFrame webView] backForwardList];
-        [[mainFrame webView] goToBackForwardItem:[bfList itemAtIndex:bfIndex]];
-    }
-}
-
-- (void)queueBackNavigation:(int)howFarBack
-{
-    [self _addWorkForTarget:self selector:@selector(_doBackOrForwardNavigation:) arg1:[NSNumber numberWithInt:-howFarBack] arg2:nil];
-}
-
-- (void)queueForwardNavigation:(int)howFarForward
-{
-    [self _addWorkForTarget:self selector:@selector(_doBackOrForwardNavigation:) arg1:[NSNumber numberWithInt:howFarForward] arg2:nil];
-}
-
-- (void)queueReload
-{
-    [self _addWorkForTarget:[mainFrame webView] selector:@selector(reload:) arg1:self arg2:nil];
-}
-
-- (void)queueScript:(NSString *)script
-{
-    [self _addWorkForTarget:[mainFrame webView] selector:@selector(stringByEvaluatingJavaScriptFromString:) arg1:script arg2:nil];
-}
-
-- (void)queueLoad:(NSString *)URLString target:(NSString *)target
-{
-    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 *)[[mainFrame webView] editingDelegate] setAcceptsEditing:newAcceptsEditing];
-}
-
-- (void)setTabKeyCyclesThroughElements:(BOOL)newTabKeyCyclesThroughElements
-{
-    [[mainFrame webView] setTabKeyCyclesThroughElements:newTabKeyCyclesThroughElements];
-}
-
-- (void)storeWebScriptObject:(WebScriptObject *)webScriptObject
-{
-    if (webScriptObject == storedWebScriptObject)
-        return;
-
-    [storedWebScriptObject release];
-    storedWebScriptObject = [webScriptObject retain];
-}
-
-- (void)accessStoredWebScriptObject
-{
-    JSObjectRef jsObject = [storedWebScriptObject JSObject];
-    ASSERT(!jsObject);
-
-    [storedWebScriptObject callWebScriptMethod:@"" withArguments:nil];
-    [storedWebScriptObject evaluateWebScript:@""];
-    [storedWebScriptObject setValue:[WebUndefined undefined] forKey:@"key"];
-    [storedWebScriptObject valueForKey:@"key"];
-    [storedWebScriptObject removeWebScriptKey:@"key"];
-    [storedWebScriptObject stringRepresentation];
-    [storedWebScriptObject webScriptValueAtIndex:0];
-    [storedWebScriptObject setWebScriptValueAtIndex:0 value:[WebUndefined undefined]];
-    [storedWebScriptObject setException:@"exception"];
-}
-
-- (BOOL)testWrapperRoundTripping:(WebScriptObject *)webScriptObject
-{
-    JSObjectRef jsObject = [webScriptObject JSObject];
-
-    if (!jsObject)
-        return false;
-
-    if (!webScriptObject)
-        return false;
-
-    if ([[webScriptObject evaluateWebScript:@"({ })"] class] != [webScriptObject class])
-        return false;
-
-    [webScriptObject setValue:[NSNumber numberWithInt:666] forKey:@"key"];
-    if (![[webScriptObject valueForKey:@"key"] isKindOfClass:[NSNumber class]] ||
-        ![[webScriptObject valueForKey:@"key"] isEqualToNumber:[NSNumber numberWithInt:666]])
-        return false;
-
-    [webScriptObject removeWebScriptKey:@"key"];
-    @try {
-        if ([webScriptObject valueForKey:@"key"])
-            return false;
-    } @catch(NSException *exception) {
-        // NSObject throws an exception if the key doesn't exist.
-    }
-
-    [webScriptObject setWebScriptValueAtIndex:0 value:webScriptObject];
-    if ([webScriptObject webScriptValueAtIndex:0] != webScriptObject)
-        return false;
-
-    if ([[webScriptObject stringRepresentation] isEqualToString:@"[Object object]"])
-        return false;
-
-    if ([webScriptObject callWebScriptMethod:@"returnThis" withArguments:nil] != webScriptObject)
-        return false;
-
-    return true;
-}
-
-- (void)dealloc
-{
-    [storedWebScriptObject release];
-    [super dealloc];
-}
-
-- (NSString *)objCClassNameOf:(id)object
-{
-    if (!object)
-        return @"nil";
-    return NSStringFromClass([object class]);
-}
-
-- (id)objCObjectOfClass:(NSString *)aClass
-{
-    if ([aClass isEqualToString:@"NSNull"])
-        return [NSNull null];
-    if ([aClass isEqualToString:@"WebUndefined"])
-        return [WebUndefined undefined];
-    if ([aClass isEqualToString:@"NSCFBoolean"])
-        return [NSNumber numberWithBool:true];
-    if ([aClass isEqualToString:@"NSCFNumber"])
-        return [NSNumber numberWithInt:1];
-    if ([aClass isEqualToString:@"NSCFString"])
-        return @"";
-    if ([aClass isEqualToString:@"WebScriptObject"])
-        return self;
-    if ([aClass isEqualToString:@"NSArray"])
-        return [NSArray array];
-
-    return nil;
-}
-
-- (BOOL)objCIdentityIsEqual:(WebScriptObject *)a :(WebScriptObject *)b
-{
-    return a == b;
-}
-
-- (NSString*)decodeHostName:(NSString*)name
-{
-    return [name _web_decodeHostName];
-}
-
-- (NSString*)encodeHostName:(NSString*)name
-{
-    return [name _web_encodeHostName];
-}
-
-- (long long)objCLongLongRoundTrip:(long long)num
-{
-    return num;
-}
-
-- (unsigned long long)objCUnsignedLongLongRoundTrip:(unsigned long long)num
-{
-    return num;
-}
-
-@end
-
 static bool shouldLogFrameLoadDelegates(const char *pathOrURL)
 {
     return strstr(pathOrURL, "loading/");
@@ -1660,7 +1147,7 @@ static NSString *md5HashStringForBitmap(CGImageRef bitmap)
     return [NSString stringWithUTF8String:hex];
 }
 
-static void displayWebView()
+void displayWebView()
 {
     NSView *webView = [mainFrame webView];
     [webView display];
index bb471cd928fa472189d36904fa97556f5b062f1c..8811f5e55dc2b0603359dccddfee453c528d7a14 100644 (file)
                AE8259F408D22463000507AB /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; };
                B5A752A008AF5CD400138E45 /* ImageDiff.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A7525808AF4A3600138E45 /* ImageDiff.m */; };
                B5A752A208AF5D1F00138E45 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5A752A108AF5D1F00138E45 /* QuartzCore.framework */; };
+               BCA876B70C921FA100946E9C /* ObjCController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA876B50C921FA100946E9C /* ObjCController.h */; };
+               BCA876B80C921FA100946E9C /* ObjCController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA876B60C921FA100946E9C /* ObjCController.m */; };
+               BCA877B00C93D8F500946E9C /* LayoutTestController.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA877AE0C93D8F500946E9C /* LayoutTestController.h */; };
+               BCA877B10C93D8F500946E9C /* LayoutTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA877AF0C93D8F500946E9C /* LayoutTestController.m */; };
                D23AE9660C56BB2100C47236 /* PolicyDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D23AE8EA0C56B2FF00C47236 /* PolicyDelegate.m */; };
                D23AE9690C56BB2900C47236 /* PolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = D23AE8E00C56B29E00C47236 /* PolicyDelegate.h */; };
                E1330800099624DA00AC0A91 /* AppleScriptController.h in Headers */ = {isa = PBXBuildFile; fileRef = E13307FE099624DA00AC0A91 /* AppleScriptController.h */; };
                B5A7525808AF4A3600138E45 /* ImageDiff.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ImageDiff.m; sourceTree = "<group>"; };
                B5A7526708AF4A4A00138E45 /* ImageDiff */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ImageDiff; sourceTree = BUILT_PRODUCTS_DIR; };
                B5A752A108AF5D1F00138E45 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
+               BCA876B50C921FA100946E9C /* ObjCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCController.h; sourceTree = "<group>"; };
+               BCA876B60C921FA100946E9C /* ObjCController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjCController.m; sourceTree = "<group>"; };
+               BCA877AE0C93D8F500946E9C /* LayoutTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutTestController.h; sourceTree = "<group>"; };
+               BCA877AF0C93D8F500946E9C /* LayoutTestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LayoutTestController.m; sourceTree = "<group>"; };
                D23AE8E00C56B29E00C47236 /* PolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolicyDelegate.h; sourceTree = "<group>"; };
                D23AE8EA0C56B2FF00C47236 /* PolicyDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PolicyDelegate.m; sourceTree = "<group>"; };
                E13307FE099624DA00AC0A91 /* AppleScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleScriptController.h; sourceTree = "<group>"; };
                                14A6FB890971CAE5008B014F /* NavigationController.m */,
                                93442CF408F8BA4900BFE8CA /* TextInputController.h */,
                                93442CF508F8BA4900BFE8CA /* TextInputController.m */,
+                               BCA876B50C921FA100946E9C /* ObjCController.h */,
+                               BCA876B60C921FA100946E9C /* ObjCController.m */,
+                               BCA877AE0C93D8F500946E9C /* LayoutTestController.h */,
+                               BCA877AF0C93D8F500946E9C /* LayoutTestController.m */,
                        );
                        name = Controllers;
                        sourceTree = "<group>";
                                6508A2990BFABB8100AD2696 /* FrameLoadDelegate.h in Headers */,
                                6508A29A0BFABB8200AD2696 /* ResourceLoadDelegate.h in Headers */,
                                D23AE9690C56BB2900C47236 /* PolicyDelegate.h in Headers */,
+                               BCA876B70C921FA100946E9C /* ObjCController.h in Headers */,
+                               BCA877B00C93D8F500946E9C /* LayoutTestController.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                1422A1BB0AF6EDD600E1A883 /* UIDelegate.m in Sources */,
                                6508A2980BFABB8000AD2696 /* FrameLoadDelegate.m in Sources */,
                                D23AE9660C56BB2100C47236 /* PolicyDelegate.m in Sources */,
+                               BCA876B80C921FA100946E9C /* ObjCController.m in Sources */,
+                               BCA877B10C93D8F500946E9C /* LayoutTestController.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index cb0b4cf37d31ab2829d6b9ca45810d23cdd3bb53..1da22f16a65a9d89904f440f0b7f93bf5c571c3e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, Apple Inc.  All rights reserved.
+ * 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
@@ -20,7 +20,7 @@
  * 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
+ * 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 "DumpRenderTree.h"
 #import "EventSendingController.h"
 #import "GCController.h"
+#import "LayoutTestController.h"
 #import "NavigationController.h"
+#import "ObjCController.h"
 #import "ObjCPlugin.h"
 #import "ObjCPluginFunction.h"
-
 #import "TextInputController.h"
 
 #import <JavaScriptCore/Assertions.h>
     GCController *gcc = [[GCController alloc] init];
     [obj setValue:gcc forKey:@"GCController"];
     [gcc release];
-    
+
+    ObjCController *occ = [[ObjCController alloc] init];
+    [obj setValue:occ forKey:@"objCController"];
+    [occ release];
+
     [obj setValue:navigationController forKey:@"navigationController"];
     
     ObjCPlugin *plugin = [[ObjCPlugin alloc] init];
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
new file mode 100644 (file)
index 0000000..8a1d57d
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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 <Foundation/Foundation.h>
+
+@class WebScriptObject;
+
+@interface LayoutTestController : NSObject
+{
+    WebScriptObject *storedWebScriptObject;
+}
+- (void)dealloc;
+@end
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.m b/WebKitTools/DumpRenderTree/LayoutTestController.m
new file mode 100644 (file)
index 0000000..2575e3c
--- /dev/null
@@ -0,0 +1,457 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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 "LayoutTestController.h"
+
+#import "DumpRenderTree.h"
+
+#import <JavaScriptCore/Assertions.h>
+#import <WebKit/WebBackForwardList.h>
+#import <WebKit/WebFrame.h>
+#import <WebKit/WebHTMLView.h>
+#import <WebKit/WebHTMLViewPrivate.h>
+#import <WebKit/WebHistory.h>
+#import <WebKit/WebNSURLExtras.h>
+#import <WebKit/WebPreferences.h>
+#import <WebKit/WebScriptObject.h>
+#import <WebKit/WebView.h>
+#import <WebKit/WebViewPrivate.h>
+
+@implementation LayoutTestController
+
++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
+{
+    if (0
+            || aSelector == @selector(accessStoredWebScriptObject)
+            || aSelector == @selector(addDisallowedURL:)    
+            || aSelector == @selector(addFileToPasteboardOnDrag)
+            || aSelector == @selector(clearBackForwardList)
+            || aSelector == @selector(decodeHostName:)
+            || aSelector == @selector(display)
+            || aSelector == @selector(dumpAsText)
+            || aSelector == @selector(dumpBackForwardList)
+            || aSelector == @selector(dumpChildFrameScrollPositions)
+            || aSelector == @selector(dumpChildFramesAsText)
+            || aSelector == @selector(dumpDOMAsWebArchive)
+            || aSelector == @selector(dumpEditingCallbacks)
+            || aSelector == @selector(dumpFrameLoadCallbacks)
+            || aSelector == @selector(dumpResourceLoadCallbacks)
+            || aSelector == @selector(dumpSelectionRect)
+            || aSelector == @selector(dumpSourceAsWebArchive)
+            || aSelector == @selector(dumpTitleChanges)
+            || aSelector == @selector(encodeHostName:)
+            || aSelector == @selector(keepWebHistory)
+            || aSelector == @selector(notifyDone)
+            || aSelector == @selector(queueBackNavigation:)
+            || aSelector == @selector(queueForwardNavigation:)
+            || aSelector == @selector(queueLoad:target:)
+            || aSelector == @selector(queueReload)
+            || aSelector == @selector(queueScript:)
+            || aSelector == @selector(repaintSweepHorizontally)
+            || aSelector == @selector(setAcceptsEditing:)
+            || aSelector == @selector(setCallCloseOnWebViews:)
+            || aSelector == @selector(setCanOpenWindows)
+            || aSelector == @selector(setCloseRemainingWindowsWhenComplete:)
+            || aSelector == @selector(setCustomPolicyDelegate:)
+            || aSelector == @selector(setMainFrameIsFirstResponder:)
+            || aSelector == @selector(setTabKeyCyclesThroughElements:)
+            || aSelector == @selector(setUseDashboardCompatibilityMode:)
+            || aSelector == @selector(setUserStyleSheetEnabled:)
+            || aSelector == @selector(setUserStyleSheetLocation:)
+            || aSelector == @selector(setWindowIsKey:)
+            || aSelector == @selector(storeWebScriptObject:)
+            || aSelector == @selector(testRepaint)
+            || aSelector == @selector(waitUntilDone)
+            || aSelector == @selector(windowCount)
+        )
+        return NO;
+    return YES;
+}
+
++ (NSString *)webScriptNameForSelector:(SEL)aSelector
+{
+    if (aSelector == @selector(setWindowIsKey:))
+        return @"setWindowIsKey";
+    if (aSelector == @selector(setMainFrameIsFirstResponder:))
+        return @"setMainFrameIsFirstResponder";
+    if (aSelector == @selector(queueBackNavigation:))
+        return @"queueBackNavigation";
+    if (aSelector == @selector(queueForwardNavigation:))
+        return @"queueForwardNavigation";
+    if (aSelector == @selector(queueScript:))
+        return @"queueScript";
+    if (aSelector == @selector(queueLoad:target:))
+        return @"queueLoad";
+    if (aSelector == @selector(setAcceptsEditing:))
+        return @"setAcceptsEditing";
+    if (aSelector == @selector(setTabKeyCyclesThroughElements:))
+        return @"setTabKeyCyclesThroughElements";
+    if (aSelector == @selector(storeWebScriptObject:))
+        return @"storeWebScriptObject";
+    if (aSelector == @selector(setUserStyleSheetLocation:))
+        return @"setUserStyleSheetLocation";
+    if (aSelector == @selector(setUserStyleSheetEnabled:))
+        return @"setUserStyleSheetEnabled";
+    if (aSelector == @selector(addDisallowedURL:))
+        return @"addDisallowedURL";
+    if (aSelector == @selector(setCallCloseOnWebViews:))
+        return @"setCallCloseOnWebViews";
+    if (aSelector == @selector(setCloseRemainingWindowsWhenComplete:))
+        return @"setCloseRemainingWindowsWhenComplete";
+    if (aSelector == @selector(setCustomPolicyDelegate:))
+        return @"setCustomPolicyDelegate";
+    if (aSelector == @selector(setUseDashboardCompatibilityMode:))
+        return @"setUseDashboardCompatiblityMode";
+    if (aSelector == @selector(encodeHostName:))
+        return @"encodeHostName";
+    if (aSelector == @selector(decodeHostName:))
+        return @"decodeHostName";    
+    
+    return nil;
+}
+
+- (void)clearBackForwardList
+{
+    WebBackForwardList *backForwardList = [[mainFrame webView] backForwardList];
+    WebHistoryItem *item = [[backForwardList currentItem] retain];
+
+    // We clear the history by setting the back/forward list's capacity to 0
+    // then restoring it back and adding back the current item.
+    int capacity = [backForwardList capacity];
+    [backForwardList setCapacity:0];
+    [backForwardList setCapacity:capacity];
+    [backForwardList addItem:item];
+    [backForwardList goToItem:item];
+    [item release];
+}
+
+- (void)setUseDashboardCompatibilityMode:(BOOL)flag
+{
+    [[mainFrame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:flag];
+}
+
+- (void)setCloseRemainingWindowsWhenComplete:(BOOL)closeWindows
+{
+    closeRemainingWindowsWhenComplete = closeWindows;
+}
+
+- (void)setCustomPolicyDelegate:(BOOL)setDelegate
+{
+    if (setDelegate)
+        [[mainFrame webView] setPolicyDelegate:policyDelegate];
+    else
+        [[mainFrame webView] setPolicyDelegate:nil];
+}
+
+- (void)keepWebHistory
+{
+    if (![WebHistory optionalSharedHistory]) {
+        WebHistory *history = [[WebHistory alloc] init];
+        [WebHistory setOptionalSharedHistory:history];
+        [history release];
+    }
+}
+
+- (void)setCallCloseOnWebViews:(BOOL)callClose
+{
+    closeWebViews = callClose;
+}
+
+- (void)setCanOpenWindows
+{
+    canOpenWindows = YES;
+}
+
+- (void)waitUntilDone
+{
+    waitToDump = YES;
+    if (!waitToDumpWatchdog)
+        waitToDumpWatchdog = [[NSTimer scheduledTimerWithTimeInterval:waitToDumpWatchdogInterval target:self selector:@selector(waitUntilDoneWatchdogFired) userInfo:nil repeats:NO] retain];
+}
+
+- (void)waitUntilDoneWatchdogFired
+{
+    const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
+    fprintf(stderr, message);
+    fprintf(stdout, message);
+    dump();
+}
+
+- (void)notifyDone
+{
+    if (waitToDump && !topLoadingFrame && [workQueue count] == 0)
+        dump();
+    waitToDump = NO;
+}
+
+- (void)dumpAsText
+{
+    dumpAsText = YES;
+}
+
+- (void)addFileToPasteboardOnDrag
+{
+    addFileToPasteboardOnDrag = YES;
+}
+
+- (void)addDisallowedURL:(NSString *)urlString
+{
+    if (!disallowedURLs)
+        disallowedURLs = [[NSMutableSet alloc] init];
+    
+    
+    // Canonicalize the URL
+    NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
+    request = [NSURLProtocol canonicalRequestForRequest:request];
+    
+    [disallowedURLs addObject:[request URL]];
+}
+
+- (void)setUserStyleSheetLocation:(NSString *)path
+{
+    NSURL *url = [NSURL URLWithString:path];
+    [[WebPreferences standardPreferences] setUserStyleSheetLocation:url];
+}
+
+- (void)setUserStyleSheetEnabled:(BOOL)flag
+{
+    [[WebPreferences standardPreferences] setUserStyleSheetEnabled:flag];
+}
+
+- (void)dumpDOMAsWebArchive
+{
+    dumpDOMAsWebArchive = YES;
+}
+
+- (void)dumpSourceAsWebArchive
+{
+    dumpSourceAsWebArchive = YES;
+}
+
+- (void)dumpSelectionRect
+{
+    dumpSelectionRect = YES;
+}
+
+- (void)dumpTitleChanges
+{
+    dumpTitleChanges = YES;
+}
+
+- (void)dumpBackForwardList
+{
+    dumpBackForwardList = YES;
+}
+
+- (int)windowCount
+{
+    return CFArrayGetCount(allWindowsRef);
+}
+
+- (void)dumpChildFrameScrollPositions
+{
+    dumpChildFrameScrollPositions = YES;
+}
+
+- (void)dumpChildFramesAsText
+{
+    dumpChildFramesAsText = YES;
+}
+
+- (void)dumpEditingCallbacks
+{
+    shouldDumpEditingCallbacks = YES;
+}
+
+- (void)dumpResourceLoadCallbacks
+{
+    shouldDumpResourceLoadCallbacks = YES;
+}
+
+- (void)dumpFrameLoadCallbacks
+{
+    shouldDumpFrameLoadCallbacks = YES;
+}
+
+- (void)setWindowIsKey:(BOOL)flag
+{
+    windowIsKey = flag;
+    NSView *documentView = [[mainFrame frameView] documentView];
+    if ([documentView isKindOfClass:[WebHTMLView class]])
+        [(WebHTMLView *)documentView _updateActiveState];
+}
+
+- (void)setMainFrameIsFirstResponder:(BOOL)flag
+{
+    NSView *documentView = [[mainFrame frameView] documentView];
+    
+    NSResponder *firstResponder = flag ? documentView : nil;
+    [[[mainFrame webView] window] makeFirstResponder:firstResponder];
+        
+    if ([documentView isKindOfClass:[WebHTMLView class]])
+        [(WebHTMLView *)documentView _updateActiveState];
+}
+
+- (void)display
+{
+    displayWebView();
+}
+
+- (void)testRepaint
+{
+    testRepaint = YES;
+}
+
+- (void)repaintSweepHorizontally
+{
+    repaintSweepHorizontally = YES;
+}
+
+- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
+{
+    return nil;
+}
+
+- (void)_addWorkForTarget:(id)target selector:(SEL)selector arg1:(id)arg1 arg2:(id)arg2
+{
+    if (workQueueFrozen)
+        return;
+    NSMethodSignature *sig = [target methodSignatureForSelector:selector];
+    NSInvocation *work = [NSInvocation invocationWithMethodSignature:sig];
+    [work retainArguments];
+    [work setTarget:target];
+    [work setSelector:selector];
+    if (arg1) {
+        [work setArgument:&arg1 atIndex:2];
+        if (arg2)
+            [work setArgument:&arg2 atIndex:3];
+    }
+    [workQueue addObject:work];
+}
+
+- (void)_doLoad:(NSURL *)url target:(NSString *)target
+{
+    WebFrame *targetFrame;
+    if (target && ![target isKindOfClass:[WebUndefined class]])
+        targetFrame = [mainFrame findFrameNamed:target];
+    else
+        targetFrame = mainFrame;
+    [targetFrame loadRequest:[NSURLRequest requestWithURL:url]];
+}
+
+- (void)_doBackOrForwardNavigation:(NSNumber *)index
+{
+    int bfIndex = [index intValue];
+    if (bfIndex == 1)
+        [[mainFrame webView] goForward];
+    if (bfIndex == -1)
+        [[mainFrame webView] goBack];
+    else {        
+        WebBackForwardList *bfList = [[mainFrame webView] backForwardList];
+        [[mainFrame webView] goToBackForwardItem:[bfList itemAtIndex:bfIndex]];
+    }
+}
+
+- (void)queueBackNavigation:(int)howFarBack
+{
+    [self _addWorkForTarget:self selector:@selector(_doBackOrForwardNavigation:) arg1:[NSNumber numberWithInt:-howFarBack] arg2:nil];
+}
+
+- (void)queueForwardNavigation:(int)howFarForward
+{
+    [self _addWorkForTarget:self selector:@selector(_doBackOrForwardNavigation:) arg1:[NSNumber numberWithInt:howFarForward] arg2:nil];
+}
+
+- (void)queueReload
+{
+    [self _addWorkForTarget:[mainFrame webView] selector:@selector(reload:) arg1:self arg2:nil];
+}
+
+- (void)queueScript:(NSString *)script
+{
+    [self _addWorkForTarget:[mainFrame webView] selector:@selector(stringByEvaluatingJavaScriptFromString:) arg1:script arg2:nil];
+}
+
+- (void)queueLoad:(NSString *)URLString target:(NSString *)target
+{
+    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 *)[[mainFrame webView] editingDelegate] setAcceptsEditing:newAcceptsEditing];
+}
+
+- (void)setTabKeyCyclesThroughElements:(BOOL)newTabKeyCyclesThroughElements
+{
+    [[mainFrame webView] setTabKeyCyclesThroughElements:newTabKeyCyclesThroughElements];
+}
+
+- (void)storeWebScriptObject:(WebScriptObject *)webScriptObject
+{
+    if (webScriptObject == storedWebScriptObject)
+        return;
+
+    [storedWebScriptObject release];
+    storedWebScriptObject = [webScriptObject retain];
+}
+
+- (void)accessStoredWebScriptObject
+{
+    JSObjectRef jsObject = [storedWebScriptObject JSObject];
+    ASSERT(!jsObject);
+
+    [storedWebScriptObject callWebScriptMethod:@"" withArguments:nil];
+    [storedWebScriptObject evaluateWebScript:@""];
+    [storedWebScriptObject setValue:[WebUndefined undefined] forKey:@"key"];
+    [storedWebScriptObject valueForKey:@"key"];
+    [storedWebScriptObject removeWebScriptKey:@"key"];
+    [storedWebScriptObject stringRepresentation];
+    [storedWebScriptObject webScriptValueAtIndex:0];
+    [storedWebScriptObject setWebScriptValueAtIndex:0 value:[WebUndefined undefined]];
+    [storedWebScriptObject setException:@"exception"];
+}
+
+- (void)dealloc
+{
+    [storedWebScriptObject release];
+    [super dealloc];
+}
+
+- (NSString*)decodeHostName:(NSString*)name
+{
+    return [name _web_decodeHostName];
+}
+
+- (NSString*)encodeHostName:(NSString*)name
+{
+    return [name _web_encodeHostName];
+}
+
+@end
diff --git a/WebKitTools/DumpRenderTree/ObjCController.h b/WebKitTools/DumpRenderTree/ObjCController.h
new file mode 100644 (file)
index 0000000..1287551
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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 <Foundation/Foundation.h>
+
+@interface ObjCController : NSObject
+@end
diff --git a/WebKitTools/DumpRenderTree/ObjCController.m b/WebKitTools/DumpRenderTree/ObjCController.m
new file mode 100644 (file)
index 0000000..b55c6d8
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * 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 "ObjCController.h"
+
+#import <WebKit/WebView.h>
+#import <WebKit/WebScriptObject.h>
+
+@implementation ObjCController
+
++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
+{
+    if (0
+            || aSelector == @selector(objCClassNameOf:)
+            || aSelector == @selector(objCObjectOfClass:)
+            || aSelector == @selector(objCIdentityIsEqual::)
+            || aSelector == @selector(objCLongLongRoundTrip:)
+            || aSelector == @selector(objCUnsignedLongLongRoundTrip:)
+            || aSelector == @selector(testWrapperRoundTripping:))
+        return NO;
+    return YES;
+}
+
++ (NSString *)webScriptNameForSelector:(SEL)aSelector
+{
+    if (aSelector == @selector(objCClassNameOf:))
+        return @"objCClassName";
+    if (aSelector == @selector(objCObjectOfClass:))
+        return @"objCObjectOfClass";
+    if (aSelector == @selector(objCIdentityIsEqual::))
+        return @"objCIdentityIsEqual";
+    if (aSelector == @selector(objCLongLongRoundTrip:))
+        return @"objCLongLongRoundTrip";
+    if (aSelector == @selector(objCUnsignedLongLongRoundTrip:))
+        return @"objCUnsignedLongLongRoundTrip";
+    if (aSelector == @selector(testWrapperRoundTripping:))
+        return @"testWrapperRoundTripping";
+
+    return nil;
+}
+
+- (NSString *)objCClassNameOf:(id)object
+{
+    if (!object)
+        return @"nil";
+    return NSStringFromClass([object class]);
+}
+
+- (id)objCObjectOfClass:(NSString *)aClass
+{
+    if ([aClass isEqualToString:@"NSNull"])
+        return [NSNull null];
+    if ([aClass isEqualToString:@"WebUndefined"])
+        return [WebUndefined undefined];
+    if ([aClass isEqualToString:@"NSCFBoolean"])
+        return [NSNumber numberWithBool:true];
+    if ([aClass isEqualToString:@"NSCFNumber"])
+        return [NSNumber numberWithInt:1];
+    if ([aClass isEqualToString:@"NSCFString"])
+        return @"";
+    if ([aClass isEqualToString:@"WebScriptObject"])
+        return self;
+    if ([aClass isEqualToString:@"NSArray"])
+        return [NSArray array];
+
+    return nil;
+}
+
+- (BOOL)objCIdentityIsEqual:(WebScriptObject *)a :(WebScriptObject *)b
+{
+    return a == b;
+}
+
+- (long long)objCLongLongRoundTrip:(long long)num
+{
+    return num;
+}
+
+- (unsigned long long)objCUnsignedLongLongRoundTrip:(unsigned long long)num
+{
+    return num;
+}
+
+- (BOOL)testWrapperRoundTripping:(WebScriptObject *)webScriptObject
+{
+    JSObjectRef jsObject = [webScriptObject JSObject];
+
+    if (!jsObject)
+        return false;
+
+    if (!webScriptObject)
+        return false;
+
+    if ([[webScriptObject evaluateWebScript:@"({ })"] class] != [webScriptObject class])
+        return false;
+
+    [webScriptObject setValue:[NSNumber numberWithInt:666] forKey:@"key"];
+    if (![[webScriptObject valueForKey:@"key"] isKindOfClass:[NSNumber class]] ||
+        ![[webScriptObject valueForKey:@"key"] isEqualToNumber:[NSNumber numberWithInt:666]])
+        return false;
+
+    [webScriptObject removeWebScriptKey:@"key"];
+    @try {
+        if ([webScriptObject valueForKey:@"key"])
+            return false;
+    } @catch(NSException *exception) {
+        // NSObject throws an exception if the key doesn't exist.
+    }
+
+    [webScriptObject setWebScriptValueAtIndex:0 value:webScriptObject];
+    if ([webScriptObject webScriptValueAtIndex:0] != webScriptObject)
+        return false;
+
+    if ([[webScriptObject stringRepresentation] isEqualToString:@"[Object object]"])
+        return false;
+
+    if ([webScriptObject callWebScriptMethod:@"returnThis" withArguments:nil] != webScriptObject)
+        return false;
+
+    return true;
+}
+
+@end