[V8] Generate specialized callbacks for the main world
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2013 22:52:24 +0000 (22:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2013 22:52:24 +0000 (22:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=112430

Patch by Marja Hölttä <marja@chromium.org> on 2013-03-21
Reviewed by Jochen Eisinger.

The new specialized bindings will be faster, because they don't need to
do the "main world, isolated world or a worker" check, but can right
away assume that we're in the main world.

This patch generates main world bindings for getters and setters of Node,
Element and Document.

No new tests (updated existing binding tests).

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateOverloadedFunction):
(GenerateFunctionCallback):
(GenerateFunction):
(GenerateParametersCheck):
(GenerateSingleConstructorCallback):
(GenerateNonStandardFunction):
(GenerateImplementation):
(GenerateFunctionCallString):
* bindings/scripts/test/V8/V8Float64Array.cpp:
(WebCore):
* bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
(WebCore):
* bindings/scripts/test/V8/V8TestEventTarget.cpp:
(WebCore):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore):
* bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
(WebCore):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore):
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
(WebCore):
* bindings/scripts/test/V8/V8TestTypedefs.cpp:
(WebCore):
* bindings/v8/V8DOMConfiguration.cpp:
(WebCore::V8DOMConfiguration::batchConfigureCallbacks):
(WebCore::V8DOMConfiguration::configureTemplate):
* bindings/v8/V8DOMConfiguration.h:
(BatchedMethod):
(V8DOMConfiguration):
* dom/Document.idl:
* dom/Element.idl:
* dom/Node.idl:

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

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestTypedefs.cpp
Source/WebCore/bindings/v8/V8DOMConfiguration.cpp
Source/WebCore/bindings/v8/V8DOMConfiguration.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Element.idl
Source/WebCore/dom/Node.idl

index d64ded3..0297081 100644 (file)
@@ -1,3 +1,54 @@
+2013-03-21  Marja Hölttä  <marja@chromium.org>
+
+        [V8] Generate specialized callbacks for the main world
+        https://bugs.webkit.org/show_bug.cgi?id=112430
+
+        Reviewed by Jochen Eisinger.
+
+        The new specialized bindings will be faster, because they don't need to
+        do the "main world, isolated world or a worker" check, but can right
+        away assume that we're in the main world.
+
+        This patch generates main world bindings for getters and setters of Node,
+        Element and Document.
+
+        No new tests (updated existing binding tests).
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateOverloadedFunction):
+        (GenerateFunctionCallback):
+        (GenerateFunction):
+        (GenerateParametersCheck):
+        (GenerateSingleConstructorCallback):
+        (GenerateNonStandardFunction):
+        (GenerateImplementation):
+        (GenerateFunctionCallString):
+        * bindings/scripts/test/V8/V8Float64Array.cpp:
+        (WebCore):
+        * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
+        (WebCore):
+        * bindings/scripts/test/V8/V8TestEventTarget.cpp:
+        (WebCore):
+        * bindings/scripts/test/V8/V8TestInterface.cpp:
+        (WebCore):
+        * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
+        (WebCore):
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore):
+        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+        (WebCore):
+        * bindings/scripts/test/V8/V8TestTypedefs.cpp:
+        (WebCore):
+        * bindings/v8/V8DOMConfiguration.cpp:
+        (WebCore::V8DOMConfiguration::batchConfigureCallbacks):
+        (WebCore::V8DOMConfiguration::configureTemplate):
+        * bindings/v8/V8DOMConfiguration.h:
+        (BatchedMethod):
+        (V8DOMConfiguration):
+        * dom/Document.idl:
+        * dom/Element.idl:
+        * dom/Node.idl:
+
 2013-03-21  Elliott Sprehn  <esprehn@chromium.org>
 
         Remove RenderObject::canHaveRegionStyle since nothing uses it
index 0717f4c..4915c97 100644 (file)
@@ -1556,6 +1556,7 @@ sub GenerateOverloadedFunction
 {
     my $function = shift;
     my $interface = shift;
+    my $forMainWorldSuffix = shift;
     my $interfaceName = $interface->name;
 
     # Generate code for choosing the correct overload to call. Overloads are
@@ -1569,7 +1570,7 @@ sub GenerateOverloadedFunction
     my $leastNumMandatoryParams = 255;
     push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalString;
     push(@implContentInternals, <<END);
-static v8::Handle<v8::Value> ${name}Method(const v8::Arguments& args)
+static v8::Handle<v8::Value> ${name}Method${forMainWorldSuffix}(const v8::Arguments& args)
 {
 END
     push(@implContentInternals, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}));
@@ -1579,7 +1580,7 @@ END
         $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams < $leastNumMandatoryParams);
         push(@implContentInternals, "    if ($parametersCheck)\n");
         my $overloadedIndexString = $overload->{overloadIndex};
