Changeset 260733 in webkit
- Timestamp:
- Apr 26, 2020 3:54:45 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r260732 r260733 1 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Symbol should have [[Construct]] internal method 4 https://bugs.webkit.org/show_bug.cgi?id=211050 5 6 Reviewed by Yusuke Suzuki. 7 8 * stress/is-constructor.js: 9 * test262/expectations.yaml: Mark 2 test cases as passing. 10 1 11 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 12 -
trunk/JSTests/stress/is-constructor.js
r233377 r260733 38 38 assert(isConstructor(Set)); 39 39 assert(isConstructor(String)); 40 assert(isConstructor(Symbol)); 40 41 assert(isConstructor(WeakMap)); 41 42 assert(isConstructor(WeakSet)); … … 66 67 assert(!isConstructor(Array.prototype)); 67 68 68 // Symbol is not a constructor.69 assert(!isConstructor(Symbol));70 71 69 // Getters / setters are not constructors. 72 70 assert(!isConstructor(Object.getOwnPropertyDescriptor({get f(){}}, "f").get)); … … 92 90 assert(!isConstructor(JSON.stringify)); 93 91 assert(!isConstructor(Promise.all)); 92 assert(!isConstructor(Proxy.revocable)); 94 93 assert(!isConstructor(Symbol.for)); 95 94 assert(!isConstructor(Array.prototype.push)); 96 95 97 96 // Proxy and bound functions carry forward non-constructor-ness. 98 assert(!isConstructor(new Proxy(Symbol, {}))); 97 assert(isConstructor(new Proxy(Symbol, {}))); 98 assert(isConstructor(Symbol.bind(null))); 99 99 assert(!isConstructor(new Proxy(Math.cos, {}))); 100 assert(!isConstructor(Symbol.bind(null)));101 100 assert(!isConstructor(Math.cos.bind(null))); -
trunk/JSTests/test262/expectations.yaml
r260732 r260733 1616 1616 default: 'TypeError: null is not a function' 1617 1617 strict mode: 'TypeError: null is not a function' 1618 test/built-ins/Symbol/is-constructor.js:1619 default: 'Test262Error: Expected true but got false'1620 strict mode: 'Test262Error: Expected true but got false'1621 1618 test/built-ins/ThrowTypeError/extensible.js: 1622 1619 default: 'Test262Error: Expected SameValue(«true», «false») to be true' -
trunk/Source/JavaScriptCore/ChangeLog
r260732 r260733 1 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Symbol should have [[Construct]] internal method 4 https://bugs.webkit.org/show_bug.cgi?id=211050 5 6 Reviewed by Yusuke Suzuki. 7 8 This change introduces constructSymbol() method, which unconditionally throws 9 a TypeError, since its presence is observable when, for example, Symbol is a 10 [[ProxyTarget]] itself [1]. Aligns JSC with the spec [2], V8, and SpiderMonkey. 11 12 [1]: https://tc39.es/ecma262/#sec-proxycreate (step 7.b) 13 [2]: https://tc39.es/ecma262/#constructor 14 15 * runtime/SymbolConstructor.cpp: 16 (JSC::SymbolConstructor::SymbolConstructor): 17 (JSC::constructSymbol): 18 1 19 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 20 -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.cpp
r252520 r260733 58 58 59 59 static EncodedJSValue JSC_HOST_CALL callSymbol(JSGlobalObject*, CallFrame*); 60 static EncodedJSValue JSC_HOST_CALL constructSymbol(JSGlobalObject*, CallFrame*); 60 61 61 62 SymbolConstructor::SymbolConstructor(VM& vm, Structure* structure) 62 : InternalFunction(vm, structure, callSymbol, nullptr)63 : InternalFunction(vm, structure, callSymbol, constructSymbol) 63 64 { 64 65 } … … 90 91 RETURN_IF_EXCEPTION(scope, { }); 91 92 return JSValue::encode(Symbol::createWithDescription(vm, string)); 93 } 94 95 static EncodedJSValue JSC_HOST_CALL constructSymbol(JSGlobalObject* globalObject, CallFrame* callFrame) 96 { 97 VM& vm = globalObject->vm(); 98 auto scope = DECLARE_THROW_SCOPE(vm); 99 return throwVMError(globalObject, scope, createNotAConstructorError(globalObject, callFrame->jsCallee())); 92 100 } 93 101
Note: See TracChangeset
for help on using the changeset viewer.