local function GetDifficultyLevelColor(level)
local color = GetQuestDifficultyColor(level)
return format("|cff%.2x%.2x%.2x", color.r*255,color.g*255,color.b*255)
end
There are only a select few occurences of this "uncheck"
The following seems not to have any impact:
function UIDropDownMenu_ClearAll(frame)
-- Previous code refreshed the menu quite often and was a performance bottleneck
frame.selectedID = nil;
frame.selectedName = nil;
frame.selectedValue = nil;
UIDropDownMenu_SetText(frame, "");
local button, checkImage;
for i=1, UIDROPDOWNMENU_MAXBUTTONS do
button = _G["DropDownList"..UIDROPDOWNMENU_MENU_LEVEL.."Button"..i];
button:UnlockHighlight();
checkImage = _G["DropDownList"..UIDROPDOWNMENU_MENU_LEVEL.."Button"..i.."Check"];
checkImage:Hide();
[COLOR="Red"]uncheckImage = _G["DropDownList"..UIDROPDOWNMENU_MENU_LEVEL.."Button"..i.."UnCheck"];[/COLOR]
uncheckImage:Hide();
end
end
However, this seems to be the culprit (lines 497 and onwards)
--function UIDropDownMenu_Refresh(frame, useValue, dropdownLevel)
--[...]
if not button.notCheckable and button:IsShown() then
-- If checked show check image
checkImage = _G["DropDownList"..dropdownLevel.."Button"..i.."Check"];
[COLOR="#ff0000"]uncheckImage = _G["DropDownList"..dropdownLevel.."Button"..i.."UnCheck"];[/COLOR]
if ( checked ) then
somethingChecked = true;
if ( useValue ) then
UIDropDownMenu_SetText(frame, button.value);
else
UIDropDownMenu_SetText(frame, button:GetText());
end
button:LockHighlight();
checkImage:Show();
uncheckImage:Hide();
else
button:UnlockHighlight();
checkImage:Hide();
uncheckImage:Show();
end
end
This is called by (as can be seen from the stack provided in the first post)
-- line 556
function UIDropDownMenu_SetSelectedValue(frame, value, useValue)
-- useValue will set the value as the text, not the name
frame.selectedName = nil;
frame.selectedID = nil;
frame.selectedValue = value;
UIDropDownMenu_Refresh(frame, useValue);
end
So what makes that different then? What causes this taint to bubble up?
- We know it only happens at buttons that are 1) firstlevel 2) have a function 3) are not checkable (aka "not button.notCheckable) and 3) visible, at least, as far as I know ofcourse :D
- The taint is in my case caused by assigning a non-default value, causing a refresh of the dropdownmenu.
The only relevant difference between the routine "refresh" and the creation of the DropDown is the usage of the initialize function, which - handy dandy - contains:
-- line 64
securecall("UIDropDownMenu_InitializeHelper", frame);
which refers to line 35:
function UIDropDownMenu_InitializeHelper (frame)
-- This deals with the potentially tainted stuff!
if ( frame ~= UIDROPDOWNMENU_OPEN_MENU ) then
UIDROPDOWNMENU_MENU_LEVEL = 1;
end
Do note that in the initialization process the UIDROPDOWNMENU_MENU_LEVEL is used, whereas in the refreshing process a supplied value is used.
Geez...
So apparently, by causing taint in an addon, this is allowed to bubble up to the execution path due to the fact that an initialization of a DropDownMenu is secured against taint, however a refresh of that same menu is not, leading to a tainted global variable "uncheck" by using
-> user-variables, thus tainting the functionality, and when referring to a global variable, which through the lua and the XML-template is referencing to one image, tainting that image, locking out secure function calls?
Did I make any sense here or am I just jibbering about as usual?
Cheers for the help, boiled down to something I overlooked...
Ok, here is the tainting reported:
10/20 13:27:59.665 Execution tainted by !Swatter while reading Swatter - Interface\AddOns\!Swatter\Swatter.lua:296 GetAddOns()
10/20 13:27:59.665 Interface\AddOns\!Swatter\Swatter.lua:145 OnError()
10/20 13:27:59.665 Interface\AddOns\!Swatter\Swatter.lua:360
10/20 13:27:59.665 PlaceRaidMarker()
10/20 13:27:59.665 Interface\AddOns\Blizzard_CompactRaidFrames\Blizzard_CompactRaidFrameManager.lua:103 func()
10/20 13:27:59.665 Interface\FrameXML\UIDropDownMenu.lua:636 UIDropDownMenuButton_OnClick()
10/20 13:27:59.665 DropDownList1Button1:OnClick()
10/20 13:27:59.665 An action was blocked because of taint from EthenaUI - PlaceRaidMarker()
10/20 13:27:59.665 Interface\AddOns\Blizzard_CompactRaidFrames\Blizzard_CompactRaidFrameManager.lua:103 func()
10/20 13:27:59.665 Interface\FrameXML\UIDropDownMenu.lua:636 UIDropDownMenuButton_OnClick()
10/20 13:27:59.665 DropDownList1Button1:OnClick()
Seems indeed it has something to do with the DropDown...
So I went looking for that:
Execution tainted by EthenaUI while reading TIMESTAMP_FORMAT_HHMM - Interface\FrameXML\InterfaceOptionsPanels.lua:1099 initFunction()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:69 UIDropDownMenu_Initialize()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1061
10/20 13:27:54.220 Execution tainted by EthenaUI while reading TIMESTAMP_FORMAT_HHMMSS - Interface\FrameXML\InterfaceOptionsPanels.lua:1100 initFunction()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:69 UIDropDownMenu_Initialize()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1061
10/20 13:27:54.220 Execution tainted by EthenaUI while reading TIMESTAMP_FORMAT_HHMM_AMPM - Interface\FrameXML\InterfaceOptionsPanels.lua:1101 initFunction()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:69 UIDropDownMenu_Initialize()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1061
10/20 13:27:54.220 Execution tainted by EthenaUI while reading TIMESTAMP_FORMAT_HHMMSS_AMPM - Interface\FrameXML\InterfaceOptionsPanels.lua:1102 initFunction()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:69 UIDropDownMenu_Initialize()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1061
10/20 13:27:54.220 Execution tainted by EthenaUI while reading TIMESTAMP_FORMAT_HHMM_24HR - Interface\FrameXML\InterfaceOptionsPanels.lua:1103 initFunction()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:69 UIDropDownMenu_Initialize()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1061
10/20 13:27:54.220 Execution tainted by EthenaUI while reading TIMESTAMP_FORMAT_HHMMSS_24HR - Interface\FrameXML\InterfaceOptionsPanels.lua:1104 initFunction()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:69 UIDropDownMenu_Initialize()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1061
[COLOR="Red"]10/20 13:27:54.220 Global variable uncheckImage tainted by EthenaUI - Interface\FrameXML\UIDropDownMenu.lua:500 UIDropDownMenu_Refresh()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:561 UIDropDownMenu_SetSelectedValue()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1062[/COLOR]
10/20 13:27:54.220 Execution tainted by EthenaUI while reading uncheckImage - Interface\FrameXML\UIDropDownMenu.lua:514 UIDropDownMenu_Refresh()
10/20 13:27:54.220 Interface\FrameXML\UIDropDownMenu.lua:561 UIDropDownMenu_SetSelectedValue()
10/20 13:27:54.220 Interface\FrameXML\InterfaceOptionsPanels.lua:1062
At the red part is where it goes wrong, as every single time after that when UIDropDwonMenu is called, this is the issue.
Funny thing, I'm totally unaware to how I'm even remotely touching this image?
But *apparently* it's the case that this image is infected through me altering the default textual values on one of the UIDropDowns (The timestamp in chat ones, directly above this occurence).
Disabling that alleviated the issue aka the raidmarkers work.
Now only to figure out how to style the timestamps to my liking without causing taint (no brackets, specific color)...
Is there a concise list of what causes taint, how to prevent it and most importantly, how to find out what caused it?
Reason I'm asking is that I have never had taint issues with my UI before (pre-4.0.1 and in the Cata Beta), but when trying to place a raid-marker I suddenly get the issue:
What strikes me as odd is:
"AddOn EthenaUI attempted to call a forbidden function (PlaceRaidMarker())"
Where this is completely unchanged, standard Blizzard UI and I just clicked "Place Blue Marker". :confused:
-- adds my own layout to the default bags
local function bags_Override(frame, size, id)
-- get the relevant data
bag = frame
bagName = bag:GetName()
-- hide default textures
toHide = {
[COLOR="Red"]_G[bagName.."BackgroundTop"],
_G[bagName.."BackgroundMiddle1"],
_G[bagName.."BackgroundMiddle2"],
_G[bagName.."BackgroundBottom"],
_G[bagName.."Background1Slot"],[/COLOR]
}
for k, v in pairs(toHide) do
v:SetTexture(0,0,0,0)
[COLOR="Red"]v.SetTexture = dummyfunc[/COLOR]
end
-- create own background
if not bag.Ethbg then
bag:SetBackdrop(config.backdrop)
bag.Ethbg = bag:CreateTexture(nil, "PARENT")
bag.Ethbg:SetTexture(1,1,1,1)
bag.Ethbg:ClearAllPoints()
bag.Ethbg:SetPoint("TOPLEFT", bag, "TOPLEFT", 2, -2);
bag.Ethbg:SetPoint("BOTTOMRIGHT", bag, "BOTTOMRIGHT", -2, 2);
bag.Ethbg:SetVertexColor(unpack(config.background))
bag.Ethbg:SetBlendMode("BLEND")
bag:SetBackdropBorderColor(unpack(config.border))
end
-- apply own texture to the background of the itemslots
local numSlots = GetContainerNumSlots(i)
for j=1, size do
local itemSlot = _G[bagName.."Item"..j.."NormalTexture"]
itemSlot:SetTexture(config.itemslot)
itemSlot:SetVertexColor(unpack(config.itemslot_background))
itemSlot:SetPoint("TOPLEFT", -1, 1)
itemSlot:SetPoint("BOTTOMRIGHT", 1, -1)
[COLOR="#ff0000"]itemSlot.SetTexture = dummyfunc[/COLOR]
-- shift count to a visible spot
local stock = _G[bagName.."Item"..j.."Count"]
stock:SetPoint("BOTTOMRIGHT", -5, 5)
[color="#ff0000"]stock.SetPoint = dummyfunc[/COLOR]
end
end
-- somewhere down the line
hooksecurefunc("ContainerFrame_GenerateFrame", bags_Override)
dummyfunc is just "function() end"
but removing those (or disabling this whole function) didn't change a thing, whereas this is about the only thing I added.
Since I can't flag where taint occurs, I'm going to scour over all code, but it would be good to know everything that can possibly cause taint.
I've been working on my UI on the beta, but I've ran into a problem...
I used to have a simple script that made it possible to drag my bags around, but it's kinda broken now...
I've tried about everything, but I can't get it to work. Even the simple
local frame1 = CreateFrame("Frame", "MyTestDragFrame", UIParent)
frame1:SetMovable(true)
frame1:EnableMouse(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
-- The code below makes the frame visible, and is not necessary to enable dragging.
frame1:SetPoint("CENTER"); frame1:SetWidth(64); frame1:SetHeight(64);
local tex = frame1:CreateTexture("ARTWORK");
tex:SetAllPoints();
tex:SetTexture(1.0, 0.5, 0); tex:SetAlpha(0.5);
does not work.
Does anyone know why not and possibly (well, preferably :P ) how to fix it?
What you can do is simply disable their paging, and add a state driver that only does the Possession paging
This is where I already hit the brick wall.
No matter what I try I either have to disable all paging (by blocking the bonusbar) or I cannot disable any paging (since it is controlled by the bonusbar). Conditionally enabling/disabling of the bonusbar is something that does not seem to work, or at least, I can't get it to work... if all paging is disabled it won't show the possession bar ???
I've repositioned and altered the default actionbars, much to my liking. That is basicly all I did really, I did not create own bars, did not alter functionality or anything, just that.
Now I *am* trying to alter functionality: I hate the paging of actionbars upon altering stance/form (warrior stances, rogue stealth, priest shadowform, druid shapeshifts). Is there a way to block these without interfering with the normal functionality like when you MC a target, or when you get into a vehicle a la Flame Lev, or Prof P Abom duty?
First I tried my own implementation. Worked like a charm, however it meant that I had an extra bar on my screen that was empty 99% of the time (just reposition the BonusBar), kinda pointless really. So on to a better solution.
Then I've been trying different alternatives, inspired by caelUI and thus rothUI, but somehow I can't get it to work correctly: either it does not page, or it does not release the hotkeys back to the original bar, or it doesn't block the ones mentioned above...
So on to more advanced techniques, I've been trying to figure out events (UPDATE_SHAPESHIFT_FORM, UPDATE_STEALTH) to hook on to, or functions to block/dummy (ShapeshiftBar:Show()/Hide()/Update()) but to no avail.
Trying to figure out how Bartender4 controls that, I came across snkUI, they both create completely new bars, new buttons and then go on with adding the
actionbar:SetAttribute("_onstate-page", [[
self:SetAttribute("actionpage", tonumber(newstate));
ActionButtons = newtable( self:GetChildren() );
for i, button in ipairs( ActionButtons ) do
button:SetAttribute("touch", nil);
end
]]);
RegisterStateDriver(actionbar, "page", "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; [bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; [bonusbar:5] 11; 1");
-- shameless copy from snkUI for illustrative purposes
-- http://www.wowinterface.com/downloads/info16472-1.0.html
StateDrivers?
I can do that as well ofcourse, but can't you just alter those StateDrivers? (as bartender for instance also Unregisters StateDrivers I suppose I could Unregister the default ones and then Register my own?)
And then - which of the bonusbars to delete and which to keep? Which bar is a stance, which is a possess (bartender4 indicates bonus:5 as possess?) and is that possess both ways (MC by shadowpr. ánd Prof P Abom), which is a vehicle?
I dying for some tips/explanation regarding this, I don't need fully functional code, but some pointers would be very much appreciated. The documentation I can find about the StateDriver ends in the Restricted Environment... not something I want to play around with really.
[...] I mean you should already have decided and picked which algorithms and data structures you are going to use (eg, quick sort versus merge sort, separate hash tables of data or tables of tables of data, etc). [...]
Isn't this standard when writing any code? I mean, just starting to write with no clue on what, why, how and where is pointless. Well, not pointless if you're just in it for the fun of it, but then why bother?
Perhaps it would be an idea if there could be made some sort of thread containing some basic pointers with regards to optimization and code streamlining? More just a general Tips & Tricks when it comes to wow-Lua I suppose
0
0
0
Hmms, trying to figure this out....
Using: http://github.com/tekkub/wow-ui-source/blob/live/FrameXML/UIDropDownMenu.lua
There are only a select few occurences of this "uncheck"
The following seems not to have any impact:
However, this seems to be the culprit (lines 497 and onwards)
This is called by (as can be seen from the stack provided in the first post)
So what makes that different then? What causes this taint to bubble up?
- We know it only happens at buttons that are 1) firstlevel 2) have a function 3) are not checkable (aka "not button.notCheckable) and 3) visible, at least, as far as I know ofcourse :D
- The taint is in my case caused by assigning a non-default value, causing a refresh of the dropdownmenu.
The only relevant difference between the routine "refresh" and the creation of the DropDown is the usage of the initialize function, which - handy dandy - contains:
which refers to line 35:
Do note that in the initialization process the UIDROPDOWNMENU_MENU_LEVEL is used, whereas in the refreshing process a supplied value is used.
Geez...
So apparently, by causing taint in an addon, this is allowed to bubble up to the execution path due to the fact that an initialization of a DropDownMenu is secured against taint, however a refresh of that same menu is not, leading to a tainted global variable "uncheck" by using
-> user-variables, thus tainting the functionality, and when referring to a global variable, which through the lua and the XML-template is referencing to one image, tainting that image, locking out secure function calls?
Did I make any sense here or am I just jibbering about as usual?
0
Ok, here is the tainting reported:
Seems indeed it has something to do with the DropDown...
So I went looking for that:
At the red part is where it goes wrong, as every single time after that when UIDropDwonMenu is called, this is the issue.
Funny thing, I'm totally unaware to how I'm even remotely touching this image?
But *apparently* it's the case that this image is infected through me altering the default textual values on one of the UIDropDowns (The timestamp in chat ones, directly above this occurence).
Disabling that alleviated the issue aka the raidmarkers work.
Now only to figure out how to style the timestamps to my liking without causing taint (no brackets, specific color)...
0
Reason I'm asking is that I have never had taint issues with my UI before (pre-4.0.1 and in the Cata Beta), but when trying to place a raid-marker I suddenly get the issue:
What strikes me as odd is:
"AddOn EthenaUI attempted to call a forbidden function (PlaceRaidMarker())"
Where this is completely unchanged, standard Blizzard UI and I just clicked "Place Blue Marker". :confused:
I've never had this issue before.
After reading up a bit http://www.wowwiki.com/Secure_Execution_and_Tainting , I suspect the error lies in:
dummyfunc is just "function() end"
but removing those (or disabling this whole function) didn't change a thing, whereas this is about the only thing I added.
Since I can't flag where taint occurs, I'm going to scour over all code, but it would be good to know everything that can possibly cause taint.
Thanks in advance.
0
I'll go get some coffee....
0
I've been working on my UI on the beta, but I've ran into a problem...
I used to have a simple script that made it possible to drag my bags around, but it's kinda broken now...
I've tried about everything, but I can't get it to work. Even the simple
does not work.
Does anyone know why not and possibly (well, preferably :P ) how to fix it?
Thanks a lot!
0
http://www.wowinterface.com/forums/showthread.php?t=34507
0
This is where I already hit the brick wall.
No matter what I try I either have to disable all paging (by blocking the bonusbar) or I cannot disable any paging (since it is controlled by the bonusbar). Conditionally enabling/disabling of the bonusbar is something that does not seem to work, or at least, I can't get it to work... if all paging is disabled it won't show the possession bar ???
If there are any tips... ;D
0
0
here I am again, started on a new playground :)
I've repositioned and altered the default actionbars, much to my liking. That is basicly all I did really, I did not create own bars, did not alter functionality or anything, just that.
Now I *am* trying to alter functionality: I hate the paging of actionbars upon altering stance/form (warrior stances, rogue stealth, priest shadowform, druid shapeshifts). Is there a way to block these without interfering with the normal functionality like when you MC a target, or when you get into a vehicle a la Flame Lev, or Prof P Abom duty?
First I tried my own implementation. Worked like a charm, however it meant that I had an extra bar on my screen that was empty 99% of the time (just reposition the BonusBar), kinda pointless really. So on to a better solution.
Then I've been trying different alternatives, inspired by caelUI and thus rothUI, but somehow I can't get it to work correctly: either it does not page, or it does not release the hotkeys back to the original bar, or it doesn't block the ones mentioned above...
So on to more advanced techniques, I've been trying to figure out events (UPDATE_SHAPESHIFT_FORM, UPDATE_STEALTH) to hook on to, or functions to block/dummy (ShapeshiftBar:Show()/Hide()/Update()) but to no avail.
Trying to figure out how Bartender4 controls that, I came across snkUI, they both create completely new bars, new buttons and then go on with adding the
StateDrivers?
I can do that as well ofcourse, but can't you just alter those StateDrivers? (as bartender for instance also Unregisters StateDrivers I suppose I could Unregister the default ones and then Register my own?)
And then - which of the bonusbars to delete and which to keep? Which bar is a stance, which is a possess (bartender4 indicates bonus:5 as possess?) and is that possess both ways (MC by shadowpr. ánd Prof P Abom), which is a vehicle?
I dying for some tips/explanation regarding this, I don't need fully functional code, but some pointers would be very much appreciated. The documentation I can find about the StateDriver ends in the Restricted Environment... not something I want to play around with really.
/salute
0
Isn't this standard when writing any code? I mean, just starting to write with no clue on what, why, how and where is pointless. Well, not pointless if you're just in it for the fun of it, but then why bother?
0
0
hence why I ask before I start with it (still analyzing and testing atm) ;)
Donald Knuth
0
Having Java as background, Lua is quite something to get used to in terms of optimization, due to the lack of classes per sé and instantiation etc.
Perhaps it would be an idea if there could be made some sort of thread containing some basic pointers with regards to optimization and code streamlining? More just a general Tips & Tricks when it comes to wow-Lua I suppose