JavaScript Error: "TypeError: focused is null" {file: "chrome://browser/content/browser.js" line: 1205}

RESOLVED FIXED in Firefox 24

Status

()

Firefox for Android
General
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: kats, Assigned: Marcos A. Di Pietro)

Tracking

(Blocks: 1 bug)

unspecified
Firefox 24
All
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [lang=js][mentor=kats])

Attachments

(1 attachment)

This line of code in browser.js:

if  (focused instanceof HTMLTextAreaElement || focused.isContentEditable) {

causes the script error noted in the summary when focused is null. Should be an easy fix for somebody looking for a good first bug.

Comment 1

4 years ago
This was reported in bug 864926, although the description in that bug points to the wrong line of code. Setting this bug to block that one, since there was another error reported in there as well.
Blocks: 864926

Comment 2

4 years ago
Hi there,

I've been speaking to people on the IRC channel and this bug was suggested as a good first bug to tackle. I've had a look into it but am unable to reproduce the error. It's clear to me what is going wrong here, just I don't see it going wrong on my device. I do get the "Only internal code is allowed..." error described in bug 864926 when I open a new private tab, though. How do I go about reproducing this script error?

Is the intention here to work out why focused is null or simply do a 
if (!focused) return null 
catch either before or after the HTMLFrameElement search/traveral?

Thanks...

Comment 3

4 years ago
Hi Jamie, thanks for showing interest in this bug.

It sounds to me like we just need a null check. kats is on vacation right now, but maybe wesj can help you out with this bug, since he has also worked on this code.
Flags: needinfo?(wjohnston)
Yeah. Glancing at the code, it looks like we DO expect getFocusedInput to return null sometimes. I'm also having trouble reproducing it, but the null check seems like a good idea.
Flags: needinfo?(wjohnston)
Hi Jamie, sorry for the delayed response; I was on vacation. But yeah as wesj said getFocusedInput can return null, and so we just need to modify the if condition I posted above to include a null check.
(Assignee)

Comment 6

4 years ago
Kartikaya, I would like to work on this. Could you please assign me the bug?

Updated

4 years ago
Assignee: nobody → marcosadp
(Assignee)

Comment 7

4 years ago
Created attachment 759778 [details] [diff] [review]
Patch v1
Attachment #759778 - Flags: review?(bugmail.mozilla)
Comment on attachment 759778 [details] [diff] [review]
Patch v1

Review of attachment 759778 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks!
Attachment #759778 - Flags: review?(bugmail.mozilla) → review+
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/2882222d290a
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2882222d290a
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 24
You need to log in before you can comment on or make changes to this bug.