Changes between Version 110 and Version 111 of WebKitIDL
- Timestamp:
- May 8, 2013, 1:48:25 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WebKitIDL
v110 v111 60 60 = Overview = #Overview 61 61 62 The [http://www.w3.org/TR/WebIDL/ Web IDL] is a language that defines how WebCore interfaces are bound to external languages such as JavaScriptCore, V8, ObjC, GObject and CPP. You need to write IDL files (e.g. XMLHttpRequest.idl, Element.idl, etc) to expose WebCore interfaces to those external languages. When WebKit is built, the IDL files are parsed, and the code to bind WebCore implementations and JavaScriptCore, V8, ObjC, GObject and CPP interfaces is automatically generated.62 The [http://www.w3.org/TR/WebIDL/ Web IDL] is a language that defines how WebCore interfaces are bound to external languages such as JavaScriptCore, ObjC, GObject and CPP. You need to write IDL files (e.g. XMLHttpRequest.idl, Element.idl, etc) to expose WebCore interfaces to those external languages. When WebKit is built, the IDL files are parsed, and the code to bind WebCore implementations and JavaScriptCore, ObjC, GObject and CPP interfaces is automatically generated. 63 63 64 64 This document describes practical information about how the IDL bindings work and how you can write IDL files in WebKit. The syntax of IDL files is fairly well documented in the [http://www.w3.org/TR/WebIDL/ Web IDL spec], but it is too formal to read:-) and there are several differences between the Web IDL spec and the WebKit IDL due to implementation issues. … … 148 148 Tools/Scripts/run-bindings-tests tests IDL attributes. 149 149 Specifically, run-bindings-tests reads WebCore/bindings/scripts/test/*.idl, 150 and then generates bindings code to WebCore/bindings/scripts/test/{JS, V8,ObjC,GObject,CPP}/*.150 and then generates bindings code to WebCore/bindings/scripts/test/{JS,ObjC,GObject,CPP}/*. 151 151 For example, run-bindings-tests reads WebCore/bindings/scripts/test/TestObj.idl, 152 152 and then generates bindings code to WebCore/bindings/scripts/test/JS/JSTestObj.h, WebCore/bindings/scripts/test/JS/JSTestObj.cpp, etc. … … 191 191 WebKitBuild/Release/DerivedSources/WebCore/JSXXX.cpp 192 192 }}} 193 * V8:194 195 {{{196 out/Release/obj/gen/webkit/bindings/V8XXX.h197 out/Release/obj/gen/webcore/bindings/V8XXX.cpp198 }}}199 193 * ObjC: 200 194 … … 222 216 * A name should be aligned with the Web IDL spec as much as possible. 223 217 * JavaScriptCore-specific IDL attributes are prefixed by "JS". 224 * V8-specific IDL attributes are prefixed by "V8".225 218 * ObjC-specific IDL attributes are prefixed by "ObjC". 226 219 * GObject-specific IDL attributes are prefixed by "GObject". … … 361 354 * `[Custom]` on a method indicates that you can write JavaScriptCore custom bindings for the method. 362 355 * `[CustomGetter]` or `[CustomSetter]` on an attribute indicates that you can write JavaScriptCore custom bindings for the attribute getter or setter. 363 364 For example, if you want to write custom bindings only for an attribute getter of JavaScriptCore and V8 and an attribute setter of JavaScriptCore, you can specify `[CustomGetter, JSCustomSetter]`.365 356 366 357 You can write custom bindings with JavaScriptCore for a method or an attribute getter/setter, as follows: … … 459 450 ADD EXPLANATIONS 460 451 461 V8 andJSC: `[StrictTypeChecking]` can also be applied to a DOMString parameter in an overloaded method to make the452 JSC: `[StrictTypeChecking]` can also be applied to a DOMString parameter in an overloaded method to make the 462 453 overload resolution only match for ECMAScript types null, undefined, string or object - and not number or boolean. 463 454 This is to permit overloads which are not "distinguishable" in WebIDL, for example: … … 480 471 }}} 481 472 482 Without `[ReturnNewObject]`, JavaScriptCore and V8cache a wrapped object for performance.473 Without `[ReturnNewObject]`, JavaScriptCore cache a wrapped object for performance. 483 474 For example, consider the case where `node.firstChild` is accessed: 484 475 … … 952 943 } 953 944 }}} 954 * In V8: You can write custom `V8XXX::indexedPropertySetter(...)` in WebCore/bindings/v8/custom/V8XXXCustom.cpp:955 956 {{{957 v8::Handle<v8::Value> V8XXX::indexedPropertySetter(uint32_t index, const v8::AccessorInfo& info)958 {959 ...;960 }961 }}}962 945 963 946 == `[NamedGetter]`(i) == #NamedGetter … … 1010 993 } 1011 994 }}} 1012 * `[CustomNamedGetter]` in V8: You can write custom `V8XXX::namedPropertyGetter(...)` in WebCore/bindings/v8/custom/V8XXXCustom.cpp:1013 1014 {{{1015 v8::Handle<v8::Value> V8XXX::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)1016 {1017 ...;1018 }1019 }}}1020 995 * `[CustomNamedSetter]` in JavaScriptCore: You can write custom `JSXXX::putDelegate(...)` in WebCore/bindings/js/JSXXXCustom.cpp: 1021 996 1022 997 {{{ 1023 998 bool JSXXX::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 1024 {1025 ...;1026 }1027 }}}1028 * `[CustomNamedSetter]` in V8: You can write custom `V8XXX::namedPropertySetter(...)` in WebCore/bindings/v8/custom/V8XXXCustom.cpp:1029 1030 {{{1031 v8::Handle<v8::Value> V8XXX::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)1032 999 { 1033 1000 ...; … … 1140 1107 }}} 1141 1108 1142 * `[CustomEnumerateProperty]` in V8: You can write custom bindings as `V8XXX::namedPropertyQuery(...)` and `V8XXX::namedPropertyEnumerator(...)` in WebCore/bindings/v8/custom/V8XXXCustom.cpp:1143 1144 {{{1145 v8::Handle<v8::Integer> V8XXX::namedPropertyQuery(v8::Local<v8::String> name, const v8::AccessorInfo& info)1146 {1147 ...;1148 }1149 1150 v8::Handle<v8::Array> V8XXX::namedPropertyEnumerator(const v8::AccessorInfo& info)1151 {1152 ...;1153 }1154 }}}1155 1156 1109 * `[CustomDeleteProperty]` in JavaScriptCore: You can write custom bindings for the case where a property of XXX is deleted. 1157 1110 Specifically, you can write custom `JSXXX::deleteProperty(...)` in WebCore/bindings/js/JSXXXCustom.cpp: … … 1159 1112 {{{ 1160 1113 bool JSXXX::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) 1161 {1162 ...;1163 }1164 }}}1165 1166 * `[CustomDeleteProperty]` in V8: You can write custom bindings as `V8XXX::namedPropertyDeleter(...)` in WebCore/bindings/v8/custom/V8XXXCustom.cpp:1167 1168 {{{1169 v8::Handle<v8::Boolean> V8XXX::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)1170 1114 { 1171 1115 ...; … … 1256 1200 {{{ 1257 1201 JSC::CallType JSXXX::getCallData(JSC::JSCell* cell, JSC::CallData& callData) 1258 {1259 ...;1260 }1261 }}}1262 * V8: You can write custom `V8XXX::callAsFunctionCallback(...)` in WebCore/bindings/v8/custom/V8XXXCustom.cpp:1263 1264 {{{1265 v8::Handle<v8::Value> V8XXX::callAsFunctionCallback(const v8::Arguments& args)1266 1202 { 1267 1203 ...;