[webkit-dev] JSObjectSetProperty & JSObjectHasProperty stuck in an infinite loop

Laurent Calburtin laurent.calburtin at free.fr
Wed Feb 4 13:55:21 PST 2009


Hi,

With the trunk version of javascriptcore, JSObjectHasProperty is stuck  
in an infinite loop with following code:

     JSClassDefinition globalObjectClassDefinition =  
kJSClassDefinitionEmpty;
     globalObjectClassDefinition.staticFunctions =  
globalObject_staticFunctions; // not null
     JSClassRef globalObjectClass =  
JSClassCreate( &globalObjectClassDefinition);
     JSGlobalContextRef context = JSGlobalContextCreateInGroup(NULL,  
globalObjectClass);
     JSStringRef propName = JSStringCreateWithUTF8CString("name");
     JSObjectHasProperty( context, JSContextGetGlobalObject(context),  
propName);

By comparing my code to testapi.c I found that adding the attribute  
kJSClassAttributeNoAutomaticPrototype to my global class definition  
solved the problem.

Is this a bug or an expected behavior?
If kJSClassAttributeNoAutomaticPrototype is mandatory in such a  
situation, may I suggest to state it in the header file?
Are there other situations I should use  
kJSClassAttributeNoAutomaticPrototype?

Note that JSObjectSetProperty is also stuck without the attribute  
because it internally calls the same code as JSObjectHasProperty.
Also note that JSObjectHasProperty from MacOSX10.5 webkit framework  
doesn't get stuck.

Laurent


More information about the webkit-dev mailing list