Browse Source

Merge pull request #227 from sebastienros/bug/207

Making ClrFunctionInstance extensible
Sébastien Ros 10 years ago
parent
commit
36ef0ad891
2 changed files with 14 additions and 0 deletions
  1. 13 0
      Jint.Tests/Runtime/EngineTests.cs
  2. 1 0
      Jint/Runtime/Interop/ClrFunctionInstance.cs

+ 13 - 0
Jint.Tests/Runtime/EngineTests.cs

@@ -1495,5 +1495,18 @@ namespace Jint.Tests.Runtime
                 assert(target[key] == 3);
                 assert(target[key] == 3);
             ");
             ");
         }
         }
+
+        [Fact]
+        public void ObjectShouldBeExtensible()
+        {
+            RunTest(@"
+                try {
+                    Object.defineProperty(Object.defineProperty, 'foo', { value: 1 });
+                }
+                catch(e) {
+                    assert(false);
+                }
+            ");
+        }
     }
     }
 }
 }

+ 1 - 0
Jint/Runtime/Interop/ClrFunctionInstance.cs

@@ -17,6 +17,7 @@ namespace Jint.Runtime.Interop
             _func = func;
             _func = func;
             Prototype = engine.Function.PrototypeObject;
             Prototype = engine.Function.PrototypeObject;
             FastAddProperty("length", length, false, false, false);
             FastAddProperty("length", length, false, false, false);
+            Extensible = true;
         }
         }
 
 
         public ClrFunctionInstance(Engine engine, Func<JsValue, JsValue[], JsValue> func)
         public ClrFunctionInstance(Engine engine, Func<JsValue, JsValue[], JsValue> func)