ES6 specifies the function name property (it was not part of ES5) and
it specifies the name of Function.prototype to the empty string ("" and
not "Empty"). This makes us match Firefox, Safari and IE developer
preview.
BUG=v8:4033
LOG=N
R=adamk@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/
1080393004
Cr-Commit-Position: refs/heads/master@{#28021}
.Assert();
}
- // Allocate the empty function as the prototype for function ECMAScript
- // 262 15.3.4.
- Handle<String> empty_string =
- factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty"));
+ // Allocate the empty function as the prototype for function - ES6 19.2.3
Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction));
- Handle<JSFunction> empty_function = factory->NewFunctionWithoutPrototype(
- empty_string, code);
+ Handle<JSFunction> empty_function =
+ factory->NewFunctionWithoutPrototype(factory->empty_string(), code);
// Allocate the function map first and then patch the prototype later
Handle<Map> empty_function_map =
function f() {}
delete f.name;
- assertEquals('Empty', f.name);
+ assertEquals('', f.name);
f.name = 42;
- assertEquals('Empty', f.name); // non writable prototype property.
+ assertEquals('', f.name); // non writable prototype property.
assertFalse(f.hasOwnProperty('name'));
Object.defineProperty(Function.prototype, 'name', {writable: true});
function f() {}
assertTrue(delete f.name);
assertFalse(f.hasOwnProperty('name'));
- assertEquals('Empty', f.name);
+ assertEquals('', f.name);
assertTrue(delete Function.prototype.name);
assertEquals(undefined, f.name);
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+assertSame('', Function.prototype.name);
+
+var descr = Object.getOwnPropertyDescriptor(Function.prototype, 'name');
+assertFalse(descr.enumerable);
+assertTrue(descr.configurable);
+assertFalse(descr.writable);
+assertSame('', descr.value);