Opened 13 years ago

Closed 13 years ago

#1648 closed defect (wontfix)

[patch] [CLA needed] Bug fix for dojo.debugDeep() under Firefox 1.5

Reported by: guest Owned by: Becky Gibson
Priority: high Milestone: 0.9
Component: General Version: 0.3
Keywords: Cc: alexander.klimetschek@…
Blocked By: Blocking:

Description

Under Firefox 1.5, dojo.debugDeep() would die complaining about obj having no properties at line 275 in src/debug/deep.html when something attempted to call getConstructorClass(). The solution was to add this snippet of code:

        var noProps = 1;
        for(var prop in obj) {
                noProps = 0;
                break;
        }
        if (noProps) return;

Thus, the new getConstructorClass() function in src/debug/deep.html (which now works under Firefox 1.5) looks like this:

function getConstructorClass(obj){

        var noProps = 1;
        for(var prop in obj) {
                noProps = 0;
                break;
        }
        if (noProps) return;

        if (!obj.constructor || !obj.constructor.toString) return;

        var m = obj.constructor.toString().match(/functions*(w+)/);

        if (m && m.length == 2) return m[1];

        return null;
}

Also (just to be pedantic about things) shouldn't "!obj.constructor || !obj.constructor.toString" actually be "!obj.constructor || !obj.constructor.toString()"?

Change History (8)

comment:1 Changed 13 years ago by dylan

Milestone: 0.4.1

comment:2 Changed 13 years ago by guest

I have found that the 'obj' argument passed to the function getConstructorClass in src/debug/deep.html can be null. For this case the error that gets generated also complains about obj having no properties. I made the following change to overcome this bug...

[was]

if (!obj.constructor
!obj.constructor.toString) return;

[updated to]

if (!obj
!obj.constructor !obj.constructor.toString) return;

... I am running Firefox 2.0 rc2.

comment:3 Changed 13 years ago by guest

I obviously should have previewed my previous submit as the formating of the code snippit I included came out badly. Hopefully the following is legible and more useful ...

before:

if (!obj.constructor || !obj.constructor.toString) return;

after:

if (!obj || !obj.constructor || !obj.constructor.toString) return;

comment:4 Changed 13 years ago by bill

Milestone: 0.4.10.5
Summary: Bug fix for dojo.debugDeep() under Firefox 1.5[patch] [CLA needed] Bug fix for dojo.debugDeep() under Firefox 1.5

Who wrote this bug report? We need to a CLA (www.dojotoolkit.org/icla.txt) in order to process it. Also, why is it assigned as Accessibility?

comment:5 Changed 13 years ago by guest

It was assigned to Accessibility because there was no documentation on what type of bug gets assigned where; and there was no "Debugger" category; and I could not access the deep debugging feature... So that must mean it gets assigned to Accessibility, right? :-P

comment:6 Changed 13 years ago by Adam Peller

Component: AccessibilityGeneral
Resolution: invalid
Status: newclosed

no cla

comment:7 Changed 13 years ago by guest

Resolution: invalid
Status: closedreopened

Working with Firefox 2.0.0.3 here, having the same problem. It is a big deal, since in most cases, where you want to do a debugDeep(), there might be a null object in the object tree. This bug breaks the display completely, seeing nothing in the popup window.

So here is *my* patch in src/debug/deep.html, function getConstructorClass(obj):

if (!obj || !obj.constructor || !obj.constructor.toString) return;

The !obj condition is new.

License of the patch is given to the dojo project.

Alexander Klimetschek (alexander <dot> klimetschek <at> mindquarry.com)

comment:8 Changed 13 years ago by Adam Peller

Cc: alexander.klimetschek@… added
Resolution: wontfix
Status: reopenedclosed

Hi Alexander. dojo.debug* is being replaced by firebug console.* APIs for 0.9, so this is being marked as wontfix.

FYI, you will need to actually file a CLA in order for us to use patches.

Note: See TracTickets for help on using tickets.