mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1469019
- Object.fromEntries. r=evilpie, r=peterv
--HG-- extra : rebase_source : d9f198cd5546c6f244c53c49a613bdcd4194d7f5
This commit is contained in:
parent
b0cb6b2857
commit
47ba603af2
@ -1965,6 +1965,7 @@ static const JSFunctionSpec object_static_methods[] = {
|
||||
JS_FN("isFrozen", obj_isFrozen, 1, 0),
|
||||
JS_FN("seal", obj_seal, 1, 0),
|
||||
JS_FN("isSealed", obj_isSealed, 1, 0),
|
||||
JS_SELF_HOSTED_FN("fromEntries", "ObjectFromEntries", 1, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
@ -286,3 +286,23 @@ function ObjectDefineProperty(obj, propertyKey, attributes) {
|
||||
// Step 5.
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Proposal https://tc39.github.io/proposal-object-from-entries/
|
||||
// 1. Object.fromEntries ( iterable )
|
||||
function ObjectFromEntries(iter) {
|
||||
// We omit the usual step number comments here because they don't help.
|
||||
// This implementation inlines AddEntriesFromIterator and
|
||||
// CreateDataPropertyOnObject, so it looks more like the polyfill
|
||||
// <https://github.com/tc39/proposal-object-from-entries/blob/master/polyfill.js>
|
||||
// than the spec algorithm.
|
||||
const obj = {};
|
||||
|
||||
for (const pair of allowContentIter(iter)) {
|
||||
if (!IsObject(pair))
|
||||
ThrowTypeError(JSMSG_INVALID_MAP_ITERABLE, "Object.fromEntries");
|
||||
_DefineDataProperty(obj, pair[0], pair[1]);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -459,26 +459,6 @@ skip script test262/annexB/language/function-code/block-decl-nested-blocks-with-
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1406171
|
||||
skip script test262/built-ins/Reflect/ownKeys/return-on-corresponding-order-large-index.js
|
||||
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1469019
|
||||
skip script test262/built-ins/Object/fromEntries/to-property-key.js
|
||||
skip script test262/built-ins/Object/fromEntries/iterator-closed-for-string-entry.js.js
|
||||
skip script test262/built-ins/Object/fromEntries/supports-symbols.js
|
||||
skip script test262/built-ins/Object/fromEntries/evaluation-order.js
|
||||
skip script test262/built-ins/Object/fromEntries/length.js
|
||||
skip script test262/built-ins/Object/fromEntries/uses-keys-not-iterator.js
|
||||
skip script test262/built-ins/Object/fromEntries/iterator-not-closed-for-throwing-next.js
|
||||
skip script test262/built-ins/Object/fromEntries/uses-define-semantics.js
|
||||
skip script test262/built-ins/Object/fromEntries/key-order.js
|
||||
skip script test262/built-ins/Object/fromEntries/iterator-closed-for-null-entry.js.js
|
||||
skip script test262/built-ins/Object/fromEntries/simple-properties.js
|
||||
skip script test262/built-ins/Object/fromEntries/empty-iterable.js
|
||||
skip script test262/built-ins/Object/fromEntries/iterator-closed-for-throwing-entry-accessor.js
|
||||
skip script test262/built-ins/Object/fromEntries/string-entry-object-succeeds.js
|
||||
skip script test262/built-ins/Object/fromEntries/iterator-not-closed-for-throwing-done-accessor.js
|
||||
skip script test262/built-ins/Object/fromEntries/prototype.js
|
||||
skip script test262/built-ins/Object/fromEntries/iterator-closed-for-throwing-entry-key-tostring.js
|
||||
skip script test262/built-ins/Object/fromEntries/name.js
|
||||
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1291407
|
||||
skip script test262/intl402/ListFormat/prototype/toStringTag/toString.js
|
||||
skip script test262/intl402/ListFormat/prototype/toStringTag/toStringTag.js
|
||||
|
@ -193,9 +193,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
|
||||
constructorProps(["setPrototypeOf", "getOwnPropertyDescriptor", "getOwnPropertyDescriptors",
|
||||
"keys", "is", "defineProperty", "defineProperties", "create",
|
||||
"getOwnPropertyNames", "getOwnPropertySymbols",
|
||||
"preventExtensions", "freeze", "isFrozen", "seal",
|
||||
"preventExtensions", "freeze", "fromEntries", "isFrozen", "seal",
|
||||
"isSealed", "assign", "getPrototypeOf", "values",
|
||||
"entries", "isExtensible"])
|
||||
"entries", "isExtensible"]);
|
||||
gPrototypeProperties['Array'] =
|
||||
["length", "toSource", "toString", "toLocaleString", "join", "reverse", "sort", "push",
|
||||
"pop", "shift", "unshift", "splice", "concat", "slice", "lastIndexOf", "indexOf",
|
||||
|
Loading…
Reference in New Issue
Block a user