jsbattig / delphi-javascript

Automatically exported from code.google.com/p/delphi-javascript
3 stars 3 forks source link

New functions declarations for wrapper #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Part 1.

Added in file “js15decl.pas”:

procedure JS_SetOperationCallback (cx : PJSContext; funcTransition : pointer); 
cdecl; external libName;

function JS_GetOperationCallback (cx : PJSContext) : pointer; cdecl; external 
libName;

procedure JS_TriggerOperationCallback (cx : PJSContext); cdecl; external 
libName;

Purpose of these functions:
"To enforce application limits on the amount of time a script may run. (In this 
case, the callback may terminate the script by returning “JS_FALSE”.)"
https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_SetOper
ationCallback

Part 2.

Added in file “js15decl.pas”:

JSFunctionCallback = procedure (const proc : JSFunction; const scr : JSScript; 
const cx : PJSContext; entering : integer); cdecl;

procedure JS_SetFunctionCallback (cx : PJSContext; proc : JSFunctionCallback); 
cdecl; external libName;

function JS_GetFunctionCallback (cx : PJSContext) : pointer; cdecl; external 
libName;

Purpose of this function:
"Sets a callback to be run whenever a JavaScript function is invoked or exited. 
This lets you trace the execution of code, and is particularly useful for 
JavaScript tracers and profilers since it works across all run modes 
(interpreter, method JIT, trace JIT). Using this function may have a 
significant performance impact. See Function tracing for an example."

https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_SetFunc
tionCallback

Original issue reported on code.google.com by andre...@diatomenterprises.com on 19 Dec 2013 at 10:09

GoogleCodeExporter commented 8 years ago
NOTE about "procedure JS_SetFunctionCallback" and "function 
JS_GetFunctionCallback" -- these function available only in DEBUG edition of 
SpiderMonkey JavaScript engine.

Original comment by andre...@diatomenterprises.com on 19 Dec 2013 at 10:13