Closed Bug 642528 Opened 13 years ago Closed 12 years ago

Exception in HUDService.jsm, aWindow is null

Categories

(DevTools :: Console, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wes, Unassigned)

References

Details

(Whiteboard: [console-1])

Error: aWindow is null
Source File: resource:///modules/HUDService.jsm
Line: 1318

I keep getting these messages popping up, seemingly randomly but not too frequently, in my JavaScript console.  I haven't been able to reliably repro yet. I'm just doing regular web-dev tasks with the Web Console open a lot.
Right. The mechanism that adds the WindowID to the nsIScriptError allows for nulls. In some cases, the window ID is unidentifiable. We should perhaps move this bug to core/dom - actually I am not sure. msucan will know.
Whiteboard: [dupeme] [console-1]
David is correct. Window IDs are not always available and they can't realistically be always available.

Still, this bug report is a valid one. We shouldn't throw.

Having checked the source code ... this is not a core/dom issue, not even an issue related to the lack of window IDs.

We pass null to the HUDService.getWindowId() method. So, we are mistaken in believing we have a window object in the first place. We need to fix it.

Wesley: please try to provide us with steps to reproduce. I haven't seen this error.
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [dupeme] [console-1] → [console-1]
Wesley: a hint from a quick look into the code: could be network related. Try playing with network requests - loading pages, scripts, images, flash, plugins, perhaps AJAX requests - anything. I have a hunch the bug is in that part of the code.
I think your instincts are good, Mihai;

What I've learned so far is that if I bang the reload button enough times on the chat application I am currently developing, I will eventually see this error, provided I am running the web console. It comes two at a time, and is often preceeded by a pair of these errors:

Error: attempt to run compile-and-go script on a cleared scope
Source File: http://ape.wes.msgs.net/APE_JSF//Source/mootools-core.js
Line: 1202

I talked to bz about the compile-and-go errors on a cleared scope about a week ago in #jsapi, and he tells me essentially that the error message itself is a bug, I guess this can happen legitimately during window close and reload.  Copying bz so maybe he can comment on this part.

I don't think there is anything special about the mootools-core.js script (latest MooTools framework), it's the second script loaded by the application, right after BravoJS (my CommonJS module system).  BravoJS hooks window.onerror FWIW.

(I can arrange access through our firewall for short-term access to this app if needed. I'm also trying to find a public site using APE that also exhibits this bug, since APE is the Comet server/framework I'm using)

Anyhow, what the app is doing at this point is loading a whole pile of resources (so the web console is quite busy) and then it establishes an XHR long-poll ("Comet") connection the server, and receives a few messages (like what rooms to join, who is in the rooms).

The protocol might not be stacking the messages as efficiently as possible, there might a bunch of small XHRs happening in quick succession before the first really long poll engages itself -- it's a bit tough to sort out, as there are several layers of abstraction between between myself and the bare browser-metal.

So, I don't have a test case (and don't think a small one will be easy), but this gives us a little more information.  FWIW, once it happens once, it is very easy to get it to happen again (like, every time).
That error about cleared scopes basically means script is running on an already-closed window...
Component: Developer Tools → Developer Tools: Console
There have been a ton of changes to the Web Console. This error no longer shows. Please reopen if you find otherwise. Thanks!
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.