Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-08-07, 06:59 PM   #1
Flickerstreak
A Deviate Faerie Dragon
Join Date: Dec 2006
Posts: 19
Arrow Request: SecureTemplate access for forgotten protected functions

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
    
...

Last edited by Flickerstreak : 01-10-07 at 06:12 PM. Reason: added implementation example, removed PlaceAction from the list since it's not actually protected
  Reply With Quote
 

WoWInterface » Developer Discussions » Wish List » Request: SecureTemplate access for forgotten protected functions

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off