[Dojo-interest] Re: A bug of dojo.evalProp ?

Scott J. Miles sjmiles at turbophp.com
Thu Apr 6 17:12:41 MDT 2006


Thanks Dean for the testcase.

I tracked down the problem and ended up patching bootstrap1.js as you
suggested (i.e. evalProp tests for a false object before trying to evaluate
any property). The latest checkout or tonight's nightly should solve your
problem.

This problem was tricky for two reasons:

1) If the obj parameter to dj_undef is false (null), dj_undef substitutes
dj_global for obj. evalProp was expecting it to return true in this case
(which was my fault). Perhaps dj_undef should only use dj_global when obj
=== undefined, I will cogitate on that.

2) "Controllers" is the name of a built-in in FireFox. So, on FireFox,
dj_undef("Controllers", null) == false, and that unexpected result caused
the error.

As I say, perhaps dj_undef should be adjusted so that dj_undef(<name>, null)
is always true, while dj_undef(<name>) == dj_undef(<name>, dj_global). But
in any case, checking for false obj in evalProp solves the problem directly.

Regards,
Scott J. Miles
TurboAjax Group
http://www.turboajax.com

-----Original Message-----
From: dojo-interest-bounces at dojotoolkit.org
[mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Dean Pan
Sent: Thursday, April 06, 2006 9:24 AM
To: dojo-interest at dojotoolkit.org
Subject: [Dojo-interest] Re: A bug of dojo.evalProp ?

Hi Scott:
Thanks again. Yes there's a mistake in my test code, but if I fixed that,
the error still occurred ;-( Yes, I've build the dojo use  the
"kitchen_sink" profile, and now I rebuild it against the SVN head again,
but, the test failed again, it's make me crazy! So, I attached my full
test(including my custom dojo build) files to you( the attachments send
directly to you).

> Yes, here is a puzzle test case, it will trigger error, see the
attachment.
> Say "puzzle " because if  I rename "foo.B.Controllers" to another name,
assume "foo.B.Controller" or "foo.B.C", then test will passed! I don't know
why? But I'm sure this just occurred in the latest nightly build.

>> Today I checkout the latest nightly code, when I run my script again, 
>> it throws an exception, but it run ok with last week dojo nightly build.
>> I trace and found ,maybe there is a bug in dojo.evalProp.
>> 
>> check bootstrap1.js :
>> 
>> dojo.evalProp = function(name, obj, create){
>>      return (!dj_undef(name, obj) ? obj[name] : (create ? 
>> (obj[name]={})
>> : undefined));
>> }
>> 
>> As above code , dj_undef will throws an excpetion, if obj is not an 
>> obj, so ,in my case, my package namespace is eps.model, there is an 
>> class named Controller.js, it's code like:
>> 
>> dojo.provide('eps.model.Controllers');
>> 
>> now , I want use Controller, so I include it as:
>> dojo.require('eps.model.Controllers');
>> 
>> then,when script run here  will throws an exception.

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 4/5/2006
 



More information about the Dojo-interest mailing list