Revert "Expose v8::Function::GetDisplayName to public API."
authoryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 22 Oct 2013 15:46:15 +0000 (15:46 +0000)
committeryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 22 Oct 2013 15:46:15 +0000 (15:46 +0000)
This reverts commit 54c7b9af65dd349405944bd9ae2f064202dc6e1d.

The new test fails in debug mode.

BUG=chromium:17356
TBR=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/30443006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17325 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

include/v8.h
src/api.cc
test/cctest/test-api.cc

index 44a74ed5fea97282ce307cafd3d88df161da1adc..77684bf7909cb48762f8747f38a8a73c2323d3c7 100644 (file)
@@ -2478,12 +2478,6 @@ class V8_EXPORT Function : public Object {
    */
   Handle<Value> GetInferredName() const;
 
-  /**
-   * User-defined name assigned to the "displayName" property of this function.
-   * Used to facilitate debugging and profiling of JavaScript code.
-   */
-  Handle<Value> GetDisplayName() const;
-
   /**
    * Returns zero based line number of function body and
    * kLineOffsetNotFound if no information available.
index 2ff60c4a2e4c768966fbe86627eb5e8c63d62324..8e07b1a2e04b1035e6ddc0a1f8da4504f90bf749 100644 (file)
@@ -4110,30 +4110,6 @@ Handle<Value> Function::GetInferredName() const {
 }
 
 
-Handle<Value> Function::GetDisplayName() const {
-  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
-  ON_BAILOUT(isolate, "v8::Function::GetDisplayName()",
-             return ToApiHandle<Primitive>(
-                isolate->factory()->undefined_value()));
-  ENTER_V8(isolate);
-  i::HandleScope scope(isolate);
-  i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
-  i::Handle<i::String> property_name =
-      isolate->factory()->InternalizeOneByteString(
-          STATIC_ASCII_VECTOR("displayName"));
-  i::LookupResult lookup(isolate);
-  func->LookupRealNamedProperty(*property_name, &lookup);
-  if (lookup.IsFound()) {
-    i::Object* value = lookup.GetLazyValue();
-    if (value && value->IsString()) {
-      i::String* name = i::String::cast(value);
-      if (name->length() > 0) return Utils::ToLocal(i::Handle<i::String>(name));
-    }
-  }
-  return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
-}
-
-
 ScriptOrigin Function::GetScriptOrigin() const {
   i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
   if (func->shared()->script()->IsScript()) {
index 3722ff1e813eb07dde947e649d87eb3035d7763b..38ca9f59adf0c5480578368f89c406b486282244 100644 (file)
@@ -17504,77 +17504,6 @@ THREADED_TEST(FunctionGetInferredName) {
 }
 
 
-THREADED_TEST(FunctionGetDisplayName) {
-  LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-  const char* code = "var error = false;"
-                     "function a() { this.x = 1; };"
-                     "a.displayName = 'display_a';"
-                     "var b = (function() {"
-                     "  var f = function() { this.x = 2; };"
-                     "  f.displayName = 'display_b';"
-                     "  return f;"
-                     "})();"
-                     "var c = function() {};"
-                     "c.__defineGetter__('displayName', function() {"
-                     "  error = true;"
-                     "  throw new Error();"
-                     "});"
-                     "function d() {};"
-                     "d.__defineGetter__('displayName', function() {"
-                     "  error = true;"
-                     "  return 'wrong_display_name';"
-                     "});"
-                     "function e() {};"
-                     "e.displayName = 'wrong_display_name';"
-                     "e.__defineSetter__('displayName', function() {"
-                     "  error = true;"
-                     "  throw new Error();"
-                     "});"
-                     "function f() {};"
-                     "f.displayName = { 'foo': 6, toString: function() {"
-                     "  error = true;"
-                     "  return 'wrong_display_name';"
-                     "}};"
-                     "var g = function() {"
-                     "  arguments.callee.displayName = 'set_in_runtime';"
-                     "}; g();"
-                     "a.prototype.displayName = 'prototype_display_a';"
-                     "var hClass = function() {};"
-                     "hClass.prototype.__proto__ = a.prototype;"
-                     "var h = new hClass();"
-                     ;
-  v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
-  v8::Script::Compile(v8::String::New(code), &origin)->Run();
-  v8::Local<v8::Value> error = env->Global()->Get(v8::String::New("error"));
-  v8::Local<v8::Function> a = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("a")));
-  v8::Local<v8::Function> b = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("b")));
-  v8::Local<v8::Function> c = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("c")));
-  v8::Local<v8::Function> d = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("d")));
-  v8::Local<v8::Function> e = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("e")));
-  v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("f")));
-  v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("g")));
-  v8::Local<v8::Function> h = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::New("h")));
-  CHECK_EQ(false, error->BooleanValue());
-  CHECK_EQ("display_a", *v8::String::Utf8Value(a->GetDisplayName()));
-  CHECK_EQ("display_b", *v8::String::Utf8Value(b->GetDisplayName()));
-  CHECK(c->GetDisplayName()->IsUndefined());
-  CHECK(d->GetDisplayName()->IsUndefined());
-  CHECK(e->GetDisplayName()->IsUndefined());
-  CHECK(f->GetDisplayName()->IsUndefined());
-  CHECK_EQ("set_in_runtime", *v8::String::Utf8Value(g->GetDisplayName()));
-  CHECK_EQ("prototype_display_a", *v8::String::Utf8Value(h->GetDisplayName()));
-}
-
-
 THREADED_TEST(ScriptLineNumber) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());