修复受保护执行环境中的 "Secret values" 错误 #19
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题
在受保护执行环境中,直接访问
tooltipData字段、tooltip 文本或调用SetHyperlink会导致 "Secret values" 错误。解决方案
Commit 1: 统一保护 tooltipData 字段访问和 tooltip 文本操作
SafeUnitAPI中添加 tooltipData 保护函数(TooltipDataField, TooltipDataType, TooltipDataGUID, TooltipDataLines)SafeUnitAPI中添加文本操作保护函数(GetText, StringFind, TooltipLineText)用于受保护执行环境pcall安全获取值,再用issecretvalue检查tooltipData字段的代码FindLineInGameTooltip和FindLineInTooltipData以安全处理 secret valuesCommit 2: 延迟调用 SetHyperlink
C_Timer.After(0, ...)延迟调用SetHyperlink/SetSpellByID/SetText修改文件
InspectCore.lua: 添加 SafeUnitAPI tooltipData 和文本操作保护函数InspectMouse.lua: 使用 SafeUnitAPI 保护 tooltipData 访问和文本操作libs/LibItemInfo.lua: 使用 SafeUnitAPI 保护 tooltipData.lines 访问InspectUnitGemAndEnchant.lua: 添加延迟调用保护 SetHyperlink