Closed Bug 553697 Opened 14 years ago Closed 14 years ago

JavaScript error "_content is null" in console.xul (Error Console)

Categories

(Other Applications :: DOM Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mnyromyr, Assigned: crussell)

References

Details

Attachments

(2 files, 4 obsolete files)

Hitting ctrl-shift-I in the Error Console will result in
  Error: _content is null
  Source File: chrome://global/content/console.xul
  Line: 1
and no DOM Inspector window. 
Using the menuitem mousically works as inspected.
In the DOM Inspector tasksOverlay.xul
change:

    <command id="Tasks:InspectPage" oncommand="inspectDOMDocument(_content.document);"/> 

To:

    <command id="Tasks:InspectPage"
             oncommand="inspectDOMDocument(content ? content.document : document);"/>

1. The TB overlay needs to be changed too.
2 s/_content/content/g for all DOMi files.
Component: Error Console → DOM Inspector
OS: Linux → All
Product: SeaMonkey → Other Applications
QA Contact: error-console → dom-inspector
Hardware: x86 → All
What application does this occur in?
> What application does this occur in?
SeaMonkey 2.0.3.

Because the DOM Inspector Overlay is pulled into several windows including the Error Console. Ctrl-Shift-I works in those windows. Except that for the SeaMonkey windows that do not have a content window (Error Console, Download Manager), "content" (or "_content") is null.
I originally filed this for SeaMonkey trunk, but it also happens in current SeaMonkey releases, i.e. "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100205 Mnenhy/0.8.0pre3 SeaMonkey/2.0.3".
I also changed the js to uniformly use XPCU. XULNS const isn't necessary, we already have kXULNSURI const from utils.js. Transaction manager interface constant from utils.js isn't needed anymore, either.
Assignee: nobody → Sevenspade
Status: NEW → ASSIGNED
Attachment #449956 - Flags: review?(sdwilsh)
(In reply to comment #1)
>     <command id="Tasks:InspectPage"
> oncommand="inspectDOMDocument(_content.document);"/> 
> 
> To:
> 
>     <command id="Tasks:InspectPage"
>              oncommand="inspectDOMDocument(content ? content.document :
> document);"/>
> 
> 1. The TB overlay needs to be changed too.

I didn't do a non-null check part for the Thunderbird overlay. Do we need to? is mailWindowOverlay.xul applicable anywhere outside of the main window or the view message window, and if so, is it expected that window.content could be null there?
Attachment #449958 - Flags: review?(sdwilsh)
Attachment #449958 - Flags: feedback?
Attachment #449958 - Flags: feedback? → feedback?(philip.chee)
Correct attachment this time. Also, the changes from the second patch aren't in here so that the change is easier to see. I think Neil thinks these kinds of patches are silly (where I change one line, only to change it again in a subsequent patch).
Attachment #449956 - Attachment is obsolete: true
Attachment #449956 - Flags: review?(sdwilsh)
Attachment #449963 - Flags: review?(sdwilsh)
Comment on attachment 449963 [details] [diff] [review]
 inspector.js, sidebar.js, tasksOverlay.xul, and tasksOverlay-tb.xul cleanup

>+// dump text to the Error Console
> function debug(aText)
> {
>   // XX comment out to reduce noise
>-  consoleDump(aText);
>-  //dump(aText);
>-}
>-
>-// dump text to the Error Console
>-function consoleDump(aText)
>-{
>-  var csClass = Components.classes['@mozilla.org/consoleservice;1'];
>-  var cs = csClass.getService(Components.interfaces.nsIConsoleService);
>+  XPCU.getService("@mozilla.org/consoleservice;1", "nsIConsoleService");
>   cs.logStringMessage(aText);
> }
Shouldn't this be var cs = XPCU... ?
Attachment #449963 - Attachment is obsolete: true
Attachment #449982 - Flags: review?(sdwilsh)
Attachment #449963 - Flags: review?(sdwilsh)
Comment on attachment 449958 [details] [diff] [review]
check for non-null content in SeaMonkey overlay

> -             oncommand="inspectDOMDocument(content.document);"/>
> +             oncommand="inspectDOMDocument(content ? content.document : content);"/>

Err, typo? Should be:
(content ? content.document : document)

f+=me with that fixed.

> I didn't do a non-null check part for the Thunderbird overlay. Do we need to?
> is mailWindowOverlay.xul applicable anywhere outside of the main window or the
> view message window, and if so, is it expected that window.content could be
> null there?
Good point. A quick MXR says no but, please check with a Thunderbird peer.
Attachment #449958 - Flags: feedback?(philip.chee) → feedback+
I didn't get an authoritative answer, but Thunderbird on OS X is kind of wonky anyway. I changed it to check for the existence of content just to be safe.
Attachment #449958 - Attachment is obsolete: true
Attachment #451791 - Flags: review?(sdwilsh)
Attachment #451791 - Flags: feedback+
Attachment #449958 - Flags: review?(sdwilsh)
I should have moved the kInspectorTitle const out of the "Global Variables" section when I did cleanup.
Attachment #449982 - Attachment is obsolete: true
Attachment #451795 - Flags: review?(sdwilsh)
Attachment #449982 - Flags: review?(sdwilsh)
Comment on attachment 451791 [details] [diff] [review]
check for content in tasksOverlay.xul (SeaMonkey) and tasksOverlay-tb.xul

r=sdwilsh
Attachment #451791 - Flags: review?(sdwilsh) → review+
Comment on attachment 451795 [details] [diff] [review]
inspector.js, sidebar.js, tasksOverlay.xul, and tasksOverlay-tb.xul cleanup mkII

r=sdwilsh
Attachment #451795 - Flags: review?(sdwilsh) → review+
Attachment #451791 - Flags: superreview?(neil)
Attachment #451791 - Flags: superreview?(neil) → superreview+
Pushed:
http://hg.mozilla.org/dom-inspector/rev/686ee0326ae8
http://hg.mozilla.org/dom-inspector/rev/828cbd52007b
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: