2010-09-05 Jeremy Orlow <jorlow@chromium.org>
authorjorlow@chromium.org <jorlow@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Sep 2010 15:08:18 +0000 (15:08 +0000)
committerjorlow@chromium.org <jorlow@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Sep 2010 15:08:18 +0000 (15:08 +0000)
        Reviewed by Steve Block.

        Add IndexedDB objects' constructors to window
        https://bugs.webkit.org/show_bug.cgi?id=44599

        Beef up keyRange test to verify we're actualy operating
        on the interface rather than an instance.

        Add a test to verify the constants.

        * storage/indexeddb/constants.html:
        * storage/indexeddb/constants-expected.txt:
        * storage/indexeddb/keyrange-expected.txt:
        * storage/indexeddb/script-tests/keyrange.js:
        ():
2010-09-05  Jeremy Orlow  <jorlow@chromium.org>

        Reviewed by Nate Chapin.

        Add the concept of class methods to bindings (for IndexedDB's IDBKeyRange).
        https://bugs.webkit.org/show_bug.cgi?id=45044

        IndexedDB's IDBKeyRange has what, in other languages, are called class
        methods. In javaScript terms, these are methods only accessible from their
        constructor and not instances. This change adds such support to V8. There
        are already other features required for IndexedDB that JSC doesn't yet
        support, so I'll add this to the list of todo items in the master bug
        for that.

        The bindings tests cover this. My next patch will change WebCore to use
        this and it'll have associated layout tests.

        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/scripts/test/CPP/WebDOMTestObj.cpp:
        (WebDOMTestObj::classMethod):
        (WebDOMTestObj::classMethodWithOptional):
        * bindings/scripts/test/CPP/WebDOMTestObj.h:
        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
        (webkit_dom_test_obj_class_method):
        (webkit_dom_test_obj_class_method_with_optional):
        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
        * bindings/scripts/test/JS/JSTestObj.cpp:
        (WebCore::jsTestObjPrototypeFunctionStaticMethod):
        (WebCore::jsTestObjPrototypeFunctionStaticMethodWithOptional):
        * bindings/scripts/test/JS/JSTestObj.h:
        * bindings/scripts/test/ObjC/DOMTestObj.h:
        * bindings/scripts/test/ObjC/DOMTestObj.mm:
        (-[DOMTestObj classMethod]):
        (-[DOMTestObj classMethodWithOptional:]):
        * bindings/scripts/test/TestObj.idl:
        * bindings/scripts/test/V8/V8TestObj.cpp:
        (WebCore::TestObjInternal::classMethodCallback):
        (WebCore::TestObjInternal::classMethodWithOptionalCallback):
        (WebCore::ConfigureV8TestObjTemplate):
        * storage/IDBKeyRange.idl:

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

24 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/constants-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/constants.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/keyrange-expected.txt
LayoutTests/storage/indexeddb/script-tests/keyrange.js
WebCore/ChangeLog
WebCore/bindings/generic/RuntimeEnabledFeatures.h
WebCore/bindings/scripts/CodeGeneratorV8.pm
WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
WebCore/bindings/scripts/test/JS/JSTestObj.cpp
WebCore/bindings/scripts/test/JS/JSTestObj.h
WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
WebCore/bindings/scripts/test/TestObj.idl
WebCore/bindings/scripts/test/V8/V8TestObj.cpp
WebCore/page/DOMWindow.cpp
WebCore/page/DOMWindow.h
WebCore/page/DOMWindow.idl
WebCore/storage/IDBKeyRange.idl
WebCore/storage/IDBTransaction.h
WebCore/storage/IDBTransaction.idl

index 2d58bee..eb35a74 100644 (file)
@@ -1,3 +1,21 @@
+2010-09-05  Jeremy Orlow  <jorlow@chromium.org>
+
+        Reviewed by Steve Block.
+
+        Add IndexedDB objects' constructors to window
+        https://bugs.webkit.org/show_bug.cgi?id=44599
+
+        Beef up keyRange test to verify we're actualy operating
+        on the interface rather than an instance.
+
+        Add a test to verify the constants.
+
+        * storage/indexeddb/constants.html:
+        * storage/indexeddb/constants-expected.txt:
+        * storage/indexeddb/keyrange-expected.txt:
+        * storage/indexeddb/script-tests/keyrange.js:
+        ():
+
 2010-09-05  Robert Hogan  <robert@webkit.org>
 
         Reviewed by Antonio Gomes.
diff --git a/LayoutTests/storage/indexeddb/constants-expected.txt b/LayoutTests/storage/indexeddb/constants-expected.txt
new file mode 100644 (file)
index 0000000..ff47655
--- /dev/null
@@ -0,0 +1,35 @@
+Test IndexedDB's constants.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS IDBKeyRange.SINGLE is 0
+PASS IDBKeyRange.LEFT_OPEN is 1
+PASS IDBKeyRange.RIGHT_OPEN is 2
+PASS IDBKeyRange.LEFT_BOUND is 4
+PASS IDBKeyRange.RIGHT_BOUND is 8
+PASS IDBDatabaseException.UNKNOWN_ERR is 0
+PASS IDBDatabaseException.NON_TRANSIENT_ERR is 1
+PASS IDBDatabaseException.NOT_FOUND_ERR is 2
+PASS IDBDatabaseException.CONSTRAINT_ERR is 3
+PASS IDBDatabaseException.DATA_ERR is 4
+PASS IDBDatabaseException.NOT_ALLOWED_ERR is 5
+PASS IDBDatabaseException.SERIAL_ERR is 11
+PASS IDBDatabaseException.RECOVERABLE_ERR is 21
+PASS IDBDatabaseException.TRANSIENT_ERR is 31
+PASS IDBDatabaseException.TIMEOUT_ERR is 32
+PASS IDBDatabaseException.DEADLOCK_ERR is 33
+PASS IDBRequest.LOADING is 1
+PASS IDBRequest.DONE is 2
+PASS IDBCursor.NEXT is 0
+PASS IDBCursor.NEXT_NO_DUPLICATE is 1
+PASS IDBCursor.PREV is 2
+PASS IDBCursor.PREV_NO_DUPLICATE is 3
+PASS IDBTransaction.READ_WRITE is 0
+PASS IDBTransaction.READ_ONLY is 1
+PASS IDBTransaction.SNAPSHOT_READ is 2
+PASS IDBTransaction.VERSION_CHANGE is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/constants.html b/LayoutTests/storage/indexeddb/constants.html
new file mode 100644 (file)
index 0000000..dd24917
--- /dev/null
@@ -0,0 +1,58 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB's constants.");
+if (window.layoutTestController) 
+    layoutTestController.waitUntilDone();
+
+function test()
+{
+    shouldBe("IDBKeyRange.SINGLE", "0");
+    shouldBe("IDBKeyRange.LEFT_OPEN", "1");
+    shouldBe("IDBKeyRange.RIGHT_OPEN", "2");
+    shouldBe("IDBKeyRange.LEFT_BOUND", "4");
+    shouldBe("IDBKeyRange.RIGHT_BOUND", "8");
+
+    shouldBe("IDBDatabaseException.UNKNOWN_ERR", "0");
+    shouldBe("IDBDatabaseException.NON_TRANSIENT_ERR", "1");
+    shouldBe("IDBDatabaseException.NOT_FOUND_ERR", "2");
+    shouldBe("IDBDatabaseException.CONSTRAINT_ERR", "3");
+    shouldBe("IDBDatabaseException.DATA_ERR", "4");
+    shouldBe("IDBDatabaseException.NOT_ALLOWED_ERR", "5");
+    shouldBe("IDBDatabaseException.SERIAL_ERR", "11");
+    shouldBe("IDBDatabaseException.RECOVERABLE_ERR", "21");
+    shouldBe("IDBDatabaseException.TRANSIENT_ERR", "31");
+    shouldBe("IDBDatabaseException.TIMEOUT_ERR", "32");
+    shouldBe("IDBDatabaseException.DEADLOCK_ERR", "33");
+
+    shouldBe("IDBRequest.LOADING", "1");
+    shouldBe("IDBRequest.DONE", "2");
+
+    shouldBe("IDBCursor.NEXT", "0");
+    shouldBe("IDBCursor.NEXT_NO_DUPLICATE", "1");
+    shouldBe("IDBCursor.PREV", "2");
+    shouldBe("IDBCursor.PREV_NO_DUPLICATE", "3");
+
+    shouldBe("IDBTransaction.READ_WRITE", "0");
+    shouldBe("IDBTransaction.READ_ONLY", "1");
+    shouldBe("IDBTransaction.SNAPSHOT_READ", "2");
+    shouldBe("IDBTransaction.VERSION_CHANGE", "3");
+}
+
+test();
+
+var successfullyParsed = true;
+done();
+
+</script>
+</body>
+</html>
index a510a80..6528a11 100644 (file)
@@ -3,6 +3,33 @@ Test IndexedDB's KeyRange.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS 'SINGLE' in IDBKeyRange is true
+PASS 'LEFT_OPEN' in IDBKeyRange is true
+PASS 'RIGHT_OPEN' in IDBKeyRange is true
+PASS 'LEFT_BOUND' in IDBKeyRange is true
+PASS 'RIGHT_BOUND' in IDBKeyRange is true
+PASS 'left' in IDBKeyRange is false
+PASS 'right' in IDBKeyRange is false
+PASS 'flags' in IDBKeyRange is false
+PASS 'only' in IDBKeyRange is true
+PASS 'leftBound' in IDBKeyRange is true
+PASS 'rightBound' in IDBKeyRange is true
+PASS 'bound' in IDBKeyRange is true
+
+instance = IDBKeyRange.only(1)
+PASS 'SINGLE' in instance is true
+PASS 'LEFT_OPEN' in instance is true
+PASS 'RIGHT_OPEN' in instance is true
+PASS 'LEFT_BOUND' in instance is true
+PASS 'RIGHT_BOUND' in instance is true
+PASS 'left' in instance is true
+PASS 'right' in instance is true
+PASS 'flags' in instance is true
+PASS 'only' in instance is false
+PASS 'leftBound' in instance is false
+PASS 'rightBound' in instance is false
+PASS 'bound' in instance is false
+
 IDBKeyRange.only(1)
 PASS keyRange.left is 1
 PASS keyRange.right is 1
@@ -117,3 +144,4 @@ PASS rightFlags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND
 PASS successfullyParsed is true
 
 TEST COMPLETE
+
index 907d817..a5b58f4 100644 (file)
@@ -39,6 +39,37 @@ function checkBoundKeyRange(left, right, openLeft, openRight)
 
 function test()
 {
+    shouldBeTrue("'SINGLE' in IDBKeyRange");
+    shouldBeTrue("'LEFT_OPEN' in IDBKeyRange");
+    shouldBeTrue("'RIGHT_OPEN' in IDBKeyRange");
+    shouldBeTrue("'LEFT_BOUND' in IDBKeyRange");
+    shouldBeTrue("'RIGHT_BOUND' in IDBKeyRange");
+    shouldBeFalse("'left' in IDBKeyRange");
+    shouldBeFalse("'right' in IDBKeyRange");
+    shouldBeFalse("'flags' in IDBKeyRange");
+    shouldBeTrue("'only' in IDBKeyRange");
+    shouldBeTrue("'leftBound' in IDBKeyRange");
+    shouldBeTrue("'rightBound' in IDBKeyRange");
+    shouldBeTrue("'bound' in IDBKeyRange");
+
+    debug("");
+
+    var instance = evalAndLog("instance = IDBKeyRange.only(1)");
+    shouldBeTrue("'SINGLE' in instance");
+    shouldBeTrue("'LEFT_OPEN' in instance");
+    shouldBeTrue("'RIGHT_OPEN' in instance");
+    shouldBeTrue("'LEFT_BOUND' in instance");
+    shouldBeTrue("'RIGHT_BOUND' in instance");
+    shouldBeTrue("'left' in instance");
+    shouldBeTrue("'right' in instance");
+    shouldBeTrue("'flags' in instance");
+    shouldBeFalse("'only' in instance");
+    shouldBeFalse("'leftBound' in instance");
+    shouldBeFalse("'rightBound' in instance");
+    shouldBeFalse("'bound' in instance");
+
+    debug("");
+
     checkSingleKeyRange(1);
     checkSingleKeyRange("'a'");
 
@@ -68,6 +99,7 @@ function test()
     checkBoundKeyRange("'aad'", "'abd'", false, true);
     checkBoundKeyRange("'aae'", "'abe'", true, false);
     checkBoundKeyRange("'aaf'", "'abf'", true, true);
+
 }
 
 test();
index 52c6755..f73ebce 100644 (file)
@@ -1,3 +1,78 @@
+2010-09-05  Jeremy Orlow  <jorlow@chromium.org>
+
+        Reviewed by Nate Chapin.
+
+        Add the concept of class methods to bindings (for IndexedDB's IDBKeyRange).
+        https://bugs.webkit.org/show_bug.cgi?id=45044
+
+        IndexedDB's IDBKeyRange has what, in other languages, are called class
+        methods. In javaScript terms, these are methods only accessible from their
+        constructor and not instances. This change adds such support to V8. There
+        are already other features required for IndexedDB that JSC doesn't yet
+        support, so I'll add this to the list of todo items in the master bug
+        for that.
+
+        The bindings tests cover this. My next patch will change WebCore to use
+        this and it'll have associated layout tests.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/scripts/test/CPP/WebDOMTestObj.cpp:
+        (WebDOMTestObj::classMethod):
+        (WebDOMTestObj::classMethodWithOptional):
+        * bindings/scripts/test/CPP/WebDOMTestObj.h:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_class_method):
+        (webkit_dom_test_obj_class_method_with_optional):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionStaticMethod):
+        (WebCore::jsTestObjPrototypeFunctionStaticMethodWithOptional):
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        (-[DOMTestObj classMethod]):
+        (-[DOMTestObj classMethodWithOptional:]):
+        * bindings/scripts/test/TestObj.idl:
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjInternal::classMethodCallback):
+        (WebCore::TestObjInternal::classMethodWithOptionalCallback):
+        (WebCore::ConfigureV8TestObjTemplate):
+        * storage/IDBKeyRange.idl:
+
+2010-09-05  Jeremy Orlow  <jorlow@chromium.org>
+
+        Reviewed by Steve Block.
+
+        Add IndexedDB objects' constructors to window
+        https://bugs.webkit.org/show_bug.cgi?id=44599
+
+        Also add a forgotten constant to IDBTransaction, and
+        change IDBKeyRange over to using the V8Static attribute
+        so it actually behaves as it's supposed to.
+
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::iDBCursorEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBDatabaseEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBDatabaseErrorEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBDatabaseExceptionEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBErrorEventEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBEventEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBFactoryEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBIndexEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBKeyRangeEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBObjectStoreEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBRequestEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBSuccessEventEnabled):
+        (WebCore::RuntimeEnabledFeatures::iDBTransactionEnabled):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::clear):
+        (WebCore::DOMWindow::indexedDB):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+        * storage/IDBKeyRange.idl:
+        * storage/IDBTransaction.h:
+        * storage/IDBTransaction.idl:
+
 2010-09-04  Justin Schuh  <jschuh@chromium.org>
 
         Reviewed by Nikolas Zimmermann.
