Firefox Headup window interference

I am trying to get firefox to create 2 windows, only if they are not already open, and then resize them to my specs.
The infamous Headup window is often in the way. Is there any way to get rid of it or to stop it interfering?
I do not need to open Firefox, I only run the code if it is open.
Here is the code i am using (it works normally but sometimes the headup window is at the front):
I tried it with the -1 and without it but in some cases I still get headup to be one of the two top windows.
Thanks

on stFrfx(thNm, bnds1, bnds2)
	-- gets win specs, returns nothing
	tell application thNm
		activate
		set wCnt to the (count (the windows of application "Firefox" whose visible is true)) 
		-- set wCnt to the (count (the windows of application "Firefox" whose visible is true))  -1
		tell application "System Events"
			repeat (2 - wCnt) times
				keystroke "n" using command down
				delay 0.2
			end repeat
			set bounds of (window 1 of application "Firefox") to bnds1
			set bounds of (window 2 of application "Firefox") to bnds2
		end tell
	end tell
end stFrfx

Not sure what the headup window is, but maybe it has a certain name so you would just check the name of the windows. If the name of it isn’t special, then maybe some other property is.

Hi Regulus,

Thanks for replying.

The window called Headup is always present in Firefox. You can see it in the windows menu. I believe it is the place holder for other windows and normally it would be hidden. If you choose it from the window menu, after you made it visible, it shows up as a grey area with no title bar. It is unmovable by hand. If you select it the menubar disappears and you are left with only the possibility to quit Firefox unless you select another window.

I suppose what I really want to know is how to set the order of open windows in Firefox. Is there an index of windows? How do I set the blasted Headup window to be the last in the queue so that it does not show up instead of one of mine?

You can test this by firing up Firefox and choosing Headup from menu window. The menubar will disappear. You could get it back by clicking on the visible window but, for now, please do nothing and run my code above. When I do that I get one of the windows I created and beside it the grey Headup. My other window is hidden. All windows are listed in the Windows menu. The blasted Headup became visible and it is now the first or the second window of Firefox.

I don’t have a window called Headup in Firefox. You must have added a plugin that gives this window. Anyway, you can see the properties that you can work with…

tell application "Firefox"
	set theWindows to windows
	return properties of (item 1 of theWindows)
end tell

You’ll need to find some property that the headup window has that you can focus on. Here’s an example of what might work. If I have two windows open in firefox, this will make the background window come to the front.

tell application "Firefox"
	set theWindows to windows
	repeat with aWindow in theWindows
		set thisIndex to index of aWindow
		set winName to name of aWindow
		if thisIndex is not 1 and winName is not "" then
			set index of aWindow to 1
			exit repeat
		end if
	end repeat
end tell

Hi Regulus

Yes you were 100% right.
I uninstalled all plugins and Headup disappeared.
Thanks for your help.