createSafeFunction method

Returns a function wrapping the passed-in function.

Note These APIs can only be used with F12 developer tools and the Diagnostics Script Engine, and can't be called from JavaScript.


var retVal = DiagnosticsBrowser.createSafeFunction(object, func);


  • object [in]
    Type: any

    Object to create the function's object model.

  • func [in]
    Type: Function

    Function with which to create a safe function.


The function that is created has a prototype in the same object model as the first parameter, and thus cannot be used to get back into the Diagnostics Object Model. This means that it can't be called using function.prototype.constructor(…) to create a new function in the Diagnostics Object Model. It would instead be created in the target object’s object model.

See also