index fb43f3f..91768b0 100644 (file)
@@ -56,7 +56,19 @@ public:
 
     static void setIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
     static bool indexedDBEnabled() { return isIndexedDBEnabled; }
-    static bool iDBKeyRangeEnabled() { return indexedDBEnabled(); }
+    static bool iDBCursorEnabled() { return isIndexedDBEnabled; }
+    static bool iDBDatabaseEnabled() { return isIndexedDBEnabled; }
+    static bool iDBDatabaseErrorEnabled() { return isIndexedDBEnabled; }
+    static bool iDBDatabaseExceptionEnabled() { return isIndexedDBEnabled; }
+    static bool iDBErrorEventEnabled() { return isIndexedDBEnabled; }
+    static bool iDBEventEnabled() { return isIndexedDBEnabled; }
+    static bool iDBFactoryEnabled() { return isIndexedDBEnabled; }
+    static bool iDBIndexEnabled() { return isIndexedDBEnabled; }
+    static bool iDBKeyRangeEnabled() { return isIndexedDBEnabled; }
+    static bool iDBObjectStoreEnabled() { return isIndexedDBEnabled; }
+    static bool iDBRequestEnabled() { return isIndexedDBEnabled; }
+    static bool iDBSuccessEventEnabled() { return isIndexedDBEnabled; }
+    static bool iDBTransactionEnabled() { return isIndexedDBEnabled; }
 
 #if ENABLE(VIDEO)
     static bool audioEnabled();
