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

        Remove custom bindings for TreeWalker
        https://bugs.webkit.org/show_bug.cgi?id=38182

        This custom code is just CallWith=ScriptState.

        * WebCore.gypi:
        * bindings/js/JSTreeWalkerCustom.cpp:
        (WebCore::JSTreeWalker::markChildren):
        * bindings/scripts/CodeGeneratorJS.pm:
        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/scripts/test/TestObj.idl:
        * bindings/v8/custom/V8TreeWalkerCustom.cpp: Removed.
        * dom/TreeWalker.idl:

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

15 files changed:
WebCore/ChangeLog
WebCore/WebCore.gypi
WebCore/bindings/js/JSTreeWalkerCustom.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/V8TreeWalkerCustom.cpp [deleted file]
WebCore/dom/TreeWalker.idl

index e1b386d..ce845cb 100644 (file)
@@ -1,3 +1,21 @@
+2010-04-27  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Remove custom bindings for TreeWalker
+        https://bugs.webkit.org/show_bug.cgi?id=38182
+
+        This custom code is just CallWith=ScriptState.
+
+        * WebCore.gypi:
+        * bindings/js/JSTreeWalkerCustom.cpp:
+        (WebCore::JSTreeWalker::markChildren):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/scripts/test/TestObj.idl:
+        * bindings/v8/custom/V8TreeWalkerCustom.cpp: Removed.
+        * dom/TreeWalker.idl:
+
 2010-04-27  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Adam Barth.
index 6cf8661..77e287c 100644 (file)
             'bindings/v8/custom/V8SharedWorkerCustom.cpp',
             'bindings/v8/custom/V8StyleSheetCustom.cpp',
             'bindings/v8/custom/V8StyleSheetListCustom.cpp',
-            'bindings/v8/custom/V8TreeWalkerCustom.cpp',
             'bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp',
             'bindings/v8/custom/V8WebKitPointConstructor.cpp',
             'bindings/v8/custom/V8WebSocketCustom.cpp',
index f879cf4..0c1947f 100644 (file)
@@ -36,61 +36,5 @@ void JSTreeWalker::markChildren(MarkStack& markStack)
     if (NodeFilter* filter = m_impl->filter())
         filter->markAggregate(markStack);
 }
-    
-JSValue JSTreeWalker::parentNode(ExecState* exec, const ArgList&)
-{
-    Node* node = impl()->parentNode(exec);
-    if (exec->hadException())
-        return jsUndefined();
-    return toJS(exec, node);
-}
-    
-JSValue JSTreeWalker::firstChild(ExecState* exec, const ArgList&)
-{
-    Node* node = impl()->firstChild(exec);
-    if (exec->hadException())
-        return jsUndefined();
-    return toJS(exec, node);
-}
-    
-JSValue JSTreeWalker::lastChild(ExecState* exec, const ArgList&)
-{
-    Node* node = impl()->lastChild(exec);
-    if (exec->hadException())
-        return jsUndefined();
-    return toJS(exec, node);
-}
-    
-JSValue JSTreeWalker::nextSibling(ExecState* exec, const ArgList&)
-{
-    Node* node = impl()->nextSibling(exec);
-    if (exec->hadException())
-        return jsUndefined();
-    return toJS(exec, node);
-}
-    
-JSValue JSTreeWalker::previousSibling(ExecState* exec, const ArgList&)
-{
-    Node* node = impl()->previousSibling(exec);
-    if (exec->hadException())
-        return jsUndefined();
-    return toJS(exec, node);
-}
-    
-JSValue JSTreeWalker::previousNode(ExecState* exec, const ArgList&)
-{
-    Node* node = impl()->previousNode(exec);
-    if (exec->hadException())
-        return jsUndefined();
-    return toJS(exec, node);
-}
-    
-JSValue JSTreeWalker::nextNode(ExecState* exec, const ArgList&)
-{
-    Node* node = impl()->nextNode(exec);
-    if (exec->hadException())
-        return jsUndefined();
-    return toJS(exec, node);
-}
 
 }
index d1d26f9..c75f5d6 100644 (file)
@@ -1704,12 +1704,18 @@ sub GenerateImplementation
                 }
 
                 my $callWith = $function->signature->extendedAttributes->{"CallWith"};
-                if ($callWith && $callWith eq "DynamicFrame") {
-                    push(@implContent, "    Frame* dynamicFrame = toDynamicFrame(exec);\n");
-                    push(@implContent, "    if (!dynamicFrame)\n");
-                    push(@implContent, "        return jsUndefined();\n");
+                if ($callWith) {
+                    my $callWithArg = "COMPILE_ASSERT(false)";
+                    if ($callWith eq "DynamicFrame") {
+                        push(@implContent, "    Frame* dynamicFrame = toDynamicFrame(exec);\n");
+                        push(@implContent, "    if (!dynamicFrame)\n");
+                        push(@implContent, "        return jsUndefined();\n");
+                        $callWithArg = "dynamicFrame";
+                    } elsif ($callWith eq "ScriptState") {
+                        $callWithArg = "exec";
+                    }
                     $functionString .= ", " if $paramIndex;
-                    $functionString .= "dynamicFrame";
+                    $functionString .= $callWithArg;
                     $paramIndex++;
                 }
 
@@ -1885,6 +1891,11 @@ sub GenerateImplementationFunctionCall()
         push(@implContent, $indent . "return jsUndefined();\n");
     } else {
         push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n");
+        $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"}) {
index 2eaaff8..33ac23d 100644 (file)
@@ -2333,14 +2333,23 @@ sub GenerateFunctionCallString()
     }
 
     my $index = 0;
