<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189063] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189063">189063</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-08-27 15:35:46 -0700 (Thu, 27 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>A WebIDL callback interface is allowed to have constants
https://bugs.webkit.org/show_bug.cgi?id=148449
Reviewed by Geoffrey Garen.
Our JS bindings generator is now able to:
1. Handle IDL constants [1] on a callback interfaces [2] and generate
a DOMConstructorObject subclass with static properties for
these constants [3].
2. Generate a property on the global object for callback interfaces
that have constants and do not have the [NoInterfaceObject] IDL
extended attribute [4].
This is a pre-requirement for Bug 148415 as NodeFilter [5] has constants
and should be a callback interface. Once NodeFilter is ported to be
a callback interface, the JS still needs to be able to access
window.NodeFilter.SHOW_ALL for e.g.
[1] https://heycam.github.io/webidl/#dfn-constant
[2] https://heycam.github.io/webidl/#dfn-callback-interface
[3] https://heycam.github.io/webidl/#NoInterfaceObject
[4] https://heycam.github.io/webidl/#es-interfaces
[5] https://dom.spec.whatwg.org/#interface-nodefilter
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallbackHeader):
(GenerateCallbackImplementation):
(GenerateConstructorHelperMethods):
(ConstructorHasProperties): Deleted.
* bindings/scripts/preprocess-idls.pl:
(getInterfaceExtendedAttributesFromIDL):
(interfaceHasConstantAttribute):
* bindings/scripts/test/GObject/WebKitDOMTestCallback.h:
* bindings/scripts/test/JS/JSTestCallback.cpp:
(WebCore::JSTestCallbackConstructor::create):
(WebCore::JSTestCallbackConstructor::createStructure):
(WebCore::JSTestCallbackConstructor::JSTestCallbackConstructor):
(WebCore::JSTestCallbackConstructor::finishCreation):
(WebCore::JSTestCallback::getConstructor):
* bindings/scripts/test/JS/JSTestCallback.h:
* bindings/scripts/test/ObjC/DOMTestCallback.h:
* bindings/scripts/test/TestCallback.idl:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptspreprocessidlspl">trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestCallbackh">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestCallbackh">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestCallbackidl">trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/ChangeLog        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -1,5 +1,50 @@
</span><span class="cx"> 2015-08-27 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ A WebIDL callback interface is allowed to have constants
+ https://bugs.webkit.org/show_bug.cgi?id=148449
+
+ Reviewed by Geoffrey Garen.
+
+ Our JS bindings generator is now able to:
+ 1. Handle IDL constants [1] on a callback interfaces [2] and generate
+ a DOMConstructorObject subclass with static properties for
+ these constants [3].
+ 2. Generate a property on the global object for callback interfaces
+ that have constants and do not have the [NoInterfaceObject] IDL
+ extended attribute [4].
+
+ This is a pre-requirement for Bug 148415 as NodeFilter [5] has constants
+ and should be a callback interface. Once NodeFilter is ported to be
+ a callback interface, the JS still needs to be able to access
+ window.NodeFilter.SHOW_ALL for e.g.
+
+ [1] https://heycam.github.io/webidl/#dfn-constant
+ [2] https://heycam.github.io/webidl/#dfn-callback-interface
+ [3] https://heycam.github.io/webidl/#NoInterfaceObject
+ [4] https://heycam.github.io/webidl/#es-interfaces
+ [5] https://dom.spec.whatwg.org/#interface-nodefilter
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateCallbackHeader):
+ (GenerateCallbackImplementation):
+ (GenerateConstructorHelperMethods):
+ (ConstructorHasProperties): Deleted.
+ * bindings/scripts/preprocess-idls.pl:
+ (getInterfaceExtendedAttributesFromIDL):
+ (interfaceHasConstantAttribute):
+ * bindings/scripts/test/GObject/WebKitDOMTestCallback.h:
+ * bindings/scripts/test/JS/JSTestCallback.cpp:
+ (WebCore::JSTestCallbackConstructor::create):
+ (WebCore::JSTestCallbackConstructor::createStructure):
+ (WebCore::JSTestCallbackConstructor::JSTestCallbackConstructor):
+ (WebCore::JSTestCallbackConstructor::finishCreation):
+ (WebCore::JSTestCallback::getConstructor):
+ * bindings/scripts/test/JS/JSTestCallback.h:
+ * bindings/scripts/test/ObjC/DOMTestCallback.h:
+ * bindings/scripts/test/TestCallback.idl:
+
+2015-08-27 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> Range.compareBoundaryPoints() should throw a NotSupportedError for invalid compareHow values
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=148483
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -3475,6 +3475,11 @@
</span><span class="cx"> # Destructor
</span><span class="cx"> push(@headerContent, " virtual ~$className();\n");
</span><span class="cx">
</span><ins>+ # Constructor object getter.
+ if (@{$interface->constants}) {
+ push(@headerContent, " static JSC::JSValue getConstructor(JSC::VM&, JSC::JSGlobalObject*);\n");
+ }
+
</ins><span class="cx"> if ($interface->extendedAttributes->{"CallbackNeedsOperatorEqual"}) {
</span><span class="cx"> push(@headerContent, " virtual bool operator==(const $interfaceName&) const;\n\n")
</span><span class="cx"> }
</span><span class="lines">@@ -3522,6 +3527,7 @@
</span><span class="cx"> my ($object, $interface) = @_;
</span><span class="cx">
</span><span class="cx"> my $interfaceName = $interface->name;
</span><ins>+ my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
</ins><span class="cx"> my $className = "JS$interfaceName";
</span><span class="cx">
</span><span class="cx"> # - Add default header template
</span><span class="lines">@@ -3570,7 +3576,54 @@
</span><span class="cx"> push(@implContent, " return static_cast<const ${className}*>(&other)->m_data->callback() == m_data->callback();\n");
</span><span class="cx"> push(@implContent, "}\n\n");
</span><span class="cx"> }
</span><del>- # Functions
</del><ins>+
+ # Constants.
+ my $numConstants = @{$interface->constants};
+ if ($numConstants > 0) {
+ GenerateConstructorDeclaration(\@implContent, $className, $interface, $interfaceName);
+
+ my $hashSize = 0;
+ my $hashName = $className . "ConstructorTable";
+
+ my @hashKeys = ();
+ my @hashValue1 = ();
+ my @hashValue2 = ();
+ my @hashSpecials = ();
+ my %conditionals = ();
+
+ foreach my $constant (@{$interface->constants}) {
+ my $name = $constant->name;
+ push(@hashKeys, $name);
+ push(@hashValue1, $constant->value);
+ push(@hashValue2, "0");
+ push(@hashSpecials, "DontDelete | ReadOnly | ConstantInteger");
+
+ my $implementedBy = $constant->extendedAttributes->{"ImplementedBy"};
+ if ($implementedBy) {
+ $implIncludes{"${implementedBy}.h"} = 1;
+ }
+ my $conditional = $constant->extendedAttributes->{"Conditional"};
+ if ($conditional) {
+ $conditionals{$name} = $conditional;
+ }
+
+ $hashSize++;
+ }
+ $object->GenerateHashTable($hashName, $hashSize,
+ \@hashKeys, \@hashSpecials,
+ \@hashValue1, \@hashValue2,
+ \%conditionals, 1) if $hashSize > 0;
+
+ push(@implContent, $codeGenerator->GenerateCompileTimeCheckForEnumsIfNeeded($interface));
+
+ GenerateConstructorDefinitions(\@implContent, $className, "", $interfaceName, $visibleInterfaceName, $interface);
+
+ push(@implContent, "JSValue ${className}::getConstructor(VM& vm, JSGlobalObject* globalObject)\n{\n");
+ push(@implContent, " return getDOMConstructor<${className}Constructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));\n");
+ push(@implContent, "}\n\n");
+ }
+
+ # Functions.
</ins><span class="cx"> my $numFunctions = @{$interface->functions};
</span><span class="cx"> if ($numFunctions > 0) {
</span><span class="cx"> push(@implContent, "\n// Functions\n");
</span><span class="lines">@@ -4779,20 +4832,25 @@
</span><span class="cx">
</span><span class="cx"> push(@$outputArray, "void ${constructorClassName}::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)\n");
</span><span class="cx"> push(@$outputArray, "{\n");
</span><del>- if (IsDOMGlobalObject($interface)) {
- push(@$outputArray, " Base::finishCreation(vm);\n");
- push(@$outputArray, " ASSERT(inherits(info()));\n");
- push(@$outputArray, " putDirect(vm, vm.propertyNames->prototype, globalObject->prototype(), DontDelete | ReadOnly | DontEnum);\n");
- } elsif ($generatingNamedConstructor) {
</del><ins>+
+ if ($generatingNamedConstructor) {
</ins><span class="cx"> push(@$outputArray, " Base::finishCreation(globalObject);\n");
</span><del>- push(@$outputArray, " ASSERT(inherits(info()));\n");
- push(@$outputArray, " putDirect(vm, vm.propertyNames->prototype, ${className}::getPrototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);\n");
</del><span class="cx"> } else {
</span><span class="cx"> push(@$outputArray, " Base::finishCreation(vm);\n");
</span><del>- push(@$outputArray, " ASSERT(inherits(info()));\n");
- push(@$outputArray, " putDirect(vm, vm.propertyNames->prototype, ${className}::getPrototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);\n");
</del><span class="cx"> }
</span><ins>+ push(@$outputArray, " ASSERT(inherits(info()));\n");
</ins><span class="cx">
</span><ins>+ # There must exist an interface prototype object for every non-callback interface defined, regardless
+ # of whether the interface was declared with the [NoInterfaceObject] extended attribute.
+ # https://heycam.github.io/webidl/#interface-prototype-object
+ if (IsDOMGlobalObject($interface)) {
+ push(@$outputArray, " putDirect(vm, vm.propertyNames->prototype, globalObject->prototype(), DontDelete | ReadOnly | DontEnum);\n");
+ } elsif ($interface->isCallback) {
+ push(@$outputArray, " UNUSED_PARAM(globalObject);\n");
+ } else {
+ push(@$outputArray, " putDirect(vm, vm.propertyNames->prototype, ${className}::getPrototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);\n");
+ }
+
</ins><span class="cx"> push(@$outputArray, " putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral(\"$visibleInterfaceName\"))), ReadOnly | DontEnum);\n");
</span><span class="cx">
</span><span class="cx"> if (defined $leastConstructorLength) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptspreprocessidlspl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -95,10 +95,15 @@
</span><span class="cx"> $supplementalDependencies{$implementedIdlFile} = [$interfaceName];
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- # Handle [NoInterfaceObject].
- unless (isCallbackInterfaceFromIDL($idlFileContents)) {
- my $extendedAttributes = getInterfaceExtendedAttributesFromIDL($idlFileContents);
- unless ($extendedAttributes->{"NoInterfaceObject"}) {
</del><ins>+
+ # For every interface that is exposed in a given ECMAScript global environment and:
+ # - is a callback interface that has constants declared on it, or
+ # - is a non-callback interface that is not declared with the [NoInterfaceObject] extended attribute, a corresponding
+ # property must exist on the ECMAScript environment's global object.
+ # See https://heycam.github.io/webidl/#es-interfaces
+ my $extendedAttributes = getInterfaceExtendedAttributesFromIDL($idlFileContents);
+ unless ($extendedAttributes->{"NoInterfaceObject"}) {
+ if (!isCallbackInterfaceFromIDL($idlFileContents) || interfaceHasConstantAttribute($idlFileContents)) {
</ins><span class="cx"> my @globalContexts = split("&", $extendedAttributes->{"GlobalContext"} || "DOMWindow");
</span><span class="cx"> my $attributeCode = GenerateConstructorAttribute($interfaceName, $extendedAttributes);
</span><span class="cx"> $windowConstructorsCode .= $attributeCode if grep(/^DOMWindow$/, @globalContexts);
</span><span class="lines">@@ -277,7 +282,7 @@
</span><span class="cx">
</span><span class="cx"> my $extendedAttributes = {};
</span><span class="cx">
</span><del>- if ($fileContents =~ /\[(.*)\]\s+(interface|exception)\s+(\w+)/gs) {
</del><ins>+ if ($fileContents =~ /\[(.*)\]\s+(callback interface|interface|exception)\s+(\w+)/gs) {
</ins><span class="cx"> my @parts = split(',', $1);
</span><span class="cx"> foreach my $part (@parts) {
</span><span class="cx"> my @keyValue = split('=', $part);
</span><span class="lines">@@ -291,3 +296,10 @@
</span><span class="cx">
</span><span class="cx"> return $extendedAttributes;
</span><span class="cx"> }
</span><ins>+
+sub interfaceHasConstantAttribute
+{
+ my $fileContents = shift;
+
+ return $fileContents =~ /\s+const[\s\w]+=\s+[\w]+;/gs;
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestCallbackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -36,6 +36,16 @@
</span><span class="cx"> #define WEBKIT_DOM_IS_TEST_CALLBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_DOM_TYPE_TEST_CALLBACK))
</span><span class="cx"> #define WEBKIT_DOM_TEST_CALLBACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_DOM_TYPE_TEST_CALLBACK, WebKitDOMTestCallbackClass))
</span><span class="cx">
</span><ins>+/**
+ * WEBKIT_DOM_TEST_CALLBACK_CONSTANT1:
+ */
+#define WEBKIT_DOM_TEST_CALLBACK_CONSTANT1 1
+
+/**
+ * WEBKIT_DOM_TEST_CALLBACK_CONSTANT2:
+ */
+#define WEBKIT_DOM_TEST_CALLBACK_CONSTANT2 2
+
</ins><span class="cx"> struct _WebKitDOMTestCallback {
</span><span class="cx"> WebKitDOMObject parent_instance;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -59,7 +59,62 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+class JSTestCallbackConstructor : public DOMConstructorObject {
+private:
+ JSTestCallbackConstructor(JSC::Structure*, JSDOMGlobalObject*);
+ void finishCreation(JSC::VM&, JSDOMGlobalObject*);
</ins><span class="cx">
</span><ins>+public:
+ typedef DOMConstructorObject Base;
+ static JSTestCallbackConstructor* create(JSC::VM& vm, JSC::Structure* structure, JSDOMGlobalObject* globalObject)
+ {
+ JSTestCallbackConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestCallbackConstructor>(vm.heap)) JSTestCallbackConstructor(structure, globalObject);
+ ptr->finishCreation(vm, globalObject);
+ return ptr;
+ }
+
+ DECLARE_INFO;
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+};
+
+/* Hash table for constructor */
+
+static const HashTableValue JSTestCallbackConstructorTableValues[] =
+{
+ { "CONSTANT1", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, (intptr_t)(1), (intptr_t) (0) },
+ { "CONSTANT2", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, (intptr_t)(2), (intptr_t) (0) },
+};
+
+
+COMPILE_ASSERT(1 == TestCallback::CONSTANT1, TestCallbackEnumCONSTANT1IsWrongUseDoNotCheckConstants);
+COMPILE_ASSERT(2 == TestCallback::CONSTANT2, TestCallbackEnumCONSTANT2IsWrongUseDoNotCheckConstants);
+
+const ClassInfo JSTestCallbackConstructor::s_info = { "TestCallbackConstructor", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestCallbackConstructor) };
+
+JSTestCallbackConstructor::JSTestCallbackConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
+ : DOMConstructorObject(structure, globalObject)
+{
+}
+
+void JSTestCallbackConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+ UNUSED_PARAM(globalObject);
+ putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestCallback"))), ReadOnly | DontEnum);
+ putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+ reifyStaticProperties(vm, JSTestCallbackConstructorTableValues, *this);
+}
+
+JSValue JSTestCallback::getConstructor(VM& vm, JSGlobalObject* globalObject)
+{
+ return getDOMConstructor<JSTestCallbackConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
+}
+
+
</ins><span class="cx"> // Functions
</span><span class="cx">
</span><span class="cx"> bool JSTestCallback::callbackWithNoParam()
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
</span><span class="cx">
</span><span class="cx"> virtual ~JSTestCallback();
</span><ins>+ static JSC::JSValue getConstructor(JSC::VM&, JSC::JSGlobalObject*);
</ins><span class="cx">
</span><span class="cx"> // Functions
</span><span class="cx"> virtual bool callbackWithNoParam();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestCallbackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -33,6 +33,11 @@
</span><span class="cx"> @class DOMTestNode;
</span><span class="cx"> @class NSString;
</span><span class="cx">
</span><ins>+enum {
+ DOM_CONSTANT1 = 1,
+ DOM_CONSTANT2 = 2
+} WEBKIT_ENUM_AVAILABLE_MAC(9876_5);
+
</ins><span class="cx"> WEBKIT_CLASS_AVAILABLE_MAC(9876_5)
</span><span class="cx"> WEBCORE_EXPORT @interface DOMTestCallback : DOMObject
</span><span class="cx"> - (BOOL)callbackWithNoParam;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestCallbackidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl (189062 => 189063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl        2015-08-27 22:33:40 UTC (rev 189062)
+++ trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl        2015-08-27 22:35:46 UTC (rev 189063)
</span><span class="lines">@@ -31,6 +31,11 @@
</span><span class="cx"> [
</span><span class="cx"> Conditional=SPEECH_SYNTHESIS,
</span><span class="cx"> ] callback interface TestCallback {
</span><ins>+ // Constants
+ const unsigned short CONSTANT1 = 1;
+ const unsigned short CONSTANT2 = 2;
+
+ // Operations.
</ins><span class="cx"> boolean callbackWithNoParam();
</span><span class="cx"> boolean callbackWithArrayParam(Float32Array arrayParam);
</span><span class="cx"> boolean callbackWithSerializedScriptValueParam(SerializedScriptValue srzParam, DOMString strArg);
</span></span></pre>
</div>
</div>
</body>
</html>