883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
30 lines
2.7 KiB
Lua
30 lines
2.7 KiB
Lua
local root=arg[1];local frames={};local sends=0;local ticks=10;local logChat=false;local logCombat=false;local hooks={}
|
|
WoWHybridNativeSessionObserver=nil
|
|
GetTime=function()return ticks end;date=function()return 'test-session'end
|
|
CreateFrame=function()local f={};frames[#frames+1]=f;function f:RegisterEvent(e)if e=='TRADE_SKILL_ITEM_CRAFTED_RESULT'then error('unknown')end end;function f:SetScript(_,fn)self.handler=fn end;return f end
|
|
issecretvalue=function(v)return v=='SECRET'end
|
|
hooksecurefunc=function(owner,key,fn)hooks[#hooks+1]=fn;local old=owner[key];owner[key]=function(...)local a,b=old(...);fn(...);return a,b end end
|
|
SendChatMessage=function(a,b,c,d)sends=sends+1;return a,d end
|
|
LoggingChat=function(v)if v~=nil then logChat=v end;return logChat end
|
|
LoggingCombat=function(v)if v~=nil then logCombat=v end;return logCombat end
|
|
DEFAULT_CHAT_FRAME={AddMessage=function()end};SlashCmdList={};GatewayDiagnosticsSaved={other='preserved'}
|
|
dofile(root..'/client_addons/GatewayDiagnostics/SessionObserver.lua');assert(sends==0)
|
|
frames[1].handler(frames[1],'PLAYER_LOGIN');local O=WoWHybridNativeSessionObserver;local C=O:Status()
|
|
assert(C.active and logChat and logCombat and GatewayDiagnosticsSaved.other=='preserved')
|
|
assert(#C.unsupportedEvents==1 and C.hooks.SendChatMessage==true and C.hooks['C_Container.SortBags']==false)
|
|
local a,b=SendChatMessage('private','WHISPER',nil,'target');assert(a=='private'and b=='target'and sends==1)
|
|
frames[1].handler(frames[1],'CHAT_MSG_GUILD','SECRET','name');assert(C.rows[#C.rows].args[1]=='<secret>')
|
|
local n=#C.rows;frames[1].handler(frames[1],'UNIT_AURA','raid1');assert(#C.rows==n)
|
|
frames[1].handler(frames[1],'UNIT_SPELLCAST_SUCCEEDED','player','cast',123);assert(#C.rows==n+1)
|
|
O:Mark('local-test');assert(C.rows[#C.rows].direction=='marker')
|
|
O.maxRows=#C.rows;O:Mark('bounded');assert(C.dropped==1)
|
|
SlashCmdList.WOWHYBRIDSESSION('stop');assert(not C.active and not logChat and not logCombat)
|
|
SendChatMessage('after stop','WHISPER',nil,'target');assert(sends==2 and C.dropped==1)
|
|
SlashCmdList.WOWHYBRIDSESSION('start');assert(C.active and logChat and logCombat)
|
|
ticks=ticks+7201;O:Mark('expired');assert(not C.active and not logChat and not logCombat)
|
|
C.active=true;C.ownsChatLog=true;C.ownsCombatLog=true;logChat=true;logCombat=true
|
|
dofile(root..'/client_addons/GatewayDiagnostics/SessionObserver.lua');frames[2].handler(frames[2],'PLAYER_LOGIN')
|
|
assert(WoWHybridNativeSessionObserver.ownsChatLog and WoWHybridNativeSessionObserver.ownsCombatLog)
|
|
SlashCmdList.WOWHYBRIDSESSION('stop');assert(not logChat and not logCombat and not C.ownsChatLog and not C.ownsCombatLog)
|
|
print('Native session observer preserves secure-hook calls/results, respects secrets, filters units, bounds output, stops owned logs, and records no invented network actions.')
|