+    my $hasScriptState = 0;
 
     my $callWith = $function->signature->extendedAttributes->{"CallWith"};
-    if ($callWith && $callWith eq "DynamicFrame") {
-        $result .= $indent . "Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();\n";
-        $result .= $indent . "if (!enteredFrame)\n";
-        $result .= $indent . "    return v8::Undefined();\n";
+    if ($callWith) {
+        my $callWithArg = "COMPILE_ASSERT(false)";
+        if ($callWith eq "DynamicFrame") {
+            $result .= $indent . "Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();\n";
+            $result .= $indent . "if (!enteredFrame)\n";
+            $result .= $indent . "    return v8::Undefined();\n";
+            $callWithArg = "enteredFrame";
+        } elsif ($callWith eq "ScriptState") {
+            $result .= $indent . "EmptyScriptState state;\n";
+            $callWithArg = "&state";
+            $hasScriptState = 1;
+        }
         $functionString .= ", " if $index;
-        $functionString .= "enteredFrame";
+        $functionString .= $callWithArg;
         $index++;
         $numberOfParameters++
     }
@@ -2397,7 +2406,7 @@ sub GenerateFunctionCallString()
         $result .= $indent . GetNativeType($returnType, 0) . " result = *imp;\n" . $indent . "$functionString;\n";
     } elsif ($returnsListItemPodType) {
         $result .= $indent . "RefPtr<SVGPODListItem<$nativeReturnType> > result = $functionString;\n";
-    } elsif (@{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) {
+    } elsif ($hasScriptState or @{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) {
         $result .= $indent . $nativeReturnType . " result = $functionString;\n";
     } else {
         # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary
@@ -2405,8 +2414,14 @@ 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" . $indent . "    goto fail;\n";
+        $result .= $indent . "if (UNLIKELY(ec))\n";
+        $result .= $indent . "    goto fail;\n";
     }
 
     # If the return type is a POD type, separate out the wrapper generation
index 38eda4d..66e0c2b 100644 (file)
@@ -187,6 +187,26 @@ webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *
 }
 
 void
+webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withScriptStateVoid();
+
+}
+
+WebKitDOMTestObj* 
+webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self)
+{
+    g_return_val_if_fail (self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj());
+    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 c75a9e0..832497a 100644 (file)
@@ -86,6 +86,12 @@ WEBKIT_API void
 webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg);
 
 WEBKIT_API void
+webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self);
+
+WEBKIT_API WebKitDOMTestObj* 
+webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self);
+
+WEBKIT_API void
 webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt);
 
 WEBKIT_API void
index 973a100..f089ca7 100644 (file)
@@ -128,7 +128,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident
 #define THUNK_GENERATOR(generator)
 #endif
 
