There are quite a few "forgotten" protected functions which don't have any secure template access (and really need it):
- StopAttack()
- TogglePetAutocast()
- PetStopAttack()
- PetAggressiveMode/DefensiveMode/PassiveMode/Follow/Wait()
- CastShapeshiftForm()
And that's only in the action button domain.
Really,
all protected functions should have some sort of secure template access, unless they're very specifically (and carefully) excluded
completely from AddOn use (e.g. TurnOrMoveStart()). Ideally, it should be possible for an author to completely rewrite the default interface without using any Blizzard code other than secure templates. Currently that is not possible (shapeshift bar and pet bar) due to the exclusion of any non-tainted path to the above functions.
Now, some of these (e.g. TogglePetAutocast) you can work around by using a "click" action handler which clicks the (hidden?) original default UI button ... but that's about as elegant as swatting a fly with a Buick and it only works in certain scenarios.
Basically it's an artifact of not converting all the Blizzard UI code (see PetActionBarFrame.lua for example) to use the new security model: the blanket permission for all blizzard code to be trusted means that inevitably lots of these types of functions fall through the cracks. If the trusted files were reduced to Bindings.xml, SecureTemplates.lua, and SecureStateHeader.lua, that would be a preferable model.
Here's an example of how you could modify SecureButton_OnClick() to perform all the functionality listed above:
Code:
elseif ( type == "pet" ) then
local action = SecureButton_GetModifiedAttribute(self, "action", button);
local autocast = SecureButton_GetModifiedAttribute(self, "autocast", button);
if ( action ) then
if ( autocast ) then
TogglePetAutocast(action)
elsef ( IsPetAttackActive(action) ) then
PetStopAttack();
else
CastPetAction(action);
end
else
local mode = SecureButton_GetModifiedAttribute(self, "mode", button);
if mode == "aggressive" then
PetModeAggressive()
elseif mode == "passive" then
PetModePassive()
elseif mode == "defensive" then
PetModeDefensive()
end
end
...
elseif ( type == "shapeshift" ) then
local action = SecureButton_GetModifiedAttribute(self, "action", button);
if action then
CastShapeshiftForm(action)
end
...