Thread Tools Display Modes
04/05/22, 08:24 AM   #1
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
ZO_PostHook vs. SecurePostHook

Are there any differences in terms of actual behavior?

As I understand it SecurePostHook is just a modified method of ZO_PostHook ZOS added for instances where the later was causing "from insecure code" errors.

Are there any situations where ZO_PostHook would still be preferable?

Will they eventually remove ZO_PostHook or simply make it work like SecurePostHook if not?
  Reply With Quote
04/05/22, 09:33 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
>As I understand it SecurePostHook is just a modified method of ZO_PostHook ZOS added for instances where the later was causing "from insecure code" errors.

Yep, correct afaik.

I'm always using SecurePostHook meanwhile "just to be sure" and never had any trouble so far.
If this is correct -> ZOs needs to tell us.

I guess the correct way would be to always use ZO_PostHook until you get issues, or if you are working around the inventory or other "taintable"/"secured" code (there is no list what is potentially secured, afaik, before you ask! ) you should use SecurePostHook.

But intentionally this was designed for e.g. inventory related stuff where the addon code "tainted" the ZOs code before the inventory was fully build-up. There also were other use-cases but this is the one I remember.

btw:
I still ran into issues with that, e.g. if you posthook the PLAYER_INVETORY.inventories[...]list.SetupFunction (or RowSetupFunciton of the scroll list, dunnot the exact function name anymore):
If I used SecurePostHook or ZO_PostHook it still threw me errors later on upon destroying items, or even mouse over or keybind usage.
If I "overwrite" it with my own post hook function it works though...

Last edited by Baertram : 04/05/22 at 09:35 AM.
  Reply With Quote
04/05/22, 05:47 PM   #3
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
Thanks, Baertram.

I'd been doing much the same, leaning towards preferring SecurePostHook, however lately I am finding myself taking more of a similar tact to what you describe, using ZO_PostHook where post hooking is needed unless it is something which touches any inventory (including character worn inventory) in any way. I feel I am still being pretty conservative, and SecurePostHook is there in case "insecure code" errors ever do pop up.
  Reply With Quote
04/06/22, 01:36 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Oh btw. I also use them at crafting tables where possible. I experienced (at least with worn items at improvement e.g.) it also could throw insecure errors there but this is an pretty old experience and maybe "fixed" meanwhile, or was a coincidence of other inventory related hooks that were changed to SecurePostHook too meanwhile.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » ZO_PostHook vs. SecurePostHook

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