Commit graph

2607 commits

Author SHA1 Message Date
Linus Groh
8d1e6e9175 LibJS: Don't repeat attributes in {Date,Symbol}Constructor 2021-06-13 00:58:25 +01:00
Linus Groh
7327a28ccc LibJS: Add ECMA-262 section/title/URL comments almost everywhere
As mentioned on Discord earlier, we'll add these to all new functions
going forward - this is the backfill. Reasons:

- It makes you look at the spec, implementing based on MDN or V8
  behavior is a no-go
- It makes finding the various functions that are non-compliant easier,
  in the future everything should either have such a comment or, if it's
  not from the spec at all, a comment explaining why that is the case
- It makes it easier to check whether a certain abstract operation is
  implemented in LibJS, not all of them use the same name as the spec.
  E.g. RejectPromise() is Promise::reject()
- It makes it easier to reason about vm.arguments(), e.g. when the
  function has a rest parameter
- It makes it easier to see whether a certain function is from a
  proposal or Annex B

Also:

- Add arguments to all functions and abstract operations that already
  had a comment
- Fix some outdated section numbers
- Replace some ecma-international.org URLs with tc39.es
2021-06-13 00:33:28 +01:00
Idan Horowitz
322c8a3995 LibJS: Add the MapIterator built-in and the key/values/entries methods
While this implementation should be complete it is based on HashMap's
iterator, which currently follows bucket-order instead of the required
insertion order. This can be simply fixed by replacing the underlying
HashMap member in Map with an enhanced one that maintains a linked
list in insertion order.
2021-06-13 00:33:18 +01:00
Idan Horowitz
6c0d5163a1 LibJS: Add most of the Map.prototype methods
Specifically all aside from "keys", "values" and "entries" which
require an implementation of the MapIterator object.
2021-06-13 00:33:18 +01:00
Idan Horowitz
a96ac8bd56 LibJS: Add the Map built-in object 2021-06-13 00:33:18 +01:00
Idan Horowitz
f9d58ec0b4 LibJS: Move ValueTraits to Value.h and add special case for -0.0
This will allow us to use these traits for other hash-based containers
(like Map). This commit also adds a special case for negative zero
values, because while the equality check used same_value_zero which is
negative/positive zero insensitive, the hash was not.
2021-06-13 00:33:18 +01:00
Idan Horowitz
3c83298a26 LibJS: Use undefined as the fallback value for iterable entry key/value
As defined in OdinaryGet in the specification.
2021-06-12 22:34:28 +01:00
Sreelakshmi
a471af4ae1 TextEditor: Don't close autocomplete box or stop timer on leave_event
The autocomplete box closes on its own when the user tries to hover
over it because text_editor consideres hovering over the box to be
a leave_event. This commit stops that from happening.
2021-06-12 23:54:08 +04:30
Sahan Fernando
6fb08f20e3 LibC: Expose PAGE_ROUND_UP in mallocdefs.h 2021-06-12 22:50:40 +04:30
FalseHonesty
baff94e44d LibVideo/VP9: Add Decoder and begin parsing uncompressed header data
This patch brings all of the previous work together and starts to
actually parse and decode frame information. Currently it only parses
the uncompressed header data (section 6.2 of the spec).
2021-06-12 22:48:28 +04:30
FalseHonesty
2e31b9cf7c LibVideo/VP9: Implement a bit stream to decode VP9 data
The VP9 specification requires a special decoding process to parse a
lot of the data read from a frame, so this BitStream wrapper implements
that behavior. These processes are defined in section 9 of the
VP9 spec.
2021-06-12 22:48:28 +04:30
FalseHonesty
18759ff56d LibVideo/VP9: Implement syntax element counter 2021-06-12 22:48:28 +04:30
FalseHonesty
8dd9d1bbdb LibVideo/VP9: Add probability table constants
This patch adds VP9's probability tables and the functions needed
to load/clear them.
2021-06-12 22:48:28 +04:30
FalseHonesty
ff3a2a703f LibVideo/VP9: Define all VP9 symbols and enum constants 2021-06-12 22:48:28 +04:30
Matthew Olsson
612b183703 LibPDF: Convert to east-const to comply with the recent style changes 2021-06-12 22:45:01 +04:30
Matthew Olsson
0a4d8ef98d LibPDF: Bake the flipped y-axis directly into the CTM matrix 2021-06-12 22:45:01 +04:30
Matthew Olsson
449ef14895 LibPDF: Avoid calculating rendering matrix for every glyph 2021-06-12 22:45:01 +04:30
Matthew Olsson
c142dadbe8 LibPDF: Handle the TJ graphical operator 2021-06-12 22:45:01 +04:30
Matthew Olsson
47531619e3 LibPDF: Handle the gs graphical operator 2021-06-12 22:45:01 +04:30
Matthew Olsson
006f5498de LibPDF: Add support for the CalRGB ColorSpace
This isn't tested all that well, as the PDF I am testing with only uses
it for black (which is trivial). It can be tested further when LibPDF
is able to process more complex PDFs that actually use this color space
non-trivially.
2021-06-12 22:45:01 +04:30
Matthew Olsson
7b4e36bf88 LibPDF: Split ColorSpace into a different class for each color space
While unnecessary at the moment, this will allow for more fine-grained
control when complex color spaces get added.
2021-06-12 22:45:01 +04:30
Matthew Olsson
ea3abb14fe LibPDF: Parse hint tables
This code isn't _actually_ used as of right now, but I wrote it at the
same time as all of the code in the previous commit. I realized after
I wrote it that these hint tables aren't super useful if the parser
already has access to the full file. However, this will be useful if
we ever want to stream PDFs from the web (and possibly view them in
the browser).
2021-06-12 22:45:01 +04:30
Matthew Olsson
e23bfd7252 LibPDF: Parse linearized PDF files
This is a big step, as most PDFs which are downloaded online will be
linearized. Pretty much the only difference is that the xref structure
is slightly different.
2021-06-12 22:45:01 +04:30
Matthew Olsson
be1be47613 LibPDF: Fix two parser bugs
- A newline was assumed to follow the "stream" keyword, when it can also
  be a windows-style line break
