Changeset 259587 in webkit
- Timestamp:
- Apr 6, 2020 12:01:57 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r259583 r259587 1 2020-04-06 Rick Waldron <waldron.rick@gmail.com> and Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Remove unnecessary Test262 harness file and implement $262.IsHTMLDDA 4 https://bugs.webkit.org/show_bug.cgi?id=187526 5 6 Reviewed by Darin Adler. 7 8 * stress/optional-chaining.js: Adjust test for callable masquerader. 9 1 10 2020-04-06 Justin Michaud <justin_michaud@apple.com> 2 11 -
trunk/JSTests/stress/optional-chaining.js
r252679 r259587 80 80 shouldThrowTypeError(() => []?.(), '[] is not a function'); 81 81 shouldThrowTypeError(() => ['hi']?.(), '[\'hi\'] is not a function'); 82 shouldThrowTypeError(() => masquerader?.(), 'masquerader is not a function');83 82 } 84 83 noInline(testBasicFailureCases); … … 106 105 shouldBe((() => {})?.()?.(), undefined); 107 106 shouldBe(null?.()().a['b'], undefined); 107 shouldBe(masquerader?.(), null); 108 108 109 109 const o0 = { a: { b() { return this._b.bind(this); }, _b() { return this.__b; }, __b: { c: 42 } } }; -
trunk/Source/JavaScriptCore/ChangeLog
r259583 r259587 1 2020-04-06 Rick Waldron <waldron.rick@gmail.com> and Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Remove unnecessary Test262 harness file and implement $262.IsHTMLDDA 4 https://bugs.webkit.org/show_bug.cgi?id=187526 5 6 Reviewed by Darin Adler. 7 8 Test262 harness requires [1] $262.IsHTMLDDA to be an object with [[IsHTMLDDA]] slot [2], 9 much like `document.all`. It is used in a few tests to make sure that runtimes strictly 10 compare values with `null` and `undefined`. 11 12 With this change, `makeMasquerader` returns callable masquerader to mimic `document.all` 13 in the wild. In order to avoid `masqueradesAsUndefinedWatchpoint` being fired during 14 initialization of JSC shell, $262.IsHTMLDDA is a getter. 15 16 [1]: https://github.com/tc39/test262/blob/master/INTERPRETING.md#host-defined-functions 17 [2]: https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot 18 19 * jsc.cpp: 20 (functionMakeMasquerader): 21 (functionCallMasquerader): 22 (JSC::Masquerader::Masquerader): Deleted. 23 (JSC::Masquerader::subspaceFor): Deleted. 24 (JSC::Masquerader::create): Deleted. 25 (JSC::Masquerader::createStructure): Deleted. 26 * runtime/JSObject.h: 27 1 28 2020-04-06 Justin Michaud <justin_michaud@apple.com> 2 29 -
trunk/Source/JavaScriptCore/jsc.cpp
r259564 r259587 197 197 } 198 198 199 class Masquerader : public JSNonFinalObject {200 public:201 Masquerader(VM& vm, Structure* structure)202 : Base(vm, structure)203 {204 }205 206 typedef JSNonFinalObject Base;207 static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::MasqueradesAsUndefined;208 209 template<typename CellType, SubspaceAccess>210 static CompleteSubspace* subspaceFor(VM& vm)211 {212 return &vm.cellSpace;213 }214 215 static Masquerader* create(VM& vm, JSGlobalObject* globalObject)216 {217 globalObject->masqueradesAsUndefinedWatchpoint()->fireAll(vm, "Masquerading object allocated");218 Structure* structure = createStructure(vm, globalObject, jsNull());219 Masquerader* result = new (NotNull, allocateCell<Masquerader>(vm.heap)) Masquerader(vm, structure);220 result->finishCreation(vm);221 return result;222 }223 224 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)225 {226 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());227 }228 229 DECLARE_INFO;230 };231 232 const ClassInfo Masquerader::s_info = { "Masquerader", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(Masquerader) };233 199 static unsigned asyncTestPasses { 0 }; 234 200 static unsigned asyncTestExpectedPasses { 0 }; … … 349 315 static EncodedJSValue JSC_HOST_CALL functionIdentity(JSGlobalObject*, CallFrame*); 350 316 static EncodedJSValue JSC_HOST_CALL functionMakeMasquerader(JSGlobalObject*, CallFrame*); 317 static EncodedJSValue JSC_HOST_CALL functionCallMasquerader(JSGlobalObject*, CallFrame*); 351 318 static EncodedJSValue JSC_HOST_CALL functionHasCustomProperties(JSGlobalObject*, CallFrame*); 352 319 static EncodedJSValue JSC_HOST_CALL functionDumpTypesForAllVariables(JSGlobalObject*, CallFrame*); … … 630 597 631 598 dollar->putDirect(vm, Identifier::fromString(vm, "global"), this); 599 600 JSFunction* IsHTMLDDAGetter = JSFunction::create(vm, this, 0, "IsHTMLDDA"_s, functionMakeMasquerader); 601 dollar->putGetter(this, Identifier::fromString(vm, "IsHTMLDDA"), IsHTMLDDAGetter, static_cast<unsigned>(PropertyAttribute::Accessor)); 632 602 633 603 JSObject* agent = JSFinalObject::create(vm, plainObjectStructure); … … 2220 2190 { 2221 2191 VM& vm = globalObject->vm(); 2222 return JSValue::encode(Masquerader::create(vm, globalObject)); 2192 return JSValue::encode(JSFunction::createFunctionThatMasqueradesAsUndefined(vm, globalObject, 0, "IsHTMLDDA"_s, functionCallMasquerader)); 2193 } 2194 2195 EncodedJSValue JSC_HOST_CALL functionCallMasquerader(JSGlobalObject*, CallFrame*) 2196 { 2197 return JSValue::encode(jsNull()); 2223 2198 } 2224 2199 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r259463 r259587 608 608 JS_EXPORT_PRIVATE bool putDirectCustomAccessor(VM&, PropertyName, JSValue, unsigned attributes); 609 609 610 bool putGetter(JSGlobalObject*, PropertyName, JSValue, unsigned attributes);610 JS_EXPORT_PRIVATE bool putGetter(JSGlobalObject*, PropertyName, JSValue, unsigned attributes); 611 611 bool putSetter(JSGlobalObject*, PropertyName, JSValue, unsigned attributes); 612 612 -
trunk/Tools/ChangeLog
r259582 r259587 1 2020-04-06 Rick Waldron <waldron.rick@gmail.com> and Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Remove unnecessary Test262 harness file and implement $262.IsHTMLDDA 4 https://bugs.webkit.org/show_bug.cgi?id=187526 5 6 Reviewed by Darin Adler. 7 8 Removed file duplicates functionality of jsc.cpp's GlobalObject::finishCreation. 9 10 * Scripts/test262/Runner.pm: 11 * Scripts/test262/agent.js: Removed. 12 1 13 2020-04-06 Saam Barati <sbarati@apple.com> 2 14 -
trunk/Tools/Scripts/test262/Runner.pm
r258286 r259587 328 328 "$harnessDir/assert.js", 329 329 "$harnessDir/doneprintHandle.js", 330 "$Bin/agent.js"331 330 ); 332 331
Note: See TracChangeset
for help on using the changeset viewer.