Lines of code repeated/duplicated randomly in Script panel, but in server-dependent fashion

0 views
Skip to first unread message

M Gozler

unread,
Mar 24, 2010, 1:09:46 AM3/24/10
to Firebug
I am using FF 3.6 with FB 1.5.2 for developing a site using Javascript
as well as PHP/MySQL. I have installed Apache 2.2 (on my Windows 6.x
[Vista Home Premium 32-bit]).

In one PHP document, I load two JS files, one called "dbSchema.js" and
the other "mysqlClass.js". The first JS file just defines a single
variable (serverSchema) which is an array of arrays of strings the
contain names and characteristics of a MySQL database, with all its
structural components, in this case one database containing two
tables, and each table containing a variable number of fields whose
characteristics are defined (field name, field type and length, field
collation, null and default setting status, etc).

I am using FB to step through the bugs in the JS code naturally. The
problem is that both db.Schema.js and mysqlClass.js have been loaded
the coded in the Script panel window not as they are. Lines of code
are repeated and inserted randomly. This makes stepwise tracing/
debugging impossible. There are two curious things here (#2 is really
curious):

For the purposes of being concise about the problem, I have stripped
the irrelevant content and code of the PHP document into an HTML file
"dbSchema.html" (the URL to this is at the bottom of this message).


1. FB seems to have the code for execution correctly within its
memory, but the problem is the code it presents to the user in the
Script panel window. For example. line 347 of mysqlClass.js is the
entry point or function definition (line #1) of the DatabaseSchema
object, which is called from the HTML document. But line 347 is shown
in the Script panel as the 7th line of the function definition above
it, the definition for the Database object. I could use FB to trace
execution if I follow the line numbers in FB alone, but I have to have
my text editor (that I use for editing all documents) open side-by-
side to follow the trace.

2. Now here's the real astonishment: if you click the URL below to
see the improper loading of the Script panel, you may not actually see
it. You may actually be able to do the step trace properly in FB.
Why? Because in order to present this problem to you and this group,
I uploaded the three files (dbSchema.html, dbSchema.js, mysqlClass.js)
to a free web hosting site we use, and then downloaded the HTML file
and FB loaded and presented the code of the JS files properly, without
randomly repetitive and inserted lines of code!! In other words, the
problem seemed server dependent!!

I have re-started Windows (and thus the server), and the problem of
badly presented code still occurs at http://localhost. And FB loads
and presents the code correctly when it is loaded from host
http://nilgulkaradeniz.awardspace.info. Is this bizarre?

This problem, and all the code of the JS files, is brought together
and explained in fuller detail at http://nilgulkaradeniz.awardspace.info/dbSchema.html.

John J Barton

unread,
Mar 24, 2010, 11:42:28 AM3/24/10
to Firebug
I suggest as a next step that you install Firebug 1.6X.0a8 in a new
Firefox profile and try it on your localhost version.

If it works, you can try variations between this setup and your
current one (Firebug version, stuff in your profile).

If it fails you can open Firebug > Firebug Icon Menu > Open Tracing >
Options SOURCEFILES. Clear then load you problem page. The URL of the
sources will appear in the trace.

jjb

> badly presented code still occurs athttp://localhost.  And FB loads
> and presents the code correctly when it is loaded from hosthttp://nilgulkaradeniz.awardspace.info.  Is this bizarre?

M Gozler

unread,
Mar 24, 2010, 7:18:25 PM3/24/10
to Firebug
On Mar 24, 5:42 pm, John J Barton <johnjbar...@johnjbarton.com> wrote:
> I suggest as a next step that you install Firebug 1.6X.0a8 in a new
> Firefox profile and try it on your localhost version.

1. Installed FB 1.6X.0a8 on usual profile (with 14 add-ons) and on
completely new profile with only FB added to it (besides those there
with profile creation).
2. On both profiles, when the HTML document is loaded from localhost,
the Script panel shows added code lines in external JS files, and in
one of the JS files the code lines is exactly doubled!
3. When HTML document loaded from server on remote host, FB shows the
code lines of both JS files properly.

Thus there is no difference in results between 1.5.2 and 1.6x on FF3.6
with both profiles.

>
> If it works, you can try variations between this setup and your
> current one (Firebug version, stuff in your profile).
>
> If it fails you can open Firebug > Firebug Icon Menu > Open Tracing >
> Options SOURCEFILES. Clear then load you problem page. The URL of the
> sources will appear in the trace.

It is not apparent to me what effect these instructions have. I don't
see where the URL appears in the trace.

But there are other things.

1. when loading the page, the code in the Script panel does not appear
fully (only the first two lines) until a key is pressed so as to step
into or over the code.

2. the dropdown list below the FB menu that shows all files containing
JS code DUPLICATES the file names of the two JS files. It shows the
file names with different cases in the characters. For example, the
file names of the original JS files have mixed cases: one is
mysqlClass.js and the other is dbSchema.js. When these are selected
in the dropdown list, both selections say "Failed to load source for:"
and then it gives the fully qualified URL. The other file names are
ALL lowercase: mysqlclass.js and dbschema.js. Only these selections
from the dropdown list show the source code with repeated or even
fully duplicated lines.

So as an experiment, I made the following changes:

1. the two JS filenames were changed to all lowercase using Windows
Explorer
2. the script elements in the HTML file were changed to load in the
two JS files using all lowercase letters:
<script type="text/javascript" src="mysqlclass.js"></script>

instead of the attribute being src="mysqlClass.js" which reflected the
former accurate letter case of the file name.

When the page was loaded on http://localhost again, there were ONLY
two external JS files in the dropdown list, not 4, with no failed to
load source. What was more, the code was correctly loaded and the
stepping during debugging presented accurately!

===

Thus the bug in FB is that it is somehow looking at case sensitivity
of the filenames, failing to find/load the sources with their
filenames in proper case sensitivity, and instead loading the files
using all lowercase, and doing a bad job of it. When all filenaming
is lowercase, both in the filesystem and in the HTML document,
everything is okay.

Should this be the case? The one host, running Linux (remote free web
hosting site), actually FAILS to serve documents unless the case
sensitivity of the file name is used properly. The other host
(localhost), being a Windows system, fails to serve the document even
with correct correct filename character case sensitivity; only when it
is all lowercase is there no defect in serving.

With Unix/Linux filesystems, clearly the file (object) 'mysqlclass.js'
is different from 'mysqlClass.js', and the distinction must be noted
in specifying the URI. But Windows systems are not sensitive to case
in filenaming, but still there was a problem with FB loading source
code correctly with the filename entered in mixed case just as it
exists in mixed case on the file system.

This is a bug in something, but I am not sure if it is FF or FB.

John J Barton

unread,
Mar 25, 2010, 1:07:57 AM3/25/10
to Firebug
If you open a bug report with your test case I will take a look.
http://code.google.com/p/fbug/issues/list

jjb

> When the page was loaded onhttp://localhostagain, there were ONLY

Reply all
Reply to author
Forward
0 new messages