dojo 1.1.0 and eval source

75 views
Skip to first unread message

Nicola Piccinini

unread,
Apr 18, 2008, 7:41:29 AM4/18/08
to fir...@googlegroups.com
Hi,

with dojo 1.0.2 I can debug code in Firebug without much troubles.

After upgrading to dojo 1.1.0 the required modules are no longer
available in the 'Script' tab, in place of them one finds:

eval -> undefineddojo._scopeArgs = [undefined];

I believe you should be able to replicate this behaviour with a dojo
test page, for example:

http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/test_Calendar.html

I've tried with Firebug 1.1.0b10, 1.1.0b12 and last 1.2 alpha.

Any hint about what is happening and possibly how to solve the issue?

Thanks in advance,

Nicola

John J Barton

unread,
Apr 19, 2008, 8:28:13 PM4/19/08
to Firebug
If you recreate the problem with a debug version of dojo and report it
on the issues list I will fix it. The deploy version is unreadable.
John.

On Apr 18, 4:41 am, "Nicola Piccinini" <piccin...@gmail.com> wrote:
> Hi,
>
> with dojo 1.0.2 I can debug code in Firebug without much troubles.
>
> After upgrading to dojo 1.1.0 the required modules are no longer
> available in the 'Script' tab, in place of them one finds:
>
> eval -> undefineddojo._scopeArgs = [undefined];
>
> I believe you should be able to replicate this behaviour with a dojo
> test page, for example:
>
> http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/test_C...

Nicola Piccinini

unread,
Apr 20, 2008, 5:26:31 PM4/20/08
to fir...@googlegroups.com
> If you recreate the problem with a debug version of dojo and report it
> on the issues list I will fix it. The deploy version is unreadable.

OK, doing that I've discovered that the issue is specific to the deploy version.

At this address:
http://superfluo.org/firebug-and-dojo-1.1.0/
there are three version of the same sample:

index-devel-1_1_0.html
dojo 1.1.0 in development/debug flavour. The dojo.fx module is
required through xhr and is fully debuggable with Firebug.

index-deploy-1_1_0.html
dojo 1.1.0 in deploy flavour. The dojo.fx module is required through
xhr but doesn't appear in the available script sources and isn't
debuggable with Firebug.

index-deploy-1_0_2.html
dojo 1.0.2 in deploy flavour, for comparison with the previous. The
dojo.fx module is required through xhr and is fully debuggable with
Firebug.

Note: Firebug is version 1.1.0b12

An "issue" with the dojo 1.1.0 build system or a defect in Firebug or other?

I cross posted to dojo forum:
http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/firebug-and-dojo-1-1-0
and ttrenka added an insightful comment.

Regards.

John J Barton

unread,
Apr 21, 2008, 10:08:30 AM4/21/08
to Firebug


On Apr 20, 2:26 pm, "Nicola Piccinini" <piccin...@gmail.com> wrote:
> Note: Firebug is version 1.1.0b12
>
> An "issue" with the dojo 1.1.0 build system or a defect in Firebug or other?
>
Probably a bug in Firebug but as a practical matter it is hard to fix
based on the test cases you have. If you can narrow down the problem
to a small file I'll fix it.

John.

Nicola Piccinini

unread,
May 18, 2008, 4:22:40 PM5/18/08
to fir...@googlegroups.com
> Probably a bug in Firebug but as a practical matter it is hard to fix
> based on the test cases you have. If you can narrow down the problem
> to a small file I'll fix it.

better late than never:
at
http://superfluo.org/firebug-and-dojo-1.1.x/index-minimal-deploy-1_1_1.html
you find what I believe is the simplest possible test case.

The compressed dojo build
http://superfluo.org/firebug-and-dojo-1.1.x/release/dojo/dojo/dojo.js
includes only:

./jslib/dojoGuardStart.jsfrag
./../../dojo/_base/_loader/bootstrap.js
./../../dojo/_base/_loader/loader.js
./../../dojo/_base/_loader/hostenv_browser.js
./jslib/dojoGuardEnd.jsfrag

dojo._base.lang is required and works but firebug isn't able to show
its source and print instead the infamous:
undefineddojo._scopeArgs = [undefined];
string.

Notice that the issue is specif of the compressed flavour, in fact
everything works as expected using the dojo.js.uncompressed.js build.
See:

http://superfluo.org/firebug-and-dojo-1.1.x/index-minimal-deploy-uncompressed-1_1_1.html

Hope that helps, best regards,

Nicola

John J Barton

unread,
May 19, 2008, 1:27:28 AM5/19/08
to Firebug
Hi Nicola. You simplified case did help make the problem obvious.
Firebug uses very primitive heuristics to extract information from
source, eg function names or in this case eval() bodies. These
heuristics are based on human readable source code, for example,
looking at the current line and three lines back to get the eval()
expressions. In the compressed dojo case, the eval() is buried in a
long line, so the simple solution fails. A correct javascript parse
or an underlying engine that exposed the parse tree would solve this.

If you put your information and links in an bug report I might take a
deeper look to see if some simple tweek to the current solution will
fix it.

Also, is this an important case or one you happened to notice?

