My favorites | Sign in
Logo
             
New issue | Search
for
| Advanced search | Search tips
Issue 2481: 'Add watch' on 2nd expression of a multi-conditional will use incorrect expression
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  sroussey
Cc:  johnjbar...@johnjbarton.com
Type-Defect
debugger
1.5
Test-case-available


Sign in to add a comment
 
Reported by Prefon...@hotmail.com, Nov 10, 2009
Please, if you don't have a test case or the time to write detailed
instructions on how to reproduce your problem, then post to the newsgroup,
http://groups.google.com/group/firebug. We can only fix bugs that we can
reproduce exactly the way you see the problem.

What steps will reproduce the problem?
1.  open up addwatch.html
2.  set a breakpoint on the conditional statement
3.  click 'do test' button
4.  when it breaks, try to add a watch on the 'document.get...' expression.
5.  the incorrect expression will get added, causing it to display a syntax
error

What is the expected result? What do you see instead?

If i highlight 'document.getElementById("button1")' and add a watch for it,
the added watch is '&p; document.getElementById("b'.


Which version of Firebug? (more specific than latest please): 1.5b3
Which version of Firefox? 3.5.5
On what operating system? Windows XP


To be able to fix a bug we need a test case and detailed steps to reproduce
the problem. Please attach a small test case or public URL for one. No
matter how trivial you think a test case may be to create, we almost never
work on bugs without one.

addwatch.html
444 bytes   Download
Comment 1 by Prefon...@hotmail.com, Nov 11, 2009
I found another situation where this can occur.  With the following line:

return String.valueOf(postID).indexOf(">") != -1;

i got the syntax error when i added a watch for that line.

The issue is that it is html escaping the > symbol.
Comment 2 by johnjbar...@johnjbarton.com, Nov 11, 2009
Well yet another Firebug feature I did not know existed.

1.open addwatch.html
2. set a breakpoint on line 6 "if (1 != 2 &..."
3. click 'do test'
4. Use the mouse to select the text 'document.getElementById("button1")'
5. right click, the menu includes 'Add Watch', click it.

Loos like the underlying HTML is not properly selected from the script panel. Any
symbol that special for HTML will probably have this problem.
Status: Triaged
Cc: johnjbar...@johnjbarton.com
Labels: Type-Defect debugger 1.5 Test-case-available
Comment 3 by johnjbar...@johnjbarton.com, Nov 11, 2009
Steve maybe you know what is going on here?
Cc: sroussey
Comment 4 by sroussey, Nov 11, 2009
    getSourceLinesFrom: function(selection)
    {
        // https://developer.mozilla.org/en/DOM/Selection
        if (selection.isCollapsed)
            return "";

        var anchorSourceRow = getAncestorByClass(selection.anchorNode, "sourceRow");
        var focusSourceRow = getAncestorByClass(selection.focusNode, "sourceRow");
        if (anchorSourceRow == focusSourceRow)
        {
            return selection.toString();// trivial case
        }
        var buf = this.getSourceLine(anchorSourceRow, selection.anchorOffset);

        var currentSourceRow = anchorSourceRow.nextSibling;
        while(currentSourceRow && (currentSourceRow != focusSourceRow) &&
hasClass(currentSourceRow, "sourceRow"))
        {
            buf += this.getSourceLine(currentSourceRow);
            currentSourceRow = currentSourceRow.nextSibling;
        }
        buf += this.getSourceLine(focusSourceRow, 0, selection.focusOffset);
        
        return buf;
    },

    getSourceLine: function(sourceRow, beginOffset, endOffset)
    {
        var source = getChildByClass(sourceRow, "sourceRowText").textContent;
        if (endOffset)
            source = source.substring(beginOffset, endOffset);
        else if (beginOffset)
            source = source.substring(beginOffset);
        else
            source = source;

        return source;
    },
Comment 5 by sroussey, Nov 12, 2009
Just to be clear, the offsets from the range are on characters, not their source code
representations. So in the simple case, I just had the range return the toString()
version since it was on one line. The general case I have it use textContent instead
of innerHTML, and also removed the unescape stuff.
Comment 6 by sroussey, Nov 12, 2009
The change in comment four was added in R4822, will be in Firebug 1.5b4.
Status: Commit
Owner: sroussey
Cc: -sroussey
Comment 7 by johnjbar...@johnjbarton.com, Nov 18, 2009
This is one of 26 fixes in Firebug 1.5X.0b4. Please try the new release and
let us know if this problem is solved.
http://getfirebug.com/releases/firebug/1.5X
Status: Fixed
Sign in to add a comment

Hosted by Google Code