Commit graph

2055 commits

Author SHA1 Message Date
Linus Groh
3b21c4aa56 LibJS: Add console.trace() 2020-04-11 14:10:42 +02:00
Linus Groh
eece424694 LibJS: Make Function and CallFrame aware of their function name 2020-04-11 14:10:42 +02:00
Andreas Kling
4eceea7c62 LibX86: When there are multiple REPZ/REPNZ prefixes, the last one wins 2020-04-11 14:05:10 +02:00
Andreas Kling
1924112d7d LibX86: Tolerate invalid segment register indices when disassembling
While #6 and #7 are not valid segment register, they can still be
encoded in otherwise-valid instructions, so let's tolerate it.
2020-04-11 14:00:20 +02:00
Andreas Kling
d7d7a32d47 LibX86: Disassemble unknown opcodes as "db %#02x" 2020-04-11 13:57:28 +02:00
Andreas Kling
95df0847c5 LibX86: Decode PADDB, PADDW and PADDD 2020-04-11 13:57:20 +02:00
Andreas Kling
16455e91db LibX86: Don't choke on invalid LOCK prefixes for now
This might be interesting information later, but I'm not sure how to
encode it at the moment.
2020-04-11 13:53:12 +02:00
Andreas Kling
f115416db3 LibX86: Fix backwards arguments to ENTER imm16,imm8 2020-04-11 13:51:00 +02:00
Andreas Kling
cf7d042e0f LibX86: Add 8-bit CMPXCHG and allow LOCK CMPXCHG 2020-04-11 13:46:30 +02:00
Andreas Kling
2ce38d4699 LibX86: Support decoding basic MMX instructions like MOVQ 2020-04-11 13:42:18 +02:00
Andreas Kling
e5cde0082a LibX86: Run the instruction decoder in 32-bit mode by default
Let's assume a 32-bit execution environment unless otherwise specified.
2020-04-11 13:24:55 +02:00
Andreas Kling
8f503da93f LibX86: Remove some unnecessary stuff from Disassembler.h 2020-04-11 13:23:52 +02:00
Andreas Kling
32d83fdee4 LibX86: Add an X86 instruction decoder library + basic disassembler
This will be very useful for developer tools like ProfileView, and also
for future tools like debuggers and such. :^)
2020-04-11 13:16:17 +02:00
4ourbit
02c9f4c951
LibJS: Improve Object.defineProperty test 2020-04-10 23:33:02 +02:00
Linus Groh
31505dde7e LibJS: Add String.prototype.pad{Start,End}() 2020-04-10 16:37:04 +02:00
Linus Groh
7636dee2cb LibJS: Remove assert function from Object.defineProperty() test 2020-04-10 16:37:04 +02:00
Andreas Kling
0fea525373 LibJS: Key shape transitions on both property name and attributes
This allows us to cache forward transitions that reconfigure existing
properties as well, leading to better shape reuse.
2020-04-10 16:33:44 +02:00
Linus Groh
0243ac5d04 LibJS: Remove mock String.prototype from tests 2020-04-10 15:51:39 +02:00
Linus Groh
32c27afdf0 LibJS: Add String.prototype.toString() 2020-04-10 15:49:40 +02:00
Andreas Kling
6f3ea75569 LibJS: Add String constructor :^) 2020-04-10 14:14:02 +02:00
Andreas Kling
cb0dfd8f72 LibJS: Use enumerator macros for boilerplate code around native types 2020-04-10 14:06:52 +02:00
Andreas Kling
070a8f2689 LibJS: Boolean, Number and String prototypes should have values too
It appears that calling .valueOf() on an objectified primitive's
prototype should return a value after all.

This matches what other engines are doing.
2020-04-10 13:09:35 +02:00
Andreas Kling
c06d5ef114 Kernel+LibC: Remove ESUCCESS
There's no official ESUCCESS==0 errno code, and it keeps breaking the
Lagom build when we use it, so let's just say 0 instead.
2020-04-10 13:09:35 +02:00
Andreas Kling
e5da1cc566 LibJS: Throw real TypeError, ReferenceError, etc objects
Instead of just throwing Error objects with a name string, we now throw
the real Error subclass types. :^)
2020-04-10 13:09:35 +02:00
Andreas Kling
58ab76269c LibJS: Add all the Error subclasses
This patch adds instance, constructor and prototype classes for:

    - EvalError
    - InternalError
    - RangeError
    - ReferenceError
    - SyntaxError
    - TypeError
    - URIError

Enumerator macros are used to reduce the amount of typing. :^)
2020-04-10 13:09:35 +02:00
Conrad Pankoff
a3edeb5868 Kernel: Add explicit offset parameter to File::read etc 2020-04-10 11:59:30 +02:00
Barney Wilks
4f48fcdb94 LibJS: Add tests for exception if assignment LHS is invalid 2020-04-10 11:27:10 +02:00
Barney Wilks
56474bab15 LibJS: Throw exception if LHS of assignment is of unexpected type 2020-04-10 11:27:10 +02:00
AnotherTest
2315f789cc LibLine: Appropriately react to window size changes 2020-04-10 11:26:44 +02:00
AnotherTest
1b422315fa LibLine: Fix regression with moving around in history misplacing cursor
This commit fixes a regression where the prompt would not be cleared
upon substitution of lines from the history
2020-04-10 11:26:44 +02:00
Hüseyin ASLITÜRK
bc323c488e LibGUI: Add ColorInput component
ColorInput is a new GUI component for selecting color using ColorPicker dialog.
It is simplify usage of ColorPicker dialog and more elegant view of current selected color.
2020-04-10 11:25:49 +02:00
AnotherTest
da9335dbec LibLine: Implement multiline editing
This commit also adds the ability to change the prompt mid-edit :^)
2020-04-10 00:58:59 +02:00
AnotherTest
2663739db1 LibVT: Implement Device Status Report (cursor position report) 2020-04-10 00:58:59 +02:00
Andreas Kling
8286f8b996 LibJS: Add property configuration transitions
Object.defineProperty() can now change the attributes of a property
already on the object. Internally this becomes a shape transition with
the TransitionType::Configure. Such transitions don't expand the
property storage capacity, but rather simply keep attributes up to date
when generating a property table.
2020-04-10 00:36:06 +02:00
Andreas Kling
e6d920d87d LibJS: Add Object.defineProperty() and start caring about attributes
We now care (a little bit) about the "configurable" and "writable"
property attributes.

Property attributes are stored together with the property name in
the Shape object. Forward transitions are not attribute-savvy and will
cause poor Shape reuse in the case of multiple same-name properties
with different attributes.

Oh, and this patch also adds Object.getOwnPropertyDescriptor() :^)
2020-04-10 00:36:06 +02:00
Linus Groh
c06a6c67d5 LibJS: Add globalThis
We already have "global" as a way to access the global object in js(1)
(both REPL and script mode). This replaces it with "globalThis", which
is available in all environments, not just js.
2020-04-09 15:58:49 +02:00
Andreas Kling
cbecb23e1d LibJS: Fix BooleanPrototype build 2020-04-09 14:29:57 +02:00
Linus Groh
520c4254c9 LibJS: Make BooleanPrototype inherit from Object
BooleanPrototype should inherit from Object, not BooleanObject.
2020-04-09 13:21:24 +02:00
Andreas Kling
a06548eaf7 LibGUI: Keep still-valid indexes in selection after a model update
This is a stop-gap patch solution for the annoying problem of models
being bad at updating. At least the process table will retain your
selection in SystemMonitor now.
2020-04-09 09:53:28 +02:00
Andreas Kling
4036f15728 LibWeb: Support relative URL's in XMLHttpRequest
In order to complete a relative URL, we need a Document. Fix this by
giving XMLHttpRequest a pointer to its window object. Then we can go
from the window to the document, and then we're home free. :^)
2020-04-08 21:46:43 +02:00
Andreas Kling
4ffac713b9 LibWeb: Add XMLHttpRequest object :^)
This patch adds very basic XMLHttpRequest support to LibWeb. Here's an
example that currently works:

    var callback = function() { alert(this.responseText); }
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("load", callback);
    xhr.open("GET", "http://serenityos.org/~kling/test/example.txt");
    xhr.send();

There are many limitations and bugs, but it's pretty dang awesome that
we have XHR. :^)
2020-04-08 21:46:43 +02:00
Andreas Kling
b3c62d0bc8 LibWeb: Expose the global object as "window" 2020-04-08 21:46:43 +02:00
Linus Groh
531335f57c LibJS: Handle empty values in Array.prototype.toString() 2020-04-08 20:01:42 +02:00
Andreas Kling
0de368e36c LibWeb: Remove bizarre HashMap leak in StyleProperties copy ctor 2020-04-08 17:19:46 +02:00
Andreas Kling
348e209eb5 LibWeb: Make CanvasRenderingContext2D use floats instead of ints
This matches what we already do for the layout tree and things are
expected to work this way regardless.
2020-04-08 17:19:46 +02:00
Andreas Kling
2ffa054574 LibJS: Add Value::to_double() for convenience 2020-04-08 17:19:46 +02:00
Emanuele Torre
38dfd04633 LibJS: rename JS::DeclarationType => JS::DeclarationKind
Many other parsers call it with this name.

Also Type can be confusing in this context since the DeclarationType is
not the type (number, string, etc.) of the variables that are being
declared by the VariableDeclaration.
2020-04-08 14:50:14 +02:00
Andreas Kling
f07f8d5a44 LibJS: Add "constructor" property to constructor prototypes 2020-04-08 11:08:07 +02:00
Brian Gianforcaro
39855fe9ef LibWeb: Add canvas.strokeRect(), and fix scale & translate
Add an implementation of CanvasRenderingContext2DWrapper.strokeRect().
While implementing this I fixed fillRect() and the new strokeRect() to
honor the .scale() and .translate() values that had previously been plumbed.

Also enhance the canvas.html demo to utilize strokeRect(), scale(), and translate().
2020-04-08 11:07:50 +02:00
Andreas Kling
7382b27c22 LibWeb: Add Origin concept (protocol, host, port tuple)
Every Document now has an Origin, found via Document::origin().
It's based on the URL of the document.

This will be used to implement things like the same-origin policy.
2020-04-07 23:01:45 +02:00