View Single Post
10-23-15, 03:46 PM   #9
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Just wanted to clear something up, since people seem a little confused as to what taint actually is.

Anything an addon does is considered "tainted". Its purpose is to prevent an addon from tricking a blizzard function into executing code that it wouldn't normally be able to do directly, or otherwise influence the result of a protected function.

So, when we call a function like SpellBookPrevPageButton_OnClick, which calls SpellBookFrame_Update, which calls SpellBook_UpdatePlayerTab, which calls SpellBookFrame_UpdateSpells, which calls SpellButton_UpdateButton, which sets "self.offSpecID", which is then read by SpellButton_OnClick when you click the spell button, it directly influences whether or not "CastSpell" is called by the interface.

Since we've "tainted" the execution path by calling a function which ultimately affected a protected function, the interface prevents the protected function from being called.

When you create a global variable, it's tainted because it wasn't created by blizzard's "trusted" code, it was created by your addon, which is untrustworthy. If something in the interface were to read that variable it would taint its execution path.

This doesn't mean that global variables are bad, just that you need to take care not to name them something that would ever be referenced by anything else.
  Reply With Quote