View Single Post
12-21-17, 09:26 AM   #8
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Taint isn't hard to understand at all. It just means "addon code touched this, so we can't assume execution is safe from here on out". Taint usually spreads by replacing or calling UI functions (implemented in Lua) directly, instead of properly hooking on to functions when they execute instead.
Using widget meta functions (such as SetPoint) doesn't spread taint. E.g:

Lua Code:
  1. -- This will spread taint if BuffFrame:SetPoint() is called in a signed code scope.
  2. local realSetPoint = BuffFrame.SetPoint
  3. function BuffFrame:SetPoint()
  4.     realSetPoint(self, "CENTER", UIParent, "RIGHT", -500, 200)
  5. end
  6.  
  7. -- This will not spread taint at any time, ever.
  8. hooksecurefunc(BuffFrame, "SetPoint", function(self, pnt, relTo, relPnt, x, y)
  9.     if pnt ~= "CENTER" or relPnt ~= "RIGHT" or x ~= -500 then
  10.         self:SetPoint("CENTER", UIParent, "RIGHT", -500, 200)
  11.     end
  12. end)
__________________

Last edited by MunkDev : 12-21-17 at 09:34 AM.
  Reply With Quote