index eca7301..a46c67c 100644 (file)
@@ -1150,7 +1150,7 @@ END
         push(@implContentDecls, "    V8SVGPODTypeWrapper<$nativeClassName>* impWrapper = V8SVGPODTypeWrapper<$nativeClassName>::toNative(args.Holder());\n");
         push(@implContentDecls, "    $nativeClassName impInstance = *impWrapper;\n");
         push(@implContentDecls, "    $nativeClassName* imp = &impInstance;\n");
-    } else {
+    } elsif (!$function->signature->extendedAttributes->{"ClassMethod"}) {
         push(@implContentDecls, <<END);
     ${implClassName}* imp = V8${implClassName}::toNative(args.Holder());
 END
@@ -1771,6 +1771,9 @@ sub GenerateImplementation
         if ($attrExt->{"V8OnInstance"}) {
             next;
         }
+        if ($attrExt->{"ClassMethod"}) {
+            next;
+        }
         if ($attrExt->{"EnabledAtRuntime"} || RequiresCustomSignature($function) || $attrExt->{"V8DoNotCheckSignature"}) {
             next;
         }
@@ -1956,6 +1959,9 @@ END
         if ($attrExt->{"V8OnInstance"}) {
             $template = "instance";
         }
+        if ($attrExt->{"ClassMethod"}) {
+            $template = "desc";
+        }
 
         my $conditional = "";
         if ($attrExt->{"EnabledAtRuntime"}) {
@@ -1991,7 +1997,7 @@ END
       }
 
       my $signature = "defaultSignature";
-      if ($attrExt->{"V8DoNotCheckSignature"}) {
+      if ($attrExt->{"V8DoNotCheckSignature"} || $attrExt->{"ClassMethod"}) {
           $signature = "v8::Local<v8::Signature>()";
       }
 
@@ -2564,6 +2570,10 @@ sub GenerateFunctionCallString()
         $functionString = "result.${name}(";
     }
 
+    if ($function->signature->extendedAttributes->{"ClassMethod"}) {
+        $functionString = "${implClassName}::${name}(";
+    }
+
     my $returnsListItemPodType = 0;
     # SVG lists functions that return POD types require special handling
     if (IsSVGListTypeNeedingSpecialHandling($implClassName) && IsSVGListMethod($name) && $returnsPodType) {
index 882e633..9cceb3c 100644 (file)
@@ -749,6 +749,22 @@ void WebDOMTestObj::methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int o
     impl()->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
 }
 
+void WebDOMTestObj::classMethod()
+{
+    if (!impl())
+        return;
+
+    impl()->classMethod();
+}
+
+int WebDOMTestObj::classMethodWithOptional(int arg)
+{
+    if (!impl())
+        return 0;
+
+    return impl()->classMethodWithOptional(arg);
+}
+
 WebCore::TestObj* toWebCore(const WebDOMTestObj& wrapper)
 {
     return wrapper.impl();
index 770ce51..037a1d3 100644 (file)
@@ -150,6 +150,8 @@ public:
     void methodWithOptionalArg(int opt);
     void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt);
     void methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2);
+    void classMethod();
+    int classMethodWithOptional(int arg);
 
     WebCore::TestObj* impl() const;
 
index 3c27b81..c9c10d7 100644 (file)
@@ -364,6 +364,25 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOM
     item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2);
 }
 
+void
+webkit_dom_test_obj_class_method(WebKitDOMTestObj* self)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->classMethod();
+}
+
+glong
+webkit_dom_test_obj_class_method_with_optional(WebKitDOMTestObj* self, glong arg)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_val_if_fail(self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    glong res = item->classMethodWithOptional(arg);
+    return res;
+}
+
 glong
 webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self)
 {
index 4cc796d..8ee8f04 100644 (file)
@@ -124,6 +124,12 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestO
 WEBKIT_API void
 webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2);
 
+WEBKIT_API void
+webkit_dom_test_obj_class_method(WebKitDOMTestObj* self);
+
+WEBKIT_API glong
+webkit_dom_test_obj_class_method_with_optional(WebKitDOMTestObj* self, glong arg);
+
 WEBKIT_API glong
 webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self);
 
index e172cd5..63bc368 100644 (file)
@@ -177,7 +177,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident
 #define THUNK_GENERATOR(generator)
 #endif
 
-static const HashTableValue JSTestObjPrototypeTableValues[45] =
+static const HashTableValue JSTestObjPrototypeTableValues[47] =
 {
     { "CONST_VALUE_0", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_0), (intptr_t)0 THUNK_GENERATOR(0) },
     { "CONST_VALUE_1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_1), (intptr_t)0 THUNK_GENERATOR(0) },
@@ -223,6 +223,8 @@ static const HashTableValue JSTestObjPrototypeTableValues[45] =
     { "methodWithNonCallbackArgAndCallbackArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t)2 THUNK_GENERATOR(0) },
     { "methodWithCallbackAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
     { "overloadedMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2 THUNK_GENERATOR(0) },
+    { "classMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethod), (intptr_t)0 THUNK_GENERATOR(0) },
+    { "classMethodWithOptional", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithOptional), (intptr_t)1 THUNK_GENERATOR(0) },
     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
 };
 
@@ -1447,6 +1449,42 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecStat
     return throwVMTypeError(exec);
 }
 
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethod(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwVMTypeError(exec);
+    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+
+    imp->classMethod();
+    return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwVMTypeError(exec);
+    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+
+    int argsCount = exec->argumentCount();
+    if (argsCount <= 0) {
+
+        JSC::JSValue result = jsNumber(exec, imp->classMethodWithOptional());
+        return JSValue::encode(result);
+    }
+
+    int arg = exec->argument(0).toInt32(exec);
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+
+    JSC::JSValue result = jsNumber(exec, imp->classMethodWithOptional(arg));
+    return JSValue::encode(result);
+}
+
 // Constant getters
 
 JSValue jsTestObjCONST_VALUE_0(ExecState* exec, JSValue, const Identifier&)
index 993df8c..2168b3f 100644 (file)
@@ -119,6 +119,8 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAr
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(JSC::ExecState*);
 // Attributes
 
 JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
index 4a0f065..132b215 100644 (file)
@@ -142,6 +142,8 @@ enum {
 - (void)methodWithOptionalArg:(int)opt;
 - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
 - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
+- (void)classMethod;
+- (int)classMethodWithOptional:(int)arg;
 @end
 
 #endif
index 01fcf34..9725b24 100644 (file)
     IMPL->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
 }
 
+- (void)classMethod
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->classMethod();
+}
+
+- (int)classMethodWithOptional:(int)arg
+{
+    WebCore::JSMainThreadNullState state;
+    return IMPL->classMethodWithOptional(arg);
+}
+
 @end
 
 WebCore::TestObj* core(DOMTestObj *wrapper)
index f8fe782..89dfdf7 100644 (file)
@@ -138,6 +138,10 @@ module test {
         void    overloadedMethod(in [Callback] TestCallback callback);
 #endif
 
+        // Class methods within JavaScript (like what's used for IDBKeyRange).
+        [ClassMethod] void classMethod();
+        [ClassMethod] long classMethodWithOptional(in [Optional] long arg);
+
         // ObjectiveC reserved words.
         readonly attribute long      description;
         attribute long               id;
index b4acf74..8f824d9 100644 (file)
@@ -1003,6 +1003,23 @@ static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
     return notHandledByInterceptor();
 }
 
+static v8::Handle<v8::Value> classMethodCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.classMethod");
+    TestObj::classMethod();
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> classMethodWithOptionalCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.classMethodWithOptional");
+    if (args.Length() <= 0) {
+        return v8::Integer::New(TestObj::classMethodWithOptional());
+    }
+    EXCEPTION_BLOCK(int, arg, toInt32(args[0]));
+    return v8::Integer::New(TestObj::classMethodWithOptional(arg));
+}
+
 } // namespace TestObjInternal
 
 static const BatchedAttribute TestObjAttrs[] = {
@@ -1176,6 +1193,8 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi
     v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
     v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
     proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
+    desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjInternal::classMethodCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
+    desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjInternal::classMethodWithOptionalCallback, v8::Handle<v8::Value>(), v8::Local<v8::Signature>()));
     batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts));
 
     // Custom toString template
index efb82bb..bf26ce4 100644 (file)
@@ -60,7 +60,6 @@
 #include "History.h"
 #include "IDBFactory.h"
 #include "IDBFactoryBackendInterface.h"
-#include "IDBKeyRange.h"
 #include "InspectorController.h"
 #include "InspectorTimelineAgent.h"
 #include "KURL.h"
@@ -498,7 +497,6 @@ void DOMWindow::clear()
 
 #if ENABLE(INDEXED_DATABASE)
     m_idbFactory = 0;
-    m_idbKeyRange = 0;
 #endif
 }
 
@@ -720,14 +718,6 @@ IDBFactory* DOMWindow::indexedDB() const
     m_idbFactory = IDBFactory::create(page->group().idbFactory());
     return m_idbFactory.get();
 }
-
-IDBKeyRange* DOMWindow::iDBKeyRange() const
-{
-    if (!m_idbKeyRange)
-        m_idbKeyRange = IDBKeyRange::create(0, 0, 0);
-
-    return m_idbKeyRange.get();
-}
 #endif
 
 #if ENABLE(FILE_SYSTEM)
index 894aa08..1470628 100644 (file)
@@ -57,7 +57,6 @@ namespace WebCore {
     class Frame;
     class History;
     class IDBFactory;
-    class IDBKeyRange;
     class InspectorTimelineAgent;
     class LocalFileSystem;
     class Location;
@@ -238,7 +237,6 @@ namespace WebCore {
 
 #if ENABLE(INDEXED_DATABASE)
         IDBFactory* indexedDB() const;
-        IDBKeyRange* iDBKeyRange() const;
 #endif
 
 #if ENABLE(FILE_SYSTEM)
@@ -445,7 +443,6 @@ namespace WebCore {
 #endif
 #if ENABLE(INDEXED_DATABASE)
         mutable RefPtr<IDBFactory> m_idbFactory;
-        mutable RefPtr<IDBKeyRange> m_idbKeyRange;
 #endif
 #if ENABLE(FILE_SYSTEM)
         RefPtr<LocalFileSystem> m_localFileSystem;
index c775ae6..702edcd 100644 (file)
@@ -174,7 +174,20 @@ module window {
 #endif
 #if defined(ENABLE_INDEXED_DATABASE) && ENABLE_INDEXED_DATABASE
         readonly attribute [EnabledAtRuntime] IDBFactory indexedDB;
-        readonly attribute [EnabledAtRuntime] IDBKeyRange IDBKeyRange;
+
+        attribute [EnabledAtRuntime] IDBCursorConstructor IDBCursor;
+        attribute [EnabledAtRuntime] IDBDatabaseConstructor IDBDatabase;
+        attribute [EnabledAtRuntime] IDBDatabaseErrorConstructor IDBDatabaseError;
+        attribute [EnabledAtRuntime] IDBDatabaseExceptionConstructor IDBDatabaseException;
+        attribute [EnabledAtRuntime] IDBErrorEventConstructor IDBErrorEvent;
+        attribute [EnabledAtRuntime] IDBEventConstructor IDBEvent;
+        attribute [EnabledAtRuntime] IDBFactoryConstructor IDBFactory;
+        attribute [EnabledAtRuntime] IDBIndexConstructor IDBIndex;
+        attribute [EnabledAtRuntime] IDBKeyRangeConstructor IDBKeyRange;
+        attribute [EnabledAtRuntime] IDBObjectStoreConstructor IDBObjectStore;
+        attribute [EnabledAtRuntime] IDBRequestConstructor IDBRequest;
+        attribute [EnabledAtRuntime] IDBSuccessEventConstructor IDBSuccessEvent;
+        attribute [EnabledAtRuntime] IDBTransactionConstructor IDBTransaction;
 #endif
 #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM
         const unsigned short TEMPORARY = 0;
index 6daaec1..8e4d61f 100644 (file)
@@ -39,10 +39,11 @@ module storage {
         readonly attribute IDBKey right;
         readonly attribute unsigned short flags;
 
-        IDBKeyRange only(in IDBKey value);
-        IDBKeyRange leftBound(in IDBKey bound, in [Optional] boolean open);
-        IDBKeyRange rightBound(in IDBKey bound, in [Optional] boolean open);
-        IDBKeyRange bound(in IDBKey left, in IDBKey right, in [Optional] boolean openLeft, in [Optional] boolean openRight);
+        // FIXME: Make ClassMethod work for JSC as well.
+        [ClassMethod] IDBKeyRange only(in IDBKey value);
+        [ClassMethod] IDBKeyRange leftBound(in IDBKey bound, in [Optional] boolean open);
+        [ClassMethod] IDBKeyRange rightBound(in IDBKey bound, in [Optional] boolean open);
+        [ClassMethod] IDBKeyRange bound(in IDBKey left, in IDBKey right, in [Optional] boolean openLeft, in [Optional] boolean openRight);
     };
 
 }
index 3c7f9dd..0d6f3ea 100644 (file)
@@ -54,7 +54,8 @@ public:
     enum Mode {
         READ_WRITE = 0,
         READ_ONLY = 1,
-        SNAPSHOT_READ = 2
+        SNAPSHOT_READ = 2,
+        VERSION_CHANGE = 3
     };
 
     unsigned short mode() const;
index a3907dc..cdf9f63 100644 (file)
@@ -33,6 +33,8 @@ module storage {
         const unsigned short READ_WRITE = 0;
         const unsigned short READ_ONLY = 1;
         const unsigned short SNAPSHOT_READ = 2;
+        const unsigned short VERSION_CHANGE = 3;
+
         // Properties
         readonly attribute unsigned short mode;
         readonly attribute IDBDatabase db;