WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-150131-20151014114341.patch (text/plain), 21.87 KB, created by
Jordan Harband
on 2015-10-14 11:44:19 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jordan Harband
Created:
2015-10-14 11:44:19 PDT
Size:
21.87 KB
patch
obsolete
>Subversion Revision: 191049 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index b367456e9f953b6611ea370d43a9372cf0cd9813..b478a45d40215d62fe2352cc2635d122fb4218b3 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,26 @@ >+2015-10-14 Jordan Harband <ljharb@gmail.com> >+ >+ Implement Object.values / Object.entries >+ https://bugs.webkit.org/show_bug.cgi?id=150131 >+ https://github.com/ljharb/proposal-object-values-entries >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * runtime/EnumerationMode.h: >+ * runtime/ObjectConstructor.cpp: >+ (JSC::objectConstructorGetOwnPropertyDescriptor): >+ (JSC::objectConstructorGetOwnPropertyNames): >+ (JSC::objectConstructorGetOwnPropertySymbols): >+ (JSC::objectConstructorKeys): >+ (JSC::objectConstructorEntries): >+ (JSC::objectConstructorValues): >+ (JSC::ownEnumerablePropertyKeys): >+ (JSC::ownProperties): >+ (JSC::ownPropertyKeys): Deleted. >+ * runtime/ObjectConstructor.h: >+ * runtime/ReflectObject.cpp: >+ (JSC::reflectObjectOwnKeys): >+ > 2015-10-14 Mark Lam <mark.lam@apple.com> > > Speculative build fix: the CallSiteIndex constructor is explicit and requires an uint32_t. >diff --git a/Source/JavaScriptCore/runtime/EnumerationMode.h b/Source/JavaScriptCore/runtime/EnumerationMode.h >index 86d53e049a983d9f00bc11dc7ed8a633e22b97e1..7f275a155430003f8a3b28b33eb18454d4655ab2 100644 >--- a/Source/JavaScriptCore/runtime/EnumerationMode.h >+++ b/Source/JavaScriptCore/runtime/EnumerationMode.h >@@ -34,6 +34,12 @@ enum class PropertyNameMode { > StringsAndSymbols = Symbols | Strings, > }; > >+enum class OwnPropertyKind { >+ Keys = 1 << 0, >+ Values = 1 << 1, >+ Entries = Keys | Values, >+}; >+ > enum class DontEnumPropertiesMode { > Include, > Exclude >diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp >index bc8625ac270b644d739a04f6b5c2320666eafee5..dc01f0a1e2dddf81abeb478e163eb5a012c17c3c 100644 >--- a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp >+++ b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp >@@ -70,6 +70,8 @@ const ClassInfo ObjectConstructor::s_info = { "Function", &InternalFunction::s_i > getOwnPropertyDescriptor objectConstructorGetOwnPropertyDescriptor DontEnum|Function 2 > getOwnPropertyNames objectConstructorGetOwnPropertyNames DontEnum|Function 1 > keys objectConstructorKeys DontEnum|Function 1 >+ entries objectConstructorEntries DontEnum|Function 1 >+ values objectConstructorValues DontEnum|Function 1 > defineProperty objectConstructorDefineProperty DontEnum|Function 3 > defineProperties objectConstructorDefineProperties DontEnum|Function 2 > create objectConstructorCreate DontEnum|Function 2 >@@ -240,7 +242,7 @@ JSValue objectConstructorGetOwnPropertyDescriptor(ExecState* exec, JSObject* obj > description->putDirect(exec->vm(), exec->propertyNames().get, descriptor.getter(), 0); > description->putDirect(exec->vm(), exec->propertyNames().set, descriptor.setter(), 0); > } >- >+ > description->putDirect(exec->vm(), exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0); > description->putDirect(exec->vm(), exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0); > >@@ -264,7 +266,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exe > JSObject* object = exec->argument(0).toObject(exec); > if (exec->hadException()) > return JSValue::encode(jsNull()); >- return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Include)); >+ return JSValue::encode(ownProperties(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Include, OwnPropertyKind::Keys)); > } > > // FIXME: Use the enumeration cache. >@@ -273,7 +275,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState* e > JSObject* object = exec->argument(0).toObject(exec); > if (exec->hadException()) > return JSValue::encode(jsNull()); >- return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Symbols, DontEnumPropertiesMode::Include)); >+ return JSValue::encode(ownProperties(exec, object, PropertyNameMode::Symbols, DontEnumPropertiesMode::Include, OwnPropertyKind::Keys)); > } > > // FIXME: Use the enumeration cache. >@@ -282,7 +284,25 @@ EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec) > JSObject* object = exec->argument(0).toObject(exec); > if (exec->hadException()) > return JSValue::encode(jsNull()); >- return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude)); >+ return JSValue::encode(ownProperties(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude, OwnPropertyKind::Keys)); >+} >+ >+// FIXME: Use the enumeration cache. >+EncodedJSValue JSC_HOST_CALL objectConstructorEntries(ExecState* exec) >+{ >+ JSObject* object = exec->argument(0).toObject(exec); >+ if (exec->hadException()) >+ return JSValue::encode(jsNull()); >+ return JSValue::encode(ownProperties(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude, OwnPropertyKind::Entries)); >+} >+ >+// FIXME: Use the enumeration cache. >+EncodedJSValue JSC_HOST_CALL objectConstructorValues(ExecState* exec) >+{ >+ JSObject* object = exec->argument(0).toObject(exec); >+ if (exec->hadException()) >+ return JSValue::encode(jsNull()); >+ return JSValue::encode(ownProperties(exec, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude, OwnPropertyKind::Values)); > } > > EncodedJSValue JSC_HOST_CALL ownEnumerablePropertyKeys(ExecState* exec) >@@ -290,7 +310,7 @@ EncodedJSValue JSC_HOST_CALL ownEnumerablePropertyKeys(ExecState* exec) > JSObject* object = exec->argument(0).toObject(exec); > if (exec->hadException()) > return JSValue::encode(jsNull()); >- return JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Exclude)); >+ return JSValue::encode(ownProperties(exec, object, PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Exclude, OwnPropertyKind::Keys)); > } > > // ES5 8.10.5 ToPropertyDescriptor >@@ -628,12 +648,13 @@ EncodedJSValue JSC_HOST_CALL objectConstructorIs(ExecState* exec) > } > > // FIXME: Use the enumeration cache. >-JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode propertyNameMode, DontEnumPropertiesMode dontEnumPropertiesMode) >+JSArray* ownProperties(ExecState* exec, JSObject* object, PropertyNameMode propertyNameMode, DontEnumPropertiesMode dontEnumPropertiesMode, OwnPropertyKind ownPropertyKind) > { > PropertyNameArray properties(exec, propertyNameMode); > object->methodTable(exec->vm())->getOwnPropertyNames(object, exec, properties, EnumerationMode(dontEnumPropertiesMode)); > >- JSArray* keys = constructEmptyArray(exec, 0); >+ Vector<Identifier> propertyStrings; >+ Vector<Identifier, 16> propertySymbols; > > switch (propertyNameMode) { > case PropertyNameMode::Strings: { >@@ -641,7 +662,7 @@ JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode pro > for (size_t i = 0; i < numProperties; i++) { > const auto& identifier = properties[i]; > ASSERT(!identifier.isSymbol()); >- keys->push(exec, jsOwnedString(exec, identifier.string())); >+ propertyStrings.append(identifier); > } > break; > } >@@ -652,13 +673,12 @@ JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode pro > const auto& identifier = properties[i]; > ASSERT(identifier.isSymbol()); > if (!exec->propertyNames().isPrivateName(identifier)) >- keys->push(exec, Symbol::create(exec->vm(), static_cast<SymbolImpl&>(*identifier.impl()))); >+ propertySymbols.append(identifier); > } > break; > } > > case PropertyNameMode::StringsAndSymbols: { >- Vector<Identifier, 16> propertySymbols; > size_t numProperties = properties.size(); > for (size_t i = 0; i < numProperties; i++) { > const auto& identifier = properties[i]; >@@ -666,18 +686,70 @@ JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode pro > if (!exec->propertyNames().isPrivateName(identifier)) > propertySymbols.append(identifier); > } else >- keys->push(exec, jsOwnedString(exec, identifier.string())); >+ propertyStrings.append(identifier); > } > >+ break; >+ } >+ } >+ >+ JSArray* results = constructEmptyArray(exec, 0); >+ switch (ownPropertyKind) { >+ case OwnPropertyKind::Keys: { >+ for (const auto& identifier : propertyStrings) >+ results->push(exec, jsOwnedString(exec, identifier.string())); >+ // To ensure the order defined in the spec (9.1.12), we append symbols at the last elements of keys. >+ for (const auto& identifier : propertySymbols) >+ results->push(exec, Symbol::create(exec->vm(), static_cast<SymbolImpl&>(*identifier.impl()))); >+ break; >+ } >+ case OwnPropertyKind::Values: { >+ Vector<Identifier> properties; >+ for (const auto& identifier : propertyStrings) >+ properties.append(identifier); > // To ensure the order defined in the spec (9.1.12), we append symbols at the last elements of keys. > for (const auto& identifier : propertySymbols) >- keys->push(exec, Symbol::create(exec->vm(), static_cast<SymbolImpl&>(*identifier.impl()))); >+ properties.append(identifier); > >+ for (const auto& identifier : properties) { >+ PropertyDescriptor desc; >+ if (!object->getOwnPropertyDescriptor(exec, identifier, desc) || !desc.enumerable()) >+ continue; >+ JSValue value = object->get(exec, identifier); >+ if (exec->hadException()) >+ return results; >+ results->push(exec, value); >+ } >+ break; >+ } >+ case OwnPropertyKind::Entries: { >+ Vector<Identifier> properties; >+ for (const auto& identifier : propertyStrings) >+ properties.append(identifier); >+ // To ensure the order defined in the spec (9.1.12), we append symbols at the last elements of keys. >+ for (const auto& identifier : propertySymbols) >+ properties.append(identifier); >+ >+ for (const auto& identifier : properties) { >+ PropertyDescriptor desc; >+ if (!object->getOwnPropertyDescriptor(exec, identifier, desc) || !desc.enumerable()) >+ continue; >+ JSValue value = object->get(exec, identifier); >+ if (exec->hadException()) >+ return results; >+ JSArray* entry = constructEmptyArray(exec, 0, 2); >+ if (identifier.isSymbol()) >+ entry->push(exec, Symbol::create(exec->vm(), static_cast<SymbolImpl&>(*identifier.impl()))); >+ else >+ entry->push(exec, jsOwnedString(exec, identifier.string())); >+ entry->push(exec, value); >+ results->push(exec, entry); >+ } > break; > } > } > >- return keys; >+ return results; > } > > } // namespace JSC >diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.h b/Source/JavaScriptCore/runtime/ObjectConstructor.h >index 5db78ba163fe5c776bee0213741d6c1e3f67fe43..9ff312eb626c698f9a011d9f4cd188412e758ee8 100644 >--- a/Source/JavaScriptCore/runtime/ObjectConstructor.h >+++ b/Source/JavaScriptCore/runtime/ObjectConstructor.h >@@ -29,7 +29,9 @@ namespace JSC { > > EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*); > EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertySymbols(ExecState*); >+EncodedJSValue JSC_HOST_CALL objectConstructorEntries(ExecState*); > EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*); >+EncodedJSValue JSC_HOST_CALL objectConstructorValues(ExecState*); > EncodedJSValue JSC_HOST_CALL ownEnumerablePropertyKeys(ExecState*); > > class ObjectPrototype; >@@ -93,7 +95,7 @@ inline JSObject* constructEmptyObject(ExecState* exec) > JSObject* objectConstructorFreeze(ExecState*, JSObject*); > JSValue objectConstructorGetPrototypeOf(ExecState*, JSObject*); > JSValue objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, const Identifier&); >-JSArray* ownPropertyKeys(ExecState*, JSObject*, PropertyNameMode, DontEnumPropertiesMode); >+JSArray* ownProperties(ExecState*, JSObject*, PropertyNameMode, DontEnumPropertiesMode, OwnPropertyKind); > bool toPropertyDescriptor(ExecState*, JSValue, PropertyDescriptor&); > > } // namespace JSC >diff --git a/Source/JavaScriptCore/runtime/ReflectObject.cpp b/Source/JavaScriptCore/runtime/ReflectObject.cpp >index 9f9a97eccf4ca63958d7a8081b74e387bc4630f7..3499d60e7775d5f3a33a64dfae23c23801897fee 100644 >--- a/Source/JavaScriptCore/runtime/ReflectObject.cpp >+++ b/Source/JavaScriptCore/runtime/ReflectObject.cpp >@@ -177,7 +177,7 @@ EncodedJSValue JSC_HOST_CALL reflectObjectOwnKeys(ExecState* exec) > JSValue target = exec->argument(0); > if (!target.isObject()) > return JSValue::encode(throwTypeError(exec, ASCIILiteral("Reflect.ownKeys requires the first argument be an object"))); >- return JSValue::encode(ownPropertyKeys(exec, jsCast<JSObject*>(target), PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Include)); >+ return JSValue::encode(ownProperties(exec, jsCast<JSObject*>(target), PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Include, OwnPropertyKind::Keys)); > } > > // http://www.ecma-international.org/ecma-262/6.0/#sec-reflect.preventextensions >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 35aa5ca3e22af0da5f14aa2e53d7fd80f960c151..66c4e480471294caf2dd66afffe987fbc01a97a7 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2015-10-14 Jordan Harband <ljharb@gmail.com> >+ >+ Implement proposed Object.values / Object.entries >+ https://bugs.webkit.org/show_bug.cgi?id=150131 >+ https://github.com/ljharb/proposal-object-values-entries >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * js/Object-getOwnPropertyNames-expected.txt: >+ * js/Object-values-expected.txt: Added. >+ * js/Object-values.html: Added. >+ * js/script-tests/Object-getOwnPropertyNames.js: >+ * js/script-tests/Object-values.js: Added. >+ (Symbol): >+ (get Object): >+ > 2015-10-14 Said Abou-Hallawa <sabouhallawa@apple.com> > > REGRESSION(r53318): background-repeat: space with gradients doesn't render correctly >diff --git a/LayoutTests/js/Object-getOwnPropertyNames-expected.txt b/LayoutTests/js/Object-getOwnPropertyNames-expected.txt >index b0544ceff498e0db7e2fc622408e5d0fb5ea1f08..f9f7177e421a7fb9387746a4d7c4158d12ec20d5 100644 >--- a/LayoutTests/js/Object-getOwnPropertyNames-expected.txt >+++ b/LayoutTests/js/Object-getOwnPropertyNames-expected.txt >@@ -41,7 +41,7 @@ PASS getSortedOwnPropertyNames(decodeURI) is ['length', 'name'] > PASS getSortedOwnPropertyNames(decodeURIComponent) is ['length', 'name'] > PASS getSortedOwnPropertyNames(encodeURI) is ['length', 'name'] > PASS getSortedOwnPropertyNames(encodeURIComponent) is ['length', 'name'] >-PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf'] >+PASS getSortedOwnPropertyNames(Object) is ['assign', 'create', 'defineProperties', 'defineProperty', 'entries', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf', 'values'] > PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'] > PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype'] > PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString'] >diff --git a/LayoutTests/js/Object-values-expected.txt b/LayoutTests/js/Object-values-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..fe75ef95e5d7b2ec5bc11cda77f06ef5fe5585b6 >--- /dev/null >+++ b/LayoutTests/js/Object-values-expected.txt >@@ -0,0 +1,25 @@ >+Test to ensure correct behaviour of Object.values >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Object.values({}) is [] >+PASS Object.values({a:'A'}) is ['A'] >+PASS Object.values({a:'A', b:'B'}) is ['A', 'B'] >+PASS Object.values({b:'B', a:'A'}) is ['B', 'A'] >+PASS Object.values([]) is [] >+PASS Object.values([1]) is [1] >+PASS Object.values([1,2]) is [1,2] >+PASS Object.values([1,2,,,,6]) is [1,2,6] >+PASS Object.values({__proto__:{a:null}}) is [] >+PASS Object.values({__proto__:[1,2,3]}) is [] >+PASS var x = []; x.__proto__ = [1,2,3]; Object.values(x) is [] >+PASS var obj = {b:'B', a:'A'}; Object.keys(obj).concat(Object.values(obj)) is ['b', 'a', 'B', 'A'] >+PASS var obj = {a: 'A'}; Object.defineProperty(obj, 'b', { enumerable: false, value: 'B' }); Object.values(obj) is ['A'] >+PASS Object.values(objWithSymbols) is ['A', sym] >+PASS Object.values(objWithDeletingGetter) is [1, 3] >+PASS Object.values(objWithNonEnumingGetter) is ['A'] >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/js/Object-values.html b/LayoutTests/js/Object-values.html >new file mode 100644 >index 0000000000000000000000000000000000000000..04e4030e5ba293977e8918cac98452382bf20855 >--- /dev/null >+++ b/LayoutTests/js/Object-values.html >@@ -0,0 +1,10 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<script src="../resources/js-test-pre.js"></script> >+</head> >+<body> >+<script src="script-tests/Object-values.js"></script> >+<script src="../resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js b/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js >index f79dfab6a6af828c48302d0a7ae5a4b5ce9d9928..292941ddeb743fabfe5b8bf0d00f54cbbf23bb52 100644 >--- a/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js >+++ b/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js >@@ -50,7 +50,7 @@ var expectedPropertyNamesSet = { > "encodeURI": "['length', 'name']", > "encodeURIComponent": "['length', 'name']", > // Built-in ECMA objects >- "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf']", >+ "Object": "['assign', 'create', 'defineProperties', 'defineProperty', 'entries', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'is', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal', 'setPrototypeOf', 'values']", > "Object.prototype": "['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']", > "Function": "['length', 'name', 'prototype']", > "Function.prototype": "['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']", >diff --git a/LayoutTests/js/script-tests/Object-values.js b/LayoutTests/js/script-tests/Object-values.js >new file mode 100644 >index 0000000000000000000000000000000000000000..d9ff11d584ae03011292e4f2c4fa55d93657b1a4 >--- /dev/null >+++ b/LayoutTests/js/script-tests/Object-values.js >@@ -0,0 +1,50 @@ >+description("Test to ensure correct behaviour of Object.values"); >+ >+shouldBe("Object.values({})", "[]"); >+shouldBe("Object.values({a:'A'})", "['A']"); >+shouldBe("Object.values({a:'A', b:'B'})", "['A', 'B']"); >+shouldBe("Object.values({b:'B', a:'A'})", "['B', 'A']"); >+shouldBe("Object.values([])", "[]"); >+shouldBe("Object.values([1])", "[1]"); >+shouldBe("Object.values([1,2])", "[1,2]"); >+shouldBe("Object.values([1,2,,,,6])", "[1,2,6]"); >+shouldBe("Object.values({__proto__:{a:null}})", "[]"); >+shouldBe("Object.values({__proto__:[1,2,3]})", "[]"); >+shouldBe("var x = []; x.__proto__ = [1,2,3]; Object.values(x)", "[]"); >+ >+shouldBe("var obj = {b:'B', a:'A'}; Object.keys(obj).concat(Object.values(obj))", "['b', 'a', 'B', 'A']"); >+shouldBe("var obj = {a: 'A'}; Object.defineProperty(obj, 'b', { enumerable: false, value: 'B' }); Object.values(obj)", "['A']"); >+ >+var sym = Symbol(); >+var objWithSymbols = {a: 'A', [Symbol()]: 'enum', b: sym }; >+Object.defineProperty(objWithSymbols, Symbol(), { enumerable: false, value: 'nonenum' }); >+shouldBe("Object.values(objWithSymbols)", "['A', sym]"); >+ >+var objWithDeletingGetter = {}; >+Object.defineProperty(objWithDeletingGetter, 'a', { >+ enumerable: true, >+ get: function () { >+ delete this.b; >+ return 1; >+ } >+}); >+objWithDeletingGetter.b = 2; >+objWithDeletingGetter.c = 3; >+shouldBe("Object.values(objWithDeletingGetter)", "[1, 3]"); >+ >+var objWithNonEnumingGetter = {}; >+Object.defineProperty(objWithNonEnumingGetter, 'a', { >+ configurable: true, >+ enumerable: true, >+ get: function () { >+ Object.defineProperty(this, 'b', { enumerable: false }); >+ return 'A'; >+ } >+}); >+Object.defineProperty(objWithNonEnumingGetter, 'b', { >+ configurable: true, >+ enumerable: true, >+ value: 'B', >+ writable: true >+}); >+shouldBe("Object.values(objWithNonEnumingGetter)", "['A']");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review-
darin
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 150131
: 263093