- Fix not consuming the "endobj" at the end of every indirect object
2021-06-12 22:45:01 +04:30
Matthew Olsson
78bc9d1539 LibPDF: Refine the distinction between the Document and Parser
The Parser should hold information relevant for parsing, whereas the
Document should hold information relevant for displaying pages.
With this in mind, there is no reason for the Document to hold the
xref table and trailer. These objects have been moved to the Parser,
which allows the Parser to expose less public methods (which will be
even more evident once linearized PDFs are supported).
2021-06-12 22:45:01 +04:30
Matthew Olsson
cafd7c11b4 LibPDF: Account for inverted y axis when rendering text 2021-06-12 22:45:01 +04:30
Matthew Olsson
1ef5071d1b LibPDF: Harden the document/parser against errors 2021-06-12 22:45:01 +04:30
Matthew Olsson
d654fe0e41 LibPDF: Differentiate Value's null and empty states 2021-06-12 22:45:01 +04:30
Idan Horowitz
bd9e20ef79 LibJS: Add the Object.getOwnPropertySymbols method 2021-06-12 18:39:23 +01:00
Idan Horowitz
a2da3f97ef LibJS: Remove argument count checks in Object.* methods
These are inconsistent with the specification.
2021-06-12 18:39:23 +01:00
Idan Horowitz
b9d4dd6850 LibJS: Add the WeakRef.prototype.deref method
This is the only exposed method of the WeakRef built-in.
2021-06-12 18:39:23 +01:00
Idan Horowitz
7eba63a8a3 LibJS: Add the WeakRef built-in object 2021-06-12 18:39:23 +01:00
Idan Horowitz
6913f06b6f LibJS: Store and maintain an "execution generation" counter
This counter is increased each time a synchronous execution sequence
completes, and will allow us to emulate the abstract operations
AddToKeptObjects & ClearKeptObjects efficiently.
2021-06-12 18:39:23 +01:00
davidot
e044a3e428 LibJS: Add Array.prototype.keys() 2021-06-12 14:40:34 +01:00
Andreas Kling
dc65f54c06 AK: Rename Vector::append(Vector) => Vector::extend(Vector)
Let's make it a bit more clear when we're appending the elements from
one vector to the end of another vector.
2021-06-12 13:24:45 +02:00
Linus Groh
7e1bffdeb8 LibJS: Implement Object.assign() 2021-06-12 11:36:17 +01:00
Andreas Kling
0a98964600 WindowServer+LibGUI: Make window creation asynchronous :^)
Let clients manage their own window ID's. If you try to create a new
window with an existing ID, WindowServer will simply disconnect you
for misbehaving.

