bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

using AppleScript to show Firefox window on OS X results in strange square outside of Firefox window




Shell Integration
6 years ago
2 years ago


(Reporter: JasonZ, Unassigned)


Mac OS X

Firefox Tracking Flags

(Not tracked)



(1 attachment)



6 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7

Steps to reproduce:

1) Open Firefox 9 on OS X (tested against 10.7). 
2) Navigate to about:blank, then minimize Firefox.
3) Run the following AppleScript:

set titleIdentifier to "Firefox"

tell application "Firefox"
	repeat with w in windows
		if name of w contains titleIdentifier then
			set visible of w to true
			set index of w to 1

		end if
	end repeat
end tell

error number -128

Actual results:

A grey square appears in the top left of OS X desktop, outside of the Firefox window. I have not been able to get the square to go away without quitting Firefox.

Expected results:

There should be no weird square there

Comment 1

6 years ago
To give some context about this AppleScript: The purpose is to bring Firefox into view if it's minimized, behind a window, or on another OS X space. There is a little extra AppleScript required to handle all the cases, but I've left only the essential AppleScript that reproduces the bug, in the bug report.

Comment 2

6 years ago
Created attachment 588191 [details]
picture of anomaly box
I was able to reproduce this but am not sure if it is a Firefox bug or a problem with your AppleScript.  JasonZ, if you are still using your script, did you ever get it to work correctly?
Flags: needinfo?(jzablot)

Comment 4

5 years ago
I was able to work around the issue with the following script. however the script has a limitation of not showing firefox if the user is in another OS X space.

tell application "Firefox"
	repeat with w in windows
		if name of w starts with titleIdentifier then
			set visible of w to true
		end if
	end repeat
end tell

error number -128
Flags: needinfo?(jzablot)

I, also, managed to reproduce the issue with the latest release(43.0.4) and the latest Nightly(46.0a1) builds, using the 1st script. 

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20160105164030

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160114060719

However, with the 2nd script (comment 4) I can restore Nightly(46.0a1) without problems, but when I try to restore Firefox(43.0.4) an error is displayed: (error "User canceled." number -128 from «script» to item). Also (set titleIdentifier to "Firefox") must be defined at the beginning of the 2nd script, if not an error is displayed with the message: titleIdentifier is not defined.
I can launch both browsers (if they are closed) using the 2nd script without problems, only Firefox cannot be restored when it is minimized.

Perhaps there's someone with extensive knowledge on this area that might be able to help here.

Thank you,
Component: Untriaged → Shell Integration
Version: 9 Branch → Trunk
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.