-        push(@implContentInternals, "        return ${name}${overloadedIndexString}Method(args);\n");
+        push(@implContentInternals, "        return ${name}${overloadedIndexString}Method${forMainWorldSuffix}(args);\n");
     }
     if ($leastNumMandatoryParams >= 1) {
         push(@implContentInternals, "    if (args.Length() < $leastNumMandatoryParams)\n");
@@ -1596,6 +1597,7 @@ sub GenerateFunctionCallback
 {
     my $function = shift;
     my $interface = shift;
+    my $forMainWorldSuffix = shift;
 
     my $interfaceName = $interface->name;
     my $v8InterfaceName = "V8$interfaceName";
@@ -1604,14 +1606,14 @@ sub GenerateFunctionCallback
     my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
     push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalString;
     push(@implContentInternals, <<END);
-static v8::Handle<v8::Value> ${name}MethodCallback(const v8::Arguments& args)
+static v8::Handle<v8::Value> ${name}MethodCallback${forMainWorldSuffix}(const v8::Arguments& args)
 {
 END
     push(@implContentInternals, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}));
     if (HasCustomMethod($function->signature->extendedAttributes)) {
         push(@implContentInternals, "    return ${v8InterfaceName}::${name}MethodCustom(args);\n");
     } else {
-        push(@implContentInternals, "    return ${interfaceName}V8Internal::${name}Method(args);\n");
+        push(@implContentInternals, "    return ${interfaceName}V8Internal::${name}Method${forMainWorldSuffix}(args);\n");
     }
     push(@implContentInternals, "}\n\n");
     push(@implContentInternals, "#endif // ${conditionalString}\n\n") if $conditionalString;
@@ -1621,6 +1623,7 @@ sub GenerateFunction
 {
     my $function = shift;
     my $interface = shift;
+    my $forMainWorldSuffix = shift;
 
     my $interfaceName = $interface->name;
     my $v8InterfaceName = "V8$interfaceName";
@@ -1638,7 +1641,7 @@ sub GenerateFunction
 
     my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
     push(@implContentInternals, "#if ${conditionalString}\n\n") if $conditionalString;
-    push(@implContentInternals, "static v8::Handle<v8::Value> ${name}Method(const v8::Arguments& args)\n");
+    push(@implContentInternals, "static v8::Handle<v8::Value> ${name}Method${forMainWorldSuffix}(const v8::Arguments& args)\n");
     push(@implContentInternals, "{\n");
 
     if ($name eq "addEventListener" || $name eq "removeEventListener") {
@@ -1735,11 +1738,11 @@ END
 END
     }
 
-    my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersCheck($function, $interfaceName);
+    my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersCheck($function, $interfaceName, $forMainWorldSuffix);
     push(@implContentInternals, $parameterCheckString);
 
     # Build the function call string.
-    push(@implContentInternals, GenerateFunctionCallString($function, $paramIndex, "    ", $interfaceName, %replacements));
+    push(@implContentInternals, GenerateFunctionCallString($function, $paramIndex, "    ", $interfaceName, $forMainWorldSuffix, %replacements));
 
     if ($raisesExceptions) {
         push(@implContentInternals, "    }\n");
@@ -1823,6 +1826,7 @@ sub GenerateParametersCheck
 {
     my $function = shift;
     my $interfaceName = shift;
+    my $forMainWorldSuffix = shift;
 
     my $parameterCheckString = "";
     my $paramIndex = 0;
@@ -1838,7 +1842,7 @@ sub GenerateParametersCheck
         my $optional = $parameter->extendedAttributes->{"Optional"};
         if ($optional && $optional ne "DefaultIsUndefined" && $optional ne "DefaultIsNullString" && $nativeType ne "Dictionary" && !$parameter->extendedAttributes->{"Callback"}) {
             $parameterCheckString .= "    if (args.Length() <= $paramIndex) {\n";
-            my $functionCall = GenerateFunctionCallString($function, $paramIndex, "    " x 2, $interfaceName, %replacements);
+            my $functionCall = GenerateFunctionCallString($function, $paramIndex, "    " x 2, $interfaceName, $forMainWorldSuffix, %replacements);
             $parameterCheckString .= $functionCall;
             $parameterCheckString .= "    }\n";
         }
@@ -2061,7 +2065,7 @@ END
 
     # FIXME: Currently [Constructor(...)] does not yet support [Optional] arguments.
     # It just supports [Optional=DefaultIsUndefined] or [Optional=DefaultIsNullString].
-    my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersCheck($function, $interfaceName);
+    my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersCheck($function, $interfaceName, "");
     push(@implContentInternals, $parameterCheckString);
 
     if ($interface->extendedAttributes->{"CallWith"} && $interface->extendedAttributes->{"CallWith"} eq "ScriptExecutionContext") {
@@ -2567,7 +2571,15 @@ END
 
     my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
     push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
-    push(@implContent, "    ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), ${signature})$property_attributes);\n");
+    if ($function->signature->extendedAttributes->{"V8PerWorldBindings"}) {
+        push(@implContent, "    if (currentWorldType == MainWorld) {\n");
+        push(@implContent, "        ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallbackForMainWorld, v8Undefined(), ${signature})$property_attributes);\n");
+        push(@implContent, "    } else {\n");
+        push(@implContent, "        ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), ${signature})$property_attributes);\n");
+        push(@implContent, "    }\n");
+    } else {
+        push(@implContent, "    ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New(${interfaceName}V8Internal::${name}MethodCallback, v8Undefined(), ${signature})$property_attributes);\n");
+    }
     push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString;
 }
 
@@ -2912,12 +2924,22 @@ END
     my $needsDomainSafeFunctionSetter = 0;
     # Generate methods for functions.
     foreach my $function (@{$interface->functions}) {
-        GenerateFunction($function, $interface);
+        GenerateFunction($function, $interface, "");
+        if ($function->signature->extendedAttributes->{"V8PerWorldBindings"}) {
+            GenerateFunction($function, $interface, "ForMainWorld");
+        }
+
         if ($function->{overloadIndex} == @{$function->{overloads}}) {
             if ($function->{overloadIndex} > 1) {
-                GenerateOverloadedFunction($function, $interface);
+                GenerateOverloadedFunction($function, $interface, "");
+                if ($function->signature->extendedAttributes->{"V8PerWorldBindings"}) {
+                    GenerateOverloadedFunction($function, $interface, "ForMainWorld");
+                }
+            }
+            GenerateFunctionCallback($function, $interface, "");
+            if ($function->signature->extendedAttributes->{"V8PerWorldBindings"}) {
+                GenerateFunctionCallback($function, $interface, "ForMainWorld");
             }
-            GenerateFunctionCallback($function, $interface);
         }
 
         if ($function->signature->name eq "item") {
@@ -3005,10 +3027,14 @@ END
             push(@implContent, "static const V8DOMConfiguration::BatchedMethod ${v8InterfaceName}Methods[] = {\n");
         }
         my $name = $function->signature->name;
+        my $methodForMainWorld = "0";
+        if ($function->signature->extendedAttributes->{"V8PerWorldBindings"}) {
+            $methodForMainWorld = "${interfaceName}V8Internal::${name}MethodCallbackForMainWorld";
+        }
         my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
         push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
         push(@implContent, <<END);
-    {"$name", ${interfaceName}V8Internal::${name}MethodCallback},
+    {"$name", ${interfaceName}V8Internal::${name}MethodCallback, ${methodForMainWorld}},
 END
         push(@implContent, "#endif\n") if $conditionalString;
         $num_callbacks++;
@@ -3848,6 +3874,7 @@ sub GenerateFunctionCallString
     my $numberOfParameters = shift;
     my $indent = shift;
     my $interfaceName = shift;
+    my $forMainWorldSuffix = shift;
     my %replacements = @_;
 
     my $name = $function->signature->name;
@@ -3950,9 +3977,9 @@ sub GenerateFunctionCallString
         my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($returnType);
         # FIXME: Update for all ScriptWrappables.
         if (IsDOMNodeType($interfaceName)) {
-            $result .= $indent . "return toV8Fast(WTF::getPtr(${svgNativeType}::create($return)), args, imp);\n";
+            $result .= $indent . "return toV8Fast${forMainWorldSuffix}(WTF::getPtr(${svgNativeType}::create($return)), args, imp);\n";
         } else {
-            $result .= $indent . "return toV8(WTF::getPtr(${svgNativeType}::create($return)), args.Holder(), args.GetIsolate());\n";
+            $result .= $indent . "return toV8${forMainWorldSuffix}(WTF::getPtr(${svgNativeType}::create($return)), args.Holder(), args.GetIsolate());\n";
         }
         return $result;
     }
@@ -3967,9 +3994,9 @@ sub GenerateFunctionCallString
     my $nativeValue;
     # FIXME: Update for all ScriptWrappables.
     if (IsDOMNodeType($interfaceName)) {
-        $nativeValue = NativeToJSValue($function->signature, $return, "args.Holder()", "args.GetIsolate()", "args", "imp", "ReturnUnsafeHandle", "");
+        $nativeValue = NativeToJSValue($function->signature, $return, "args.Holder()", "args.GetIsolate()", "args", "imp", "ReturnUnsafeHandle", $forMainWorldSuffix);
     } else {
-        $nativeValue = NativeToJSValue($function->signature, $return, "args.Holder()", "args.GetIsolate()", 0, 0, "ReturnUnsafeHandle", "");
+        $nativeValue = NativeToJSValue($function->signature, $return, "args.Holder()", "args.GetIsolate()", 0, 0, "ReturnUnsafeHandle", $forMainWorldSuffix);
     }
 
     $result .= $indent . "return " . $nativeValue . ";\n";
index aa02f90..04c7aa6 100644 (file)
@@ -121,7 +121,7 @@ v8::Handle<v8::Object> wrap(Float64Array* impl, v8::Handle<v8::Object> creationC
 }
 
 static const V8DOMConfiguration::BatchedMethod V8Float64ArrayMethods[] = {
-    {"set", Float64ArrayV8Internal::setMethodCallback},
+    {"set", Float64ArrayV8Internal::setMethodCallback, 0},
 };
 
 v8::Handle<v8::Value> V8Float64Array::constructorCallback(const v8::Arguments& args)
index 447dfaf..e99eda6 100644 (file)
@@ -88,7 +88,7 @@ static v8::Handle<v8::Value> anotherFunctionMethodCallback(const v8::Arguments&
 } // namespace TestCustomNamedGetterV8Internal
 
 static const V8DOMConfiguration::BatchedMethod V8TestCustomNamedGetterMethods[] = {
-    {"anotherFunction", TestCustomNamedGetterV8Internal::anotherFunctionMethodCallback},
+    {"anotherFunction", TestCustomNamedGetterV8Internal::anotherFunctionMethodCallback, 0},
 };
 
 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestCustomNamedGetterTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
index 0c8ea1a..6c75915 100644 (file)
@@ -154,9 +154,9 @@ static v8::Handle<v8::Value> dispatchEventMethodCallback(const v8::Arguments& ar
 } // namespace TestEventTargetV8Internal
 
 static const V8DOMConfiguration::BatchedMethod V8TestEventTargetMethods[] = {
-    {"item", TestEventTargetV8Internal::itemMethodCallback},
-    {"addEventListener", TestEventTargetV8Internal::addEventListenerMethodCallback},
-    {"removeEventListener", TestEventTargetV8Internal::removeEventListenerMethodCallback},
+    {"item", TestEventTargetV8Internal::itemMethodCallback, 0},
+    {"addEventListener", TestEventTargetV8Internal::addEventListenerMethodCallback, 0},
+    {"removeEventListener", TestEventTargetV8Internal::removeEventListenerMethodCallback, 0},
 };
 
 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestEventTargetTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
index 7dae58a..3764df8 100644 (file)
@@ -383,10 +383,10 @@ static const V8DOMConfiguration::BatchedAttribute V8TestInterfaceAttrs[] = {
 
 static const V8DOMConfiguration::BatchedMethod V8TestInterfaceMethods[] = {
 #if ENABLE(Condition11) || ENABLE(Condition12)
-    {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCallback},
+    {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCallback, 0},
 #endif
 #if ENABLE(Condition11) || ENABLE(Condition12)
-    {"supplementalMethod3", TestInterfaceV8Internal::supplementalMethod3MethodCallback},
+    {"supplementalMethod3", TestInterfaceV8Internal::supplementalMethod3MethodCallback, 0},
 #endif
 };
 
index b1ff23c..5062017 100644 (file)
@@ -89,7 +89,7 @@ static v8::Handle<v8::Value> methodMethodCallback(const v8::Arguments& args)
 } // namespace TestMediaQueryListListenerV8Internal
 
 static const V8DOMConfiguration::BatchedMethod V8TestMediaQueryListListenerMethods[] = {
-    {"method", TestMediaQueryListListenerV8Internal::methodMethodCallback},
+    {"method", TestMediaQueryListListenerV8Internal::methodMethodCallback, 0},
 };
 
 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListenerTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
index af7a102..9986fee 100644 (file)
@@ -3251,57 +3251,57 @@ static const V8DOMConfiguration::BatchedAttribute V8TestObjAttrs[] = {
 };
 
 static const V8DOMConfiguration::BatchedMethod V8TestObjMethods[] = {
-    {"voidMethod", TestObjV8Internal::voidMethodMethodCallback},
-    {"longMethod", TestObjV8Internal::longMethodMethodCallback},
-    {"objMethod", TestObjV8Internal::objMethodMethodCallback},
-    {"methodReturningSequence", TestObjV8Internal::methodReturningSequenceMethodCallback},
-    {"serializedValue", TestObjV8Internal::serializedValueMethodCallback},
-    {"optionsObject", TestObjV8Internal::optionsObjectMethodCallback},
-    {"methodWithException", TestObjV8Internal::methodWithExceptionMethodCallback},
-    {"customMethod", TestObjV8Internal::customMethodMethodCallback},
-    {"customMethodWithArgs", TestObjV8Internal::customMethodWithArgsMethodCallback},
-    {"addEventListener", TestObjV8Internal::addEventListenerMethodCallback},
-    {"removeEventListener", TestObjV8Internal::removeEventListenerMethodCallback},
-    {"withScriptStateVoid", TestObjV8Internal::withScriptStateVoidMethodCallback},
-    {"withScriptStateObj", TestObjV8Internal::withScriptStateObjMethodCallback},
-    {"withScriptStateVoidException", TestObjV8Internal::withScriptStateVoidExceptionMethodCallback},
-    {"withScriptStateObjException", TestObjV8Internal::withScriptStateObjExceptionMethodCallback},
-    {"withScriptExecutionContext", TestObjV8Internal::withScriptExecutionContextMethodCallback},
-    {"withScriptExecutionContextAndScriptState", TestObjV8Internal::withScriptExecutionContextAndScriptStateMethodCallback},
-    {"withScriptExecutionContextAndScriptStateObjException", TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionMethodCallback},
-    {"withScriptExecutionContextAndScriptStateWithSpaces", TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesMethodCallback},
-    {"withScriptArgumentsAndCallStack", TestObjV8Internal::withScriptArgumentsAndCallStackMethodCallback},
-    {"methodWithOptionalArg", TestObjV8Internal::methodWithOptionalArgMethodCallback},
-    {"methodWithNonOptionalArgAndOptionalArg", TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgMethodCallback},
-    {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsMethodCallback},
-    {"methodWithOptionalString", TestObjV8Internal::methodWithOptionalStringMethodCallback},
-    {"methodWithOptionalStringIsUndefined", TestObjV8Internal::methodWithOptionalStringIsUndefinedMethodCallback},
-    {"methodWithOptionalStringIsNullString", TestObjV8Internal::methodWithOptionalStringIsNullStringMethodCallback},
-    {"methodWithCallbackArg", TestObjV8Internal::methodWithCallbackArgMethodCallback},
-    {"methodWithNonCallbackArgAndCallbackArg", TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgMethodCallback},
-    {"methodWithCallbackAndOptionalArg", TestObjV8Internal::methodWithCallbackAndOptionalArgMethodCallback},
-    {"methodWithEnforceRangeInt32", TestObjV8Internal::methodWithEnforceRangeInt32MethodCallback},
-    {"methodWithEnforceRangeUInt32", TestObjV8Internal::methodWithEnforceRangeUInt32MethodCallback},
-    {"methodWithEnforceRangeInt64", TestObjV8Internal::methodWithEnforceRangeInt64MethodCallback},
-    {"methodWithEnforceRangeUInt64", TestObjV8Internal::methodWithEnforceRangeUInt64MethodCallback},
+    {"voidMethod", TestObjV8Internal::voidMethodMethodCallback, 0},
+    {"longMethod", TestObjV8Internal::longMethodMethodCallback, 0},
+    {"objMethod", TestObjV8Internal::objMethodMethodCallback, 0},
+    {"methodReturningSequence", TestObjV8Internal::methodReturningSequenceMethodCallback, 0},
+    {"serializedValue", TestObjV8Internal::serializedValueMethodCallback, 0},
+    {"optionsObject", TestObjV8Internal::optionsObjectMethodCallback, 0},
+    {"methodWithException", TestObjV8Internal::methodWithExceptionMethodCallback, 0},
+    {"customMethod", TestObjV8Internal::customMethodMethodCallback, 0},
+    {"customMethodWithArgs", TestObjV8Internal::customMethodWithArgsMethodCallback, 0},
+    {"addEventListener", TestObjV8Internal::addEventListenerMethodCallback, 0},
+    {"removeEventListener", TestObjV8Internal::removeEventListenerMethodCallback, 0},
+    {"withScriptStateVoid", TestObjV8Internal::withScriptStateVoidMethodCallback, 0},
+    {"withScriptStateObj", TestObjV8Internal::withScriptStateObjMethodCallback, 0},
+    {"withScriptStateVoidException", TestObjV8Internal::withScriptStateVoidExceptionMethodCallback, 0},
+    {"withScriptStateObjException", TestObjV8Internal::withScriptStateObjExceptionMethodCallback, 0},
+    {"withScriptExecutionContext", TestObjV8Internal::withScriptExecutionContextMethodCallback, 0},
+    {"withScriptExecutionContextAndScriptState", TestObjV8Internal::withScriptExecutionContextAndScriptStateMethodCallback, 0},
+    {"withScriptExecutionContextAndScriptStateObjException", TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionMethodCallback, 0},
+    {"withScriptExecutionContextAndScriptStateWithSpaces", TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesMethodCallback, 0},
+    {"withScriptArgumentsAndCallStack", TestObjV8Internal::withScriptArgumentsAndCallStackMethodCallback, 0},
+    {"methodWithOptionalArg", TestObjV8Internal::methodWithOptionalArgMethodCallback, 0},
+    {"methodWithNonOptionalArgAndOptionalArg", TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgMethodCallback, 0},
+    {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsMethodCallback, 0},
+    {"methodWithOptionalString", TestObjV8Internal::methodWithOptionalStringMethodCallback, 0},
+    {"methodWithOptionalStringIsUndefined", TestObjV8Internal::methodWithOptionalStringIsUndefinedMethodCallback, 0},
+    {"methodWithOptionalStringIsNullString", TestObjV8Internal::methodWithOptionalStringIsNullStringMethodCallback, 0},
+    {"methodWithCallbackArg", TestObjV8Internal::methodWithCallbackArgMethodCallback, 0},
+    {"methodWithNonCallbackArgAndCallbackArg", TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgMethodCallback, 0},
+    {"methodWithCallbackAndOptionalArg", TestObjV8Internal::methodWithCallbackAndOptionalArgMethodCallback, 0},
+    {"methodWithEnforceRangeInt32", TestObjV8Internal::methodWithEnforceRangeInt32MethodCallback, 0},
+    {"methodWithEnforceRangeUInt32", TestObjV8Internal::methodWithEnforceRangeUInt32MethodCallback, 0},
+    {"methodWithEnforceRangeInt64", TestObjV8Internal::methodWithEnforceRangeInt64MethodCallback, 0},
+    {"methodWithEnforceRangeUInt64", TestObjV8Internal::methodWithEnforceRangeUInt64MethodCallback, 0},
 #if ENABLE(Condition1)
-    {"conditionalMethod1", TestObjV8Internal::conditionalMethod1MethodCallback},
+    {"conditionalMethod1", TestObjV8Internal::conditionalMethod1MethodCallback, 0},
 #endif
 #if ENABLE(Condition1) && ENABLE(Condition2)
-    {"conditionalMethod2", TestObjV8Internal::conditionalMethod2MethodCallback},
+    {"conditionalMethod2", TestObjV8Internal::conditionalMethod2MethodCallback, 0},
 #endif
 #if ENABLE(Condition1) || ENABLE(Condition2)
-    {"conditionalMethod3", TestObjV8Internal::conditionalMethod3MethodCallback},
+    {"conditionalMethod3", TestObjV8Internal::conditionalMethod3MethodCallback, 0},
 #endif
-    {"overloadedMethod", TestObjV8Internal::overloadedMethodMethodCallback},
-    {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampMethodCallback},
-    {"getSVGDocument", TestObjV8Internal::getSVGDocumentMethodCallback},
-    {"mutablePointFunction", TestObjV8Internal::mutablePointFunctionMethodCallback},
-    {"immutablePointFunction", TestObjV8Internal::immutablePointFunctionMethodCallback},
-    {"orange", TestObjV8Internal::orangeMethodCallback},
-    {"strictFunction", TestObjV8Internal::strictFunctionMethodCallback},
-    {"variadicStringMethod", TestObjV8Internal::variadicStringMethodMethodCallback},
-    {"variadicDoubleMethod", TestObjV8Internal::variadicDoubleMethodMethodCallback},
+    {"overloadedMethod", TestObjV8Internal::overloadedMethodMethodCallback, 0},
+    {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampMethodCallback, 0},
+    {"getSVGDocument", TestObjV8Internal::getSVGDocumentMethodCallback, 0},
+    {"mutablePointFunction", TestObjV8Internal::mutablePointFunctionMethodCallback, 0},
+    {"immutablePointFunction", TestObjV8Internal::immutablePointFunctionMethodCallback, 0},
+    {"orange", TestObjV8Internal::orangeMethodCallback, 0},
+    {"strictFunction", TestObjV8Internal::strictFunctionMethodCallback, 0},
+    {"variadicStringMethod", TestObjV8Internal::variadicStringMethodMethodCallback, 0},
+    {"variadicDoubleMethod", TestObjV8Internal::variadicDoubleMethodMethodCallback, 0},
 };
 
 static const V8DOMConfiguration::BatchedConstant V8TestObjConsts[] = {
index 03d0081..2130679 100644 (file)
@@ -293,8 +293,8 @@ static const V8DOMConfiguration::BatchedAttribute V8TestSerializedScriptValueInt
 };
 
 static const V8DOMConfiguration::BatchedMethod V8TestSerializedScriptValueInterfaceMethods[] = {
-    {"acceptTransferList", TestSerializedScriptValueInterfaceV8Internal::acceptTransferListMethodCallback},
-    {"multiTransferList", TestSerializedScriptValueInterfaceV8Internal::multiTransferListMethodCallback},
+    {"acceptTransferList", TestSerializedScriptValueInterfaceV8Internal::acceptTransferListMethodCallback, 0},
+    {"multiTransferList", TestSerializedScriptValueInterfaceV8Internal::multiTransferListMethodCallback, 0},
 };
 
 v8::Handle<v8::Value> V8TestSerializedScriptValueInterface::constructorCallback(const v8::Arguments& args)
index 5f650b8..aca9e7f 100644 (file)
@@ -514,12 +514,12 @@ static const V8DOMConfiguration::BatchedAttribute V8TestTypedefsAttrs[] = {
 };
 
 static const V8DOMConfiguration::BatchedMethod V8TestTypedefsMethods[] = {
-    {"func", TestTypedefsV8Internal::funcMethodCallback},
-    {"multiTransferList", TestTypedefsV8Internal::multiTransferListMethodCallback},
-    {"setShadow", TestTypedefsV8Internal::setShadowMethodCallback},
-    {"funcWithClamp", TestTypedefsV8Internal::funcWithClampMethodCallback},
-    {"immutablePointFunction", TestTypedefsV8Internal::immutablePointFunctionMethodCallback},
-    {"methodWithException", TestTypedefsV8Internal::methodWithExceptionMethodCallback},
+    {"func", TestTypedefsV8Internal::funcMethodCallback, 0},
+    {"multiTransferList", TestTypedefsV8Internal::multiTransferListMethodCallback, 0},
+    {"setShadow", TestTypedefsV8Internal::setShadowMethodCallback, 0},
+    {"funcWithClamp", TestTypedefsV8Internal::funcWithClampMethodCallback, 0},
+    {"immutablePointFunction", TestTypedefsV8Internal::immutablePointFunctionMethodCallback, 0},
+    {"methodWithException", TestTypedefsV8Internal::methodWithExceptionMethodCallback, 0},
 };
 
 v8::Handle<v8::Value> V8TestTypedefs::constructorCallback(const v8::Arguments& args)
index 561cabd..654f825 100644 (file)
@@ -48,10 +48,14 @@ void V8DOMConfiguration::batchConfigureConstants(v8::Handle<v8::FunctionTemplate
     }
 }
 
-void V8DOMConfiguration::batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate> prototype, v8::Handle<v8::Signature> signature, v8::PropertyAttribute attributes, const BatchedMethod* callbacks, size_t callbackCount, v8::Isolate*)
+void V8DOMConfiguration::batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate> prototype, v8::Handle<v8::Signature> signature, v8::PropertyAttribute attributes, const BatchedMethod* callbacks, size_t callbackCount, v8::Isolate*, WrapperWorldType currentWorldType)
 {
-    for (size_t i = 0; i < callbackCount; ++i)
-        prototype->Set(v8::String::NewSymbol(callbacks[i].name), v8::FunctionTemplate::New(callbacks[i].callback, v8Undefined(), signature), attributes);
+    for (size_t i = 0; i < callbackCount; ++i) {
+        v8::InvocationCallback callback = callbacks[i].callback;
+        if (currentWorldType == MainWorld && callbacks[i].callbackForMainWorld)
+            callback = callbacks[i].callbackForMainWorld;
+        prototype->Set(v8::String::NewSymbol(callbacks[i].name), v8::FunctionTemplate::New(callback, v8Undefined(), signature), attributes);
+    }
 }
 
 v8::Local<v8::Signature> V8DOMConfiguration::configureTemplate(v8::Persistent<v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Persistent<v8::FunctionTemplate> parentClass,
@@ -73,7 +77,7 @@ v8::Local<v8::Signature> V8DOMConfiguration::configureTemplate(v8::Persistent<v8
         batchConfigureAttributes(instance, functionDescriptor->PrototypeTemplate(), attributes, attributeCount, isolate, currentWorldType);
     v8::Local<v8::Signature> defaultSignature = v8::Signature::New(functionDescriptor);
     if (callbackCount)
-        batchConfigureCallbacks(functionDescriptor->PrototypeTemplate(), defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callbackCount, isolate);
+        batchConfigureCallbacks(functionDescriptor->PrototypeTemplate(), defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callbackCount, isolate, currentWorldType);
     return defaultSignature;
 }
 
index e95b158..82face9 100644 (file)
@@ -101,9 +101,10 @@ public:
     struct BatchedMethod {
         const char* const name;
         v8::InvocationCallback callback;
+        v8::InvocationCallback callbackForMainWorld;
     };
 
-    static void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Signature>, v8::PropertyAttribute, const BatchedMethod*, size_t callbackCount, v8::Isolate*);
+    static void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Signature>, v8::PropertyAttribute, const BatchedMethod*, size_t callbackCount, v8::Isolate*, WrapperWorldType);
 
     static v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>, const char* interfaceName, v8::Persistent<v8::FunctionTemplate> parentClass, size_t fieldCount, const BatchedAttribute*, size_t attributeCount, const BatchedMethod*, size_t callbackCount, v8::Isolate*, WrapperWorldType);
 };
