| 27 | - [#StrictTypeChecking StrictTypeChecking(m,a)] |
| 28 | |
| 29 | - [#ReturnNewObject ReturnNewObject(m,a)] |
| 30 | |
| 31 | - [#ImplementedAs ImplementedAs(m)] |
| 32 | |
| 33 | - [#Reflect Reflect(a)] |
| 34 | |
| 35 | - [#Replaceable Replaceable(a)] |
| 36 | |
| 37 | - [#Deletable Deletable(a), NotEnumerable(a), V8ReadOnly(a)] |
| 38 | |
| 39 | - [#CachedAttribute CachedAttribute(a)] |
| 40 | |
| 41 | - [#V8Unforgeable V8Unforgeable(m,a), V8OnProto(m,a)] |
| 42 | |
| 43 | - [#URL URL(a)] |
| 44 | |
| 45 | - [#JSWindowEventListener JSWindowEventListener(a)] |
| 46 | |
| 47 | - [#Supplemental Supplemental(i)] |
| 48 | |
| 49 | - [#Constructor Constructor(i), CallWith(i,m,a), ConstructorRaisesException(i)] |
| 50 | |
| 51 | - [#ConstructorTemplate ConstructorTemplate(i), InitializedByEventConstructor(a)] |
| 52 | |
| 53 | - [#NamedConstructor NamedConstructor(i)] |
| 54 | |
| 55 | - [#CustomConstructor CustomConstructor(i), JSCustomConstructor(i), V8CustomConstructor(i), ConstructorParameters(i)] |
| 56 | |
| 57 | - [#Conditional Conditional(i,m,a)] |
| 58 | |
| 59 | - [#V8EnabledAtRuntime V8EnabledAtRuntime(i,m,a)] |
| 60 | |
| 61 | - [#CustomToJSObject CustomToJSObject(i), JSCustomToJSObject(i), V8CustomToJSObject(i)] |
| 62 | |
| 63 | - [#CheckSecurity CheckSecurity(i), DoNotCheckSecurity(m,a), DoNotCheckSecurityOnGetter(a), DoNotCheckSecurityOnSetter(a)] |
| 64 | |
28 | | |
29 | | - [#StrictTypeChecking StrictTypeChecking(m,a)] |
30 | | |
31 | | - [#ReturnNewObject ReturnNewObject(m,a)] |
32 | | |
33 | | - [#ImplementedAs ImplementedAs(m)] |
34 | | |
35 | | - [#Reflect Reflect(a)] |
36 | | |
37 | | - [#Replaceable Replaceable(a)] |
38 | | |
39 | | - [#Deletable Deletable(a), NotEnumerable(a), V8ReadOnly(a)] |
40 | | |
41 | | - [#CachedAttribute CachedAttribute(a)] |
42 | | |
43 | | - [#V8Unforgeable V8Unforgeable(m,a), V8OnProto(m,a)] |
44 | | |
45 | | - [#URL URL(a)] |
46 | | |
47 | | - [#JSWindowEventListener JSWindowEventListener(a)] |
48 | | |
49 | | - [#Supplemental Supplemental(i)] |
50 | | |
51 | | - [#Constructor Constructor(i), CallWith(i,m,a), ConstructorRaisesException(i)] |
52 | | |
53 | | - [#ConstructorTemplate ConstructorTemplate(i), InitializedByEventConstructor(a)] |
54 | | |
55 | | - [#NamedConstructor NamedConstructor(i)] |
56 | | |
57 | | - [#CustomConstructor CustomConstructor(i), JSCustomConstructor(i), V8CustomConstructor(i), ConstructorParameters(i)] |
58 | | |
59 | | - [#Conditional Conditional(i,m,a)] |
60 | | |
61 | | - [#V8EnabledAtRuntime V8EnabledAtRuntime(i,m,a)] |
62 | | |
63 | | - [#CustomToJSObject CustomToJSObject(i), JSCustomToJSObject(i), V8CustomToJSObject(i)] |
64 | | |
65 | | - [#CheckSecurity CheckSecurity(i), DoNotCheckSecurity(m,a), DoNotCheckSecurityOnGetter(a), DoNotCheckSecurityOnSetter(a)] |
309 | | The parameters marked with [Optional=...] are optional, and JavaScript can omit the parameters. Obviously, if parameter X is marked with [Optional=...], then all subsequent parameters of X must be marked with [Optional=...]. The difference between [Optional] and [Optional=DefaultIsUndefined] is whether your WebCore implementation has overloaded methods or not, as explained below. |
| 309 | The parameters marked with [Optional=...] are optional, and JavaScript can omit the parameters. Obviously, if parameter X is marked with [Optional=...], then all subsequent parameters of X should be marked with [Optional=...]. |
| 310 | |
| 311 | The difference between [Optional] and [Optional=DefaultIsUndefined] is whether the WebCore implementation has overloaded methods or not, as explained below. |
313 | | If JavaScript calls func1(100, 200, 300, 400), then HTMLFoo::func1(int a, int b, int c, int d) is called in WebCore. In other words, if your WebCore implementation has overloaded methods, you can use [Optional]. |
314 | | |
315 | | In case of func2(...), if JavaScript calls func2(100, 200), then it behaves as if JavaScript called func2(100, 200, undefined, undefined). |
316 | | Consequently, HTMLFoo::func1(int a, int b, int c, int d) is called in WebCore. |
317 | | 100 is passed to a, 200 is passed to b, 0 is passed to c, and 0 is passed to d. |
| 315 | If JavaScript calls func1(100, 200, 300, 400), then HTMLFoo::func1(int a, int b, int c, int d) is called in WebCore. |
| 316 | In other words, if the WebCore implementation has overloaded methods, you can use [Optional]. |
| 317 | |
| 318 | In case of func2(...), if JavaScript calls func2(100, 200), then it behaves as if JavaScript called func2(100, 200, undefined). |
| 319 | Consequently, HTMLFoo::func2(int a, int b, int c) is called in WebCore. |
| 320 | 100 is passed to a, 200 is passed to b, and 0 is passed to c. |
319 | | In this way, WebCore needs to implement func2(int a, int b, int c, int d) only, and needs not to implement overloaded methods like func2(int a, int b) or func2(int a, int b, int c). |
| 322 | In this way, WebCore needs to just implement func2(int a, int b, int c) and needs not to implement both func2(int a, int b) and func2(int a, int b, int c). |
322 | | While in [Optional=DefalutIsUndefined] the "supplemented" JavaScript undefined is converted to a WebKit string "undefined", in [Optional=DefaultIsNullString] the "supplemented" JavaScript undefined is converted to a WebKit null string. Specifically, if JavaScript calls func3(100, 200), then HTMLFoo::func3(int a, int b, String c, String d) is called in WebCore. Here 100 is passed to a, 200 is passed to b, a WebKit string "undefined" is passed to c, and a WebKit null string is passed to d. |
| 325 | In [Optional=DefalutIsUndefined], the "supplemented" JavaScript undefined is converted to a WebKit string "undefined". |
| 326 | On the other hand, in [Optional=DefaultIsNullString], the "supplemented" JavaScript undefined is converted to a WebKit null string. |
| 327 | For example, if JavaScript calls func3(100, 200), then HTMLFoo::func3(int a, int b, String c, String d) is called in WebCore. |
| 328 | At this point, 100 is passed to a, 200 is passed to b, a WebKit string "undefined" is passed to c, and a WebKit null string is passed to d. |
| 329 | d.IsEmpty() and d.IsNull() return true. |
482 | | [CallWith] can be specified on interfaces but it has a different meaning. Refer to the [Constructor] section for [CallWith] on interfaces. |
483 | | |
484 | | In case of func1(...), HTMLFoo::func1(ScriptExecutionContext* context, int a, int b) is called. |
485 | | Thus, in HTMLFoo::func1(...) you can retrieve document or window through context. |
486 | | |
487 | | In case of func2(...), HTMLFoo::func2(ScriptState* state, int a, int b) is called. |
488 | | |
489 | | In case of func3(...), HTMLFoo::func3(ScriptArguments* arguments, ScriptCallStack* callstack, int a, int b) is called. |
| 489 | |
| 490 | Note: [CallWith] can be also specified on interfaces but it has a different meaning. |
| 491 | Refer to [#Constructor the [Constructor] section] for [CallWith] on interfaces. |
| 492 | |
| 493 | In case of func1(...), HTMLFoo::func1(ScriptExecutionContext* context, int a, int b) is called in WebCore. |
| 494 | Thus, in HTMLFoo::func1(...) you can retrieve document or window from context. |
| 495 | |
| 496 | In case of func2(...), HTMLFoo::func2(ScriptState* state, int a, int b) is called in WebCore. |
| 497 | |
| 498 | In case of func3(...), HTMLFoo::func3(ScriptArguments* arguments, ScriptCallStack* callstack, int a, int b) is called in WebCore. |
493 | | despite the order of [CallWith=X1|X2|X3|...]. Thus, in case of func4(...), |
494 | | HTMLFoo::func3(ScriptArguments* arguments, ScriptCallStack* callstack, int a, int b) is called. |
495 | | |
496 | | == [CheckSecurityForNode](m,a) == #CheckSecurityForNode |
497 | | |
498 | | Summary: It checks if a given Node access is allowed in terms of security. |
499 | | |
500 | | Usage: [CheckSecurityForNode] can be specified on methods and attributes: |
501 | | {{{ |
502 | | attribute [CheckSecurityForNode] Node contentDocument; |
503 | | [CheckSecurityForNode] SVGDocument getSVGDocument(); |
504 | | }}} |
505 | | |
506 | | In terms of security, node.contentDocument should return undefined if the parent frame and the child frame are from different origins. |
507 | | If the security check is needed, you should specify [CheckSecurityForNode]. |
508 | | This is really important for security. |
| 502 | despite the order specified in [CallWith=X1|X2|X3|...]. |
| 503 | For example, in case of func4(...), HTMLFoo::func3(ScriptArguments* arguments, ScriptCallStack* callstack, int a, int b) is called in WebCore. |
535 | | 1. Node::firstChild() is called |
536 | | 1. The result is passed to toJS() or toV8() |
537 | | 1. toJS() or toV8() checks if a wrapper object of the result is already cached on the node |
538 | | 1. If cached, the cached wrapper object is returned |
539 | | 1. Otherwise, toJS() or toV8() creates the wrapper object of the result |
540 | | 1. The created wrapper object is cached on the node |
541 | | 1. The wrapper object is returned |
| 530 | 1. Node::firstChild() is called in WebCore. |
| 531 | 1. The result of Node::firstChild() is passed to toJS() or toV8(). |
| 532 | 1. toJS() or toV8() checks if a wrapper object of the result is already cached on the node. |
| 533 | 1. If cached, the cached wrapper object is returned. That's it. |
| 534 | 1. Otherwise, toJS() or toV8() creates the wrapper object of the result. |
| 535 | 1. The created wrapper object is cached on the node. |
| 536 | 1. The wrapper object is returned. |
556 | | Basically, the WebCore method name should be equal to the IDL method name. |
557 | | That being said, sometimes you cannot use the same method name; e.g. "delete" is a C++ keyword. |
558 | | In such cases, you can explicitly specify the WebCore method name by [ImplementedAs]. |
| 551 | Basically a method name in WebCore should be the same as the method name in an IDL file. |
| 552 | That being said, sometimes you cannot use the same method name; e.g. "delete" is reserved for a C++ keyword. |
| 553 | In such cases, you can explicitly specify the method name in WebCore by [ImplementedAs]. |
| 1091 | |
| 1092 | == [CheckSecurityForNode](m,a) == #CheckSecurityForNode |
| 1093 | |
| 1094 | Summary: It checks if a given Node access is allowed in terms of security. |
| 1095 | |
| 1096 | Usage: [CheckSecurityForNode] can be specified on methods and attributes: |
| 1097 | {{{ |
| 1098 | attribute [CheckSecurityForNode] Node contentDocument; |
| 1099 | [CheckSecurityForNode] SVGDocument getSVGDocument(); |
| 1100 | }}} |
| 1101 | |
| 1102 | In terms of security, node.contentDocument should return undefined if the parent frame and the child frame are from different origins. |
| 1103 | If the security check is needed, you should specify [CheckSecurityForNode]. |
| 1104 | This is really important for security. |