API SecureHandlerWrapScript

Wraps a widget script with code snippets that execute in the RestrictedEnvironment. SecureHandlerWrapScript(frame, script, header, preBody [, postBody]) SecureHandlerBaseTemplate:WrapScript(header, script, preBody [, postBody])

Arguments

 * frame : - A protected frame whose widget script will be wrapped.
 * script : - Eligible widget script handlers defined in   (see below).
 * header : - A protected frame whose secure handle will be passed to the code snippet as 'self'.
 * preBody : - A code snippet limited to the RestrictedEnvironment, to fire before the frame's normal widget script.  Behaves like the body of a function, with predetermined arguments and return values.
 * postBody : - A second code snippet to fire afterwards, but only if preBody returns arguments to trigger it.

Details

 * Each kind of preBody code snippet may also return values which change how execution proceeds, potentially halting or modifying the wrapped widget script.
 * The 'message' return value also determines if postBody will fire, and is passed to postBody as an argument.
 * Note the arguments are in a different order when using SecureHandlerWrapScript on any protected frame, or the WrapScript method on the SecureHandlers.

Eligible Handlers
allow, message = preBody(self) postBody(self, message)
 * allow : - Halts subsequent execution unless
 * message : any type - If non-nil, triggers postBody and passed as 'message' (unless execution was halted).

newbutton, message = preBody(self, button, down) postBody(self, message, button, down)
 * newbutton : - If non-nil, changes 'button' in subsequent execution.
 * message : any type - If non-nil, triggers postBody and passed as 'message'.

... = preBody(self, button, down) postBody(self, message, button)
 * retVal1 : - If non-nil, the first argument may either be "clear" (clears the cursor), "message" (triggers postBody) or any other string to replace 'kind' in subsequent execution.
 * retVal2 : - If retVal1 was "clear" then retVal2 may be "message" or a replacement of 'kind' in subsequent execution.  If retVal1 was "message" then retVal2 is passed as 'message' to postBody.
 * ... : Other return values used in the override of subsequent execution, if applicable.