summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
AgeCommit message (Collapse)Author
2022-04-20LibJS: De-duplicate ClassFieldDefinition RecordsLinus Groh
This was defined twice, despite being the very same thing: - ClassElement::ClassFieldDefinition - ECMAScriptFunctionObject::InstanceField Move the former to a new header and use it everywhere. Also update the define_field() AO to take a single field instead of separate name and initializer arguments.
2022-04-18LibJS: Make the BC generator.next(value) workAli Mohammad Pur
This used to put the value in the previous frame's accumulator register, which is only correct for the first invocation of the generator.
2022-04-18LibJS: Avoid copying the frame into the interpreter in BC generatorsAli Mohammad Pur
2022-04-18LibJS: Don't coerce this value in %IteratorPrototype%[@@iterator]Linus Groh
Another day, another mistake that's been there for a long time but would've been immediately obvious when adding spec comments. :^)
2022-04-17LibJS: Add missing whitespace around namespace curly bracesLinus Groh
2022-04-16LibJS: Remove cloneConstructor parameter from CloneArrayBufferTimothy Flynn
This is a normative change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/e7979fd Note that this implements a FIXME in InitializeTypedArrayFromTypedArray, now that shared array buffers are no longer a concern there. We already have test coverage for the now-handled case.
2022-04-16LibJS: Factor out TypedArrayElement{Size,Type} abstract operationsTimothy Flynn
This is an editorial change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/a90670d5 This also adds missing spec comments to the following prototypes which were affected by this change: Atomics.load Atomics.store %TypedArray%.prototype.slice %TypedArray%.prototype.subarray
2022-04-16LibJS: Add explicit ErrorType values for TypedArray prototype exceptionsTimothy Flynn
2022-04-16LibJS: Define AllocateTypedArrayBuffer AO out of lineTimothy Flynn
Not only is it easier to compare to the spec when defined out of line, but this AO was implemented inside other AOs twice.
2022-04-16LibJS: Define SetTypedArrayFrom{TypedArray,ArrayLike} AOs out of lineTimothy Flynn
%TypedArray%.prototype.set was a bit hard to read / compare to the spec with these AOs defined inside it.
2022-04-13LibJS: Add missing Vector::in_reverse() in ensure_property_table()Andreas Kling
Regressed with 35fcb028e950c804f8f0e5295b369ee1bc541ae3.
2022-04-13LibJS: Tidy up Shape::ensure_property_table() a little bitAndreas Kling
- Use a vector or references for the transition chain since null shapes are not allowed in the chain. - Use Vector::in_reverse() for iterating the chain backwards.
2022-04-13LibJS: Allow TypeArray to become detached in TypedArray.prototype.setTimothy Flynn
This is a normative change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/4d570c4
2022-04-12LibJS: Update spec comments to use ToZeroPaddedDecimalString AOLinus Groh
This is an editorial change in the ECMA-262 and Temporal specs. See: - https://github.com/tc39/ecma262/commit/843d8b8 - https://github.com/tc39/proposal-temporal/commit/f9211d9 Note that we don't actually need to implement the AO as we already have String::formatted() for this, and use unified format strings instead of zero-padding in individual steps in many cases anyway.
2022-04-12LibJS: Pass this value to fallback func in Array.prototype.toString()Linus Groh
The existing code looks innocently correct, implementing the following step: 3. If IsCallable(func) is false, set func to the intrinsic function %Object.prototype.toString%. as return ObjectPrototype::to_string(vm, global_object); However, this misses the fact that the next step calls the function with the previously ToObject()'d this value (`array`): 4. Return ? Call(func, array). This doesn't happen in the current implementation, which will use the unaltered this value from the Array.prototype.toString() call, and make another, unequal object in %Object.prototype.toString%. Since both that and Array.prototype.toString() do a Get() call on said object, this behavior is observable (see newly added test). Fix this by actually doing what the spec says and calling the fallback function the regular way.
2022-04-11LibJS: Update ZonedDateTime AO spec comments for structured headersLuke Wilde
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/01714a5
2022-04-11LibJS: Remove unused include from AbstractOperations.cppLinus Groh
2022-04-11LibJS: Move additional notes to spec comments onto their own lineLinus Groh
Having all spec comments verbatim on their own line with no additions made by us will make it easier to automate comparing said comments to their current spec counterparts.
2022-04-11LibJS: Call HostEnsureCanCompileStrings in CreateDynamicFunctionLuke Wilde
I noticed we were missing this when I added to PerformEval :^)
2022-04-11LibJS: Add tests for the new steps added to PerformEvalLuke Wilde
2022-04-11LibJS: Add missing steps and spec comments to PerformEvalLuke Wilde
While adding spec comments to PerformEval, I noticed we were missing multiple steps. Namely, these were: - Checking if the host will allow us to compile the string (allowing LibWeb to perform CSP for eval) - The parser's initial state depending on the environment around us on direct eval: - Allowing new.target via eval in functions - Allowing super calls and super properties via eval in classes - Disallowing the use of the arguments object in class field initializers at eval's parse time - Setting ScriptOrModule of eval's execution context The spec allows us to apply the additional parsing steps in any order. The method I have gone with is passing in a struct to the parser's constructor, which overrides the parser's initial state to (dis)allow the things stated above from the get-go.
2022-04-11LibJS: Use single page spec link for BoundFunctionCreateLinus Groh
2022-04-11LibJS: Fix two bogus spec linksLinus Groh
2022-04-08LibJS: Do not throw a TypeError when sorting a detached TypedArrayTimothy Flynn
This is a normative change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/e0c74e1
2022-04-08LibJS: Move DetachArrayBuffer implementation to the ArrayBuffer objectTimothy Flynn
The spec notes that this AO is unused by ECMA-262, but is provided for ECMAScript hosts. Move the definition to a common location to allow test-js to also use it.
2022-04-08LibJS: Make options object const in more Temporal AOsLinus Groh
2022-04-08LibJS: Handle undefined options in MergeLargestUnitOptionLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/5e161a2
2022-04-07LibJS: Consistently call observable Temporal AOs with undefined optionsLinus Groh
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/6fa5b9d
2022-04-06LibJS: Reorder and reduce steps of InitializeDateTimeFormatTimothy Flynn
These are editorial changes in the Intl spec. See: https://github.com/tc39/ecma402/commit/7d0326c https://github.com/tc39/ecma402/commit/05a299b https://github.com/tc39/ecma402/commit/8c24ea7 https://github.com/tc39/ecma402/commit/fd8dea9
2022-04-06LibJS: Remove outdated FIXME from String.prototype.localeCompareTimothy Flynn
This FIXME was addressed in 0975eba7241ff44fcfc5f3be074a09b353ebae5f.
2022-04-05LibJS: Actually generate a lexical env for SwitchStatement in BCAli Mohammad Pur
We had code for this in ScopeNode, but that function was never called for a SwitchStatement. This fixes a bunch of scoping tests for switch.
2022-04-05LibJS: Use InitializeOrSet to initialize function declarations in BCAli Mohammad Pur
A function may be redefined, in which case the existing binding is expected to be reused.
2022-04-05LibJS: Make Handle<Value>::is_null() also consider the contained valueAli Mohammad Pur
Previously this would've said `make_handle(Value(1234))` is null, as it did not contain a cell (but rather a plain Value), which made throwing primitives spin forever in BC mode.
2022-04-04LibJS: Fix typo in a variable name in get_substitution()Linus Groh
2022-04-04LibJS: Fix some clang-tidy warnings in TemporalLinus Groh
- Remove unused declarations of removed functions - Remove unused includes - Declare pointer values as `auto*`
2022-04-04LibJS: Use MUST() instead of TRY() for two infallible Temporal AOsLinus Groh
These were incorrectly used during the conversion from exception checks to completions.
2022-04-03LibJS: Remove a bunch of gratuitous JS namespace qualifiersLinus Groh
2022-04-03LibJS: Use AK::Time in system_utc_epoch_nanoseconds()Linus Groh
This also uses <time.h> APIs internally, but wraps them in a much nicer interface.
2022-04-02LibJS: Normalize NaN values in Sets and MapsIdan Horowitz
This ensures that different NaN types (e.g. 0/0, 0 * Infinity, etc) are mapped to the same Set/Map entry.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-31LibJS: Allow JS::make_handle(T*) to be called with nullptrAndreas Kling
Instead of asserting, just return an empty Handle.
2022-03-31LibJS: Don't assume that for-in/of target is a variable on LHS::AssignAli Mohammad Pur
e.g. `for ([foo.bar] in ...)` is actually a binding pattern.
2022-03-31LibJS: Implement codegen for MemberExpression binding patternsAli Mohammad Pur
2022-03-31LibJS: Implement bytecode generation for all ObjectExpression propertiesAli Mohammad Pur
2022-03-31LibJS: Adjust ISO8601 representation for years between 1 BCE and 999 CELinus Groh
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/39eeecd
2022-03-31LibJS: Correct PlainYearMonth arithmetic for non-ISO calendarsLinus Groh
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/61e8dd0
2022-03-31LibJS: Handle Etc/GMT timezones properly in TimeZone{IANA,Bracketed}NameLinus Groh
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/8c73780
2022-03-31LibJS: Emit reference information for { calendarName: "always" } optionLinus Groh
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/4f7519a
2022-03-31LibJS: Fix Duration.compare() for dates with unusual number of hoursLinus Groh
This is a normative change in the Temporal spec. See: - https://github.com/tc39/proposal-temporal/commit/08bcd53 - https://github.com/tc39/proposal-temporal/commit/e962797
2022-03-31LibJS: Add explicit default copy+move constructors to ThrowCompletionOrHendiadyoin1
This stops clangd from complaining about not being able to determine the copy-constructibility of ThrowCompletionOr and Completion.