Reviewed by Adam Roben.
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 00:34:13 +0000 (00:34 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 00:34:13 +0000 (00:34 +0000)
        Add a globalFlag property to the LayoutTestController to allow cross-domain indications.

        * DumpRenderTree/LayoutTestController.cpp:
        (LayoutTestController::LayoutTestController):
        (getGlobalFlagCallback):
        (setGlobalFlagCallback):
        (LayoutTestController::getJSClass):
        (LayoutTestController::staticValues):
        * DumpRenderTree/LayoutTestController.h:
        (LayoutTestController::globalFlag):
        (LayoutTestController::setGlobalFlag):

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

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/LayoutTestController.cpp
WebKitTools/DumpRenderTree/LayoutTestController.h

index 2f4b9c024d8995a1d99453a66b346517bd42599b..c77eb473f367e9f22e3c22ce8880cca56669010b 100644 (file)
@@ -1,3 +1,19 @@
+2007-10-29  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Add a globalFlag property to the LayoutTestController to allow cross-domain indications.
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController):
+        (getGlobalFlagCallback):
+        (setGlobalFlagCallback):
+        (LayoutTestController::getJSClass):
+        (LayoutTestController::staticValues):
+        * DumpRenderTree/LayoutTestController.h:
+        (LayoutTestController::globalFlag):
+        (LayoutTestController::setGlobalFlag):
+
 2007-10-29  Darin Adler  <darin@apple.com>
 
         Reviewed by Maciej.
index 7e47141b3c66c984c0dbd3bdfc365fcfed7ba164..88827261a4ce72928b50c962041a505b110b746d 100644 (file)
@@ -53,6 +53,7 @@ LayoutTestController::LayoutTestController(bool testRepaintDefault, bool testRep
     , m_testRepaintSweepHorizontally(testRepaintSweepHorizontallyDefault)
     , m_waitToDump(false)
     , m_windowIsKey(true)
+    , m_globalFlag(false)
 {
 }
 
@@ -461,6 +462,21 @@ static JSValueRef windowCountCallback(JSContextRef context, JSObjectRef function
     return JSValueMakeNumber(context, windows);
 }
 
+// Static Values
+
+static JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    return JSValueMakeBoolean(context, controller->globalFlag());
+}
+
+static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    controller->setGlobalFlag(JSValueToBoolean(context, value));
+    return true;
+}
+
 // Object Creation
 
 void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
@@ -472,12 +488,13 @@ void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef wi
 
 JSClassRef LayoutTestController::getJSClass()
 {
-    static JSClassRef layoutTestControllerClass = 0;
+    static JSClassRef layoutTestControllerClass;
 
     if (!layoutTestControllerClass) {
+        JSStaticValue* staticValues = LayoutTestController::staticValues();
         JSStaticFunction* staticFunctions = LayoutTestController::staticFunctions();
         JSClassDefinition classDefinition = {
-            0, kJSClassAttributeNone, "LayoutTestController", 0, 0, staticFunctions,
+            0, kJSClassAttributeNone, "LayoutTestController", 0, staticValues, staticFunctions,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
         };
 
@@ -487,6 +504,16 @@ JSClassRef LayoutTestController::getJSClass()
     return layoutTestControllerClass;
 }
 
+JSStaticValue* LayoutTestController::staticValues()
+{
+    static JSStaticValue staticValues[] = {
+        { "globalFlag", getGlobalFlagCallback, setGlobalFlagCallback, kJSPropertyAttributeNone },
+        { 0, 0, 0, 0 }
+    };
+    return staticValues;
+
+}
+
 JSStaticFunction* LayoutTestController::staticFunctions()
 {
     static JSStaticFunction staticFunctions[] = {
@@ -534,3 +561,5 @@ JSStaticFunction* LayoutTestController::staticFunctions()
 
     return staticFunctions;
 }
+
+
index 8d70e4f4fd9406d3be9c152b63cf987a87b2b8d6..21ebe315e2af8f7950a9534d31353925a6691dfb 100644 (file)
@@ -117,6 +117,9 @@ public:
     bool windowIsKey() const { return m_windowIsKey; }
     void setWindowIsKey(bool windowIsKey);
 
+    bool globalFlag() const { return m_globalFlag; }
+    void setGlobalFlag(bool globalFlag) { m_globalFlag = globalFlag; }
+
 private:
     bool m_dumpAsText;
     bool m_dumpBackForwardList;
@@ -138,7 +141,10 @@ private:
     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
     bool m_windowIsKey;
 
+    bool m_globalFlag;
+
     static JSClassRef getJSClass();
+    static JSStaticValue* staticValues();
     static JSStaticFunction* staticFunctions();
 };