-static const HashTableValue JSTestObjPrototypeTableValues[19] =
+static const HashTableValue JSTestObjPrototypeTableValues[21] =
 {
     { "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) },
@@ -145,6 +145,8 @@ static const HashTableValue JSTestObjPrototypeTableValues[19] =
     { "withDynamicFrameAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
     { "withDynamicFrameAndUserGesture", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1 THUNK_GENERATOR(0) },
     { "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) },
     { "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) },
@@ -581,6 +583,33 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureAS
     return jsUndefined();
 }
 
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(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());
+
+    imp->withScriptStateVoid(exec);
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(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());
+
+
+    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->withScriptStateObj(exec)));
+    if (exec->hadException())
+        return jsUndefined();
+    return result;
+}
+
 JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 {
     UNUSED_PARAM(args);
index 594a38f..23bdd3e 100644 (file)
@@ -100,6 +100,8 @@ JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC:
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
 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 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 145927e..95b6005 100644 (file)
@@ -65,6 +65,8 @@
 - (void)withDynamicFrameAndOptionalArg:(int)intArg optionalArg:(int)optionalArg;
 - (void)withDynamicFrameAndUserGesture:(int)intArg;
 - (void)withDynamicFrameAndUserGestureASAD:(int)intArg optionalArg:(int)optionalArg;
+- (void)withScriptStateVoid;
+- (DOMTestObj *)withScriptStateObj;
 - (void)methodWithOptionalArg:(int)opt;
 - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
 - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
index 0957d12..dc70867 100644 (file)
     IMPL->withDynamicFrameAndUserGestureASAD(intArg, optionalArg);
 }
 
+- (void)withScriptStateVoid
+{
+    IMPL->withScriptStateVoid();
+}
+
+- (DOMTestObj *)withScriptStateObj
+{
+    return kit(WTF::getPtr(IMPL->withScriptStateObj()));
+}
+
 - (void)methodWithOptionalArg:(int)opt
 {
     IMPL->methodWithOptionalArg(opt);
index e662565..eb30e87 100644 (file)
@@ -66,6 +66,8 @@ module test {
         [CallWith=DynamicFrame] void withDynamicFrameAndOptionalArg(in long intArg, in [Optional] long optionalArg);
         [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGesture(in long intArg);
         [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGestureASAD(in long intArg, in [Optional] long optionalArg);
+        [CallWith=ScriptState] void withScriptStateVoid();
+        [CallWith=ScriptState] TestObj withScriptStateObj();
 
         // 'Optional' extended attribute
         void    methodWithOptionalArg(in [Optional] long opt);
index 538036a..1cf4ade 100644 (file)
@@ -330,6 +330,28 @@ static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8
     return v8::Handle<v8::Value>();
 }
 
+static v8::Handle<v8::Value> withScriptStateVoidCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withScriptStateVoid");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    EmptyScriptState state;
+    imp->withScriptStateVoid(&state);
+    if (state->hadException())
+        return throwError(state->exception());
+    return v8::Handle<v8::Value>();
+}
+
+static v8::Handle<v8::Value> withScriptStateObjCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.withScriptStateObj");
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    EmptyScriptState state;
+    RefPtr<TestObj> result = imp->withScriptStateObj(&state);
+    if (state->hadException())
+        return throwError(state->exception());
+    return toV8(result.release());
+}
+
 static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.TestObj.methodWithOptionalArg");
@@ -465,6 +487,8 @@ static const BatchedCallback TestObjCallbacks[] = {
     {"withDynamicFrameAndOptionalArg", TestObjInternal::withDynamicFrameAndOptionalArgCallback},
     {"withDynamicFrameAndUserGesture", TestObjInternal::withDynamicFrameAndUserGestureCallback},
     {"withDynamicFrameAndUserGestureASAD", TestObjInternal::withDynamicFrameAndUserGestureASADCallback},
+    {"withScriptStateVoid", TestObjInternal::withScriptStateVoidCallback},
+    {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
     {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
     {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
     {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
diff --git a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
deleted file mode 100644 (file)
index 37087df..0000000
+++ /dev/null
@@ -1,128 +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 "V8TreeWalker.h"
-
-#include "Node.h"
-#include "ScriptState.h"
-#include "TreeWalker.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> toV8Object(PassRefPtr<Node> object, ScriptState* state)
-{
-    if (state->hadException())
-        return throwError(state->exception());
-
-    if (!object)
-        return v8::Null();
-
-    return toV8(object);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TreeWalker.parentNode()");
-    TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
-    EmptyScriptState state;
-    RefPtr<Node> result = treeWalker->parentNode(&state);
-    return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TreeWalker.firstChild()");
-    TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
-    EmptyScriptState state;
-    RefPtr<Node> result = treeWalker->firstChild(&state);
-    return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TreeWalker.lastChild()");
-    TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
-    EmptyScriptState state;
-    RefPtr<Node> result = treeWalker->lastChild(&state);
-    return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TreeWalker.nextNode()");
-    TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
-    EmptyScriptState state;
-    RefPtr<Node> result = treeWalker->nextNode(&state);
-    return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TreeWalker.previousNode()");
-    TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
-    EmptyScriptState state;
-    RefPtr<Node> result = treeWalker->previousNode(&state);
-    return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TreeWalker.nextSibling()");
-    TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
-    EmptyScriptState state;
-    RefPtr<Node> result = treeWalker->nextSibling(&state);
-    return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.TreeWalker.previousSibling()");
-    TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
-    EmptyScriptState state;
-    RefPtr<Node> result = treeWalker->previousSibling(&state);
-    return toV8Object(result.release(), &state);
-}
-
-} // namespace WebCore
index f591128..890e315 100644 (file)
@@ -31,13 +31,13 @@ module traversal {
                  attribute Node currentNode
                      setter raises(DOMException);
 
-        [Custom] Node parentNode();
-        [Custom] Node firstChild();
-        [Custom] Node lastChild();
-        [Custom] Node previousSibling();
-        [Custom] Node nextSibling();
-        [Custom] Node previousNode();
-        [Custom] Node nextNode();
+        [CallWith=ScriptState] Node parentNode();
+        [CallWith=ScriptState] Node firstChild();
+        [CallWith=ScriptState] Node lastChild();
+        [CallWith=ScriptState] Node previousSibling();
+        [CallWith=ScriptState] Node nextSibling();
+        [CallWith=ScriptState] Node previousNode();
+        [CallWith=ScriptState] Node nextNode();
     };
 
 }