index c9df374..49bf77e 100644 (file)
     readonly attribute DOMImplementation implementation;
     readonly attribute Element documentElement;
 
-    [ReturnNewObject] Element createElement(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString tagName)
+    [ReturnNewObject, V8PerWorldBindings] Element createElement(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString tagName)
         raises (DOMException);
-    DocumentFragment   createDocumentFragment();
-    [ReturnNewObject] Text createTextNode(in [Optional=DefaultIsUndefined] DOMString data);
-    [ReturnNewObject] Comment createComment(in [Optional=DefaultIsUndefined] DOMString data);
-    [ReturnNewObject] CDATASection createCDATASection(in [Optional=DefaultIsUndefined] DOMString data)
+    [V8PerWorldBindings] DocumentFragment   createDocumentFragment();
+    [ReturnNewObject, V8PerWorldBindings] Text createTextNode(in [Optional=DefaultIsUndefined] DOMString data);
+    [ReturnNewObject, V8PerWorldBindings] Comment createComment(in [Optional=DefaultIsUndefined] DOMString data);
+    [ReturnNewObject, V8PerWorldBindings] CDATASection createCDATASection(in [Optional=DefaultIsUndefined] DOMString data)
         raises(DOMException);
-    [ObjCLegacyUnnamedParameters, ReturnNewObject] ProcessingInstruction createProcessingInstruction(in [Optional=DefaultIsUndefined] DOMString target,
+    [ObjCLegacyUnnamedParameters, ReturnNewObject, V8PerWorldBindings] ProcessingInstruction createProcessingInstruction(in [Optional=DefaultIsUndefined] DOMString target,
                                                                                  in [Optional=DefaultIsUndefined] DOMString data)
         raises (DOMException);
-    [ReturnNewObject] Attr createAttribute(in [Optional=DefaultIsUndefined] DOMString name)
+    [ReturnNewObject, V8PerWorldBindings] Attr createAttribute(in [Optional=DefaultIsUndefined] DOMString name)
         raises (DOMException);
-    [ReturnNewObject] EntityReference createEntityReference(in [Optional=DefaultIsUndefined] DOMString name)
+    [ReturnNewObject, V8PerWorldBindings] EntityReference createEntityReference(in [Optional=DefaultIsUndefined] DOMString name)
         raises(DOMException);
-    NodeList           getElementsByTagName(in [Optional=DefaultIsUndefined] DOMString tagname);
+    [V8PerWorldBindings] NodeList getElementsByTagName(in [Optional=DefaultIsUndefined] DOMString tagname);
 
     // Introduced in DOM Level 2:
 
-    [ObjCLegacyUnnamedParameters, ReturnNewObject] Node importNode(in [Optional=DefaultIsUndefined] Node importedNode,
+    [ObjCLegacyUnnamedParameters, ReturnNewObject, V8PerWorldBindings] Node importNode(in [Optional=DefaultIsUndefined] Node importedNode,
                                                in [Optional] boolean deep)
         raises (DOMException);
-    [ObjCLegacyUnnamedParameters, ReturnNewObject] Element createElementNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
+    [ObjCLegacyUnnamedParameters, ReturnNewObject, V8PerWorldBindings] Element createElementNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
                                                        in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString qualifiedName)
         raises (DOMException);
-    [ObjCLegacyUnnamedParameters, ReturnNewObject] Attr createAttributeNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
+    [ObjCLegacyUnnamedParameters, ReturnNewObject, V8PerWorldBindings] Attr createAttributeNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
                                                       in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString qualifiedName)
         raises (DOMException);
