Reviewers: Mads Ager,

Message:
Please review this change.  Thanks.

Description:
Fixes bug 1426704.
Constructors no longer print out their source code.  They print [native
code]
instead.  Some web applications don't like constructors with complex
ToString
results.

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

Affected files:
   M     src/runtime.cc


Index: src/runtime.cc
===================================================================
--- src/runtime.cc      (revision 505)
+++ src/runtime.cc      (working copy)
@@ -891,10 +891,10 @@
      target->shared()->set_length(fun->shared()->length());
      target->shared()->set_formal_parameter_count(
          fun->shared()->formal_parameter_count());
-    // Set the source code of the target function.
-    target->shared()->set_script(fun->shared()->script());
-    target->shared()->set_start_position(fun->shared()->start_position());
-    target->shared()->set_end_position(fun->shared()->end_position());
+    // Set the source code of the target function to undefined.
+    // SetCode is only used for constructors, and some web code
+    // doesn't like seeing source code for constructors.
+    target->shared()->set_script(Heap::undefined_value());
      context = Handle<Context>(fun->context());

      // Make sure we get a fresh copy of the literal vector to avoid



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

Reply via email to