[es6] Object.getOwnPropertyDescriptor should wrap primitives
In ES6 Object.getOwnPropertyDescriptor should call ToObject, which means that primitive values will return descriptors from the wrapper. BUG=v8:3964 LOG=N R=adamk, rossberg@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/998163004 Cr-Commit-Position: refs/heads/master@{#27569}
This commit is contained in:
parent
bde8943968
commit
4374941837
@ -1000,13 +1000,9 @@ function ObjectSetPrototypeOf(obj, proto) {
|
||||
}
|
||||
|
||||
|
||||
// ES5 section 15.2.3.3
|
||||
// ES6 section 19.1.2.6
|
||||
function ObjectGetOwnPropertyDescriptor(obj, p) {
|
||||
if (!IS_SPEC_OBJECT(obj)) {
|
||||
throw MakeTypeError("called_on_non_object",
|
||||
["Object.getOwnPropertyDescriptor"]);
|
||||
}
|
||||
var desc = GetOwnPropertyJS(obj, p);
|
||||
var desc = GetOwnPropertyJS(TO_OBJECT_INLINE(obj), p);
|
||||
return FromPropertyDescriptor(desc);
|
||||
}
|
||||
|
||||
|
34
test/mjsunit/get-own-property-descriptor-non-objects.js
Normal file
34
test/mjsunit/get-own-property-descriptor-non-objects.js
Normal file
@ -0,0 +1,34 @@
|
||||
// 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.
|
||||
|
||||
assertThrows(function() {
|
||||
Object.getOwnPropertyDescriptor(null, 'x');
|
||||
}, TypeError);
|
||||
|
||||
|
||||
assertThrows(function() {
|
||||
Object.getOwnPropertyDescriptor(undefined, 'x');
|
||||
}, TypeError);
|
||||
|
||||
|
||||
assertEquals({
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
value: 3,
|
||||
writable: false,
|
||||
}, Object.getOwnPropertyDescriptor('abc', 'length'));
|
||||
|
||||
|
||||
assertEquals({
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: 'a',
|
||||
writable: false,
|
||||
}, Object.getOwnPropertyDescriptor('abc', 0));
|
||||
|
||||
|
||||
assertSame(undefined, Object.getOwnPropertyDescriptor(42, 'x'));
|
||||
assertSame(undefined, Object.getOwnPropertyDescriptor(true, 'x'));
|
||||
assertSame(undefined, Object.getOwnPropertyDescriptor(false, 'x'));
|
||||
assertSame(undefined, Object.getOwnPropertyDescriptor(Symbol(), 'x'));
|
@ -265,9 +265,6 @@
|
||||
'built-ins/Object/freeze/15.2.3.9-1-2': [FAIL],
|
||||
'built-ins/Object/freeze/15.2.3.9-1-3': [FAIL],
|
||||
'built-ins/Object/freeze/15.2.3.9-1-4': [FAIL],
|
||||
'built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-1': [FAIL],
|
||||
'built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-1-3': [FAIL],
|
||||
'built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-1-4': [FAIL],
|
||||
'built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-212': [FAIL],
|
||||
'built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-213': [FAIL],
|
||||
'built-ins/Object/getOwnPropertyDescriptor/15.2.3.3-4-214': [FAIL],
|
||||
|
@ -195,6 +195,11 @@
|
||||
'15.2.3.2-1-3': [FAIL],
|
||||
'15.2.3.2-1-4': [FAIL],
|
||||
|
||||
# Object.getOwnPropertyDescriptor wraps primitives in ES6.
|
||||
'15.2.3.3-1': [FAIL],
|
||||
'15.2.3.3-1-3': [FAIL],
|
||||
'15.2.3.3-1-4': [FAIL],
|
||||
|
||||
######################## NEEDS INVESTIGATION ###########################
|
||||
|
||||
# These test failures are specific to the intl402 suite and need investigation
|
||||
|
Loading…
Reference in New Issue
Block a user