summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
AgeCommit message (Collapse)Author
2022-09-15LibJS: Do not invoke Cell::vm in constructors before Cell is constructedTimothy Flynn
In a subclass of Cell, we cannot use Cell::vm() before the base Cell object itself is constructed. Use the Realm's VM instead. This was caught by UBSAN with vptr sanitation enabled.
2022-09-15LibJS: Do not assume that IsArray means the object type is an ArrayTimothy Flynn
IsArray returns true if the object is an Array *or* if it is a ProxyObject whose target is an Array. Therefore, we cannot downcast to an Array based on IsArray. Luckily, we don't actually need an Array here; SerializeJSONArray only needs an Object. This was caught by UBSAN with vptr sanitation enabled.
2022-09-15LibJS: Use correct include + object class for Function{Object,Prototype}Timothy Flynn
Not causing any real issue, just noticed while debugging vptr sanitation errors.
2022-09-14Everywhere: Fix a variety of typosBrian Gianforcaro
Spelling fixes found by `codespell`.
2022-09-10LibJS: Allow negative pointers in Valuedavidot
Also ensure that all a nullptr input gives null object and you don't accidentally dereference a nullptr.
2022-09-08LibJS+LibWeb: Spin event loop via VM::CustomData abstractionAndreas Kling
Instead of calling Core::EventLoop directly, LibJS now has a virtual function on VM::CustomData for customizing this behavior. We use this in LibWeb to plumb the spin request through to the PlatformEventPlugin.
2022-09-06LibJS: Make sure JS::Script visits its HostDefined objectAndreas Kling
This allows JS::Script to mark its corresponding HTML::Script, even if it's a little roundabout looking. Fixes an issue where the JS::Script was kept alive by the execution stack, but the HTML::Script was gone. This was originally part of 8f9ed415a02dd62c46fce4f5d352ad51bc779a27 but got lost in a merging accident.
2022-09-06LibJS+LibWeb: Make HTML::Script GC-allocatedAndreas Kling
This allows the garbage collector to keep HTML::Script objects alive and fixes a bug where a HTMLScriptElement could get GC'd while its code was executing.
2022-09-06LibJS: Make Script and Module GC-allocatedAndreas Kling
This ensures that code currently in any active or saved execution stack always stays alive.
2022-09-06LibWeb+LibJS: Let JS::Realm::HostDefined objects mark things during GCAndreas Kling
This allows us to mark the HTML::Window from our window environment settings object.
2022-09-06LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocatedAndreas Kling
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
2022-09-05LibLocale: Move locale source files to the LibLocale libraryTimothy Flynn
Everything is now setup to create the LibLocale library and link it where needed.
2022-09-05LibLocale: Move locale source files to the LibLocale folderTimothy Flynn
These are still included in LibUnicode, but this updates their location and the include paths of other files which include them.
2022-09-05Userland: Move files destined for LibLocale to the Locale namespaceTimothy Flynn
2022-09-05LibUnicode+LibJS: Move Unicode::get_available_currencies() to Locale.hTimothy Flynn
This is generated by GenerateLocaleData, which will soon be in the Locale namespace. Move it out of CurrencyCode.h, as that will continue to live in the Unicode namespace.
2022-09-05LibJS: Remove unused include from JS::Temporal::CalendarTimothy Flynn
2022-09-03LibJS: Don't use a Handle<Realm> in FinalizationRegistryAndreas Kling
Instead just treat it like a normal GC cell edge.
2022-09-03LibJS: Make Handle<T> more user-friendlyAndreas Kling
Allow *handle, !handle, handle.ptr(), assignment from compatible pointer types, etc. This is in preparation for using Handles in more generated code.
2022-09-03LibJS: Add Cell::Visitor::visit(Cell&)Andreas Kling
2022-09-03LibJS: Add GCPtr and NonnullGCPtrAndreas Kling
These are two new smart pointers that are really just raw pointers under the hood. The initial benefit is all in the names, they allow us to declare that we're pointing at something in the GC heap. Later we may also find ways to add debugging logic or static analysis to these types.
2022-09-02LibJS: Fix incorrect check in ValidateAndApplyPropertyDescriptorLinus Groh
This is an editorial change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/f0e4ae8
2022-09-02LibJS: Assert Proxy target is a function in [[Call]] and [[Construct]]Linus Groh
As the TODOs suggested for a long time. :^)
2022-09-02LibJS: Allow anonymous functions as default exportsdavidot
This requires a special case with names as the default function is supposed to have a unique name ("*default*" in our case) but when checked should have name "default".
2022-09-02LibJS: Make indirect bindings of module behave like normal bindingsdavidot
Before this we attempted to hack around this by only overriding has_binding. However this did not cover all cases, for example when assigning to variables before their declaration it didn't throw. By using the new find_binding_and_index virtual method we can just pretend the indirect bindings are real. Since indirect binding do come from a normal environment we need to ensure you cannot modify the binding and that properties like mutable are false as expected by the spec for such an indirect binding.
2022-09-02LibJS: Make DeclarativeEnvironment based on bindings instead of indicesdavidot
This will allow other environments which extend DeclarativeEnvironment to provide their own custom bindings.
2022-09-02LibJS: Allow exporting any imported bindingsdavidot
2022-09-02LibJS: Only check for duplicate exports if they have a namedavidot
Together with removing an incorrect VERIFY this allows multiple star imports in a single module.
2022-09-02LibJS: Put exports before symbols in keys of module namespace objectdavidot
2022-09-02LibJS: Call resolve instead of reject in AsyncFromSyncIteratorPrototypedavidot
2022-09-02LibJS: Handle empty named exportdavidot
This is an export which looks like `export {} from "module"`, and although it doesn't have any real export entries it should still add "module" to the required modules to load.
2022-09-02LibJS: Allow full ModuleExportName in namespacedavidot
This means we should accept a string after 'export * as '.
2022-08-31LibJS: Implement SuperCall for the Bytecode-VMHendiadyoin1
2022-08-31LibJS: Use builder.join in `to_string_impl()`s where applicableHendiadyoin1
2022-08-30LibJS: Create DurationFormat's ListFormat object with type and styleTimothy Flynn
This is a normative change in the Intl.DurationFormat spec. See: https://github.com/tc39/proposal-intl-duration-format/commit/1304e4b
2022-08-30LibJS: Use numeric style if the previous style was numeric or 2-digitTimothy Flynn
This is a normative change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/3a46ee3
2022-08-30LibJS: Update DurationFormat AO text to align with ECMA-402 and TemporalTimothy Flynn
These are editorial changes in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/71b291b https://github.com/tc39/proposal-intl-duration-format/commit/d0cc6fa https://github.com/tc39/proposal-intl-duration-format/commit/d4b35bb
2022-08-30LibJS: Rename DurationFormat's DurationSign to DurationRecordSignTimothy Flynn
This is an editorial change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/f947239
2022-08-30LibJS: Align ToDurationRecord with ToTemporalDurationRecordTimothy Flynn
This is an editorial change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/527ea58
2022-08-30LibJS: Mark PartitionDurationFormatPattern as infallibleTimothy Flynn
This is an editorial change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/cea3b68
2022-08-30LibJS: Change GetDurationUnitOptions to require a string for prevStyleTimothy Flynn
This is an editoral change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/62ee645
2022-08-30LibJS: Resolve FIXMEs in DurationFormat's PartitionDurationFormatPatternTimothy Flynn
These are normative changes in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/e2e18d1 https://github.com/tc39/proposal-intl-duration-format/commit/f1e8ed3 https://github.com/tc39/proposal-intl-duration-format/commit/2ed31b8 https://github.com/tc39/proposal-intl-duration-format/commit/2d51d64 https://github.com/tc39/proposal-intl-duration-format/commit/64cc5db https://github.com/tc39/proposal-intl-duration-format/commit/a1d7876 https://github.com/tc39/proposal-intl-duration-format/commit/47a3a69 https://github.com/tc39/proposal-intl-duration-format/commit/3e9358e https://github.com/tc39/proposal-intl-duration-format/commit/f4ecb46 https://github.com/tc39/proposal-intl-duration-format/commit/b454c8c
2022-08-30LibJS: Default to "short" for DurationFormat's style optionTimothy Flynn
This is a normative change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/b289494
2022-08-30LibJS: Default to 0 for DurationFormat's fractionalDigits optionTimothy Flynn
This is a normative change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/ac7e184
2022-08-30LibJS: Update spec steps to validate DurationFormat's numberingSystemTimothy Flynn
This is a normative change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/63a9202
2022-08-30LibJS: Implement $262.evalScript() according to the given algorithmLinus Groh
test262's INTERPRETING.md specifies the exact steps for this function, so let's shuffle some things around and add "spec" comments. Most importantly this now returns the result of the evaluated script, which at least one test relies on: https://github.com/tc39/test262/blob/main/test/built-ins/Proxy/revocable/tco-fn-realm.js
2022-08-30LibJS: Make string_to_bigint() a standalone functionLinus Groh
This now matches the newly added string_to_number().
2022-08-30LibJS: Trim non-ASCII whitespace as well in StringToBigIntLinus Groh
This was never caught since the original implementation AFAICT, and isn't being covered by test262 either: https://github.com/tc39/test262/issues/1354
2022-08-30LibJS: Trim non-ASCII whitespace as well in StringToNumberLinus Groh
This regressed in f4b3bb5.
2022-08-30LibJS: Handle non-decimal integer literals in Value::to_numberSlappy826
Implements support for parsing binary and octal literals, and fixes instances where a hex literal is parsed in ways the spec doesn't allow.
2022-08-29LibJS: Properly initialize the global object for $262.createRealmdavidot