浏览代码

Fix suite 15_3

Handle case when the prototype is not a function/object
Frederic Torres 12 年之前
父节点
当前提交
72d225749a
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Jint/Native/Function/FunctionInstance.cs

+ 7 - 1
Jint/Native/Function/FunctionInstance.cs

@@ -36,8 +36,14 @@ namespace Jint.Native.Function
             {
                 return false;
             }
+            
+            var po = Get("prototype");
+            if (!po.IsObject())
+            {
+                throw new JavaScriptException(_engine.TypeError, string.Format("Function has non-object prototype '{0}' in instanceof check", TypeConverter.ToString(po)));
+            }
 
-            var o = Get("prototype").AsObject();
+            var o = po.AsObject();
             
             if (o == null)
             {