<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>23771</bug_id>
          
          <creation_ts>2009-02-05 14:08:01 -0800</creation_ts>
          <short_desc>REGRESSION (r36016): JSObjectHasProperty freezes on global class without kJSClassAttributeNoAutomaticPrototype</short_desc>
          <delta_ts>2009-03-19 17:04:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction, InRadar, Regression</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="laurent calburtin">laurent.calburtin</reporter>
          <assigned_to name="Cameron Zwarich (cpst)">zwarich</assigned_to>
          <cc>ggaren</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>108506</commentid>
    <comment_count>0</comment_count>
    <who name="laurent calburtin">laurent.calburtin</who>
    <bug_when>2009-02-05 14:08:01 -0800</bug_when>
    <thetext>JSObjectHasProperty is stuck in an infinite loop with following code:

static JSValueRef fn(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    return 0;
}

static JSStaticFunction globalObject_staticFunctions[] = {  { &quot;fn&quot;, fn, kJSPropertyAttributeNone },  { 0, 0, 0 } };

static void freeze()
{
   JSClassDefinition globalObjectClassDefinition = kJSClassDefinitionEmpty;
   globalObjectClassDefinition.staticFunctions = globalObject_staticFunctions;
   JSClassRef globalObjectClass = JSClassCreate( &amp;globalObjectClassDefinition);
   JSGlobalContextRef context = JSGlobalContextCreateInGroup(NULL, globalObjectClass);
   JSStringRef propName = JSStringCreateWithUTF8CString(&quot;name&quot;);
   JSObjectHasProperty( context, JSContextGetGlobalObject(context), propName);
}

Adding the attribute kJSClassAttributeNoAutomaticPrototype to the global class definition solves the problem.

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&apos;t get stuck.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108520</commentid>
    <comment_count>1</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2009-02-05 14:50:51 -0800</bug_when>
    <thetext>&lt;rdar://problem/6561016&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109091</commentid>
    <comment_count>2</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-02-09 23:16:19 -0800</bug_when>
    <thetext>For some reason the global object&apos;s prototype gets itself as its prototype :-/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114289</commentid>
    <comment_count>3</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2009-03-19 00:58:25 -0700</bug_when>
    <thetext>I&apos;ll take this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114300</commentid>
    <comment_count>4</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2009-03-19 04:09:35 -0700</bug_when>
    <thetext>This regressed with r36016, the first inline caching patch:

http://trac.webkit.org/changeset/36016</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114402</commentid>
    <comment_count>5</comment_count>
      <attachid>28769</attachid>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2009-03-19 16:26:32 -0700</bug_when>
    <thetext>Created attachment 28769
Proposed patch

Here&apos;s a fix. I&apos;ll add a test to testapi for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114409</commentid>
    <comment_count>6</comment_count>
      <attachid>28769</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2009-03-19 16:48:02 -0700</bug_when>
    <thetext>Comment on attachment 28769
Proposed patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114413</commentid>
    <comment_count>7</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2009-03-19 17:04:38 -0700</bug_when>
    <thetext>Landed in r41846 with a test added to testapi.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>28769</attachid>
            <date>2009-03-19 16:26:32 -0700</date>
            <delta_ts>2009-03-19 16:48:02 -0700</delta_ts>
            <desc>Proposed patch</desc>
            <filename>prototype.diff</filename>
            <type>text/plain</type>
            <size>697</size>
            <attacher name="Cameron Zwarich (cpst)">zwarich</attacher>
            
              <data encoding="base64">SW5kZXg6IHJ1bnRpbWUvSlNHbG9iYWxPYmplY3QuY3BwCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHJ1bnRpbWUv
SlNHbG9iYWxPYmplY3QuY3BwCShyZXZpc2lvbiA0MTgyNykKKysrIHJ1bnRpbWUvSlNHbG9iYWxP
YmplY3QuY3BwCSh3b3JraW5nIGNvcHkpCkBAIC0zNDEsNyArMzQxLDExIEBAIHZvaWQgSlNHbG9i
YWxPYmplY3Q6OnJlc2V0KEpTVmFsdWVQdHIgcHIKIHZvaWQgSlNHbG9iYWxPYmplY3Q6OnJlc2V0
UHJvdG90eXBlKEpTVmFsdWVQdHIgcHJvdG90eXBlKQogewogICAgIHNldFByb3RvdHlwZShwcm90
b3R5cGUpOwotICAgIGxhc3RJblByb3RvdHlwZUNoYWluKHRoaXMpLT5zZXRQcm90b3R5cGUoZCgp
LT5vYmplY3RQcm90b3R5cGUpOworCisgICAgSlNPYmplY3QqIG9sZExhc3RJblByb3RvdHlwZUNo
YWluID0gbGFzdEluUHJvdG90eXBlQ2hhaW4odGhpcyk7CisgICAgSlNPYmplY3QqIG9iamVjdFBy
b3RvdHlwZSA9IGQoKS0+b2JqZWN0UHJvdG90eXBlOworICAgIGlmIChvbGRMYXN0SW5Qcm90b3R5
cGVDaGFpbiAhPSBvYmplY3RQcm90b3R5cGUpCisgICAgICAgIG9sZExhc3RJblByb3RvdHlwZUNo
YWluLT5zZXRQcm90b3R5cGUob2JqZWN0UHJvdG90eXBlKTsKIH0KIAogdm9pZCBKU0dsb2JhbE9i
amVjdDo6bWFyaygpCg==
</data>
<flag name="review"
          id="14195"
          type_id="1"
          status="+"
          setter="ggaren"
    />
          </attachment>
      

    </bug>

</bugzilla>