Changes between Version 132 and Version 133 of WebKitIDL


Ignore:
Timestamp:
Aug 7, 2015 5:01:49 AM (9 years ago)
Author:
calvaris@igalia.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WebKitIDL

    v132 v133  
    1313 - [#Clamp Clamp(a,p)][[br]]
    1414 - [#Custom Custom(m,a), CustomGetter(a), CustomSetter(a)][[br]]
     15 - [#CustomBinding CustomBinding][[br]]
    1516 - [#CallWith CallWith(m,a)][[br]]
    1617 - [#StrictTypeChecking StrictTypeChecking(m,a,p)][[br]]
     
    402403Note: ObjC, GObject and CPP bindings do not support custom bindings.
    403404
     405== `[CustomBinding]` == #CustomBinding
     406
     407Summary: They allow you to write bindings code even more manually than `[Custom]`.
     408
     409Usage: `[CustomBinding]` can be specified only on methods:
     410{{{
     411    [CustomBinding] void myMethod();
     412}}}
     413
     414We should minimize the number of custom bindings as much as possible, since they are likely to be buggy.
     415Before using `[CustomBinding]`, you should doubly consider if you really need custom bindings.
     416You are recommended to modify code generators to avoid using `[CustomBinding]`.
     417
     418Before explaining the details, let us clarify the relationship of these IDL attributes.
     419
     420 * `[CustomBinding]` on a method indicates that you can write JavaScriptCore custom bindings for the method at a higher level than `[Custom]`.
     421
     422You can write custom bindings with JavaScriptCore for a method as follows:
     423
     424{{{
     425    interface XXX {
     426        [CustomBinding] void myMethod(int a, int b);
     427    };
     428}}}
     429You can write custom bindings in WebCore/bindings/js/JSXXXCustom.cpp:
     430{{{
     431    EncodedJSValue JSC_HOST_CALL jsXXXPrototypeFunctionMyMethod(ExecState*)
     432    {
     433        // Read parameters manually if any.
     434        // Get the called object from the ExecState if needed and wanted.
     435        // Call the object and implementation if needed and wanted.
     436        // Return a value.
     437        return JSValue::encode(...);
     438    }
     439}}}
     440Refer to WebCore/bindings/js/JSXXXCustom.cpp for more details.
     441
     442The main difference between `[Custom]` and `[CustomBinding]` is that `[Custom]` generates a `jsXXXPrototypeFunctionMyMethod` where it performs the parameters management, casting to the object and calls the `JSXXX::myMethod` with the parameters and the instance. With `[CustomBinding]`, the implementation of `jsXXXPrototypeFunctionMyMethod` is not done automatically and it is up to the developer to do all the parameter, casting and call operations.
     443
     444Note: ObjC, GObject and CPP bindings do not support `[CustomBinding]` bindings.
     445
    404446== `[CallWith]`(m,a) == #CallWith
    405447