Browse Source

Fix suite 15_3

Handle case when the prototype is not a function/object
Frederic Torres 11 years ago
parent
commit
72d225749a
1 changed files with 7 additions and 1 deletions
  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;
                 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)
             if (o == null)
             {
             {