Changeset 212430 in webkit
- Timestamp:
- Feb 16, 2017 4:41:06 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r212196 r212430 1 2017-02-16 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] Update module namespace object according to the latest ECMA262 4 https://bugs.webkit.org/show_bug.cgi?id=168280 5 6 Reviewed by Saam Barati. 7 8 * modules/namespace-object-symbol-iterator-name.js: 9 * modules/namespace-object-typed-array-fast-path.js: 10 * modules/namespace.js: 11 (shouldBe.JSON.stringify.Reflect.getOwnPropertyDescriptor): 12 (shouldThrow): 13 1 14 2017-02-11 Yusuke Suzuki <utatane.tea@gmail.com> 2 15 -
trunk/JSTests/modules/namespace-object-symbol-iterator-name.js
r204160 r212430 2 2 import * as ns from "./namespace-object-symbol-iterator-name.js"; 3 3 4 shouldBe(ns[Symbol.iterator] .name, "[Symbol.iterator]");4 shouldBe(ns[Symbol.iterator], undefined); -
trunk/JSTests/modules/namespace-object-typed-array-fast-path.js
r204248 r212430 5 5 6 6 let array = new Uint8Array(ns); 7 shouldBe(array.length, 2);7 shouldBe(array.length, 0); -
trunk/JSTests/modules/namespace.js
r198023 r212430 22 22 shouldBe('Mocha' in namespace, true); 23 23 shouldBe('default' in namespace, true); 24 shouldBe(Symbol.iterator in namespace, true);24 shouldBe(Symbol.iterator in namespace, false); 25 25 shouldBe('Tea' in namespace, false); 26 26 … … 62 62 // These names should be shown in the code point order. 63 63 shouldBe(JSON.stringify(Object.getOwnPropertyNames(namespace)), `["Cappuccino","Cocoa","Matcha","Mocha","default"]`); 64 shouldBe(Object.getOwnPropertySymbols(namespace).length, 2); 65 shouldBe(Object.getOwnPropertySymbols(namespace)[0], Symbol.iterator); 66 shouldBe(Object.getOwnPropertySymbols(namespace)[1], Symbol.toStringTag); 67 68 shouldBe(typeof namespace[Symbol.iterator], 'function'); 69 var array = Array.from(namespace); 70 // These names should be shown in the code point order. 71 shouldBe(JSON.stringify(array), `["Cappuccino","Cocoa","Matcha","Mocha","default"]`); 64 shouldBe(Object.getOwnPropertySymbols(namespace).length, 1); 65 shouldBe(Object.getOwnPropertySymbols(namespace)[0], Symbol.toStringTag); 72 66 73 67 // The imported binding properties of the namespace object seen as writable, but, it does not mean that it is writable by users. … … 80 74 }, `TypeError: Attempted to assign to readonly property.`); 81 75 82 // In the case of non imported properties, we just return the original descriptor. 83 // But still these properties cannot be changed. 84 shouldBe(JSON.stringify(Reflect.getOwnPropertyDescriptor(namespace, Symbol.iterator)), `{"writable":true,"enumerable":false,"configurable":true}`); 76 shouldBe(JSON.stringify(Reflect.getOwnPropertyDescriptor(namespace, Symbol.toStringTag)), `{"value":"Module","writable":false,"enumerable":false,"configurable":false}`); 85 77 shouldThrow(() => { 86 namespace[Symbol. iterator] = 42;78 namespace[Symbol.toStringTag] = 42; 87 79 }, `TypeError: Attempted to assign to readonly property.`); 88 80 81 shouldBe(Reflect.deleteProperty(namespace, Symbol.toStringTag), false); -
trunk/Source/JavaScriptCore/ChangeLog
r212426 r212430 1 2017-02-16 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] Update module namespace object according to the latest ECMA262 4 https://bugs.webkit.org/show_bug.cgi?id=168280 5 6 Reviewed by Saam Barati. 7 8 Reflect updates to the module namespace object. 9 10 1. @@iterator property is dropped[1]. 11 2. @@toStringTag property becomes non-configurable[1]. 12 3. delete with Symbol should be delegated to the JSObject's one[2]. 13 14 [1]: https://tc39.github.io/ecma262/#sec-module-namespace-objects 15 [2]: https://github.com/tc39/ecma262/pull/767 16 17 * runtime/JSModuleNamespaceObject.cpp: 18 (JSC::JSModuleNamespaceObject::finishCreation): 19 (JSC::JSModuleNamespaceObject::deleteProperty): 20 (JSC::moduleNamespaceObjectSymbolIterator): Deleted. 21 1 22 2017-02-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 23 -
trunk/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp
r211247 r212430 31 31 #include "JSCInlines.h" 32 32 #include "JSModuleEnvironment.h" 33 #include "JSPropertyNameIterator.h"34 33 35 34 namespace JSC { 36 35 37 static EncodedJSValue JSC_HOST_CALL moduleNamespaceObjectSymbolIterator(ExecState*);38 39 36 const ClassInfo JSModuleNamespaceObject::s_info = { "ModuleNamespaceObject", &Base::s_info, nullptr, CREATE_METHOD_TABLE(JSModuleNamespaceObject) }; 40 41 37 42 38 JSModuleNamespaceObject::JSModuleNamespaceObject(VM& vm, Structure* structure) … … 46 42 } 47 43 48 void JSModuleNamespaceObject::finishCreation(ExecState* exec, JSGlobalObject* globalObject, AbstractModuleRecord* moduleRecord, const IdentifierSet& exports)44 void JSModuleNamespaceObject::finishCreation(ExecState* exec, JSGlobalObject*, AbstractModuleRecord* moduleRecord, const IdentifierSet& exports) 49 45 { 50 46 VM& vm = exec->vm(); … … 70 66 71 67 m_moduleRecord.set(vm, this, moduleRecord); 72 JSFunction* iteratorFunction = JSFunction::create(vm, globalObject, 0, ASCIILiteral("[Symbol.iterator]"), moduleNamespaceObjectSymbolIterator, NoIntrinsic); 73 putDirect(vm, vm.propertyNames->iteratorSymbol, iteratorFunction, DontEnum); 74 putDirect(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "Module"), DontEnum | ReadOnly); 68 putDirect(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "Module"), DontEnum | DontDelete | ReadOnly); 75 69 76 70 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-getprototypeof … … 182 176 } 183 177 184 bool JSModuleNamespaceObject::deleteProperty(JSCell* cell, ExecState* , PropertyName propertyName)178 bool JSModuleNamespaceObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) 185 179 { 186 180 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-delete-p 187 181 JSModuleNamespaceObject* thisObject = jsCast<JSModuleNamespaceObject*>(cell); 182 if (propertyName.isSymbol()) 183 return JSObject::deleteProperty(thisObject, exec, propertyName); 184 188 185 return !thisObject->m_exports.contains(propertyName.uid()); 189 186 } … … 209 206 } 210 207 211 EncodedJSValue JSC_HOST_CALL moduleNamespaceObjectSymbolIterator(ExecState* exec)212 {213 VM& vm = exec->vm();214 auto scope = DECLARE_THROW_SCOPE(vm);215 216 JSModuleNamespaceObject* object = jsDynamicCast<JSModuleNamespaceObject*>(vm, exec->thisValue());217 if (!object)218 return throwVMTypeError(exec, scope, ASCIILiteral("|this| should be a module namespace object"));219 return JSValue::encode(JSPropertyNameIterator::create(exec, exec->lexicalGlobalObject()->propertyNameIteratorStructure(), object));220 }221 222 208 } // namespace JSC
Note: See TracChangeset
for help on using the changeset viewer.