This removes the need for window creation to be synchronous, which
means that most GUI applications can now batch their entire GUI
initialization sequence without having to block waiting for responses.
2021-06-12 12:01:54 +02:00
Idan Horowitz
77c2db4183 LibJS: Add all of the WeakMap.prototype methods (delete, get, has, set) 2021-06-12 10:44:28 +01:00
Idan Horowitz
39554f3787 LibJS: Add the WeakMap built-in object 2021-06-12 10:44:28 +01:00
Idan Horowitz
1a8ee5d8d7 LibJS: Generify the garbage collector's weak container notifications
This will allow us to use the same interface for other JS weak
containers like the WeakMap & WeakRef.
2021-06-12 10:44:28 +01:00
Andreas Kling
06fdc26656 LibJS: Fix all clang-tidy warnings in Bytecode/Op.h
- Add missing explicit to constructors
- Use move() where appropriate
2021-06-12 11:22:46 +02:00
Gunnar Beutner
a612c22278 LibJS: Add support for running test-js with the bytecode interpreter
This obviously won't actually successfully run the test suite until
more of the AST expressions used by the test suite are supported.
2021-06-12 11:14:55 +02:00
Gunnar Beutner
6a78b44c22 LibJS: Add missing length() method for NewArray 2021-06-12 11:14:55 +02:00
Linus Groh
633f604c47 LibJS: Fix attributes of Promise.prototype
This was missing a 0 at the end to make it non-writable, non-enumerable,
non-configurable.
2021-06-12 01:19:07 +01:00
Linus Groh
1d7514d51e LibJS: Hide gc() dbgln() behind #ifdef __serenity__
This spams to stdout when using Lagom, and is therefore included in
test-js output. Don't need that.
2021-06-12 01:09:45 +01:00
Idan Horowitz
a1f5357ad3 LibJS: Expose Symbol.species properties as getters
As required by the specification.
2021-06-12 00:44:15 +01:00
Idan Horowitz
7f6d3818a2 LibJS: Add the Object::define_native_accessor method
This is very similar to Object::define_native_property, but here the
native functions are exported as standalone JS getter and setter
functions, instead of being transparently called by interactions with
the property.
2021-06-12 00:44:15 +01:00
Dmitrii Ubskii
30c831a3be LibGfx: Add Rect::centered_on()
This is a helper function for creating Rects of a given Size centered
on a Point.
2021-06-11 22:45:14 +02:00
Gal Horowitz
b47d117bd2 LibJS: Add bytecode generation for simple ObjectExpressions
Bytecode is now generated for object literals which only contain simple
key-value pairs (i.e. no spread, getters or setters)
2021-06-11 22:44:17 +02:00
Linus Groh
862ba64037 LibJS: Implement the Error Cause proposal
Currently stage 3. https://github.com/tc39/proposal-error-cause
2021-06-11 21:34:05 +01:00