2010-04-27 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Apr 2010 20:55:11 +0000 (20:55 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Apr 2010 20:55:11 +0000 (20:55 +0000)
        Reviewed by Eric Seidel.

        Remove custom NodeIterator bindings
        https://bugs.webkit.org/show_bug.cgi?id=38188

        Another example of CallWith=ScriptState.  This case shows us the right
        way to handle the interaction with exception codes.

        In my previous patch, I put the exception code handling after the
        ScriptState exception handling.  It turns out this was a mistake
        (although a harmless one at the time because no IDL caused us to
        generate that code).  Now that we're generating both kinds of exception
        handling, we need to generate them in the right order.

        * WebCore.gypi:
        * bindings/js/JSNodeIteratorCustom.cpp:
        * bindings/scripts/CodeGeneratorJS.pm:
        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
        (webkit_dom_test_obj_with_script_state_void_exception):
        (webkit_dom_test_obj_with_script_state_obj_exception):
        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
        * bindings/scripts/test/JS/JSTestObj.cpp:
        (WebCore::):
        (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidException):
        (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException):
        * bindings/scripts/test/JS/JSTestObj.h:
        * bindings/scripts/test/ObjC/DOMTestObj.h:
        * bindings/scripts/test/ObjC/DOMTestObj.mm:
        (-[DOMTestObj withScriptStateVoidException]):
        (-[DOMTestObj withScriptStateObjException]):
        * bindings/scripts/test/TestObj.idl:
        * bindings/scripts/test/V8/V8TestObj.cpp:
        (WebCore::TestObjInternal::withScriptStateVoidCallback):
        (WebCore::TestObjInternal::withScriptStateObjCallback):
        (WebCore::TestObjInternal::withScriptStateVoidExceptionCallback):
        (WebCore::TestObjInternal::withScriptStateObjExceptionCallback):
        (WebCore::):
        * bindings/v8/custom/V8NodeIteratorCustom.cpp: Removed.
        * dom/NodeIterator.idl:

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

15 files changed:
WebCore/ChangeLog
WebCore/WebCore.gypi
WebCore/bindings/js/JSNodeIteratorCustom.cpp
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bindings/scripts/CodeGeneratorV8.pm
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/bindings/v8/custom/V8NodeIteratorCustom.cpp [deleted file]
WebCore/dom/NodeIterator.idl

index afc5f42..dfd08fb 100644 (file)
@@ -1,5 +1,48 @@
 2010-04-27  Adam Barth  <abarth@webkit.org>
 
+        Reviewed by Eric Seidel.
+
+        Remove custom NodeIterator bindings
+        https://bugs.webkit.org/show_bug.cgi?id=38188
+
+        Another example of CallWith=ScriptState.  This case shows us the right
+        way to handle the interaction with exception codes.
+
+        In my previous patch, I put the exception code handling after the
+        ScriptState exception handling.  It turns out this was a mistake
+        (although a harmless one at the time because no IDL caused us to
+        generate that code).  Now that we're generating both kinds of exception
+        handling, we need to generate them in the right order.
+
+        * WebCore.gypi:
+        * bindings/js/JSNodeIteratorCustom.cpp:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_with_script_state_void_exception):
+        (webkit_dom_test_obj_with_script_state_obj_exception):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::):
+        (WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidException):
+        (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException):
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        (-[DOMTestObj withScriptStateVoidException]):
+        (-[DOMTestObj withScriptStateObjException]):
+        * bindings/scripts/test/TestObj.idl:
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjInternal::withScriptStateVoidCallback):
+        (WebCore::TestObjInternal::withScriptStateObjCallback):
+        (WebCore::TestObjInternal::withScriptStateVoidExceptionCallback):
+        (WebCore::TestObjInternal::withScriptStateObjExceptionCallback):
+        (WebCore::):
+        * bindings/v8/custom/V8NodeIteratorCustom.cpp: Removed.
+        * dom/NodeIterator.idl:
+
+2010-04-27  Adam Barth  <abarth@webkit.org>
+
         Reviewed by Darin Adler.
 
         Remove copy/paste addEventListener "custom" bindings via code generation
