Changes between Version 132 and Version 133 of WebKitIDL

Aug 7, 2015 5:01:49 AM (7 years ago)



  • 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.
     405== `[CustomBinding]` == #CustomBinding
     407Summary: They allow you to write bindings code even more manually than `[Custom]`.
     409Usage: `[CustomBinding]` can be specified only on methods:
     411    [CustomBinding] void myMethod();
     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]`.
     418Before explaining the details, let us clarify the relationship of these IDL attributes.
     420 * `[CustomBinding]` on a method indicates that you can write JavaScriptCore custom bindings for the method at a higher level than `[Custom]`.
     422You can write custom bindings with JavaScriptCore for a method as follows:
     425    interface XXX {
     426        [CustomBinding] void myMethod(int a, int b);
     427    };
     429You can write custom bindings in WebCore/bindings/js/JSXXXCustom.cpp:
     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    }
     440Refer to WebCore/bindings/js/JSXXXCustom.cpp for more details.
     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.
     444Note: ObjC, GObject and CPP bindings do not support `[CustomBinding]` bindings.
    404446== `[CallWith]`(m,a) == #CallWith