Broken if statements.

45 views
Skip to first unread message

Freman

unread,
Jul 21, 2008, 10:03:23 PM7/21/08
to Firebug
G'day there.

I've managed to reproduce a bug that I've been having while debugging
with 1.2.0b6 in Firefox 3.0 on Linux (I admit to having not tried it
on Windows)

Code: http://pastebin.com/f3c17e463
Live: http://www.users.on.net/~freman/firebug-test.html

When run with script debugger and console enabled, and click on
testBug(), it works fine.

However, when you place a breakpoint on line 16 it fails (strings do
not match)
To further isolate the bug, I built the object a different way -
noBugHere(), if you place a breakpoint on line 31, it does not fail.

Can anyone confirm this bug?

Or is it just me?

Application: Firefox 3.0 (2008060309)
Operating System: Linux (x86-gcc3)

- Adblock Filterset.G Updater 0.3.1.3
- Adblock Plus 0.7.5.5
- CustomizeGoogle 0.72
- Delicious Bookmarks 2.0.72
- EditCSS 0.3.7
- Extension List Dumper 1.14.1
- Firebug 1.2.0b6
- Google Notebook 1.0.0.20
- Google Web Comments 1.4.20070529.0
(Disabled, Incompatible)
- Greasemonkey 0.8.20080609.0
- HttpFox 0.8.2
- iMacros for Firefox 6.0.5.4
(Disabled)
- It's All Text! 0.8.5
- Line Marker 2.0.2008040702
(Disabled)
- Live HTTP headers 0.14
- MeasureIt 0.3.8
- NoScript 1.7.7
- SQLite Manager 0.3.4
- Tamper Data 10.0.4
- Ubuntu Firefox Modifications 0.5
- Vimperator 1.1
(Disabled)
- Xdebug Helper 0.3
- YSlow 0.9.5b2
(Disabled)

Freman

unread,
Jul 22, 2008, 12:51:54 AM7/22/08
to Firebug
Ok, a little more testing and I can confirm that it's also a problem
in Firefox/Visa (for me)

Any one else?

Application: Firefox 3.0 (2008052906)
Operating System: WINNT (x86-msvc)

- Adblock Plus 0.7.5.5
- Bookmark Permissions 08.05.19.02
- ColorZilla 2.0
- CustomizeGoogle 0.72
- Delicious Bookmarks 2.0.72
- Extension List Dumper 1.14.1
- Firebug 1.2.0b6
- Flash Video Resources Downloader 1.0.1
- Google Browser Sync 1.3.20070523.0
(Disabled, Incompatible)
- Google Notebook 1.0.0.20
- Greasemonkey 0.8.20080609.0
- gui:config 0.3.7
- Header Spy 1.3.2.2
- Java Console 6.0.01
- Live HTTP Headers 0.14
- Minimize To Tray Enhancer 0.7.5.3
- MinimizeToTray 0.0.1.2006102615+
(Disabled, Incompatible)
- Sage 1.4.2
- User Agent Switcher 0.6.11
- Validaty 1.4.1
- VeriSign's OpenID SeatBelt 1.0.0.3623

John J Barton

unread,
Jul 22, 2008, 1:07:14 AM7/22/08
to Firebug
I do get different results depending on whether the debugger breaks or
not. That can't be a good thing.

If I break at line 16 and put
aObject.aString === "Hello World"
in the Watch expression it says "true". It continues to say true when
I single step.

If I set a breakpoint on 19, stop at 16, then Go, I break at 19 with
"true".

This suggests that the test is ok, but the control flow is broken. Can
you try it with more lines of code in the if /else blocks?

John.

Freman

unread,
Jul 23, 2008, 6:21:18 PM7/23/08
to Firebug
I have expanded my test to further test equality.

Code: http://pastebin.com/f441a494a
Live: http://www.users.on.net/~freman/firebug-test.html

A break on line 16 still results in a true test.
A break on line 17 results in a false test while line 22 still returns
true.

Is this about the time I make an official bug report?

Freman

unread,
Jul 23, 2008, 6:34:30 PM7/23/08
to Firebug
Further to the test above, I've just tried something different.

I negated the if statement by changing line 17 to
if (aObject.aString !== "Hello World") {

Now by placing a breakpoint at line 17 it goes into the if statement
while it should be jumping to else

This shows that the break points are completely inverting the result
of if statements.

Freman

unread,
Jul 23, 2008, 6:45:20 PM7/23/08
to Firebug
Here is a new test that contains all the checks I've done so far
http://pastebin.com/f398032e8
http://www.users.on.net/~freman/firebug-test3.html (The link for the
one above is supposed to be http://www.users.on.net/~freman/firebug-test2.html
but this file contains that test now anyway)

Note for the noBugHere() test, the only difference is that the object
is created in the function and not passed to the function...

You should be able to completely negate the output of if by breaking
on lines 18 and 26.

John J Barton

unread,
Jul 24, 2008, 1:28:58 AM7/24/08
to Firebug
Please post your example to http://code.google.com/p/fbug/issues/list.
Ideally add your comments above the buttons (and make them buttons so
we don't have to guess ;-). Then we'll take this up with Firefox
folks. My guess now, based on your excellent bug/noBug isolation is a
problem caused by FF3 security mechanism but I'm just guessing...

On Jul 23, 3:45 pm, Freman <fre...@gmail.com> wrote:
> Here is a new test that contains all the checks I've done so farhttp://pastebin.com/f398032e8http://www.users.on.net/~freman/firebug-test3.html(The link for the
> one above is supposed to behttp://www.users.on.net/~freman/firebug-test2.html

Rako

unread,
Jul 24, 2008, 4:53:55 AM7/24/08
to Firebug
In my experience, it is just the line-indicator that is playing up!
In many "if" statements, if the result is false, the indicator jumps
to the last of the statements of depending on the if-condition.

Try to have a function-call as the last statment and step-through. You
will find, that the function is NOT called.
The "current-statement"-indicator seems to have a life of its own.
It is shown on lines never stepped through, etc.

On Jul 24, 12:45 am, Freman <fre...@gmail.com> wrote:
> Here is a new test that contains all the checks I've done so farhttp://pastebin.com/f398032e8http://www.users.on.net/~freman/firebug-test3.html(The link for the
> one above is supposed to behttp://www.users.on.net/~freman/firebug-test2.html
> > > > >         (Disabled)- Hide quoted text -
>
> - Show quoted text -

John J Barton

unread,
Jul 25, 2008, 12:31:34 AM7/25/08
to Firebug
Except that the test case shows, by print statements, that the
debugger changes the output.

On Jul 24, 1:53 am, Rako <mscam...@rakovszky.info> wrote:
> In my experience, it is just the line-indicator that is playing up!
> In many "if" statements, if the result is false, the indicator jumps
> to the last of the statements of depending on the if-condition.
>
> Try to have a function-call as the last statment and step-through. You
> will find, that the function is NOT called.
> The "current-statement"-indicator seems to have a life of its own.
> It is shown on lines never stepped through, etc.
>
> On Jul 24, 12:45 am, Freman <fre...@gmail.com> wrote:
>
> > Here is a new test that contains all the checks I've done so farhttp://pastebin.com/f398032e8http://www.users.on.net/~freman/firebug-...link for the
Reply all
Reply to author
Forward
0 new messages