object-front.js (1144B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 "use strict"; 6 7 function ObjectFront(grip, overrides) { 8 return { 9 grip, 10 enumEntries() { 11 return Promise.resolve( 12 this.getIterator({ 13 ownProperties: {}, 14 }) 15 ); 16 }, 17 enumProperties() { 18 return Promise.resolve( 19 this.getIterator({ 20 ownProperties: {}, 21 }) 22 ); 23 }, 24 enumSymbols() { 25 return Promise.resolve( 26 this.getIterator({ 27 ownSymbols: [], 28 }) 29 ); 30 }, 31 enumPrivateProperties() { 32 return Promise.resolve( 33 this.getIterator({ 34 privateProperties: [], 35 }) 36 ); 37 }, 38 getPrototype() { 39 return Promise.resolve({ 40 prototype: {}, 41 }); 42 }, 43 // Declared here so we can override it. 44 getIterator(res) { 45 return { 46 slice() { 47 return Promise.resolve(res); 48 }, 49 }; 50 }, 51 ...overrides, 52 }; 53 } 54 55 module.exports = ObjectFront;