Closed Bug 421020 Opened 16 years ago Closed 16 years ago

Applescript: unexpected system beep from "display alert/dialog" cancel buttons, toolbar only

Categories

(Camino Graveyard :: OS Integration, defect)

PowerPC
macOS
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED
Camino1.6

People

(Reporter: lthompson.22, Assigned: stuart.morgan+bugzilla)

Details

(Keywords: fixed1.8.1.13)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.13pre) Gecko/20080304 Camino/1.6b3pre (like Firefox/2.0.0.13pre)
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.13pre) Gecko/20080304 Camino/1.6b3pre (like Firefox/2.0.0.13pre)

I get a system beep when I run a script *from the toolbar* and click on a "display alert" or "display dialog" button that has been designated as the cancel button. This is consistent and I get the expected behavior, too, along with the beep: the dialog is dismissed and the script is terminated. For example, clicking on "bar" will generate a beep (and cancel) in all of the following:

   display dialog "foo" buttons {"bar"} cancel button 1
   display alert "foo" buttons {"bar", "OK"} cancel button "bar"
   display alert "foo" buttons {"Cancel", "bar", "OK"} cancel button 2

I also get a beep when clicking on "Cancel" from a "display dialog" statement with the usual 2-button Cancel/OK set, even if the cancel button is not specified:

   display dialog "foo" buttons {"Cancel", "OK"}
	
If I substitute "display alert" in the above, I don't get a system beep (but I don't get cancellation either since alerts don't cancel without specifying a cancel button).

The same scripts run from the Camino script menu do not generate any beeps. 

I tested this with a clean profile and clean org.mozilla.camino prefs, only the one test script in the Camino script folder, no other apps running, different system sounds.

I'll upload a script that can be used to test -- it's just a series of six alert/dialogs that demonstrate what I'm seeing (or hearing). I use 10.5.2. I don't remember exactly, but I'm not sure that alerts and/or the ability to designate a cancel button were available in 10.3, so it might not run on that system.


Reproducible: Always

Steps to Reproduce:
1. Save an applescript with one of the above statements.
2. Place script on Camino toolbar.
3. Run script to get dialog/alert.
4. Click the dialog button that's been specified as "cancel button".
Actual Results:  
Along with expected results, a system beep is generated.

Expected Results:  
Dialog/alert is dismissed, script is terminated (no beep).
might not work on 10.3
Component: Toolbars & Menus → OS Integration
QA Contact: toolbars → os.integration
We deliberately beep when executing the script returns an error, and apparently
canceling counts as an error in AS. It looks like we should check that the
error dictionary isn't returning an NSAppleScriptErrorNumber of -128 (user
cancelled), since that's not really an error case.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Peter, is this something that's safe and simple enough to fix for 1.6 final?
The fix is very simple; we should do it for 1.6.
Target Milestone: --- → Camino1.6
Ah, yes, I'd forgotten AS handles cancels as errors.  Stuart's right, the fix is simple, if we know what we want.  Is the consensus to just filter out -128?  That sounds reasonable.
Status: NEW → ASSIGNED
Assignee: nobody → peter.a.jaros
Status: ASSIGNED → NEW
Yep. I skimmed a bunch of the error codes and didn't see anything else obvious that we should filter, so -128 looks like the only one we need to check for.
Attached patch fixSplinter Review
Stealing this, so the 1.6 list can be that much shorter ;)
Assignee: peter.a.jaros → stuart.morgan
Status: NEW → ASSIGNED
Attachment #311201 - Flags: superreview?(mikepinkerton)
Comment on attachment 311201 [details] [diff] [review]
fix

sr=pink
Attachment #311201 - Flags: superreview?(mikepinkerton) → superreview+
Landed on trunk and MOZILLA_1_8_BRANCH.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: fixed1.8.1.13
Resolution: --- → FIXED
Sorry for the delinquency.  Thanks Stuart! :)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: