Commit graph

7935 commits

Author SHA1 Message Date
Andreas Kling 806d3d8e79 AK: Add adopt_own() to create a NonnullOwnPtr<T> from a T& 2020-04-01 21:05:35 +02:00
Linus Groh ee6472fef2 LibJS: Implement Error function/constructor 2020-04-01 20:47:37 +02:00
Linus Groh 849e2c77e4 LibJS: Implement constructor/non-constructor function calls
This adds Function::construct() for constructor function calls via `new`
keyword. NativeFunction doesn't have constructor behaviour by default,
ScriptFunction simply calls call() in construct()
2020-04-01 20:18:36 +02:00
Andreas Kling a27884e4be LibWeb: Remove debug spam in WindowObject 2020-04-01 19:09:37 +02:00
Andreas Kling d062d7baa7 LibWeb+LibJS: Move DOM Window object to dedicated classes
LibWeb now creates a WindowObject which inherits from GlobalObject.
Allocation of the global object is moved out of the Interpreter ctor
to allow for specialized construction.

The existing Window interfaces are moved to WindowObject with their
implementation code in the new Window class.
2020-04-01 18:57:00 +02:00
Andreas Kling cd9379dca9 LibJS: Reorganize computing of |this| for CallExpressions
This avoids executing the LHS of the object expression twice when doing
a call on the result of an object expression.
2020-04-01 18:57:00 +02:00
Linus Groh 021d78f8f7 Browser: Add error page
Add a simple HTML error page that gets loaded into the HtmlView when
loading the page fails.

Closes #1210 and #1516
2020-04-01 18:49:48 +02:00
Liav A b1365d94f4 Kernel: Align read operation in HPET registers' block 2020-04-01 18:35:57 +02:00
Brendan Coles 175ec99814 IRCClient: Add Channel application menu and LIST and KICK commands
The new Channel application menu allow offers various commands
related to the currently visible channel, including changing
the topic, kicking a user, and leaving the channel.
2020-04-01 13:11:46 +02:00
Tibor Nagy 9e855376dd HackStudio: Move the "Find in files" button in line with the search box 2020-04-01 11:35:21 +02:00
Andreas Kling 296f87fa7f LibLine: Fix Shell crashing (due to write() EFAULT) on <tab><tab>
Use a StringBuilder instead of blindly passing a bunch of potentially
empty/null strings to the kernel. StringBuilder is more lenient and
generally more pleasant to use anyway.
2020-04-01 11:25:53 +02:00
AnotherTest 9ba9bba529 Clock menu applet: launch the new Calendar on click 2020-04-01 10:42:33 +02:00
Linus Groh 632231cc0c js: Implement print function for Date objects 2020-03-31 21:19:21 +02:00
Andreas Kling 839beb52f3 Base: Tweak the canvas demo page to stop using fractional RGB values
This is a hack to workaround missing support for fractional values in
"rgb(r,g,b)" color parsing.
2020-03-31 19:10:08 +02:00
Andreas Kling a8dc6501de LibJS: Use "%d" to stringify numeric values that are whole integers
This unbreaks a bunch of the JS tests since they were now printing all
the numbers as "1.000000" instead of "1".
2020-03-31 19:06:10 +02:00
Andreas Kling b71e504bba js: Don't construct a Line::Editor unless we're going into the REPL
Otherwise the Line::Editor will try to reset termios on exit, which can
have unpleasant effects.
2020-03-31 19:00:20 +02:00
Andreas Kling 28edafbfa6 LibLine: Fix build in Linux environment
My host compiler was complaining about "%b" in format strings and about
ignoring the return value from a bunch of write() calls.
2020-03-31 18:59:15 +02:00
Andreas Kling 6529b78d08 Lagom: Build LibLine since "js" depends on it 2020-03-31 18:58:59 +02:00
Brendan Coles 2de2f49abc IRCClient: Add support for /HOP and /TOPIC commands 2020-03-31 18:06:30 +02:00
Andreas Kling c56c8c8953 WindowServer: Remove applets from AppletManager on client disconnection
Disconnecting from WindowServer without explicit calls to DestroyWindow
would leave nulled-out WeakPtr's in the AppletManager applet list.

This led to a null dereference when adding a new applet, since we were
assuming the list contained no nulled-out applets.

This patch fixes the issue by always unregistering applet windows from
the AppletManager in ~ClientConnection(). We also do an extra pass of
pruning any nulled-out WeakPtrs from the applet list when adding to it.

Fixes #1551.
2020-03-31 13:55:28 +02:00
Emanuel Sprung c54855682c AK: A few JSON improvements
* Add double number to object serializer

* Handle negative double numbers correctly

* Handle \r and \n in quoted strings independently
  This improves the situation when keys contain \r or \n that currently
  has the effect that "a\rkey" and "a\nkey" in an JSON object are the
  same key value.
2020-03-31 13:42:39 +02:00
Emanuel Sprung c925aaceb2 AK: Print double numbers with printf
This patchset allows double numbers to be printed with the printf function.
The fraction will always be printed as 6 digit number. This can be improved :^)
2020-03-31 13:42:39 +02:00
Andreas Kling c7257ed827 LibLine: Rename on_char_input() => register_character_input_callback()
The "on_foo" format is our convention for public callback members.
2020-03-31 13:37:01 +02:00
Andreas Kling 8ab576308f LibLine: Rename LineEditor.{cpp,h} => Editor.{cpp,h} 2020-03-31 13:34:57 +02:00
Andreas Kling 6595469de1 LibLine: Rename LineEditor to Line::Editor 2020-03-31 13:34:06 +02:00
Andreas Kling a30a3277a3 LibLine: Rename from LibLineEdit 2020-03-31 13:32:11 +02:00
Andreas Kling 9c7451a21d js: Don't exit the REPL when pressing enter on an empty line 2020-03-31 13:30:00 +02:00
AnotherTest 06d35d036d Userland/js: Use the new line editor in repl
We now get cursor movements for free!
and we're rid of that icky `free` call, yay.
2020-03-31 13:21:46 +02:00
AnotherTest 6f407fff32 LibLineEdit + Shell: Handle Termios internally and give a copy if asked
This moves the Termios logic inside LibLineEdit and allows users to
simply forget about the existence of termios if they so choose to :^)
2020-03-31 13:21:46 +02:00
AnotherTest 5062a7d4cd LibLinEdit + Shell: handle signals
This allows the LineEditor to get notified about signals, since we
cannot set signal handlers in a clean way within the LineEditor
instance.
2020-03-31 13:21:46 +02:00
AnotherTest 21c4c67119 Shell: Move LineEdit out and add it as a dependency
This builds up on the 'new' LibLineEdit and overrides some of its hooks
For instance, on_tab_complete_first_token
2020-03-31 13:21:46 +02:00
AnotherTest 305b1a6248 LibLineEdit: Add a new Line Editor library
This library is moved over from Shell/LineEdit and has all its
Shell-specific functionalities stripped off.
Currently it exposes some internal things, for instance
cut_mismatching_chars() and insert(); This behaviour is not the most
acceptable, however, let's just roll with it for now :^)
2020-03-31 13:21:46 +02:00
Andreas Kling 297e6625f3 Browser: Refuse to run as root 2020-03-31 13:02:05 +02:00
Andreas Kling b2b5da8a17 IRCClient: Refuse to run as root
There's no good reason to allow this, and some pretty great reasons
to disallow it. :^)
2020-03-31 13:02:05 +02:00
Brendan Coles e8b17c42bb Base: Change root user home directory from / to /root 2020-03-31 11:43:46 +02:00
Brendan Coles d64589101c Userland: Add optional human readable output to /bin/df
/bin/df now allows the operator to view human readable
output using `-h` or `--human-readable` optional flags.
2020-03-31 09:08:30 +02:00
Sergey Bugaev 7bd077a3ae LibGUI: Fix index invalidation
When the model gets updated, we have to let go of the old indexes,
because they're invalid from that moment on.

Fixes https://github.com/SerenityOS/serenity/issues/1541
2020-03-30 23:05:14 +02:00
Linus Groh 3fcea71538 LibJS: Implement Date.prototype.to{Date,Time}String() 2020-03-30 21:43:35 +02:00
Linus Groh dc9b1226ac LibJS: Implement Date.prototype.toString() 2020-03-30 20:36:18 +02:00
Andreas Kling b4fde72013 LibGUI: Brighten icons when hovering items in item views
View classes now track their hovered item and paint them in a slightly
brighter shade to liven up the user interface. :^)
2020-03-30 19:57:44 +02:00
Andreas Kling add93bf593 LibGUI: Brighten buttons when hovering over them :^) 2020-03-30 19:40:44 +02:00
Andreas Kling 7976ef7a79 LibGfx: Add Painter::blit_filtered() and blit_brightened()
blit_filtered() can be used to easily implement per-pixel filtered blit
functions. All you need to do is provide a callback that can compute
the Color for each pixel based on the original Color.
2020-03-30 19:39:37 +02:00
Andreas Kling fb2be5c404 Shell: Shorten $HOME to '~' in shell prompts
The "\w" substitution in shell prompts now uses '~' to represent the
user's home directory (technically, whatever $HOME contains.)
2020-03-30 18:08:47 +02:00
Andreas Kling 012a4eb0b5 WindowServer+NotificationServer: Vertical title bar for notifications
This patch adds a specialized window type for notifications. They now
have a title bar on the right-hand side, with a close button.

This removes the need for the "Done" button in notifications, giving us
a bit more horizontal space overall.

Design based on a mock-up from @xTibor :^)
2020-03-30 17:03:15 +02:00
Andreas Kling cbd7effd3b LibGfx: Support vertical gradient fill (not just horizontal) :^) 2020-03-30 17:00:12 +02:00
Jack Karamanian 098f1cd0ca LibJS: Add support for arrow functions 2020-03-30 15:41:36 +02:00
Jack Karamanian f90da71d28 LibJS: Add Parser save_state() and load_state() functions
These functions allow us to try to parse ambiguous expressions (such as
arrow function arguments in parentheses), and
rewind the state of the Parser if an expression candidate failed to
parse.
2020-03-30 15:41:36 +02:00
Linus Groh fb0401871c LibJS: Throw TypeError when calling non-function object
We now have "undefined is not a function" :^)
2020-03-30 14:43:58 +02:00
Linus Groh d4e3688f4f LibJS: Start implementing Date :^)
This adds:

- A global Date object (with `length` property and `now` function)
- The Date constructor (no arguments yet)
- The Date prototype (with `get*` functions)
2020-03-30 14:11:54 +02:00
Andreas Kling 5c779c124b LibVT: Don't scroll-to-bottom when pressing the Logo key
Let's treat the Logo key like all the other modifiers and not scroll to
the bottom of the buffer.
2020-03-30 13:15:47 +02:00