Misc null error in browser.js

RESOLVED FIXED in Firefox 27

Status

()

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

People

(Reporter: capella, Assigned: capella)

Tracking

unspecified
Firefox 27
ARM
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

4 years ago
Created attachment 807080 [details] [diff] [review]
bugnull

This one has been annoying me for awhile ... just start the browser and watch the log, you'll get:

Error: "BrowserApp.selectedBrowser is null" {file: "chrome://browser/content/browser.js" line: 5122}]

fyi ... originally added in bug 738848 ...

Thought to just add a null check and handle it gracefully ...
Attachment #807080 - Flags: review?(bnicholson)
Comment on attachment 807080 [details] [diff] [review]
bugnull

I'd like to know why BrowserApp.selectedBrowser is null in a "pageshow" event handler? Is the load happening so fast that we never had time to set the selectedTab property?

Can we add some debugging dumps to the code to see what the code path is?
(Assignee)

Comment 2

4 years ago
Ouch ... my dev machine just died and is on it's way back to lenovo ... I'll get back to this in a week or so :-(
(Assignee)

Comment 3

4 years ago
Created attachment 808266 [details] [diff] [review]
bug918222 - DEBUG code

The attached DEBUG patch shows the following trace ... 

If I've done it right, it seems the initial |set selectedTab()| is performed after the FormAssistant.handleEvent(pageshow) is triggered, by a call to |this.browser.stop()| in Tab.create(about:home) at startup here: http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#2617

I/XYZZY   (15312): nsDocument::OnPageShow() calls DispatchPageTransition(target, NS_LITERAL_STRING('pageshow'), aPersisted)

E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - startup()" {file: "chrome://browser/content/browser.js" line: 263}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - init()" {file: "chrome://browser/content/browser.js" line: 4990}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tabs - init()" {file: "chrome://browser/content/browser.js" line: 7820}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - initContextMenu()" {file: "chrome://browser/content/browser.js" line: 410}]
I/XYZZY   (15312): nsDocument::OnPageShow() calls DispatchPageTransition(target, NS_LITERAL_STRING('pageshow'), aPersisted)
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - observe(PanZoom:StateChange)" {file: "chrome://browser/content/browser.js" line: 5019}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - observe(Tab:Load)" {file: "chrome://browser/content/browser.js" line: 1298}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - addTab(about:home)" {file: "chrome://browser/content/browser.js" line: 806}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - create(about:home)" {file: "chrome://browser/content/browser.js" line: 2577}]

E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - create(about:home) about to: this.browser.stop()" {file: "chrome://browser/content/browser.js" line: 2608}]
I/XYZZY   (15312): nsDocument::OnPageShow() calls DispatchPageTransition(target, NS_LITERAL_STRING('pageshow'), aPersisted)
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - handleEvent(pageshow)" {file: "chrome://browser/content/browser.js" line: 5087}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - handleEvent(pageshow) ***** THIS IS WHERE IT FAILS *****" {file: "chrome://browser/content/browser.js" line: 5142}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - create(about:home) after:    this.browser.stop()" {file: "chrome://browser/content/browser.js" line: 2610}]

E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - create(about:home) FINISHES" {file: "chrome://browser/content/browser.js" line: 2716}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - set selectedTab([object Object]) STARTS   <<<" {file: "chrome://browser/content/browser.js" line: 696}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - handleEvent(focus)" {file: "chrome://browser/content/browser.js" line: 5087}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - handleEvent(focus)" {file: "chrome://browser/content/browser.js" line: 5087}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - set selectedTab([object Object]) FINISHES >>>" {file: "chrome://browser/content/browser.js" line: 717}]

E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - observe(Tab:Selected)" {file: "chrome://browser/content/browser.js" line: 1298}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - set selectedTab([object Object]) STARTS   <<<" {file: "chrome://browser/content/browser.js" line: 696}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - handleEvent(DOMLinkAdded)" {file: "chrome://browser/content/browser.js" line: 3317}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - handleEvent(DOMTitleChanged)" {file: "chrome://browser/content/browser.js" line: 3317}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - handleEvent(DOMContentLoaded)" {file: "chrome://browser/content/browser.js" line: 3317}]
I/XYZZY   (15312): nsDocument::OnPageShow() calls DispatchPageTransition(target, NS_LITERAL_STRING('pageshow'), aPersisted)
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - handleEvent(pageshow)" {file: "chrome://browser/content/browser.js" line: 3317}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - handleEvent(pageshow)" {file: "chrome://browser/content/browser.js" line: 5087}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - handleEvent(MozScrolledAreaChanged)" {file: "chrome://browser/content/browser.js" line: 3317}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - handleEvent(focus)" {file: "chrome://browser/content/browser.js" line: 5087}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *FormAssistant - handleEvent(focus)" {file: "chrome://browser/content/browser.js" line: 5087}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *Tab - handleEvent(MozScrolledAreaChanged)" {file: "chrome://browser/content/browser.js" line: 3317}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - observe(Viewport:Change)" {file: "chrome://browser/content/browser.js" line: 1298}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - observe(Viewport:Change)" {file: "chrome://browser/content/browser.js" line: 1298}]
E/GeckoConsole(15312): [JavaScript Error: "XYZZY *BrowserApp - observe(Viewport:Change)" {file: "chrome://browser/content/browser.js" line: 1298}]
Attachment #807080 - Attachment is obsolete: true
Attachment #807080 - Flags: review?(bnicholson)
(Assignee)

Comment 4

4 years ago
Created attachment 809001 [details] [diff] [review]
bug918222 (v1)

This looks like it get's it perfectly ... in testing, the check for |if (this._invalidSubmit)| obviates the null check ... but I left it in also.
Attachment #809001 - Flags: review?(mark.finkle)
Comment on attachment 809001 [details] [diff] [review]
bug918222 (v1)

Could you switch to this:

> if (!this._invalidSubmit)
>   return;
>
> let selectedBrowser = BrowserApp.selectedBrowser;

to reduce the number of indents. It's my own preference.
Attachment #809001 - Flags: review?(mark.finkle) → review+
(Assignee)

Comment 6

4 years ago
Tweaked ... pushed to try ...
https://tbpl.mozilla.org/?tree=Try&rev=db729ce818e7
https://hg.mozilla.org/mozilla-central/rev/46af6ec04b78
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
You need to log in before you can comment on or make changes to this bug.