Bug 613806 - alert(), confirm(), prompt() dont play system alert sounds. r=gavin, a=gavin
authorJustin Dolske <dolske>
Sun, 21 Nov 2010 18:38:00 -0800
changeset 58208 b890963a137e17289bad18cf5c532996d9a3205d
parent 58207 0a29ac059eb580261f1b9401161a4c095d0c1bec
child 58209 34447b39697a5452ea6d15f186d1f79d207fa7c2
push id17202
push userjdolske@mozilla.com
push dateThu, 25 Nov 2010 01:45:08 +0000
treeherdermozilla-central@34447b39697a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, gavin
bugs613806
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 613806 - alert(), confirm(), prompt() dont play system alert sounds. r=gavin, a=gavin
toolkit/components/prompts/src/CommonDialog.jsm
--- a/toolkit/components/prompts/src/CommonDialog.jsm
+++ b/toolkit/components/prompts/src/CommonDialog.jsm
@@ -210,24 +210,26 @@ CommonDialog.prototype = {
             // Use a longer, pref-controlled delay when the dialog is first opened.
             let delayTime = Services.prefs.getIntPref("security.dialog_enable_delay");
             this.startOnFocusDelay(delayTime);
             let self = this;
             this.ui.focusTarget.addEventListener("blur",  function(e) { self.onBlur(e);  }, false);
             this.ui.focusTarget.addEventListener("focus", function(e) { self.onFocus(e); }, false);
         }
 
-        // play sound
+        // Play a sound (unless we're tab-modal -- don't want those to feel like OS prompts).
         try {
-            if (this.soundID) {
+            if (xulDialog && this.soundID) {
                 Cc["@mozilla.org/sound;1"].
                 createInstance(Ci.nsISound).
-                playEventSound(soundID);
+                playEventSound(this.soundID);
             }
-        } catch (e) { }
+        } catch (e) {
+            Cu.reportError("Couldn't play common dialog event sound: " + e);
+        }
 
         let topic = "common-dialog-loaded";
         if (!xulDialog)
             topic = "tabmodal-dialog-loaded";
         Services.obs.notifyObservers(this.ui.prompt, topic, null);
     },
 
     setLabelForNode: function(aNode, aLabel) {