View Single Post
11-22-18, 08:30 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
The reason you should never overwrite Blizzard functions is because any AddOn that depends on them to work a specific way suddenly won't work, or at the very least won't work as expected. Don't forget that the entire Blizzard UI is a series of AddOns. Almost every AddOn written by fans (ex: ElvUI, anything from Curseforge/Twitch, or Wowinterface) access the Blizzard AddOns for functions, global variables, and other things. Overwriting Blizzard's code will break everything, eventually.

Securely hooking a function allows the original function to work and run, then your secure copy runs second, preserving all expected results.

Tainting is unsecured code. Every AddOn not written by Blizzard is, by its existence, tainted. That's perfectly fine, but it gets messy when some author taints the code path with a stray global variable or a function that should have been hooked. The taint log is notoriously difficult to shift through to find the offending code. This is because of the order of things. I'm about to heavily generalize here, but it gets the point across:
  1. Blizzard secure code runs
  2. A bad AddOn does something it shouldn't
  3. A second AddOn calls the now unsecured code
  4. A third AddOn that might not even use the code is blamed because its instructions were next
Yes, that's right. When you see the error code in BugSack say that such and such AddOn caused an error, the chances are pretty good said AddOn actually had zero things to do with the problem.

I could elaborate more, as there is a great deal more to say on the matter, but the short version is: just because you don't see the problem doesn't mean the problem doesn't exist –– and eventually will cause failure.
  Reply With Quote