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

RESOLVED FIXED

Status

Other Applications
DOM Inspector
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Karsten Düsterloh, Assigned: crussell)

Tracking

(Blocks: 1 bug)

Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 4 obsolete attachments)

(Reporter)

Description

8 years ago
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.

Comment 1

8 years ago
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?

Comment 3

8 years ago
> 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.
(Reporter)

Comment 4

8 years ago
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".
Created attachment 449956 [details] [diff] [review]
inspector.js, sidebar.js, tasksOverlay.xul, and tasksOverlay-tb.xul cleanup

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)
Created attachment 449958 [details] [diff] [review]
check for non-null content in SeaMonkey overlay

(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)
Created attachment 449963 [details] [diff] [review]
 inspector.js, sidebar.js, tasksOverlay.xul, and tasksOverlay-tb.xul cleanup

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)
Blocks: 551881, 384330
Attachment #449963 - Flags: review?(sdwilsh)

Comment 8

8 years ago
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... ?
Created attachment 449982 [details] [diff] [review]
inspector.js, sidebar.js, tasksOverlay.xul, and tasksOverlay-tb.xul cleanup
Attachment #449963 - Attachment is obsolete: true
Attachment #449982 - Flags: review?(sdwilsh)
Attachment #449963 - Flags: review?(sdwilsh)

Comment 10

8 years ago
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+
Created attachment 451791 [details] [diff] [review]
check for content in tasksOverlay.xul (SeaMonkey) and tasksOverlay-tb.xul

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)
Created attachment 451795 [details] [diff] [review]
inspector.js, sidebar.js, tasksOverlay.xul, and tasksOverlay-tb.xul cleanup mkII

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)

Updated

8 years ago
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
Last Resolved: 8 years ago
Resolution: --- → FIXED
Blocks: 565436
You need to log in before you can comment on or make changes to this bug.