John.

On May 18, 1:22 pm, "Nicola Piccinini" <piccin...@gmail.com> wrote:
> > Probably a bug in Firebug but as a practical matter it is hard to fix
> > based on the test cases you have. If you can narrow down the problem
> > to a small file I'll fix it.
>
> better late than never:
> athttp://superfluo.org/firebug-and-dojo-1.1.x/index-minimal-deploy-1_1_...
> you find what I believe is the simplest possible test case.
>
> The compressed dojo buildhttp://superfluo.org/firebug-and-dojo-1.1.x/release/dojo/dojo/dojo.js
> includes only:
>
> ./jslib/dojoGuardStart.jsfrag
> ./../../dojo/_base/_loader/bootstrap.js
> ./../../dojo/_base/_loader/loader.js
> ./../../dojo/_base/_loader/hostenv_browser.js
> ./jslib/dojoGuardEnd.jsfrag
>
> dojo._base.lang is required and works but firebug isn't able to show
> its source and print instead the infamous:
> undefineddojo._scopeArgs = [undefined];
> string.
>
> Notice that the issue is specif of the compressed flavour, in fact
> everything works as expected using the dojo.js.uncompressed.js build.
> See:
>
> http://superfluo.org/firebug-and-dojo-1.1.x/index-minimal-deploy-unco...

Nicola Piccinini

unread,
May 19, 2008, 7:33:34 PM5/19/08
to fir...@googlegroups.com
Hi John,

> In the compressed dojo case, the eval() is buried in a
> long line, so the simple solution fails.

also in compressed dojo 1.0.2 the eval is buried in a long line but
firebug works smoothly anyway.
So the heuristics is already very smart but not enough smart for dojo 1.1.1.

I've dissected the compressed file for 1.0.2 and 1.1.1 and I've
isolated the part where the problem resides, I believe:

(NB: with added line breaks for readability)

dojo 1.0.2 (it's OK)

dojo._loadUri=function(uri,cb)
{
if(this._loadedUrls[uri]){return true;}
var _39=this._getText(uri,true);
if(!_39){return false;}
this._loadedUrls[uri]=true;
this._loadedUrls.push(uri);
if(cb){_39="("+_39+")";}else{_39=this._scopePrefix+_39+this._scopeSuffix;}
if(d.isMoz){_39+="\r\n//@sourceURL="+uri;}
var _3a=d["eval"](_39);
if(cb){cb(_3a);}
return true;
};

dojo 1.1.1 (has problems)

dojo._loadUri=function(uri,cb)
{
if(this._loadedUrls[uri]){return true;}
var _2f=this._getText(uri,true);
if(!_2f){return false;}
this._loadedUrls[uri]=true;
this._loadedUrls.push(uri);
if(cb){_2f="("+_2f+")";}
var _30=d["eval"](_2f+"\r\n//@ sourceURL="+uri);
if(cb){cb(_30);}
return true;
};

In the few differences between this two parts there should be the
cause of the problem.

> If you put your information and links in an bug report I might take a
> deeper look to see if some simple tweek to the current solution will
> fix it.

done: http://code.google.com/p/fbug/issues/detail?id=695

> Also, is this an important case or one you happened to notice?

not sure to have understood your question, anyway:
it happens always, when using dojo 1.1.1 release if you require via
xhr a module (dojo.require), _any module_, the evaled source code


isn't debuggable with Firebug.

Thanks,
Nicola

travis vachon

unread,
May 21, 2008, 2:19:42 PM5/21/08
to Firebug
I'm also seeing this problem (and I imagine just about any devs using
dojo 1.1 are as well), and am relieved to see you two have already
done most of the legwork :)

I'm inquiring on the dojo irc channels and poking at the code myself,
I'll update here if I find anything.

Thanks for digging into this, it's a pretty frustrating functional
regression that definitely makes every day js dev more frustrating.

John J Barton

unread,
May 22, 2008, 12:00:29 AM5/22/08
to Firebug


On May 19, 4:33 pm, "Nicola Piccinini" <piccin...@gmail.com> wrote:
> > Also, is this an important case or one you happened to notice?
>
> not sure to have understood your question, anyway:
> it happens always, when using dojo 1.1.1 release if you require via
> xhr a module (dojo.require), _any module_, the evaled source code
> isn't debuggable with Firebug.

What I meant, was: don't dojo devs use different files when they are
debugging? Not the packed-all-on-one-line version but on that is more
like normal source?

John.

Nicola Piccinini

unread,
May 24, 2008, 5:38:06 AM5/24/08
to fir...@googlegroups.com
> What I meant, was: don't dojo devs use different files when they are
> debugging? Not the packed-all-on-one-line version but on that is more
> like normal source?

working with not compressed dojo is terribly slow also for
development, so my habit is precisely to use the
packed-all-on-one-line version for dojo and require apart, in readable
form, the code I'm working on. The drawback of this approach is that
you can't debug dojo code but this is usually unnecessary.

I believe this is a common practice but I'm just guessing.

I've updated the bug report with new observations, best regards,
Nicola

Reply all
Reply to author
Forward
0 new messages