Closed Bug 580652 Opened 14 years ago Closed 14 years ago

Js error in HUD: container is undefined

Categories

(DevTools :: General, defect)

3.5 Branch
x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 579954

People

(Reporter: ehsan.akhgari, Unassigned)

Details

STR:

1. Open HUD.
2. Reload my gmail tab.

I see this on the console:

Error: container is undefined
Source File: resource://gre/modules/HUDService.jsm
Line: 1429

The code is pointing to:

http://mxr.mozilla.org/mozilla-central/source/toolkit/components/console/hudservice/HUDService.jsm#1429
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Why is this bug marked as duplicate of bug 579954? Bug 579954 deals with the issue, that the gBrowser variable can't be accessed all the time. The error message for this bug is "container is undefined".

I can reproduce the bug in an different situation.

1. Open the Error console
2. Click on a link to an source file that appears in one of the warnings/errors
3. A window pops up showing the source line of the warning/error and I get an error in the Error Console "container is undefined"

This error message doesn't show up anymore, after I apply this simple patch, that checks if the container is defined or not:


diff --git a/toolkit/components/console/hudservice/HUDService.jsm b/toolkit/components/console/hudservice/HUDService.jsm
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -1419,16 +1419,19 @@ HUD_SERVICE.prototype =
       return;
     }
 
     let xulWindow = XPCNativeWrapper.unwrap(xulWindow);
     let gBrowser = xulWindow.gBrowser;
 
 
     var container = gBrowser.tabContainer;
+    if (!container) {
+      return;
+    }
     container.addEventListener("TabClose", this.onTabClose, false);
 
     if (gBrowser && !HUDWindowObserver.initialConsoleCreated) {
       HUDWindowObserver.initialConsoleCreated = true;
     }
 
     let _browser =
       gBrowser.getBrowserForDocument(aContentWindow.document.wrappedJSObject);



I think the basic issue is that a new window is created (the popup source window) but this window doesn't have a tabContainer to bind the "TabClose" event. If there is no tabContainer, that means a window was opened that is not a new tab of the main browser window (e.g. a window with a source file). In such a case, we can exit the function because such windows shouldn't be watched/have a WebConsole attached to them.
Julian, this bug was marked dupe. Either move your new test case and patch to  bug 579954 or reopen this one.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
the reason it is a dupe is because the container hangs off of the gBrowser. It may be a wrappers issue with gBrowser
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.