aboutsummaryrefslogtreecommitdiff
path: root/www/firefox35/files/patch-extensions_typeaheadfind_src_nsTypeAheadFind.cpp
blob: 0a2fa7daac00c20348f1babffa21ba0e6eae7b6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$FreeBSD$

--- extensions/typeaheadfind/src/nsTypeAheadFind.cpp.orig	Wed Nov 19 01:20:47 2003
+++ extensions/typeaheadfind/src/nsTypeAheadFind.cpp	Tue Feb 10 02:52:26 2004
@@ -323,11 +323,11 @@
   prefBranch->GetBoolPref("accessibility.typeaheadfind.startlinksonly",
                           &mStartLinksOnlyPref);
 
-  PRBool isSoundEnabled = PR_TRUE;
+  mIsSoundEnabled = PR_TRUE;
   prefBranch->GetBoolPref("accessibility.typeaheadfind.enablesound",
-                           &isSoundEnabled);
+                           &mIsSoundEnabled);
   nsXPIDLCString soundStr;
-  if (isSoundEnabled) {
+  if (mIsSoundEnabled && mIsSoundEnabled) {
     prefBranch->GetCharPref("accessibility.typeaheadfind.soundURL",
                              getter_Copies(soundStr));
   }
@@ -758,7 +758,7 @@
     }
     else {
       // No find string to backspace in!
-      if (mIsBackspaceProtectOn) {
+      if (mIsBackspaceProtectOn && mIsSoundEnabled) {
         // This flag should be on only if the last key was a backspace.
         // It keeps us from accidentally hitting backspace too many times and
         // going back in history when we really just wanted to clear 
@@ -1012,7 +1012,9 @@
 
     // Error sound (don't fire when backspace is pressed, they're 
     // trying to correct the mistake!)
-    PlayNotFoundSound();
+    if (mIsSoundEnabled) {
+      PlayNotFoundSound();
+    }
 
     // Remove bad character from buffer, so we can continue typing from
     // last matched character
@@ -1059,7 +1061,7 @@
 void
 nsTypeAheadFind::PlayNotFoundSound()
 {
-  if (mNotFoundSoundURL.IsEmpty())    // no sound
+  if (mNotFoundSoundURL.IsEmpty() || !mIsSoundEnabled)    // no sound
     return;
   if (!mSoundInterface) {
     mSoundInterface = do_CreateInstance("@mozilla.org/sound;1");