-    [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
+    [ObjCLegacyUnnamedParameters, V8PerWorldBindings] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
                                                    in [Optional=DefaultIsUndefined] DOMString localName);
-    Element            getElementById(in [Optional=DefaultIsUndefined] DOMString elementId);
+    [V8PerWorldBindings] Element            getElementById(in [Optional=DefaultIsUndefined] DOMString elementId);
 
     // DOM Level 3 Core
 
@@ -70,7 +70,7 @@
              attribute boolean xmlStandalone
                 setter raises (DOMException);
 
-    Node               adoptNode(in [Optional=DefaultIsUndefined] Node source)
+    [V8PerWorldBindings] Node adoptNode(in [Optional=DefaultIsUndefined] Node source)
         raises (DOMException);
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT
 
     // DOM Level 2 Events (DocumentEvents interface)
 
-    Event              createEvent(in [Optional=DefaultIsUndefined] DOMString eventType)
+    [V8PerWorldBindings] Event              createEvent(in [Optional=DefaultIsUndefined] DOMString eventType)
         raises(DOMException);
 
     // DOM Level 2 Tranversal and Range (DocumentRange interface)
 
-    Range              createRange();
+    [V8PerWorldBindings] Range              createRange();
 
     // DOM Level 2 Tranversal and Range (DocumentTraversal interface)
 
