Reviewers: Mads Ager,

Description:
Do not allow calls to SetProtoType on functions that should not have a prototype
(fixes issue 1151)



Please review this at http://codereview.chromium.org/6518003/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/accessors.cc


Index: src/accessors.cc
===================================================================
--- src/accessors.cc    (revision 6761)
+++ src/accessors.cc    (working copy)
@@ -447,6 +447,7 @@
JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
   if (!found_it) return Heap::undefined_value();
   if (!function->has_prototype()) {
+    if (!function->should_have_prototype()) return Heap::undefined_value();
     Object* prototype;
{ MaybeObject* maybe_prototype = Heap::AllocateFunctionPrototype(function);
       if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype;


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to