Thread Tools Display Modes
02-01-19, 03:40 AM   #1
Nightness
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 32
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.

Last edited by Nightness : 02-02-19 at 02:18 AM.
  Reply With Quote
02-01-19, 09:35 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
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
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
02-01-19, 10:58 PM   #3
Nightness
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 32
Think I found it...

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

Last edited by Nightness : 02-02-19 at 05:05 AM.
  Reply With Quote
02-02-19, 09:49 AM   #4
Nightness
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 32
It's really ClearTarget(), since it's the one that breaks the elseif chain.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » ToggleGameMenu can be called from addons (or /script) in a limited way

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