index 77e287c..85438ea 100644 (file)
             'bindings/v8/custom/V8NamedNodesCollection.h',
             'bindings/v8/custom/V8NodeCustom.cpp',
             'bindings/v8/custom/V8NodeFilterCustom.cpp',
-            'bindings/v8/custom/V8NodeIteratorCustom.cpp',
             'bindings/v8/custom/V8NodeListCustom.cpp',
             'bindings/v8/custom/V8NotificationCenterCustom.cpp',
             'bindings/v8/custom/V8PopStateEventCustom.cpp',
index 6a09abf..7c858e5 100644 (file)
@@ -37,34 +37,4 @@ void JSNodeIterator::markChildren(MarkStack& markStack)
         filter->markAggregate(markStack);
 }
 
-JSValue JSNodeIterator::nextNode(ExecState* exec, const ArgList&)
-{
-    ExceptionCode ec = 0;
-    RefPtr<Node> node = impl()->nextNode(exec, ec);
-    if (ec) {
-        setDOMException(exec, ec);
-        return jsUndefined();
-    }
-
-    if (exec->hadException())
-        return jsUndefined();
-
-    return toJS(exec, node.get());
-}
-
-JSValue JSNodeIterator::previousNode(ExecState* exec, const ArgList&)
-{
-    ExceptionCode ec = 0;
-    RefPtr<Node> node = impl()->previousNode(exec, ec);
-    if (ec) {
-        setDOMException(exec, ec);
-        return jsUndefined();
-    }
-
-    if (exec->hadException())
-        return jsUndefined();
-
-    return toJS(exec, node.get());
-}
-
 }
index 41634b2..228e15a 100644 (file)
@@ -1916,12 +1916,13 @@ sub GenerateImplementationFunctionCall()
         push(@implContent, $indent . "return jsUndefined();\n");
     } else {
         push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n");
+        push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions};
+
         $callWith = $function->signature->extendedAttributes->{"CallWith"};
         if ($callWith and $callWith eq "ScriptState") {
             push(@implContent, $indent . "if (exec->hadException())\n");
             push(@implContent, $indent . "    return jsUndefined();\n");
         }
-        push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions};
 
         if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) {
             # Immutable methods do not commit changes back to the instance, thus producing
index 33ac23d..45bb783 100644 (file)
@@ -2414,16 +2414,16 @@ sub GenerateFunctionCallString()
         $returnIsRef = 0;
     }
 
-    if ($hasScriptState) {
-        $result .= $indent . "if (state.hadException())\n";
-        $result .= $indent . "    return throwError(state.exception());\n"
-    }
-
     if (@{$function->raisesExceptions}) {
         $result .= $indent . "if (UNLIKELY(ec))\n";
         $result .= $indent . "    goto fail;\n";
     }
 
+    if ($hasScriptState) {
+        $result .= $indent . "if (state.hadException())\n";
+        $result .= $indent . "    return throwError(state.exception());\n"
+    }
+
     # If the return type is a POD type, separate out the wrapper generation
     if ($returnsListItemPodType) {
         $result .= $indent . "RefPtr<V8SVGPODTypeWrapper<" . $nativeReturnType . "> > wrapper = ";
index 6365d9b..1617ea7 100644 (file)
@@ -213,6 +213,38 @@ webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self)
 }
 
 void
+webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    WebCore::ExceptionCode ec = 0;
+    item->withScriptStateVoidException(ec);
+    if (ec) {
+        WebCore::ExceptionCodeDescription ecdesc;
+        WebCore::getExceptionCodeDescription(ec, ecdesc);
+        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
+    }
+
+}
+
+WebKitDOMTestObj* 
+webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error)
+{
+    g_return_val_if_fail (self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    WebCore::ExceptionCode ec = 0;
+    PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObjException(ec));
+    if (ec) {
+        WebCore::ExceptionCodeDescription ecdesc;
+        WebCore::getExceptionCodeDescription(ec, ecdesc);
+        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
+    }
+    WebKitDOMTestObj*  res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
+    return res;
+
+}
+
+void
 webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt)
 {
     g_return_if_fail (self);
index 1f90d7b..defa9ea 100644 (file)
@@ -98,6 +98,12 @@ WEBKIT_API WebKitDOMTestObj*
 webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self);
 
 WEBKIT_API void
+webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error);
+
+WEBKIT_API WebKitDOMTestObj* 
+webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error);
+
+WEBKIT_API void
 webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt);
 
 WEBKIT_API void
index da065ca..5c9ffcd 100644 (file)
@@ -129,7 +129,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident
 #define THUNK_GENERATOR(generator)
 #endif
 
-static const HashTableValue JSTestObjPrototypeTableValues[23] =
+static const HashTableValue JSTestObjPrototypeTableValues[25] =
 {
     { "voidMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) },
     { "voidMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
@@ -150,6 +150,8 @@ static const HashTableValue JSTestObjPrototypeTableValues[23] =
     { "withDynamicFrameAndUserGestureASAD", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2 THUNK_GENERATOR(0) },
     { "withScriptStateVoid", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoid), (intptr_t)0 THUNK_GENERATOR(0) },
     { "withScriptStateObj", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) },
+    { "withScriptStateVoidException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0 THUNK_GENERATOR(0) },
+    { "withScriptStateObjException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObjException), (intptr_t)0 THUNK_GENERATOR(0) },
     { "methodWithOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
     { "methodWithNonOptionalArgAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
     { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) },
@@ -161,7 +163,7 @@ static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable =
 #if ENABLE(PERFECT_HASH_SIZE)
     { 8191, JSTestObjPrototypeTableValues, 0 };
 #else
-    { 66, 63, JSTestObjPrototypeTableValues, 0 };
+    { 67, 63, JSTestObjPrototypeTableValues, 0 };
 #endif
 
 const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 };
@@ -641,6 +643,37 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* ex
     return result;
 }
 
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    ExceptionCode ec = 0;
+
+    imp->withScriptStateVoidException(exec, ec);
+    setDOMException(exec, ec);
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+    UNUSED_PARAM(args);
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwError(exec, TypeError);
+    JSTestObj* castedThisObj = static_cast<JSTestObj*>(asObject(thisValue));
+    TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
+    ExceptionCode ec = 0;
+
+
+    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->withScriptStateObjException(exec, ec)));
+    setDOMException(exec, ec);
+    if (exec->hadException())
+        return jsUndefined();
+    return result;
+}
+
 JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 {
     UNUSED_PARAM(args);
index b65e86f..8ffaa90 100644 (file)
@@ -104,6 +104,8 @@ JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGest
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
index ccb8e82..9154a7a 100644 (file)
@@ -70,6 +70,8 @@
 - (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg;
 - (void)withScriptStateVoid;
 - (DOMTestObj *)withScriptStateObj;
+- (void)withScriptStateVoidException;
+- (DOMTestObj *)withScriptStateObjException;
 - (void)methodWithOptionalArg:(int)opt;
 - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
 - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
index e78538c..e9f21f7 100644 (file)
     return kit(WTF::getPtr(IMPL->withScriptStateObj()));
 }
 
+- (void)withScriptStateVoidException
+{
+    WebCore::ExceptionCode ec = 0;
+    IMPL->withScriptStateVoidException(ec);
+    WebCore::raiseOnDOMError(ec);
+}
+
+- (DOMTestObj *)withScriptStateObjException
+{
+    WebCore::ExceptionCode ec = 0;
+    DOMTestObj *result = kit(WTF::getPtr(IMPL->withScriptStateObjException(ec)));
+    WebCore::raiseOnDOMError(ec);
+    return result;
+}
+
 - (void)methodWithOptionalArg:(int)opt
 {
     IMPL->methodWithOptionalArg(opt);
index 8193b29..044fbeb 100644 (file)
@@ -75,6 +75,10 @@ module test {
         [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGestureASAD(in long intArg, in [Optional] long optionalArg);
         [CallWith=ScriptState] void withScriptStateVoid();
         [CallWith=ScriptState] TestObj withScriptStateObj();
+        [CallWith=ScriptState] void withScriptStateVoidException()
+            raises(DOMException);
+        [CallWith=ScriptState] TestObj withScriptStateObjException()
+            raises(DOMException);
 
         // 'Optional' extended attribute
         void    methodWithOptionalArg(in [Optional] long opt);
index 9b08e5d..609f8a4 100644 (file)
@@ -374,6 +374,44 @@ static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& arg
     return toV8(result.release());
 }
 
+static v8::Handle<v8::Value> withScriptStateVoidExceptionCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withScriptStateVoidException");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    ExceptionCode ec = 0;
+    {
+    EmptyScriptState state;
+    imp->withScriptStateVoidException(&state, ec);
+    if (UNLIKELY(ec))
+        goto fail;
+    if (state.hadException())
+        return throwError(state.exception());
+    return v8::Handle<v8::Value>();
+    }
+    fail:
+    V8Proxy::setDOMException(ec);
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withScriptStateObjException");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    ExceptionCode ec = 0;
+    {
+    EmptyScriptState state;
+    RefPtr<TestObj> result = imp->withScriptStateObjException(&state, ec);
+    if (UNLIKELY(ec))
+        goto fail;
+    if (state.hadException())
+        return throwError(state.exception());
+    return toV8(result.release());
+    }
+    fail:
+    V8Proxy::setDOMException(ec);
+    return v8::Handle<v8::Value>();
+}
+
 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.TestObj.methodWithOptionalArg");
@@ -513,6 +551,8 @@ static const BatchedCallback TestObjCallbacks[] = {
     {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback},
     {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
     {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
+    {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback},
+    {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback},
     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
diff --git a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
deleted file mode 100644 (file)
index 728b3dc..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google 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:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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.
- */
-
-#include "config.h"
-#include "V8NodeIterator.h"
-
-#include "NodeIterator.h"
-#include "ScriptState.h"
-
-#include "V8Binding.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ExceptionCode ec, ScriptState* state)
-{
-    if (ec)
-        return throwError(ec);
-
-    if (state->hadException())
-        return throwError(state->exception());
-
-    if (!object)
-        return v8::Null();
-
-    return toV8(object);
-}
-
-v8::Handle<v8::Value> V8NodeIterator::nextNodeCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.NodeIterator.nextNode()");
-    NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
-
-    ExceptionCode ec = 0;
-    EmptyScriptState state;
-    RefPtr<Node> result = nodeIterator->nextNode(&state, ec);
-    return toV8(result.release(), ec, &state);
-}
-
-v8::Handle<v8::Value> V8NodeIterator::previousNodeCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.NodeIterator.previousNode()");
-    NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
-
-    ExceptionCode ec = 0;
-    EmptyScriptState state;
-    RefPtr<Node> result = nodeIterator->previousNode(&state, ec);
-    return toV8(result.release(), ec, &state);
-}
-
-} // namespace WebCore
index e1818a1..9f59ae1 100644 (file)
@@ -31,9 +31,9 @@ module traversal {
         readonly attribute Node referenceNode;
         readonly attribute boolean pointerBeforeReferenceNode;
 
-        [Custom] Node nextNode() 
+        [CallWith=ScriptState] Node nextNode() 
             raises (DOMException);
-        [Custom] Node previousNode()
+        [CallWith=ScriptState] Node previousNode()
             raises (DOMException);
         void detach();
     };