Closed Bug 135196 Opened 22 years ago Closed 22 years ago

F7 to toggle browse-with-caret hits a JS error

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P1)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED
mozilla1.0

People

(Reporter: jruderman, Assigned: aaronlev)

Details

(Keywords: embed, Whiteboard: [adt2])

Attachments

(1 file, 1 obsolete file)

When I press F7 in 2002 040303, nothing happens in the browser window, and the
following appears on the JS console:

Error: uncaught exception: [Exception... "Component returned failure code:
0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getBoolPref]"  nsresult:
"0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: <unknown filename> ::
onxblkeypress :: line 4"  data: no]
Strange. Can you look in your all.js file and see if it has the lines:
pref("accessibility.browsewithcaret", false);
pref("accessibility.warn_on_browsewithcaret", true);

Is this a downloaded binary build or compiled from source?
umm... no matter what the default all.js is, distributors can configure it. 
Code should always wrap get*Pref calls in try/catch
Ok, now I know. Accepting.
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.0
Interesting, I think we don't use try/catch in a lot of places where we get
prefs, for example tabbrowser.xml.
Attached patch Wraps F7 handler in try/catch. (obsolete) — Splinter Review
Still not sure why Jesse was getting exceptions. Curious whether his all.js
file has the lines I mentioned.
doesn't that just silently ignore F7 and not go into browse-with-caret mode
(since all the code is in thee try)?

I'd think that a better approach would be:

var foo = true;
try {
  foo = mPrefs.getBoolPref("accessibility.warn_on_browsewithcaret");
} catch (ex) {}
if (foo && !browseWithCaret) {
  // go on 
}

And similarly for other pref accesses.
Attachment #77518 - Attachment is obsolete: true
The 2002 040303 I tested is a nightly talkbalk zip build for Windows.  I 
installed it in a new directory, like I usually do when I get a new build.

I checked all.js and only saw
pref("accessibility.browsewithcaret", false);
Comment on attachment 77535 [details] [diff] [review]
Better patch -uses multiple try/catch's

Wouldn't it be better to have browseWithCaretOn default to "false"?  Do that
and r=bzbarsky
Attachment #77535 - Flags: review+
Done.

The reason the exception happened in the first place, is that I forgot to check
in my all.js changes! Duh.

Anyway, the try/catch is an improvement as well.
Attachment #77535 - Flags: superreview+
Comment on attachment 77535 [details] [diff] [review]
Better patch -uses multiple try/catch's

yeah, default that to false

sr=hewitt
Keywords: nsbeta1
Keywords: nsbeta1embed, nsbeta1+
Whiteboard: [adt2]
Keywords: adt1.0.0
adt1.0.0+ (on ADT's behalf) for approval for checkin.
Keywords: adt1.0.0adt1.0.0+
Comment on attachment 77535 [details] [diff] [review]
Better patch -uses multiple try/catch's

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #77535 - Flags: approval+
checked in
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
i don't see a js error when using F7. vrfy'd using 2002040510 linux comm bits.
Status: RESOLVED → VERIFIED
Component: Keyboard: Navigation → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: