| 841 | | === * [CheckDomainSecurity](i), [DoNotCheckDomainSecurity](m,a), [DoNotCheckDomainSecurityOnGetter](a), [DoNotCheckDomainSecurityOnSetter](a) === |
| 842 | | |
| 843 | | === * [IndexedGetter](i), [CustomIndexedGetter](i) === |
| 844 | | |
| 845 | | === * [NamedGetter](i), [CustomNamedGetter](i), [CustomNamedSetter](i) === |
| 846 | | |
| 847 | | === * [EventTarget](i) === |
| | 842 | === * [CheckAccessToFrame](i), [DoNotCheckAccessToFrame](m,a), [DoNotCheckAccessToFrameOnGetter](a), [DoNotCheckAccessToFrameOnSetter](a) === |
| | 843 | |
| | 844 | Summary: It checks if a given Frame access is allowed or not, in terms of security. |
| | 845 | |
| | 846 | Usage: [CheckAccessToFrame] can be specified on interfaces. |
| | 847 | [DoNotCheckAccessToFrame] can be specified on methods or attributes which belong to interfaces which have [CheckAccessToFrame]. |
| | 848 | [DoNotCheckAccessToFrameOnGetter] and [DoNotCheckAccessToFrameOnSetter] can be specified on attributes |
| | 849 | which belong to interfaces which have [CheckAccessToFrame]: |
| | 850 | {{{ |
| | 851 | interface [ |
| | 852 | CheckAccessToFrame |
| | 853 | ] DOMWindow { |
| | 854 | attribute DOMString str1; |
| | 855 | attribute [DoNotCheckAccessToFrame] DOMString str2: |
| | 856 | attribute [DoNotCheckAccessToFrameOnGetter] DOMString str3: |
| | 857 | attribute [DoNotCheckAccessToFrameOnSetter] DOMString str4: |
| | 858 | void func1(); |
| | 859 | [DoNotCheckAccessToFrame] void func2(); |
| | 860 | } |
| | 861 | }}} |
| | 862 | |
| | 863 | Consider the case where you access window.parent from inside iframe which comes from a different origin. |
| | 864 | While it is allowed to access window.parent, it is not allowed to access window.parent.document. |
| | 865 | In such cases, you need to specify [CheckAccessToFrame] in order to check |
| | 866 | whether a given Frame is allowed to access the attribute or method. |
| | 867 | This is really important for security. |
| | 868 | |
| | 869 | If you specify [CheckAccessToFrame] on an interface, the security check is enabled on all the attributes and methods in the interface. |
| | 870 | To disable the security check for some attribute or method, you can use |
| | 871 | [DoNotCheckAccessToFrame], [DoNotCheckAccessToFrameOnGetter] or [DoNotCheckAccessToFrameOnSetter]. |
| | 872 | |
| | 873 | * [DoNotCheckAccessToFrame] on a method disables the security check for the method. |
| | 874 | * [DoNotCheckAccessToFrame] on an attribute disables the security check for a getter and setter of the attribute. |
| | 875 | * [DoNotCheckAccessToFrameOnGetter] on an attribute disables the security check for a getter of the attribute. |
| | 876 | * [DoNotCheckAccessToFrameOnSetter] on an attribute disables the security check for a setter of the attribute. |
| | 877 | * [DoNotCheckAccessToFrame] on an attribute is equivalent to [DoNotCheckAccessToFrameOnGetter, DoNotCheckAccessToFrameOnSetter]. |
| | 878 | |
| | 879 | === * [IndexedGetter](i) === |
| | 880 | |
| | 881 | * [http://dev.w3.org/2006/webapi/WebIDL/#idl-indexed-properties The spec of indexed properties] (Note: The WebKit IDL explained below behaves differently from the spec) |
| | 882 | |
| | 883 | Summary: [IndexedGetter] means that a given interface should have a getter of indexed properties. |
| | 884 | |
| | 885 | Usage: [IndexedGetter] can be specified on interfaces: |
| | 886 | {{{ |
| | 887 | interface [ |
| | 888 | IndexedGetter |
| | 889 | ] XXX { |
| | 890 | } |
| | 891 | }}} |
| | 892 | |
| | 893 | Indexed getters define the behavior when XXX[i] is evaluated. |
| | 894 | The bindings code is generated automatically so that XXX[i] behaves equivalent to XXX.item(i). |
| | 895 | |
| | 896 | === * [CustomIndexedSetter](i) === |
| | 897 | |
| | 898 | * [http://dev.w3.org/2006/webapi/WebIDL/#idl-indexed-properties The spec of indexed properties] (Note: The WebKit IDL explained below behaves differently from the spec) |
| | 899 | |
| | 900 | Summary: [CustomIndexedSetter] allows us to write custom bindings for a setter of indexed properties. |
| | 901 | |
| | 902 | Usage: [CustomIndexedSetter] can be specified on interfaces: |
| | 903 | {{{ |
| | 904 | interface [ |
| | 905 | CustomIndexedSetter |
| | 906 | ] XXX { |
| | 907 | } |
| | 908 | }}} |
| | 909 | |
| | 910 | Indexed setters define the behavior when "XXX[i] = ..." is evaluated. |
| | 911 | [CustomIndexedSetter] allows us to write the custom bindings. |
| | 912 | |
| | 913 | * In JavaScriptCore, you can write JSXXX::indexSetter(...) in WebCore/bindings/js/JSXXXCustom.cpp: |
| | 914 | {{{ |
| | 915 | void JSXXX::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValue value) |
| | 916 | { |
| | 917 | ...; |
| | 918 | } |
| | 919 | }}} |
| | 920 | * In V8, you can write V8XXX::indexedPropertyGetter(...) in WebCore/bindings/v8/custom/V8XXXCustom.cpp: |
| | 921 | {{{ |
| | 922 | v8::Handle<v8::Value> V8XXX::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) |
| | 923 | { |
| | 924 | ...; |
| | 925 | } |
| | 926 | }}} |
| | 927 | |
| | 928 | === * [NamedGetter](i) === |
| | 929 | |
| | 930 | * [http://dev.w3.org/2006/webapi/WebIDL/#idl-named-properties The spec of named properties] (Note: The WebKit IDL explained below behaves differently from the spec) |
| | 931 | |
| | 932 | Summary: [NamedGetter] means that a given interface should have a getter of named properties. |
| | 933 | |
| | 934 | Usage: [NamedGetter] can be specified on interfaces: |
| | 935 | {{{ |
| | 936 | interface [ |
| | 937 | NamedGetter |
| | 938 | ] XXX { |
| | 939 | } |
| | 940 | }}} |
| | 941 | |
| | 942 | Named getters define the behavior when XXX.foooooooo is evaluated, where foooooooo is not an attribute of a given interface. |
| | 943 | The bindings code is generated automatically so that XXX.foooooooo behaves equivalent to XXX.namedItem(i). |
| | 944 | |
| | 945 | === [CustomNamedGetter](i), [CustomNamedSetter](i) === |
| | 946 | |
| | 947 | * [http://dev.w3.org/2006/webapi/WebIDL/#idl-named-properties The spec of named properties] (Note: The WebKit IDL explained below behaves differently from the spec) |
| | 948 | |
| | 949 | Summary: [CustomNamedGetter]/[CustomNamedSetter] allows us to write custom bindings for a getter/setter of named properties. |
| | 950 | |
| | 951 | Usage: They can be specified on interfaces: |
| | 952 | {{{ |
| | 953 | interface [ |
| | 954 | CustomNamedGetter, |
| | 955 | CustomNamedSetter |
| | 956 | ] XXX { |
| | 957 | } |
| | 958 | }}} |
| | 959 | |
| | 960 | Named getters define the behavior when XXX.foooooooo is evaluated, where foooooooo is not an attribute of a given interface. |
| | 961 | Named setters define the behavior when "XXX.foooooooo = ..." is evaluated. |
| | 962 | [CustomNamedGetter] and [CustomNamedSetter] allow us to write the custom bindings. |
| | 963 | |
| | 964 | * With [CustomNamedGetter] in JavaScriptCore, you can write JSXXX::canGetItemsForName(...) and JSXXX::nameGetter(...) in WebCore/bindings/js/JSXXXCustom.cpp: |
| | 965 | {{{ |
| | 966 | bool JSXXX::canGetItemsForName(ExecState*, XXX* impl, const Identifier& propertyName) |
| | 967 | { |
| | 968 | ...; |
| | 969 | } |
| | 970 | |
| | 971 | JSValue JSXXX::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName) |
| | 972 | { |
| | 973 | ...; |
| | 974 | } |
| | 975 | }}} |
| | 976 | * With [CustomNamedGetter] in V8, you can write V8XXX::namedPropertyGetter(...) in WebCore/bindings/v8/custom/V8XXXCustom.cpp: |
| | 977 | {{{ |
| | 978 | v8::Handle<v8::Value> V8XXX::namedPropertyGetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&) |
| | 979 | { |
| | 980 | ...; |
| | 981 | } |
| | 982 | }}} |
| | 983 | * With [CustomNamedSetter] in JavaScriptCore, you can write JSXXX::putDelegate(...) in WebCore/bindings/js/JSXXXCustom.cpp: |
| | 984 | {{{ |
| | 985 | bool JSXXX::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&) |
| | 986 | { |
| | 987 | ...; |
| | 988 | } |
| | 989 | }}} |
| | 990 | * With [CustomNamedSetter] in V8, you can write V8XXX::namedPropertySetter(...) in WebCore/bindings/v8/custom/V8XXXCustom.cpp: |
| | 991 | {{{ |
| | 992 | v8::Handle<v8::Value> V8XXX::namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&) |
| | 993 | { |
| | 994 | ...; |
| | 995 | } |
| | 996 | }}} |
| | 997 | |
| | 998 | === * [EventTarget](i) FIXME === |
| | 999 | |
| | 1000 | Summary: ADD SUMMARY |
| | 1001 | |
| | 1002 | Usage: [EventTarget] can be specified on interfaces. |
| | 1003 | {{{ |
| | 1004 | interface [ |
| | 1005 | EventTarget |
| | 1006 | ] XXX { |
| | 1007 | } |
| | 1008 | }}} |
| | 1009 | |
| | 1010 | ADD EXPLANATIONS |
| 851 | | === * [ActiveDOMObject](i), [V8DependentLifeTime](i) === |
| | 1014 | Summary: [DoNotCheckConstants] stops inserting compile-time assertions for constants of a given interface. |
| | 1015 | |
| | 1016 | Usage: [DoNotCheckConstants] can be specified on interfaces: |
| | 1017 | {{{ |
| | 1018 | interface [ |
| | 1019 | DoNotCheckConstants |
| | 1020 | ] XXX { |
| | 1021 | const unsigned short NOT_FOUND_ERR = 123; |
| | 1022 | const unsigned short SYNTAX_ERR = 124; |
| | 1023 | } |
| | 1024 | }}} |
| | 1025 | |
| | 1026 | Without [DoNotCheckConstants], compile-time assertions are generated to check if the constant values defined in IDL files |
| | 1027 | are equal to the constant values in WebKit implementation. |
| | 1028 | In the above example, if NOT_FOUND_ERR were 100 in WebKit implementation, the build will fail. |
| | 1029 | Basically values of all constants are defined in the spec, |
| | 1030 | and thus the values defined in IDL files and the values in WebKit implementations should be equal to the values defined in the spec. |
| | 1031 | |
| | 1032 | If you want to introduce non-speced constant values and allow different values between IDL files and WebKit implementation, |
| | 1033 | you can specify [DoNotCheckConstants] on the interface to skip the compile-time assertions. |
| | 1034 | |
| | 1035 | === * [ActiveDOMObject](i) === |
| | 1036 | |
| | 1037 | Summary: [ActiveDOMObject] indicates that a DOM object should be kept alive when the DOM object has pending activities. |
| | 1038 | |
| | 1039 | Usage: [ActiveDOMObject] can be specified on interfaces: |
| | 1040 | {{{ |
| | 1041 | interface [ |
| | 1042 | ActiveDOMObject |
| | 1043 | ] XMLHttpRequest { |
| | 1044 | } |
| | 1045 | }}} |
| | 1046 | |
| | 1047 | If a given DOM object needs to be kept alive as long as the DOM object has pending activities, you need to specify [ActiveDOMObject]. |
| | 1048 | For example, [ActiveDOMObject] can be used when the DOM object is expecting events to be raised. |
| | 1049 | |
| | 1050 | If an interface X has [ActiveDOMObject] and an interface Y inherits the interface X, |
| | 1051 | then the interface Y should also have [ActiveDOMObject]. |
| | 1052 | |
| | 1053 | === * [V8DependentLifeTime](i) FIXME === |
| | 1054 | |
| | 1055 | Summary: ADD SUMMARY |
| | 1056 | |
| | 1057 | Usage: [V8DependentLifeTime] can be specified on interfaces. |
| | 1058 | {{{ |
| | 1059 | interface [ |
| | 1060 | V8DependentLifeTime |
| | 1061 | ] XXX { |
| | 1062 | } |
| | 1063 | }}} |
| | 1064 | |
| | 1065 | ADD EXPLANATIONS |
| | 1068 | |
| | 1069 | Summary: [CustomEnumerateProperty] allows us to write custom bindings for the case where properties of a given interface are enumerated. |
| | 1070 | [CustomDeleteProperty] allows us to write custom bindings for the case where a property of a given interface is deleted. |
| | 1071 | |
| | 1072 | Usage: They can be specified on interfaces: |
| | 1073 | {{{ |
| | 1074 | interface [ |
| | 1075 | CustomEnumerateProperty, |
| | 1076 | CustomDeleteProperty |
| | 1077 | ] XXX { |
| | 1078 | } |
| | 1079 | }}} |
| | 1080 | |
| | 1081 | With [CustomEnumerateProperty], you can write custom bindings when properties of XXX are enumerated. |
| | 1082 | Specifically, you can write JSXXX::getOwnPropertyNames(...) in WebCore/bindings/js/JSXXXCustom.cpp: |
| | 1083 | {{{ |
| | 1084 | void JSXXX::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) |
| | 1085 | { |
| | 1086 | ...; |
| | 1087 | } |
| | 1088 | }}} |
| | 1089 | and V8XXX::namedPropertyQuery(...) and V8XXX::namedPropertyEnumerator(...) in WebCore/bindings/v8/custom/V8XXXCustom.cpp: |
| | 1090 | {{{ |
| | 1091 | v8::Handle<v8::Integer> V8XXX::namedPropertyQuery(v8::Local<v8::String> name, const v8::AccessorInfo& info) |
| | 1092 | { |
| | 1093 | ...; |
| | 1094 | } |
| | 1095 | |
| | 1096 | v8::Handle<v8::Array> V8XXX::namedPropertyEnumerator(const v8::AccessorInfo& info) |
| | 1097 | { |
| | 1098 | ...; |
| | 1099 | } |
| | 1100 | }}} |
| | 1101 | |
| | 1102 | With [CustomDeleteProperty], you can write custom bindings for the case where a property of XXX is deleted. |
| | 1103 | Specifically, you can write JSXXX::deleteProperty(...) in WebCore/bindings/js/JSXXXCustom.cpp: |
| | 1104 | {{{ |
| | 1105 | bool JSXXX::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) |
| | 1106 | { |
| | 1107 | ...; |
| | 1108 | } |
| | 1109 | }}} |
| | 1110 | and V8XXX::namedPropertyDeleter(...) in WebCore/bindings/v8/custom/V8XXXCustom.cpp: |
| | 1111 | {{{ |
| | 1112 | v8::Handle<v8::Boolean> V8XXX::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info) |
| | 1113 | { |
| | 1114 | ...; |
| | 1115 | } |
| | 1116 | }}} |