-    [ObjCLegacyUnnamedParameters] NodeIterator createNodeIterator(in [Optional=DefaultIsUndefined] Node root,
+    [ObjCLegacyUnnamedParameters, V8PerWorldBindings] NodeIterator createNodeIterator(in [Optional=DefaultIsUndefined] Node root,
                                                    in [Optional=DefaultIsUndefined] unsigned long whatToShow,
                                                    in [Optional=DefaultIsUndefined] NodeFilter filter,
                                                    in [Optional=DefaultIsUndefined] boolean expandEntityReferences)
         raises(DOMException);
-    [ObjCLegacyUnnamedParameters] TreeWalker createTreeWalker(in [Optional=DefaultIsUndefined] Node root,
+    [ObjCLegacyUnnamedParameters, V8PerWorldBindings] TreeWalker createTreeWalker(in [Optional=DefaultIsUndefined] Node root,
                                                in [Optional=DefaultIsUndefined] unsigned long whatToShow,
                                                in [Optional=DefaultIsUndefined] NodeFilter filter,
                                                in [Optional=DefaultIsUndefined] boolean expandEntityReferences)
 
     // DOM Level 2 Style (DocumentCSS interface)
 
-    [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle(in [Optional=DefaultIsUndefined] Element element,
+    [ObjCLegacyUnnamedParameters, V8PerWorldBindings] CSSStyleDeclaration getOverrideStyle(in [Optional=DefaultIsUndefined] Element element,
                                                         in [Optional=DefaultIsUndefined] DOMString pseudoElement);
 
     // DOM Level 3 XPath (XPathEvaluator interface)
-    [ObjCLegacyUnnamedParameters] XPathExpression createExpression(in [Optional=DefaultIsUndefined] DOMString expression,
+    [ObjCLegacyUnnamedParameters, V8PerWorldBindings] XPathExpression createExpression(in [Optional=DefaultIsUndefined] DOMString expression,
                                                     in [Optional=DefaultIsUndefined] XPathNSResolver resolver)
         raises(DOMException);
-    XPathNSResolver    createNSResolver(in Node nodeResolver);
-    [ObjCLegacyUnnamedParameters, V8Custom] XPathResult evaluate(in [Optional=DefaultIsUndefined] DOMString expression,
+    [V8PerWorldBindings] XPathNSResolver    createNSResolver(in Node nodeResolver);
+    [ObjCLegacyUnnamedParameters, V8Custom, V8PerWorldBindings] XPathResult evaluate(in [Optional=DefaultIsUndefined] DOMString expression,
                                                   in [Optional=DefaultIsUndefined] Node contextNode,
                                                   in [Optional=DefaultIsUndefined] XPathNSResolver resolver,
                                                   in [Optional=DefaultIsUndefined] unsigned short type,
     boolean            queryCommandIndeterm(in [Optional=DefaultIsUndefined] DOMString command);
     boolean            queryCommandState(in [Optional=DefaultIsUndefined] DOMString command);
     boolean            queryCommandSupported(in [Optional=DefaultIsUndefined] DOMString command);
-    DOMString          queryCommandValue(in [Optional=DefaultIsUndefined] DOMString command);
+    [V8PerWorldBindings] DOMString queryCommandValue(in [Optional=DefaultIsUndefined] DOMString command);
 
     // Moved down from HTMLDocument
 
     readonly attribute HTMLCollection anchors;
     readonly attribute DOMString lastModified;
 
-    NodeList getElementsByName(in [Optional=DefaultIsUndefined] DOMString elementName);
+    [V8PerWorldBindings] NodeList getElementsByName(in [Optional=DefaultIsUndefined] DOMString elementName);
 
 #if defined(ENABLE_MICRODATA) && ENABLE_MICRODATA
-    NodeList getItems(in [TreatNullAs=NullString, TreatUndefinedAs=NullString, Optional=DefaultIsUndefined] DOMString typeNames);
+    [V8PerWorldBindings] NodeList getItems(in [TreatNullAs=NullString, TreatUndefinedAs=NullString, Optional=DefaultIsUndefined] DOMString typeNames);
 #endif
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
     [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset;
     [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;
 
-    Element            elementFromPoint(in [Optional=DefaultIsUndefined] long x, 
-                                        in [Optional=DefaultIsUndefined] long y);
-    Range              caretRangeFromPoint(in [Optional=DefaultIsUndefined] long x, 
-                                           in [Optional=DefaultIsUndefined] long y);
+    [V8PerWorldBindings] Element elementFromPoint(in [Optional=DefaultIsUndefined] long x, 
+                                                  in [Optional=DefaultIsUndefined] long y);
+    [V8PerWorldBindings] Range caretRangeFromPoint(in [Optional=DefaultIsUndefined] long x, 
+                                                   in [Optional=DefaultIsUndefined] long y);
 
     // Mozilla extensions
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-    DOMSelection       getSelection();
+    [V8PerWorldBindings] DOMSelection getSelection();
 #endif
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString characterSet;
 
 #endif
 
     // HTML 5
-    NodeList getElementsByClassName(in [Optional=DefaultIsUndefined] DOMString tagname);
+    [V8PerWorldBindings] NodeList getElementsByClassName(in [Optional=DefaultIsUndefined] DOMString tagname);
 
     readonly attribute DOMString compatMode;
 
     // NodeSelector - Selector API
-    Element querySelector(in DOMString selectors)
+    [V8PerWorldBindings] Element querySelector(in DOMString selectors)
         raises(DOMException);
-    NodeList querySelectorAll(in DOMString selectors)
+    [V8PerWorldBindings] NodeList querySelectorAll(in DOMString selectors)
         raises(DOMException);
 
 #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
 #endif
 
 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
-    [ReturnNewObject, V8EnabledAtRuntime=touch] Touch createTouch(in [Optional=DefaultIsUndefined] DOMWindow window,
+    [ReturnNewObject, V8EnabledAtRuntime=touch, V8PerWorldBindings] Touch createTouch(in [Optional=DefaultIsUndefined] DOMWindow window,
                                                      in [Optional=DefaultIsUndefined] EventTarget target,
                                                      in [Optional=DefaultIsUndefined] long identifier,
                                                      in [Optional=DefaultIsUndefined] long pageX,
 #endif
 
 #if defined(ENABLE_CUSTOM_ELEMENTS) && ENABLE_CUSTOM_ELEMENTS
-    [V8EnabledAtRuntime=customDOMElements, Conditional=CUSTOM_ELEMENTS, ImplementedAs=registerElement, CallWith=ScriptState]
+    [V8EnabledAtRuntime=customDOMElements, Conditional=CUSTOM_ELEMENTS, ImplementedAs=registerElement, CallWith=ScriptState, V8PerWorldBindings]
     CustomElementConstructor webkitRegister(in DOMString name, in [Optional] Dictionary options) raises(DOMException);
-    [ReturnNewObject] Element createElement(in DOMString localName, in [TreatNullAs=NullString] DOMString typeExtension) raises (DOMException);
-    [ReturnNewObject] Element createElementNS(in [TreatNullAs=NullString] DOMString namespaceURI, in DOMString qualifiedName,
+    [ReturnNewObject, V8PerWorldBindings] Element createElement(in DOMString localName, in [TreatNullAs=NullString] DOMString typeExtension) raises (DOMException);
+    [ReturnNewObject, V8PerWorldBindings] Element createElementNS(in [TreatNullAs=NullString] DOMString namespaceURI, in DOMString qualifiedName,
                                               in [TreatNullAs=NullString] DOMString typeExtension) raises (DOMException);
 #endif
 
index 78b9497..4031198 100644 (file)
                                      in [Optional=DefaultIsUndefined] DOMString value)
         raises(DOMException);
     void removeAttribute(in [Optional=DefaultIsUndefined] DOMString name);
-    Attr getAttributeNode(in [Optional=DefaultIsUndefined] DOMString name);
-    Attr setAttributeNode(in [Optional=DefaultIsUndefined] Attr newAttr)
+    [V8PerWorldBindings] Attr getAttributeNode(in [Optional=DefaultIsUndefined] DOMString name);
+    [V8PerWorldBindings] Attr setAttributeNode(in [Optional=DefaultIsUndefined] Attr newAttr)
         raises(DOMException);
-    Attr removeAttributeNode(in [Optional=DefaultIsUndefined] Attr oldAttr)
+    [V8PerWorldBindings] Attr removeAttributeNode(in [Optional=DefaultIsUndefined] Attr oldAttr)
         raises(DOMException);
-    NodeList getElementsByTagName(in [Optional=DefaultIsUndefined] DOMString name);
+    [V8PerWorldBindings] NodeList getElementsByTagName(in [Optional=DefaultIsUndefined] DOMString name);
 
 #if !defined(LANGUAGE_OBJECTIVE_C)
     // For ObjC this is defined on Node for legacy support.
         raises(DOMException);
     [ObjCLegacyUnnamedParameters] void removeAttributeNS(in [TreatNullAs=NullString] DOMString namespaceURI,
                                           in DOMString localName);
-    [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
+    [ObjCLegacyUnnamedParameters, V8PerWorldBindings] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
                                                    in [Optional=DefaultIsUndefined] DOMString localName);
-    [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
+    [ObjCLegacyUnnamedParameters, V8PerWorldBindings] Attr getAttributeNodeNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
                                            in [Optional=DefaultIsUndefined] DOMString localName);
-    Attr setAttributeNodeNS(in [Optional=DefaultIsUndefined] Attr newAttr)
+    [V8PerWorldBindings] Attr setAttributeNodeNS(in [Optional=DefaultIsUndefined] Attr newAttr)
         raises(DOMException);
     boolean hasAttribute(in DOMString name);
     [ObjCLegacyUnnamedParameters] boolean hasAttributeNS(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString namespaceURI,
@@ -96,7 +96,7 @@
     void scrollByPages(in [Optional=DefaultIsUndefined] long pages);
 
     // HTML 5
-    NodeList getElementsByClassName(in [Optional=DefaultIsUndefined] DOMString name);
+    [V8PerWorldBindings] NodeList getElementsByClassName(in [Optional=DefaultIsUndefined] DOMString name);
 
     [Reflect=class, V8PerWorldBindings] attribute DOMString className;
     [V8PerWorldBindings] readonly attribute DOMTokenList classList;
 #endif
 
     // NodeSelector - Selector API
-    Element querySelector(in DOMString selectors)
+    [V8PerWorldBindings] Element querySelector(in DOMString selectors)
         raises(DOMException);
-    NodeList querySelectorAll(in DOMString selectors)
+    [V8PerWorldBindings] NodeList querySelectorAll(in DOMString selectors)
         raises(DOMException);
 
     // WebKit extension, pending specification.
     // ShadowAware API
 #if defined(ENABLE_SHADOW_DOM) && ENABLE_SHADOW_DOM && defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
     [Reflect=pseudo, V8EnabledAtRuntime=shadowDOM, ImplementedAs=pseudo, V8PerWorldBindings] attribute DOMString webkitPseudo;
-    [V8EnabledAtRuntime=shadowDOM, ImplementedAs=createShadowRoot] ShadowRoot webkitCreateShadowRoot() raises(DOMException);
+    [V8EnabledAtRuntime=shadowDOM, ImplementedAs=createShadowRoot, V8PerWorldBindings] ShadowRoot webkitCreateShadowRoot() raises(DOMException);
     [V8EnabledAtRuntime=shadowDOM, ImplementedAs=shadowRoot, V8PerWorldBindings] readonly attribute ShadowRoot webkitShadowRoot;
 #endif
 
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
     // CSSOM View Module API
-    ClientRectList getClientRects();
-    ClientRect getBoundingClientRect();
+    [V8PerWorldBindings] ClientRectList getClientRects();
+    [V8PerWorldBindings] ClientRect getBoundingClientRect();
 #endif
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
index 6b5d493..fe97567 100644 (file)
@@ -76,7 +76,7 @@
         raises(DOMException);
 
     boolean            hasChildNodes();
-    Node               cloneNode(in [Optional=DefaultIsUndefined] boolean deep);
+    [V8PerWorldBindings] Node               cloneNode(in [Optional=DefaultIsUndefined] boolean deep);
     void               normalize();
 
     // Introduced in DOM Level 2: