Last Comment Bug 867567 - JavaScript Error: "TypeError: focused is null" {file: "chrome://browser/content/browser.js" line: 1205}
: JavaScript Error: "TypeError: focused is null" {file: "chrome://browser/conte...
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: unspecified
: All Android
-- normal (vote)
: Firefox 24
Assigned To: Marcos A. Di Pietro
: general
: Sebastian Kaspari (:sebastian)
Depends on:
Blocks: 864926 725018
  Show dependency treegraph
Reported: 2013-05-01 06:53 PDT by (away until Feb21) Kartikaya Gupta (
Modified: 2013-06-10 02:15 PDT (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch v1 (1.13 KB, patch)
2013-06-07 09:08 PDT, Marcos A. Di Pietro
bugmail: review+
Details | Diff | Splinter Review

Description User image (away until Feb21) Kartikaya Gupta ( 2013-05-01 06:53:19 PDT
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 User image :Margaret Leibovic 2013-05-01 17:31:28 PDT
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.
Comment 2 User image Jamie Hewland 2013-05-02 14:28:06 PDT
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?

Comment 3 User image :Margaret Leibovic 2013-05-06 12:41:27 PDT
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.
Comment 4 User image Wesley Johnston (:wesj) 2013-05-06 12:57:30 PDT
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.
Comment 5 User image (away until Feb21) Kartikaya Gupta ( 2013-05-21 06:46:10 PDT
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.
Comment 6 User image Marcos A. Di Pietro 2013-06-07 07:58:16 PDT
Kartikaya, I would like to work on this. Could you please assign me the bug?
Comment 7 User image Marcos A. Di Pietro 2013-06-07 09:08:01 PDT
Created attachment 759778 [details] [diff] [review]
Patch v1
Comment 8 User image (away until Feb21) Kartikaya Gupta ( 2013-06-07 10:40:52 PDT
Comment on attachment 759778 [details] [diff] [review]
Patch v1

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

Looks good, thanks!
Comment 9 User image Ryan VanderMeulen [:RyanVM] 2013-06-07 12:24:33 PDT
Comment 10 User image Ed Morley [:emorley] 2013-06-10 02:15:46 PDT

Note You need to log in before you can comment on or make changes to this bug.