summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
AgeCommit message (Collapse)Author
2021-09-12LibJS: Change wording of ErrorType::NotA to be independent of contextTimothy Flynn
Currently, we have NotA and NotAn, to be used dependent on whether the following word begins with a vowel or not. To avoid this, change the wording on NotA to be independent of this context.
2021-09-11LibJS: Specify right base for PromiseResolvingElementFunction subclassesAndreas Kling
2021-09-11LibJS: Don't use MarkedValueList in PromiseValueListAndreas Kling
Instead, override visit_edges() and mark the values like any other Cell subclass would. This makes PromiseValueList play nice with zombification.
2021-09-11LibJS: Use move semantics more when creating Reference objectsAndreas Kling
Turns a bunch of FlyString copies into moves.
2021-09-11AK: Replace the mutable String::replace API with an immutable versionIdan Horowitz
This removes the awkward String::replace API which was the only String API which mutated the String and replaces it with a new immutable version that returns a new String with the replacements applied. This also fixes a couple of UAFs that were caused by the use of this API. As an optimization an equivalent StringView::replace API was also added to remove an unnecessary String allocations in the format of: `String { view }.replace(...);`
2021-09-11LibJS: Visit WeakMap's values as long as their keys were not collectedIdan Horowitz
While the WeakMap only holds a weak reference to its keys, their accompanying values should be kept alive as long as they're accessible.
2021-09-11LibJS: Visit OrdinaryFunctionObject's owning realmIdan Horowitz
2021-09-11LibJS: Visit GeneratorObject's previous value if it's any kind of CellIdan Horowitz
Not just if it's an Object (which is one kind of Cell).
2021-09-11LibJS: Revoke any outstanding WeakPtr<Shape> when zombifying shapesAndreas Kling
The forward transition cache in Shape uses WeakPtr<Shape> to learn when a cached transition has been garbage collected. When running in zombification mode, we have to explicitly revoke any outstanding WeakPtrs to a Shape when it becomes a zombie. That ensures that it gets pruned from transition caches.
2021-09-11LibJS: Include source locations in VM::dump_backtrace() outputAndreas Kling
2021-09-11LibJS+js+test-js: Add GC debug mode that keeps cells "alive" as zombiesAndreas Kling
This patch adds a `-z` option to js and test-js. When run in this mode, garbage cells are never actually destroyed. We instead keep them around in a special zombie state. This allows us to validate that zombies don't get marked in future GC scans (since there were not supposed to be any more references!) :^) Cells get notified when they become a zombie (via did_become_zombie()) and this is used by WeakContainer cells to deregister themselves from the heap.
2021-09-11LibJS: Mark the global object in Environment::visit_edges()Andreas Kling
2021-09-11LibJS+LibWeb+Spreadsheet: Upcall visit_edges() via Base typedefAndreas Kling
Let's use Base::visit_edges() when calling the base class, to prevent accidentally skipping over anyone in the inheritance chain.
2021-09-11LibJS: Use Span<Cell*> instead of Vector<Cell*> in more placesAndreas Kling
2021-09-11LibJS: Mark instance field names in FunctionObject::visit_edges()Andreas Kling
2021-09-11LibJS: Tweak the WeakContainer::remove_swept_cells() API a little bitAndreas Kling
Make this API take a Span<Cell*> instead of a Vector<Cell*>&. This is behavior neutral, but stops the API looking like it wants to do mutable things to the Vector.
2021-09-11LibJS: Implement Intl.NumberFormat.prototype.resolvedOptionsTimothy Flynn
2021-09-11LibJS: Implement Intl.NumberFormat.supportedLocalesOfTimothy Flynn
2021-09-11LibJS: Implement the Intl.NumberFormat constructorTimothy Flynn
2021-09-11LibJS: Implement a nearly empty Intl.NumberFormat objectTimothy Flynn
This adds plumbing for the Intl.NumberFormat object, constructor, and prototype.
2021-09-11LibJS: Handle Unicode locale extensions in the ResolveLocale operationTimothy Flynn
Currently, all callers of ResolveLocale invoke the operation with an empty [[RelevantExtensionKeys]] slot, so the block of the method that deals with those keys was unimplemented. This implements that block now to prepare for Intl.NumberFormat which has a [[RelevantExtensionKeys]]. Note that the find_key_in_value() method is a simple VERIFY_NOT_REACHED in just this commit until the Intl.NumberFormat's keys are handled in its implementation.
2021-09-10LibJS: Implement Temporal.PlainMonthDay.prototype.equalsLuke Wilde
2021-09-10LibJS: Implement Temporal.PlainMonthDay.fromLuke Wilde
2021-09-10LibJS: Implement ToTemporalMonthDay AOLuke Wilde
2021-09-10AK+Everywhere: Reduce the number of template parameters of IntrusiveListAli Mohammad Pur
This makes the user-facing type only take the node member pointer, and lets the compiler figure out the other needed types from that.
2021-09-09LibJS: Make default_merge_fields() {additional_,}fields Object a const&Linus Groh
This only calls Object::{get,enumerable_own_property_names}() on the fields and additional_fields Objects, both of which are const-qualified.
2021-09-09LibJS: Make resolve_iso_month() fields Object a const&Linus Groh
This only calls Object::get() on the fields Object, which is const-qualified.
2021-09-09LibJS: Make Temporal foo_from_fields() AO field/options Object a const*Linus Groh
This is a bit of a lie as the Value(Object const*) ctor will const_cast them in invoke(), but at least it ensures that nothing else in the function relies on getting non-const Objects. Perhaps we can have an actual Object const* Value in the future as well.
2021-09-09LibJS: Make prepare_temporal_fields() fields Object a const&Linus Groh
This only calls Object::get() on the fields Object, which is const-qualified.
2021-09-09LibJS: Make to_temporal_time_record() time like Object a const&Linus Groh
This only calls Object::get() on the temporal_time_like Object, which is const-qualified.
2021-09-09LibJS: Make to_temporal_duration_record() time like Object a const&Linus Groh
This only calls Object::get() or some Duration getters on the temporal_duration_like Object, both of which are const-qualified.
2021-09-09LibJS: Make Temporal to_foo() AO normalized_options Object a const&Linus Groh
These only pass the normalized_options Object directly or indirectly to get_option(), which now takes a const reference.
2021-09-09LibJS: Make get_string_or_number_option() options Object a const&Linus Groh
This only passes the options Object to get_option(), which now takes a const reference.
2021-09-09LibJS: Make get_option() options Object a const&Linus Groh
This only calls Object::get() on the options Object, which is const-qualified.
2021-09-09LibJS: Store Instant's and ZonedDateTime's m_nanoseconds as a const&Linus Groh
There's no need for these to be non-const. Suggested by @IdanHo in https://github.com/SerenityOS/serenity/pull/9904#discussion_r704960184. Perhaps we can make more internal slots of these and other objects const references as well, but that's a bit more involved as they are used by various functions expecting non-const references.
2021-09-09LibJS: Make new_target parameter of all Temporal AOs a const*Linus Groh
These are passed to ordinary_create_from_constructor() in each case, which takes the parameter as a const&, so these can also be const.
2021-09-09LibJS: Mark TemporalTimeToString as infallibleLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/899cc24
2021-09-09LibJS: Implement Temporal.PlainYearMonth.compareLuke Wilde
2021-09-09LibJS: Implement Temporal.PlainYearMonth.fromLuke Wilde
2021-09-09LibJS: Implement Temporal.PlainYearMonth.prototype.equalsLuke Wilde
2021-09-09LibJS: Implement ToTemporalYearMonth AOLuke Wilde
2021-09-09LibJS: Implement Temporal.Instant.prototype.toZonedDateTimeISO()Linus Groh
2021-09-09LibJS: Implement Temporal.Instant.prototype.toZonedDateTime()Linus Groh
2021-09-09LibJS: Add a way to attach custom data to a JS::VM instanceAndreas Kling
This will be used by LibWeb to attach web engine specific stuff that LibJS doesn't need to know about.
2021-09-08LibJS: Implement Temporal.PlainTime.prototype.toJSON()Linus Groh
2021-09-08LibJS: Implement Temporal.PlainTime.prototype.toLocaleString()Linus Groh
2021-09-08LibJS: Implement Temporal.PlainTime.prototype.toString()Linus Groh
2021-09-08LibJS: Replace String const& with StringView in various Temporal AOsLinus Groh
This is especially helpful where we already pass StringView literals and only compare them with others, e.g. overflow and largest/smallest unit, in which case there's no need to actually allocate a string.
2021-09-08LibUnicode+LibJS: Store locale keyword values as a single stringTimothy Flynn
Previously, LibUnicode would store the values of a keyword as a Vector. For example, the locale "en-u-ca-abc-def" would have its keyword "ca" stored as {"abc, "def"}. Then, canonicalization would occur on each of the elements in that Vector. This is incorrect because, for example, the keyword value "true" should only be dropped if that is the entire value. That is, the canonical form of "en-u-kb-true" is "en-u-kb", but "en-u-kb-abc-true" does not change for canonicalization. However, we would canonicalize that locale as "en-u-kb-abc".
2021-09-08LibJS: Fix typos in Intl.ListFormat commentsTimothy Flynn