JavascriptEngine dynamic_cast arguments?

Hi, 

In that code:

class Foo : public DynamicObject {

public:

    Foo( )  { setMethod("hello", Foo::hello); }

    static var hello(const var::NativeFunctionArgs& args) {
        if (dynamic_cast<Foo*>(args.thisObject.getObject( ))) { DBG("Good"); } 
        else { DBG("Bad"); }
        return var::undefined();
    }
};

int main (int argc, char* argv[])
{
    ScopedPointer<JavascriptEngine> mJS(new JavascriptEngine( ));

    mJS->registerNativeObject("Foo", new Foo( ));
    mJS->execute("var o = new Foo( ); o.hello( ); Foo.hello( )");

    return 0;
}

MacBook-de-nicolas:debug nicolas$ ./Foo
JUCE v3.0.2
Bad
Good

Executing "Foo.hello( )", args.thisObject can be dynamic_cast to Foo whereas with "o.hello( )" it can not. 

I can not figure which kind of object is passed to the function in the second case (a DynamicObject?). 

According to the simple test below, that is so a DynamicObject in the first case. I don't know if it is a desired feature (i can not find exactly what's hap in the sources) but i suppose it is (thus forget my question). 

std::cout << typeid(*(args.thisObject.getObject( ))).name() << std::endl;

After few investigations (some clues for a future reader):

    static var hello(const var::NativeFunctionArgs& args) {
    //

    if (dynamic_cast<Foo*>(args.thisObject.getObject( ))) { 
        DBG(args.thisObject.toString( )); 
    } else {
        DBG(args.thisObject.getDynamicObject( )->getProperty("prototype").toString( ));
    }

    return var::undefined();
    //
    }

MacBook-de-nicolas:debug nicolas$ ./Foo
JUCE v3.0.2
Object 0x30ab10
Object 0x30ab10