SecureHandlerWrapScript()
Jump to navigation
Jump to search
- This function is implemented in
FrameXML/SecureHandlers.lua
.
- This function is implemented in
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
- Frame - A protected frame whose widget script will be wrapped.
- script
- string - Eligible widget script handlers defined in
LOCAL_Wrap_Handlers
(see below). - header
- Frame - A protected frame whose secure handle will be passed to the code snippet as 'self'.
- preBody
- string - 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
- string? - 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
- boolean? - Halts subsequent execution unless
allow ~= false
- 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
- string? - 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
- string? - 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
- string? - 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.
Patch changes
- Patch 3.0.2 (2008-10-14): Added.
External links
- GitHub FrameXML, Gethe
- Globe "wut?" Tool, Townlong-Yak
- Iriel's Field Guide to Secure Handlers 4.0 revision 1