WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   ToggleGameMenu can be called from addons (or /script) in a limited way (https://www.wowinterface.com/forums/showthread.php?t=57005)

Nightness 02-01-19 03:40 AM

ToggleGameMenu can be called from addons (or /script) in a limited way
 
Check out the API bug I found…

“/script ToggleGameMenu(); StaticPopup1:Hide()”.

Game menu toggle is not really protected but it’s calls to SpellStopCasting(), SpellStopTargeting(), and ClearTarget() are and is what is generating the tainted error, they are not in a secure call.

Fizzlemizz 02-01-19 09:35 AM

The problem isn't so much with
Code:

ShowUIPanel(GameMenuFrame)
But more with one of these

Lua Code:
  1. function ToggleGameMenu()
  2.     if ( not UIParent:IsShown() ) then
  3.         UIParent:Show();
  4.         SetUIVisibility(true);
  5.     elseif ( C_Commentator.IsSpectating() and IsFrameLockActive("COMMENTATOR_SPECTATING_MODE") ) then
  6.         PvPCommentator:SetFrameLock(false);
  7.     elseif ( ModelPreviewFrame:IsShown() ) then
  8.         ModelPreviewFrame:Hide();
  9.     elseif ( StoreFrame_EscapePressed and StoreFrame_EscapePressed() ) then
  10.     elseif ( WowTokenRedemptionFrame_EscapePressed and WowTokenRedemptionFrame_EscapePressed() ) then
  11.     elseif ( securecall("StaticPopup_EscapePressed") ) then
  12.     elseif ( GameMenuFrame:IsShown() ) then
  13.         PlaySound(SOUNDKIT.IG_MAINMENU_QUIT);
  14.         HideUIPanel(GameMenuFrame);
  15.     elseif ( HelpFrame:IsShown() ) then
  16.         ToggleHelpFrame();
  17.     elseif ( VideoOptionsFrame:IsShown() ) then
  18.         VideoOptionsFrameCancel:Click();
  19.     elseif ( AudioOptionsFrame:IsShown() ) then
  20.         AudioOptionsFrameCancel:Click();
  21.     elseif ( SocialBrowserFrame and SocialBrowserFrame:IsShown() ) then
  22.         SocialBrowserFrame:Hide();
  23.     elseif ( InterfaceOptionsFrame:IsShown() ) then
  24.         InterfaceOptionsFrameCancel:Click();
  25.     elseif ( SocialPostFrame and Social_IsShown() ) then
  26.         Social_SetShown(false);
  27.     elseif ( TimeManagerFrame and TimeManagerFrame:IsShown() ) then
  28.         TimeManagerFrameCloseButton:Click();
  29.     elseif ( MultiCastFlyoutFrame:IsShown() ) then
  30.         MultiCastFlyoutFrame_Hide(MultiCastFlyoutFrame, true);
  31.     elseif (SpellFlyout:IsShown() ) then
  32.         SpellFlyout:Hide();
  33.     elseif ( securecall("FCFDockOverflow_CloseLists") ) then
  34.     elseif ( securecall("CloseMenus") ) then
  35.     elseif ( CloseCalendarMenus and securecall("CloseCalendarMenus") ) then
  36.     elseif ( CloseGuildMenus and securecall("CloseGuildMenus") ) then
  37.     elseif ( GarrisonMissionFrame_ClearMouse and securecall("GarrisonMissionFrame_ClearMouse") ) then
  38.     elseif ( GarrisonMissionFrame and GarrisonMissionFrame.MissionTab and GarrisonMissionFrame.MissionTab.MissionPage and GarrisonMissionFrame.MissionTab.MissionPage:IsVisible() ) then
  39.         GarrisonMissionFrame.MissionTab.MissionPage.CloseButton:Click();
  40.     elseif ( GarrisonShipyardFrame_ClearMouse and securecall("GarrisonShipyardFrame_ClearMouse") ) then
  41.     elseif ( GarrisonShipyardFrame and GarrisonShipyardFrame.MissionTab and GarrisonShipyardFrame.MissionTab.MissionPage and GarrisonShipyardFrame.MissionTab.MissionPage:IsVisible() ) then
  42.         GarrisonShipyardFrame.MissionTab.MissionPage.CloseButton:Click();
  43.     elseif ( securecall("OrderHallMissionFrame_EscapePressed") ) then
  44.     elseif ( securecall("OrderHallTalentFrame_EscapePressed") ) then
  45.     elseif ( securecall("BFAMissionFrame_EscapePressed") ) then
  46.     elseif ( SpellStopCasting() ) then
  47.     elseif ( SpellStopTargeting() ) then
  48.     elseif ( securecall("CloseAllWindows") ) then
  49.     elseif ( LootFrame:IsShown() ) then
  50.         -- if we're here, LootFrame was opened under the mouse (cvar "lootUnderMouse") so it didn't get closed by CloseAllWindows
  51.         LootFrame:Hide();
  52.     elseif ( ClearTarget() and (not UnitIsCharmed("player")) ) then
  53.     elseif ( OpacityFrame:IsShown() ) then
  54.         OpacityFrame:Hide();
  55.     elseif ( SplashFrame:IsShown() ) then
  56.         SplashFrame_Close();
  57.     elseif ( ChallengesKeystoneFrame and ChallengesKeystoneFrame:IsShown() ) then
  58.         ChallengesKeystoneFrame:Hide();
  59.     else
  60.         PlaySound(SOUNDKIT.IG_MAINMENU_OPEN);
  61.         ShowUIPanel(GameMenuFrame);
  62.     end
  63. end

Nightness 02-01-19 10:58 PM

Think I found it...
 
SpellStopCasting(), SpellStopTargeting(), and ClearTarget() are what is generating the tainted error, they are not in a secure call.

Nightness 02-02-19 09:49 AM

It's really ClearTarget(), since it's the one that breaks the elseif chain.


All times are GMT -6. The time now is 08:12 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI